You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Game/Doc/Definitions.lean
+24-16Lines changed: 24 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ import GameServer.Commands
2
2
3
3
namespace GameLogic
4
4
5
-
DefinitionDoc GameLogic.and_def as "∧""
5
+
/--
6
6
# Conjunction
7
7
## Introduction
8
8
An “And” can be introduced with the `and_intro` theorem. Conjunctions and biconditionals can both be constructed using the angle bracket notation as well.
@@ -24,9 +24,10 @@ have h₇ := (⟨p,q⟩ : P ∧ Q)
24
24
An “And” like `h : P ∧ Q` can be reduced in two ways:
25
25
1. Aquire evidence for `P` using `and_left h` or `h.left`
26
26
2. Aquire evidence for `Q` using `and_right` or `h.right`
27
-
"
27
+
-/
28
+
DefinitionDoc GameLogic.and_def as "∧"
28
29
29
-
DefinitionDoc GameLogic.or_def as "∨""
30
+
/--
30
31
# Disjunction
31
32
## Introduction
32
33
An “Or” like `h : P ∨ Q` can be introduced in two ways:
@@ -44,14 +45,16 @@ qr : Q → R
44
45
-- Goal: R
45
46
exact or_elim pvq pr qr
46
47
```
47
-
"
48
+
-/
49
+
DefinitionDoc GameLogic.or_def as "∨"
48
50
49
-
DefinitionDoc GameLogic.false_def as "False""
51
+
/--
50
52
# False
51
53
This is a proposition for which there can never be any evidence. If your assumptions lead you to evidence for `False`, then your assumptions are inconsitent and you can use `false_elim` to deduce any proposition you like.
52
-
"
54
+
-/
55
+
DefinitionDoc GameLogic.false_def as "False"
53
56
54
-
DefinitionDoc GameLogic.iff_def as "↔""
57
+
/--
55
58
# Biconditional
56
59
## Introduction
57
60
An “If and only if” can be introduced with the `iff_intro` theorem. Biconditionals and conjunctions can both be constructed using the angle bracket notation as well.
@@ -75,9 +78,10 @@ An “If and only if” like `h : P ↔ Q` can be reduced in two ways:
75
78
2. Aquire evidence for `Q → P` using `iff_mpr h` or `h.mpr`
76
79
## Rewrite
77
80
Biconditionals let you use the `rewrite` tactic to change goals or assumptions.
78
-
"
81
+
-/
82
+
DefinitionDoc GameLogic.iff_def as "↔"
79
83
80
-
DefinitionDoc GameLogic.FunElim as "→ elim""
84
+
/--
81
85
# Function Application/Implication Elimination
82
86
`P → Q` is propostion given to functions from evidence of `P` to evidence of `Q`.
83
87
# Juxtaposition
@@ -107,9 +111,10 @@ B
107
111
exact (h₁ a)
108
112
```
109
113
Takes `h₁` and applies `a` to it.
110
-
"
114
+
-/
115
+
DefinitionDoc GameLogic.FunElim as "→ elim"
111
116
112
-
DefinitionDoc GameLogic.FunIntro as "→ intro""
117
+
/--
113
118
# `fun _ => _`
114
119
You can create evidence for an implication by defining the appropriate function.
115
120
- `have h₁ : P → P := fun p : P => p`
@@ -125,9 +130,10 @@ Generally, you don't need to repeat the types when they're obvious from the cont
125
130
----
126
131
- `have h₁ : P → P := λp ↦ p`
127
132
- `have h₂ : P ∧ Q → P := λh ↦ h.left`
128
-
"
133
+
-/
134
+
DefinitionDoc GameLogic.FunIntro as "→ intro"
129
135
130
-
DefinitionDoc GameLogic.AsciiTable as "Unicode Table""
Copy file name to clipboardExpand all lines: Game/Doc/Lemmas.lean
+60-40Lines changed: 60 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -4,40 +4,43 @@ namespace GameLogic
4
4
5
5
defand_left {P Q : Prop} (h : P ∧ Q) : P := And.left h
6
6
7
-
LemmaDoc GameLogic.and_left as "and_left"in"∧""
7
+
/--
8
8
# ∧ Elimination Left
9
9
### and_left : P ∧ Q -> P`
10
10
11
11
If `h` is a term with a type like `AP∧ Q`
12
12
13
13
`and_left h`, `h.left` or `h.1` are all expressions for denoting the left-hand side of the given evidence. In this case, the left side has a type of `P`.
14
-
"
14
+
-/
15
+
TheoremDoc GameLogic.and_left as "and_left"in"∧"
15
16
16
17
defand_right {P Q : Prop} (h : P ∧ Q) : Q := And.right h
17
18
18
-
LemmaDoc GameLogic.and_right as "and_right"in"∧""
19
+
/--
19
20
# ∧ Elimination Right
20
21
### and_right : P ∧ Q -> Q`
21
22
22
23
If `h` is a term with a type like `P ∧ Q`
23
24
24
25
`and_right h`, `h.right` or `h.2` are all expressions for denoting the right-hand side of the given evidence. In this case, the left side has a type of `Q`.
25
-
"
26
+
-/
27
+
TheoremDoc GameLogic.and_right as "and_right"in"∧"
26
28
27
29
defand_intro {P Q : Prop} (left : P) (right : Q) : P ∧ Q := And.intro left right
28
30
29
-
LemmaDoc GameLogic.and_intro as "and_intro"in"∧""
31
+
/--
30
32
# and_intro
31
33
### `and_intro : P -> Q -> P ∧ Q`
32
34
`and_intro` is a function with two parameters. It takes two disparate pieces of evidence and combines them into a single piece of evidence. If `(e₁ : P)` and `(e₂ : Q)` are evidence, then
33
35
```
34
36
have h : P ∧ Q := and_intro e₁ e₂
35
37
```
36
-
"
38
+
-/
39
+
TheoremDoc GameLogic.and_intro as "and_intro"in"∧"
37
40
38
41
deffalse_elim {P : Prop} (h : False) : P := h.rec
39
42
40
-
LemmaDoc GameLogic.false_elim as "false_elim"in"¬""
43
+
/--
41
44
If
42
45
```
43
46
-- Assumptions
@@ -48,11 +51,12 @@ then
48
51
have t : T := false_elim h
49
52
```
50
53
will allow you to write any well formed proposition in place of `T`. This makes `false_elim` the \"From `False`, anything goes\" function. **Ex falso quodlibet**.
51
-
"
54
+
-/
55
+
TheoremDoc GameLogic.false_elim as "false_elim"in"¬"
52
56
53
57
defor_inl {P Q : Prop} (p : P) : Or P Q := Or.inl p
54
58
55
-
LemmaDoc GameLogic.or_inl as "or_inl"in"∨""
59
+
/--
56
60
# Or Introduction Left
57
61
Turns evidence for the lefthand of an `∨` proposition into a disjunction. The context must supply what the righthand side of the disjunction is.
58
62
```
@@ -67,11 +71,12 @@ have h : P ∨ Q := or_inl p
67
71
have h := (or_inl p : P ∨ Q)
68
72
have h := show P ∨ Q from or_inl p
69
73
```
70
-
"
74
+
-/
75
+
TheoremDoc GameLogic.or_inl as "or_inl"in"∨"
71
76
72
77
defor_inr {P Q : Prop} (q : Q) : Or P Q := Or.inr q
73
78
74
-
LemmaDoc GameLogic.or_inr as "or_inr"in"∨""
79
+
/--
75
80
# Or Introduction Right
76
81
Turns evidence for the righthand of an `∨` proposition into a disjunction. The context must supply what the lefthand side of the disjunction is.
77
82
```
@@ -87,6 +92,8 @@ have h := (or_inl q : P ∨ Q)
87
92
have h := show P ∨ Q from or_inl q
88
93
```
89
94
"
95
+
-/
96
+
TheoremDoc GameLogic.or_inr as "or_inr"in"∨"
90
97
91
98
defor_elim
92
99
{P Q R : Prop}
@@ -95,7 +102,7 @@ def or_elim
95
102
(right : Q → R) : R :=
96
103
Or.elim h left right
97
104
98
-
LemmaDoc GameLogic.or_elim as "or_elim"in"∨""
105
+
/--
99
106
# Or Elimination
100
107
If you can conclude something from `A` and you can conclude the same thing from `B`, then if you know `A ∨ B` it won't matter which of the two happens as you can still guarentee something.
101
108
@@ -116,33 +123,37 @@ pr : P → R
116
123
qr : Q → R
117
124
have r : R := or_elim pvq pr qr
118
125
```
119
-
"
126
+
-/
127
+
TheoremDoc GameLogic.or_elim as "or_elim"in"∨"
120
128
121
129
defiff_intro
122
130
{P Q : Prop}
123
131
(mp: P → Q)
124
132
(mpr: Q → P) : P ↔ Q :=
125
133
Iff.intro mp mpr
126
134
127
-
LemmaDoc GameLogic.iff_intro as "iff_intro"in"↔""
128
-
TODO 8888
129
-
"
135
+
/--
136
+
TODO
137
+
-/
138
+
TheoremDoc GameLogic.iff_intro as "iff_intro"in"↔"
130
139
131
140
defiff_mp {P Q : Prop} (h : P ↔ Q) : P → Q := h.mp
132
141
133
-
LemmaDoc GameLogic.iff_mp as "iff_mp"in"↔""
134
-
TODO 1234
135
-
"
142
+
/--
143
+
TODO
144
+
-/
145
+
TheoremDoc GameLogic.iff_mp as "iff_mp"in"↔"
136
146
137
147
defiff_mpr {P Q : Prop} (h : P ↔ Q) : Q → P := h.mpr
138
148
139
-
LemmaDoc GameLogic.iff_mpr as "iff_mpr"in"↔""
140
-
TODO 4321
141
-
"
149
+
/--
150
+
TODO
151
+
-/
152
+
TheoremDoc GameLogic.iff_mpr as "iff_mpr"in"↔"
142
153
143
154
defmodus_ponens {P Q : Prop} (hpq: P → Q) (p: P) : Q := hpq p
144
155
145
-
LemmaDoc GameLogic.modus_ponens as "modus_ponens"in"→""
156
+
/--
146
157
In this game, the deductive rule *modus_ponens* is just function application.
147
158
```
148
159
intro h : A ∧ B
@@ -170,40 +181,44 @@ There is are infix operators for function application; they look like `|>` and `
170
181
It's twin, `|>` chains such that `x |> f |> g` is interpreted as `g (f x)`.
171
182
172
183
What makes the infix operators usefull is that they can often replace a pair of brackets `(...)` making expressions easier to read.
173
-
"
184
+
-/
185
+
TheoremDoc GameLogic.modus_ponens as "modus_ponens"in"→"
174
186
175
187
defand_comm {P Q : Prop}: P ∧ Q ↔ Q ∧ P :=
176
188
⟨ λ⟨l,r⟩ ↦ ⟨r,l⟩,
177
189
λ⟨l,r⟩ ↦ ⟨r,l⟩
178
190
⟩
179
191
180
-
LemmaDoc GameLogic.and_comm as "and_comm"in"∧""
192
+
/--
181
193
# ∧ is commutative
182
194
183
195
`and_comm` is evidence that `P ∧ Q ↔ Q ∧ P`
184
-
"
196
+
-/
197
+
TheoremDoc GameLogic.and_comm as "and_comm"in"∧"
185
198
186
199
defand_assoc {P Q R : Prop}: P ∧ Q ∧ R ↔ (P ∧ Q) ∧ R :=
187
200
⟨ λ⟨p,q,r⟩ ↦ ⟨⟨p,q⟩,r⟩,
188
201
λ⟨⟨p,q⟩,r⟩ ↦ ⟨p,q,r⟩
189
202
⟩
190
203
191
-
LemmaDoc GameLogic.and_assoc as "and_assoc"in"∧""
204
+
/--
192
205
# ∧ is Associative
193
206
194
207
`and_assoc` is evidence that `P ∨ Q ∨ R ↔ (P ∨ Q) ∨ R`
195
-
"
208
+
-/
209
+
TheoremDoc GameLogic.and_assoc as "and_assoc"in"∧"
196
210
197
211
defor_comm {P Q : Prop}: P ∨ Q ↔ Q ∨ P :=
198
212
⟨ (Or.elim · Or.inr Or.inl),
199
213
(Or.elim · Or.inr Or.inl)
200
214
⟩
201
215
202
-
LemmaDoc GameLogic.or_comm as "or_comm"in"∨""
216
+
/--
203
217
# ∨ is commutative
204
218
205
219
`or_comm` is evidence that `P ∨ Q ↔ Q ∨ P`
206
-
"
220
+
-/
221
+
TheoremDoc GameLogic.or_comm as "or_comm"in"∨"
207
222
208
223
-- or_assoc
209
224
defor_assoc {P Q R : Prop}: P ∨ Q ∨ R ↔ (P ∨ Q) ∨ R :=
@@ -238,15 +253,16 @@ example {P Q R : Prop}: P ∨ Q ∨ R ↔ (P ∨ Q) ∨ R := by
238
253
(Or.inr ∘ Or.inr))
239
254
exact ⟨mp,mpr⟩
240
255
241
-
LemmaDoc GameLogic.or_assoc as "or_assoc"in"∨""
256
+
/--
242
257
# ∨ is Associative
243
258
244
259
`or_assoc` is evidence that `P ∨ Q ∨ R ↔ (P ∨ Q) ∨ R`
245
-
"
260
+
-/
261
+
TheoremDoc GameLogic.or_assoc as "or_assoc"in"∨"
246
262
247
263
defimp_trans {P Q R : Prop} (hpq : P → Q) (hqr : Q → R) (p : P): R := hqr (hpq p)
248
264
249
-
LemmaDoc GameLogic.imp_trans as "imp_trans"in"→""
265
+
/--
250
266
# → is transitive
251
267
`P → Q` and `Q → R` implies `P → R`
252
268
```
@@ -260,7 +276,8 @@ Of course, because of `and_comm`, you know you can flip this around too.
260
276
`imp_trans` has an infix operator. This looks like `≫` (which is written as “`\\gg`”).
261
277
262
278
For the math-inclined, because the expression for an implication is a function, you can also use function composition for the same purpose (`∘` is written as “`\\o`”). Just remember that `∘` has the parameters swapped from the way `imp_trans` is defined.
263
-
"
279
+
-/
280
+
TheoremDoc GameLogic.imp_trans as "imp_trans"in"→"
264
281
265
282
infixl:85" ≫ " => λa b ↦ Function.comp b a -- type as \gg
LemmaDoc GameLogic.not_not_not as "not_not_not"in"↔ extra""
289
+
/--
273
290
# Negation is stable
274
291
A nice result of this theorem is that any more than 2 negations can be simplified down to 1 or 2 negations.
275
292
```
276
293
not_not_not : ¬¬¬P ↔ ¬P
277
294
```
278
-
"
295
+
-/
296
+
TheoremDoc GameLogic.not_not_not as "not_not_not"in"↔ extra"
279
297
280
298
defmodus_tollens {P Q : Prop} (h: P → Q) (nq: ¬Q) : ¬P := h ≫ nq
281
299
282
-
LemmaDoc GameLogic.modus_tollens as "modus_tollens"in"→""
300
+
/--
283
301
# Modus Tollens
284
302
Denying the consequent.
285
303
@@ -292,14 +310,16 @@ mt : (P → Q) → ¬Q → ¬P
292
310
293
311
### Infix Operator:
294
312
`modus_tollens` is a specialized version of `imp_trans`, which makes it possible to use `≫` (which is written as “`\\gg`”) as an infix operator for `modus_tollens`.
295
-
"
313
+
-/
314
+
TheoremDoc GameLogic.modus_tollens as "modus_tollens"in"→"
296
315
297
316
defidentity {P : Prop}(p : P) : P := p
298
317
299
-
LemmaDoc GameLogic.identity as "identity"in"→""
318
+
/--
300
319
# Propositional Identity
301
320
This is the \"I think therefore I am\" of propositional logic. Like `True` it is a simple tautology whose truth requires no premises or assumptions — only reason alone.
0 commit comments