You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lean4game/server/nng/NNG/Levels/AdvProposition/Level_5.lean

60 lines
1.2 KiB
Plaintext

import NNG.Metadata
import NNG.MyNat.Addition
import Std.Tactic.RCases
Game "NNG"
World "AdvProposition"
Level 5
Title "`iff_trans` easter eggs."
open MyNat
Introduction
"
Let's try `iff_trans` again. Try proving it in other ways.
### A trick.
Instead of using `cases` on `h : P ↔ Q` you can just access the proofs of `P → Q` and `Q → P`
directly with `h.1` and `h.2`. So you can solve this level with
```
intros hpq hqr,
split,
intro p,
apply hqr.1,
...
```
### Another trick
Instead of using `cases` on `h : P ↔ Q`, you can just `rw h`, and this will change all `P`s to `Q`s
in the goal. You can use this to create a much shorter proof. Note that
this is an argument for *not* running the `cases` tactic on an iff statement;
you cannot rewrite one-way implications, but you can rewrite two-way implications.
### Another trick
`cc` works on this sort of goal too.
"
Statement --iff_trans
"If $P$, $Q$ and $R$ are true/false statements, then `P ↔ Q` and `Q ↔ R` together imply `P ↔ R`.
"
(P Q R : Prop) : (P ↔ Q) → (Q ↔ R) → (P ↔ R) := by
intro hpq hqr
constructor
intro p
apply hqr.1
apply hpq.1
assumption
intro r
apply hpq.2
apply hqr.2
assumption
Conclusion
"
"