by
after the :=
sign.⊢
._
In a typing system such as Lean's, the natural deduction rule known as modus ponens is derived, not postulated. Namely, it is a consequence of the fact that functions can be evaluated.
theorem mp {P Q : Prop} : (P → Q) ∧ P → Q :=
fun t ↦ match t with | .intro f p => f p
Or, using the intro
, rcases
and exact
tactics (curly brackets are optional):
theorem mp {P Q : Prop} : (P → Q) ∧ P → Q :=
by { -- ⊢ (P → Q) ∧ P → Q
intro t -- (t : (P → Q) ∧ P) ⊢ Q
rcases t with ⟨f, p⟩ -- (f : P → Q) (p : P) ⊢ Q
exact f p -- No goals
}
Here are two practice files that you can work on for the rest of this session. I am happy to answer any questions you may have 😊 .
**+ link to these slides?**
Languages such as Lean are based on [typed $\lambda$-calculus](https://en.wikipedia.org/wiki/Typed_lambda_calculus), which has three basic constructs: