Skip to content

Commit 45732fa

Browse files
author
Trequetrum
committed
Iff Tactics
1 parent 1022b56 commit 45732fa

File tree

14 files changed

+165
-277
lines changed

14 files changed

+165
-277
lines changed

Game/Levels/IffIntro/L01.lean

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,3 @@ exact iff_intro hsj hjs
4141
exact ⟨hsj, hjs⟩
4242
```
4343
"
44-
45-
/-- Tactic Proof -/
46-
example (J S : Prop) (hsj: S → J) (hjs: J → S) : S ↔ J := by
47-
constructor <;> assumption

Game/Levels/IffIntro/L02.lean

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,3 @@ For a biconditional like `h : P ↔ Q`,
2828
/-- Statement -/
2929
Statement (B P : Prop) (h : B ↔ ¬P) : (B → ¬P) ∧ (¬P → B) := by
3030
exact and_intro (iff_mp h) (iff_mpr h)
31-
32-
/-- Tactic Proof -/
33-
example (B P : Prop) (h : B ↔ ¬P) : (B → ¬P) ∧ (¬P → B) := by
34-
cases h
35-
constructor <;> assumption

Game/Levels/IffIntro/L03.lean

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,4 @@ You'll need h1.mp in order to turn evidence for Q into evidence for R
1717

1818
/-- Statement -/
1919
Statement (P Q R : Prop) (h1 : Q ↔ R)(h2 : P → Q) : P → R := by
20-
exact λp ↦ h1.mp (h2 p)
21-
22-
/-- Tactic Proof -/
23-
example (P Q R : Prop) (h1 : Q ↔ R)(h2 : P → Q) : P → R := by
24-
intro p
25-
apply h1.mp
26-
apply h2
27-
assumption
20+
exact h2 ≫ h1.mp

Game/Levels/IffIntro/L04.lean

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,4 @@ You'll need `h1.mpr` in order to turn evidence for R into evidence for P
1717

1818
/-- Statement -/
1919
Statement (P Q R : Prop) (h1 : P ↔ R)(h2 : P → Q) : R → Q := by
20-
exact λr ↦ h2 (h1.mpr r)
21-
22-
/-- Tactic Proof -/
23-
example (P Q R : Prop) (h1 : P ↔ R)(h2 : P → Q) : R → Q := by
24-
intro r
25-
apply h2
26-
apply h1.mpr
27-
assumption
20+
exact h1.mpr ≫ h2

Game/Levels/IffIntro/L05.lean

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,3 @@ exact ⟨
111111
```
112112
The thing to notice here is that this long-form solution needs both `h₁.mp` and `h₁.mpr`. Keep in mind that though it’s often tempting to try to use conditionals (`→`), rewrite **requires** a biconditional (`↔`) to work.
113113
"
114-
115-
/-- Tactic Proof -/
116-
example
117-
(A C L P : Prop)
118-
(h1 : L ↔ P)
119-
(h2 : ¬((A → C ∨ ¬P) ∧ (P ∨ A → ¬C) → (P → C)) ↔ A ∧ C ∧ ¬P)
120-
: ¬((A → C ∨ ¬L) ∧ (L ∨ A → ¬C) → (L → C)) ↔ A ∧ C ∧ ¬L := by
121-
rw [h1]
122-
assumption

Game/Levels/IffIntro/L06.lean

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,3 @@ exact or_assoc.mp ≫ h ≫ imp_trans and_assoc.mp
7070
7171
```
7272
"
73-
74-
/-- Tactic Proof -/
75-
example (P Q R : Prop) (h : (P ∨ Q) ∨ R → ¬((P ∧ Q) ∧ R)) : P ∨ Q ∨ R → ¬(P ∧ Q ∧ R) := by
76-
rw [or_assoc, and_assoc]
77-
assumption

Game/Levels/IffIntro/L07.lean

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ Title "IffBoss"
99
OnlyTactic
1010
exact
1111
«have»
12-
rw
13-
«repeat»
14-
nth_rewrite
1512

1613
Introduction "
1714
# BOSS LEVEL

Game/Levels/IffTactic/L01.lean

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,16 @@ World "IffTactic"
66
Level 1
77
Title "Iff_Intro"
88

9-
NewTheorem GameLogic.iff_intro
10-
NewDefinition GameLogic.iff_def
119
OnlyTactic
12-
exact
13-
«have»
10+
assumption
11+
constructor
12+
«repeat»
1413

1514
Introduction "
16-
# Coupled Conditionals
17-
Sybeth and Alarfil are a couple. In effect, this means that if Sybeth is playing a party game, then Alarfil is playing too and vise versa. Therefore Sybeth is playing Charades if and only if Alarfil playing.
18-
# Proposition Key:
19-
- J — Alarfil is playing Charades
20-
- S — Sybeth is playing Charades
21-
# Unlocked `↔ intro`
22-
Assuming `e₁ : P → Q` and `e₂ : Q → P`, you can introduce a biconditional with `have h := iff_intro e₁ e₂`, though the anonymous constructor syntax works just like it does for conjunctions: `have h : P ↔ Q := ⟨e₁, e₂⟩`
15+
# Using Tactics
16+
The tactics available to you should provide a hint for what to do. You'll be using a tactic in a context you havn't tried before, but the result should make sense once you try it and see what happens.
2317
"
2418

25-
/-- Statement -/
26-
Statement (J S : Prop) (hsj: S → J) (hjs: J → S) : S ↔ J := by
27-
exact iff_intro hsj hjs
28-
29-
example (J S : Prop) (hsj: S → J) (hjs: J → S) : S ↔ J := by
30-
exact ⟨hsj, hjs⟩
31-
32-
Conclusion "
33-
Onward and upward
34-
35-
----
36-
```
37-
exact iff_intro hsj hjs
38-
```
39-
---
40-
```
41-
exact ⟨hsj, hjs⟩
42-
```
43-
"
44-
45-
/-- Tactic Proof -/
46-
example (J S : Prop) (hsj: S → J) (hjs: J → S) : S ↔ J := by
47-
constructor <;> assumption
19+
Statement (P Q : Prop) (hsj: Q → P) (hjs: P → Q) : Q ↔ P := by
20+
constructor
21+
repeat assumption

Game/Levels/IffTactic/L02.lean

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,18 @@ World "IffTactic"
66
Level 2
77
Title "Conjuctive Iff"
88

9-
NewTheorem
10-
GameLogic.iff_mp
11-
GameLogic.iff_mpr
129
OnlyTactic
13-
exact
14-
«have»
10+
assumption
11+
cases
12+
constructor
13+
«repeat»
1514

1615
Introduction "
17-
# Two sides to every coin
18-
You're flipping a coin to decide which team gets to guess first in *Salad Bowl*. Heads means blue team and tails means purple team. Even though you're on the purple team, you're secretly hoping it comes up heads.
19-
# Proposition Key:
20-
- B — Blue Team goes first
21-
- P — Purple Team goes First
22-
# Unlocked `iff_mp` and `iff_mpr`
23-
For a biconditional like `h : P ↔ Q`,
24-
1. You can extract `P → Q` using `iff_mp h` or `h.mp`. `mp` here is short of modus ponens.
25-
2. You can extra `Q → P` using `iff_mpr h` or `h.mpr`. `mpr` here is short of modus ponens reversed.
16+
# Using Tactics
17+
Last level you learned that `constructor` works for biconditionals in the the same way it works for conjunction. This level demonstrates that `cases` works the way you may expect as well.
2618
"
2719

28-
/-- Statement -/
29-
Statement (B P : Prop) (h : B ↔ ¬P) : (B → ¬P) ∧ (¬P → B) := by
30-
exact and_intro (iff_mp h) (iff_mpr h)
31-
32-
/-- Tactic Proof -/
33-
example (B P : Prop) (h : B ↔ ¬P) : (B → ¬P) ∧ (¬P → B) := by
20+
Statement (P Q : Prop) (h : P ↔ ¬Q) : (P → ¬Q) ∧ (¬Q → P) := by
3421
cases h
35-
constructor <;> assumption
22+
constructor
23+
repeat assumption

Game/Levels/IffTactic/L03.lean

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,15 @@ Level 3
77
Title "Iff_mp"
88

99
OnlyTactic
10-
exact
11-
«have»
10+
intro
11+
apply
12+
assumption
1213

1314
Introduction "
1415
# Right-Hand Swap
15-
You'll need h1.mp in order to turn evidence for Q into evidence for R
1616
"
1717

18-
/-- Statement -/
1918
Statement (P Q R : Prop) (h1 : Q ↔ R)(h2 : P → Q) : P → R := by
20-
exact λp ↦ h1.mp (h2 p)
21-
22-
/-- Tactic Proof -/
23-
example (P Q R : Prop) (h1 : Q ↔ R)(h2 : P → Q) : P → R := by
2419
intro p
2520
apply h1.mp
2621
apply h2

0 commit comments

Comments
 (0)