Pattern matching provides an approach that is more convenient, and familiar to users of functional programming languages.Ĭonsider the inductively defined type of natural numbers. But complicated definitions may use several nested cases_on applications, and may be hard to read and understand. We have seen that the cases_on recursor can be used to define functions and prove theorems by cases, according to the constructors involved in an inductively defined type. The interpretation of schematic patterns is the first step of the compilation process. Behind the scenes, these descriptions are “compiled” down to primitive recursors, using a procedure that we refer to as the “equation compiler.” The equation compiler is not part of the trusted code base its output consists of terms that are checked independently by the kernel. It allows you to define a function by specifying equations that it should satisfy, and it allows you to prove a theorem by specifying how to handle various cases that can arise. Lean provides natural ways of defining recursive functions, performing pattern matching, and writing inductive proofs. By the propositions-as-types correspondence, this means that induction is the fundamental method of proof. Moreover, the constructors and the recursors provide the only means of defining functions on these types. In the previous chapter, we saw that inductive definitions provide a powerful means of introducing new types in Lean.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |