Abstract

• PLFA is an online textbook, available at plfa.inf.ed.ac.uk . • The proofs for a textbook on programming languages can be written in Agda, without a separate scripting language. • Constructive proofs of preservation and progress give rise to a prototype evaluator. • Using raw terms with a separate typing relation is far less perspicuous than using inherently-typed terms. • An online final examination with access to a proof assistant can lead to flawless student performance. One of the leading textbooks for formal methods is Software Foundations (SF), written by Benjamin Pierce in collaboration with others, and based on Coq. After five years using SF in the classroom, we came to the conclusion that Coq is not the best vehicle for this purpose, as too much of the course needs to focus on learning tactics for proof derivation, to the cost of learning programming language theory. Accordingly, we have written a new textbook, Programming Language Foundations in Agda (PLFA). PLFA covers much of the same ground as SF, although it is not a slavish imitation. What did we learn from writing PLFA? First, that it is possible. One might expect that without proof tactics that the proofs become too long, but in fact proofs in PLFA are about the same length as those in SF. Proofs in Coq require an interactive environment to be understood, while proofs in Agda can be read on the page. Second, that constructive proofs of preservation and progress give immediate rise to a prototype evaluator. This fact is obvious in retrospect but it is not exploited in SF (which instead provides a separate normalise tactic) nor can we find it in the literature. Third, that using extrinsically-typed terms is far less perspicuous than using intrinsically-typed terms. SF uses the former presentation, while PLFA presents both; the former uses about 1.6 as many lines of Agda code as the latter, roughly the golden ratio. The textbook is written as a literate Agda script, and can be found here: http://plfa.inf.ed.ac.uk

Highlights

  • The most profound connection between logic and computation is a pun

  • We found ourselves keen to recast the course in Agda (?)

  • We argue that Agda has advantages over Coq for pedagogic purposes

Read more

Summary

Introduction

The most profound connection between logic and computation is a pun. The doctrine of Propositions as Types asserts that a certain kind of formal structure may be read in two ways: either as a proposition in logic or as a type in computing. PLFA is aimed at students in the last year of an undergraduate honours programme or the first year of a master or doctorate degree It aims to teach the fundamentals of semantics of programming languages, with -typed and untyped lambda calculi as the central examples. The early denotational semantics of the lambda calculus based on graph models (???) and filter models (?) were simple and elegant: a function is modeled as a lookup table We present such a semantics using a big-step notation that is approachable to readers familiar with operational semantics, writing γ M ↓ d for the evaluation of a term M to denotation d in environment γ. The chapter concludes with a functional definition of the denotational semantics and a proof that it is equivalent to the big-step version. It is safe to use denotational equality to justify code transformations

Discussion
Proofs in Agda and Coq
Intrinsic typing is golden
Teaching experience
Software
Conclusion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call