mirror of
https://github.com/saymrwulf/verifying-crypto-with-lean.git
synced 2026-07-19 19:01:17 +00:00
- 53-page LaTeX/TikZ book (main.pdf + full sources): from zero background to reading the real Ed25519/Pasta verification projects - runnable exercises with sorry-holes + complete solutions for chapters 2-7, 9, 12; every solution file compiles clean (zero errors, no sorry) against Lean v4.30.0-rc2 + Mathlib 5450b53e - lake project pinned to the same toolchain/Mathlib the solutions were verified with; students fetch the Mathlib cache, never build it - honesty ledger in README: what was machine-checked and how Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
29 lines
734 B
Text
29 lines
734 B
Text
/- Chapter 3 — solutions. Term mode only, as required. -/
|
||
|
||
namespace Ch03
|
||
|
||
variable (P Q R : Prop)
|
||
|
||
theorem const_imp : P → Q → P :=
|
||
fun p _ => p
|
||
|
||
theorem and_to_or : P ∧ Q → P ∨ Q :=
|
||
fun h => Or.inl h.1
|
||
|
||
theorem modus_ponens : P → (P → Q) → Q :=
|
||
fun p f => f p
|
||
|
||
theorem and_assoc' : (P ∧ Q) ∧ R → P ∧ (Q ∧ R) :=
|
||
fun h => And.intro h.1.1 (And.intro h.1.2 h.2)
|
||
|
||
theorem or_swap : P ∨ Q → Q ∨ P :=
|
||
fun h => match h with
|
||
| Or.inl p => Or.inr p
|
||
| Or.inr q => Or.inl q
|
||
|
||
/- The program: "given evidence p for P and a refuter f of P, feed p to f."
|
||
A proof of ¬¬P is a function that defeats any would-be refutation. -/
|
||
theorem not_not_intro : P → ¬¬P :=
|
||
fun p f => f p
|
||
|
||
end Ch03
|