Files
NNG/Game/Levels/OldAdvProposition/Level_8.lean
2024-03-11 19:10:20 +01:00

54 lines
1.1 KiB
Lean4
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import Game.Metadata
import Game.MyNat.Addition
World "AdvProposition"
Level 8
Title "`and_or_distrib_left`"
open MyNat
Introduction
"
We know that $x(y+z)=xy+xz$ for numbers, and this
is called distributivity of multiplication over addition.
The same is true for `∧` and `` -- in fact `∧` distributes
over `` and `` distributes over `∧`. Let's prove one of these.
"
/-- If $P$. $Q$ and $R$ are true/false statements, then
$$P \land(Q \lor R) \iff(P \land Q) \lor (P \land R).$$ -/
Statement --and_or_distrib_left
(P Q R : Prop) : P (Q R) (P Q) (P R) := by
constructor
intro h
rcases h with hp, hqr
rcases hqr with q | r
left
constructor
exact hp
exact q
right
constructor
exact hp
exact r
intro h
rcases h with hpq | hpr
rcases hpq with p, q
constructor
exact p
left
exact q
rcases hpr with hp, hr
constructor
exact hp
right
exact hr
Conclusion
"
You already know enough to embark on advanced addition world. But the next two levels comprise
just a couple more things.
"