-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterlude.lean
More file actions
67 lines (37 loc) · 1.68 KB
/
Copy pathInterlude.lean
File metadata and controls
67 lines (37 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
def woodlandCritters : List String :=
["hedgehog", "deer", "snail"]
def hedgehog := woodlandCritters[0]
def deer := woodlandCritters[1]
def snail := woodlandCritters[2]
def onePlusOneIsTwo : 1 + 1 = 2 := rfl
def onePlusOneIsTwo' : Prop := 1 + 1 = 2
theorem onePlusOneIsTwo'' : onePlusOneIsTwo' := rfl
theorem onePlusOneIsTwo''' : 1 + 1 = 2 := by
decide
theorem addAndAppend : 1 + 1 = 2 ∧ "Str".append "ing" = "String" := by
decide
theorem andImpliesOr : A ∧ B → A ∨ B :=
fun andEvidence =>
match andEvidence with
| And.intro a _ => Or.inl a
theorem onePlusOneorLessThan : 1 + 1 = 2 ∨ 3 < 5 := by decide
theorem notTwoEqualFive : ¬(1 + 1 = 5) := by decide
theorem trueIsTrue : True := by decide
theorem trueOrFalse : True ∨ False := by decide
theorem falseImpliesTrue : False → True := by decide
def third (xs : List α) (ok : xs.length > 2) : α := xs[2]
#eval third woodlandCritters (by decide)
def thirdOption (xs : List α) : Option α := xs[2]?
#eval thirdOption woodlandCritters
#eval thirdOption ["only", "two"]
#eval woodlandCritters[1]!
abbrev onePlusOneIsTwo'''' : Prop := 1 + 1 = 2
theorem onePlusOneIsStillTwo : onePlusOneIsTwo'''' := by decide
theorem twoPlusThreeIsFive : 2 + 3 = 5 := rfl
theorem fifteenMinusEightIsSeven : 15 - 8 = 7 := rfl
theorem helloAppendWorldIsHelloWorld : "Hello, ".append "World" = "Hello, World" := rfl
theorem twoPlusThreeIsFive' : 2 + 3 = 5 := by decide
theorem fifteenMunusEightIsSeven' : 15 - 8 = 7 := by decide
theorem helloAppendWorldIsHelloWorld' : "Hello, ".append "World" = "Hello, World" := by decide
theorem fiveLessThanEighteen : 5 < 18 := by decide
def fifth (xs : List α) (ok : xs.length > 4) : α := xs[4]