Skip to content

Commit 8c97be5

Browse files
author
Trequetrum
committed
Fix some spelling
1 parent fa273c9 commit 8c97be5

27 files changed

+202
-103
lines changed

Game/Doc/Definitions.lean

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import GameServer.Commands
22

33
namespace GameLogic
44

5-
DefinitionDoc GameLogic.and_def as "∧" "
5+
/--
66
# Conjunction
77
## Introduction
88
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)
2424
An “And” like `h : P ∧ Q` can be reduced in two ways:
2525
1. Aquire evidence for `P` using `and_left h` or `h.left`
2626
2. Aquire evidence for `Q` using `and_right` or `h.right`
27-
"
27+
-/
28+
DefinitionDoc GameLogic.and_def as "∧"
2829

29-
DefinitionDoc GameLogic.or_def as "∨" "
30+
/--
3031
# Disjunction
3132
## Introduction
3233
An “Or” like `h : P ∨ Q` can be introduced in two ways:
@@ -44,14 +45,16 @@ qr : Q → R
4445
-- Goal: R
4546
exact or_elim pvq pr qr
4647
```
47-
"
48+
-/
49+
DefinitionDoc GameLogic.or_def as "∨"
4850

49-
DefinitionDoc GameLogic.false_def as "False" "
51+
/--
5052
# False
5153
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"
5356

54-
DefinitionDoc GameLogic.iff_def as "↔" "
57+
/--
5558
# Biconditional
5659
## Introduction
5760
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:
7578
2. Aquire evidence for `Q → P` using `iff_mpr h` or `h.mpr`
7679
## Rewrite
7780
Biconditionals let you use the `rewrite` tactic to change goals or assumptions.
78-
"
81+
-/
82+
DefinitionDoc GameLogic.iff_def as "↔"
7983

80-
DefinitionDoc GameLogic.FunElim as "→ elim" "
84+
/--
8185
# Function Application/Implication Elimination
8286
`P → Q` is propostion given to functions from evidence of `P` to evidence of `Q`.
8387
# Juxtaposition
@@ -107,9 +111,10 @@ B
107111
exact (h₁ a)
108112
```
109113
Takes `h₁` and applies `a` to it.
110-
"
114+
-/
115+
DefinitionDoc GameLogic.FunElim as "→ elim"
111116

112-
DefinitionDoc GameLogic.FunIntro as "→ intro" "
117+
/--
113118
# `fun _ => _`
114119
You can create evidence for an implication by defining the appropriate function.
115120
- `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
125130
----
126131
- `have h₁ : P → P := λp ↦ p`
127132
- `have h₂ : P ∧ Q → P := λh ↦ h.left`
128-
"
133+
-/
134+
DefinitionDoc GameLogic.FunIntro as "→ intro"
129135

130-
DefinitionDoc GameLogic.AsciiTable as "Unicode Table" "
136+
/--
131137
### **Logic Constants & Operators**
132138
| $Name~~~$ | $Ascii~~~$ | $Unicode$ | $Unicode Cmd$ |
133139
| --- | :---: | :---: | --- |
@@ -162,9 +168,10 @@ fun h : P ∧ Q => and_intro (and_right h) (and_left h)
162168
| Subscript Numbers | ₁ ₂ ₃ ... | `\\1` `\\2` `\\3` ... |
163169
| Left Arrow | ← | `\\l` `\\leftarrow` `\\gets` `\\<-` |
164170
| Turnstyle | ⊢ | `\\│-` `\\entails` `\\vdash` `\\goal` |
165-
"
171+
-/
172+
DefinitionDoc GameLogic.AsciiTable as "Unicode Table"
166173

167-
DefinitionDoc GameLogic.Precedence as "Precedence" "
174+
/--
168175
# Remembering Algebra
169176
In math class, you may have learned an acronym like BEDMAS or PEMDAS to remember the precedence of operators in your math expressions:
170177
1. Brackets (or Parentheses)
@@ -220,4 +227,5 @@ Here's a version where you can see it aligned
220227
((¬P) ∨ (Q ∧ P)) → Q ↔ (Q ∨ (R ∨ (¬S)))
221228
(((¬P) ∨ (Q ∧ P)) → Q) ↔ (Q ∨ (R ∨ (¬S)))
222229
```
223-
"
230+
-/
231+
DefinitionDoc GameLogic.Precedence as "Precedence"

Game/Doc/Lemmas.lean

Lines changed: 60 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,43 @@ namespace GameLogic
44

55
def and_left {P Q : Prop} (h : P ∧ Q) : P := And.left h
66

7-
LemmaDoc GameLogic.and_left as "and_left" in "∧" "
7+
/--
88
# ∧ Elimination Left
99
### and_left : P ∧ Q -> P`
1010
1111
If `h` is a term with a type like `AP∧ Q`
1212
1313
`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 "∧"
1516

1617
def and_right {P Q : Prop} (h : P ∧ Q) : Q := And.right h
1718

18-
LemmaDoc GameLogic.and_right as "and_right" in "∧" "
19+
/--
1920
# ∧ Elimination Right
2021
### and_right : P ∧ Q -> Q`
2122
2223
If `h` is a term with a type like `P ∧ Q`
2324
2425
`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 "∧"
2628

2729
def and_intro {P Q : Prop} (left : P) (right : Q) : P ∧ Q := And.intro left right
2830

29-
LemmaDoc GameLogic.and_intro as "and_intro" in "∧" "
31+
/--
3032
# and_intro
3133
### `and_intro : P -> Q -> P ∧ Q`
3234
`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
3335
```
3436
have h : P ∧ Q := and_intro e₁ e₂
3537
```
36-
"
38+
-/
39+
TheoremDoc GameLogic.and_intro as "and_intro" in "∧"
3740

3841
def false_elim {P : Prop} (h : False) : P := h.rec
3942

40-
LemmaDoc GameLogic.false_elim as "false_elim" in "¬" "
43+
/--
4144
If
4245
```
4346
-- Assumptions
@@ -48,11 +51,12 @@ then
4851
have t : T := false_elim h
4952
```
5053
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 "¬"
5256

5357
def or_inl {P Q : Prop} (p : P) : Or P Q := Or.inl p
5458

55-
LemmaDoc GameLogic.or_inl as "or_inl" in "∨" "
59+
/--
5660
# Or Introduction Left
5761
Turns evidence for the lefthand of an `∨` proposition into a disjunction. The context must supply what the righthand side of the disjunction is.
5862
```
@@ -67,11 +71,12 @@ have h : P ∨ Q := or_inl p
6771
have h := (or_inl p : P ∨ Q)
6872
have h := show P ∨ Q from or_inl p
6973
```
70-
"
74+
-/
75+
TheoremDoc GameLogic.or_inl as "or_inl" in "∨"
7176

7277
def or_inr {P Q : Prop} (q : Q) : Or P Q := Or.inr q
7378

74-
LemmaDoc GameLogic.or_inr as "or_inr" in "∨" "
79+
/--
7580
# Or Introduction Right
7681
Turns evidence for the righthand of an `∨` proposition into a disjunction. The context must supply what the lefthand side of the disjunction is.
7782
```
@@ -87,6 +92,8 @@ have h := (or_inl q : P ∨ Q)
8792
have h := show P ∨ Q from or_inl q
8893
```
8994
"
95+
-/
96+
TheoremDoc GameLogic.or_inr as "or_inr" in "∨"
9097

9198
def or_elim
9299
{P Q R : Prop}
@@ -95,7 +102,7 @@ def or_elim
95102
(right : Q → R) : R :=
96103
Or.elim h left right
97104

98-
LemmaDoc GameLogic.or_elim as "or_elim" in "∨" "
105+
/--
99106
# Or Elimination
100107
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.
101108
@@ -116,33 +123,37 @@ pr : P → R
116123
qr : Q → R
117124
have r : R := or_elim pvq pr qr
118125
```
119-
"
126+
-/
127+
TheoremDoc GameLogic.or_elim as "or_elim" in "∨"
120128

121129
def iff_intro
122130
{P Q : Prop}
123131
(mp: P → Q)
124132
(mpr: Q → P) : P ↔ Q :=
125133
Iff.intro mp mpr
126134

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 "↔"
130139

131140
def iff_mp {P Q : Prop} (h : P ↔ Q) : P → Q := h.mp
132141

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 "↔"
136146

137147
def iff_mpr {P Q : Prop} (h : P ↔ Q) : Q → P := h.mpr
138148

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 "↔"
142153

143154
def modus_ponens {P Q : Prop} (hpq: P → Q) (p: P) : Q := hpq p
144155

145-
LemmaDoc GameLogic.modus_ponens as "modus_ponens" in "→" "
156+
/--
146157
In this game, the deductive rule *modus_ponens* is just function application.
147158
```
148159
intro h : A ∧ B
@@ -170,40 +181,44 @@ There is are infix operators for function application; they look like `|>` and `
170181
It's twin, `|>` chains such that `x |> f |> g` is interpreted as `g (f x)`.
171182
172183
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 "→"
174186

175187
def and_comm {P Q : Prop}: P ∧ Q ↔ Q ∧ P :=
176188
⟨ λ⟨l,r⟩ ↦ ⟨r,l⟩,
177189
λ⟨l,r⟩ ↦ ⟨r,l⟩
178190
179191

180-
LemmaDoc GameLogic.and_comm as "and_comm" in "∧" "
192+
/--
181193
# ∧ is commutative
182194
183195
`and_comm` is evidence that `P ∧ Q ↔ Q ∧ P`
184-
"
196+
-/
197+
TheoremDoc GameLogic.and_comm as "and_comm" in "∧"
185198

186199
def and_assoc {P Q R : Prop}: P ∧ Q ∧ R ↔ (P ∧ Q) ∧ R :=
187200
⟨ λ⟨p,q,r⟩ ↦ ⟨⟨p,q⟩,r⟩,
188201
λ⟨⟨p,q⟩,r⟩ ↦ ⟨p,q,r⟩
189202
190203

191-
LemmaDoc GameLogic.and_assoc as "and_assoc" in "∧" "
204+
/--
192205
# ∧ is Associative
193206
194207
`and_assoc` is evidence that `P ∨ Q ∨ R ↔ (P ∨ Q) ∨ R`
195-
"
208+
-/
209+
TheoremDoc GameLogic.and_assoc as "and_assoc" in "∧"
196210

197211
def or_comm {P Q : Prop}: P ∨ Q ↔ Q ∨ P :=
198212
⟨ (Or.elim · Or.inr Or.inl),
199213
(Or.elim · Or.inr Or.inl)
200214
201215

202-
LemmaDoc GameLogic.or_comm as "or_comm" in "∨" "
216+
/--
203217
# ∨ is commutative
204218
205219
`or_comm` is evidence that `P ∨ Q ↔ Q ∨ P`
206-
"
220+
-/
221+
TheoremDoc GameLogic.or_comm as "or_comm" in "∨"
207222

208223
-- or_assoc
209224
def or_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
238253
(Or.inr ∘ Or.inr))
239254
exact ⟨mp,mpr⟩
240255

241-
LemmaDoc GameLogic.or_assoc as "or_assoc" in "∨" "
256+
/--
242257
# ∨ is Associative
243258
244259
`or_assoc` is evidence that `P ∨ Q ∨ R ↔ (P ∨ Q) ∨ R`
245-
"
260+
-/
261+
TheoremDoc GameLogic.or_assoc as "or_assoc" in "∨"
246262

247263
def imp_trans {P Q R : Prop} (hpq : P → Q) (hqr : Q → R) (p : P): R := hqr (hpq p)
248264

249-
LemmaDoc GameLogic.imp_trans as "imp_trans" in "→" "
265+
/--
250266
# → is transitive
251267
`P → Q` and `Q → R` implies `P → R`
252268
```
@@ -260,7 +276,8 @@ Of course, because of `and_comm`, you know you can flip this around too.
260276
`imp_trans` has an infix operator. This looks like `≫` (which is written as “`\\gg`”).
261277
262278
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 "→"
264281

265282
infixl:85 " ≫ " => λa b ↦ Function.comp b a -- type as \gg
266283

@@ -269,17 +286,18 @@ def not_not_not {P : Prop}: ¬¬¬P ↔ ¬P := ⟨
269286
(λnp nnp ↦ nnp $ np)
270287
271288

272-
LemmaDoc GameLogic.not_not_not as "not_not_not" in "↔ extra" "
289+
/--
273290
# Negation is stable
274291
A nice result of this theorem is that any more than 2 negations can be simplified down to 1 or 2 negations.
275292
```
276293
not_not_not : ¬¬¬P ↔ ¬P
277294
```
278-
"
295+
-/
296+
TheoremDoc GameLogic.not_not_not as "not_not_not" in "↔ extra"
279297

280298
def modus_tollens {P Q : Prop} (h: P → Q) (nq: ¬Q) : ¬P := h ≫ nq
281299

282-
LemmaDoc GameLogic.modus_tollens as "modus_tollens" in "→" "
300+
/--
283301
# Modus Tollens
284302
Denying the consequent.
285303
@@ -292,14 +310,16 @@ mt : (P → Q) → ¬Q → ¬P
292310
293311
### Infix Operator:
294312
`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 "→"
296315

297316
def identity {P : Prop}(p : P) : P := p
298317

299-
LemmaDoc GameLogic.identity as "identity" in "→" "
318+
/--
300319
# Propositional Identity
301320
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.
302321
```
303322
identity : P → P
304323
```
305-
"
324+
-/
325+
TheoremDoc GameLogic.identity as "identity" in "→"

0 commit comments

Comments
 (0)