-
Notifications
You must be signed in to change notification settings - Fork 0
/
lean.lean
79 lines (46 loc) · 2.98 KB
/
lean.lean
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
68
69
70
71
72
73
74
75
76
77
78
79
section
variables {p q : Prop}
theorem not_not : p → ¬¬p
:= λ hp hnp, hnp hp
theorem not.not : ¬¬¬p → ¬p
:= λ hp, hp ∘ not_not
theorem not.imp : ¬¬p → (p → q) → ¬¬q
:= λ hp hpq hnq, hp (hnq ∘ hpq)
theorem not.not_not_and_not_not : ¬¬(¬¬p ∧ ¬¬q) → (¬¬p ∧ ¬¬q)
:= λ hpq, ⟨λ hnp, hpq (λ ⟨hp, _⟩, hp hnp), λ hnq, hpq (λ ⟨_, hq⟩, hq hnq)⟩
theorem not.not_not_and : ¬¬(¬¬p ∧ ¬¬q) → ¬¬(p ∧ q)
:= λ hpq hnpq, hpq (λ ⟨hp', hq'⟩, hp' (λ hp, hq' (λ hq, hnpq ⟨hp, hq⟩)))
theorem not.not_not_or : ¬¬(¬¬p ∨ ¬¬q) → ¬¬(p ∨ q)
:= λ hpq' hnpq, hpq' (λ hpq, hpq.elim (λ hp, hp (hnpq ∘ or.inl)) (λ hq, hq (hnpq ∘ or.inr)))
end
/-
example : p ∧ q → ¬(¬p ∨ ¬q) := λ ⟨h₁, h₂⟩ h, h.elim (not_not h₁) (not_not h₂)
example : ¬p ∨ ¬q → ¬(p ∧ q) := λ h ⟨h₁, h₂⟩, h.elim (not_not h₁) (not_not h₂)
example : ¬p ∧ ¬q → ¬(p ∨ q) := λ ⟨h₁, h₂⟩ h, h.elim h₁ h₂
example : p ∨ q → ¬(¬p ∧ ¬q) := λ h ⟨h₁, h₂⟩, h.elim h₁ h₂
example : ¬(p ∨ q) → ¬p ∧ ¬q := λ h, ⟨h ∘ or.inl, h ∘ or.inr⟩
example : ¬(¬p ∧ ¬q) → ¬¬(p ∨ q) := λ h h', h ⟨h' ∘ or.inl, h' ∘ or.inr⟩
lemma push : ¬¬p ∧ ¬¬q → ¬¬(p ∧ q) := λ ⟨h₁, h₂⟩ h, h₁ (λ hp, h₂ (λ hq, h ⟨hp, hq⟩))
example : ¬(¬p ∨ ¬q) → ¬¬(p ∧ q) := λ h h', push ⟨h ∘ or.inl, h ∘ or.inr⟩ h'
example : ¬(p ∧ q) → ¬¬(¬p ∨ ¬q) := λ h h', push ⟨h' ∘ or.inl, h' ∘ or.inr⟩ h
-/
/-
variables {α : Sort*} {p : α → Prop}
theorem forall_not_not : ¬¬(∀ x, ¬¬p x) → (∀ x, ¬¬p x)
:= λ hnnf x hn, hnnf (λ hf, hf x hn)
theorem not_not_exists : ¬¬(∃ x, ¬¬p x) → ¬¬(∃ x, p x)
:= λ he hne, he (λ ⟨x, hnn⟩, hnn (λ h, hne ⟨x, h⟩))
theorem forall' : (∀ x, p x) → ¬(∃ x, ¬p x) := λ h ⟨x, h'⟩, h' (h x)
theorem forall_not : (∀ x, ¬p x) → ¬(∃ x, p x) := λ h ⟨x, h'⟩, h x h'
theorem exists' : (∃ x, p x) → ¬(∀ x, ¬p x) := λ ⟨x, h⟩ h' , h' x h
theorem exists_not : (∃ x, ¬p x) → ¬(∀ x, p x) := λ ⟨x, h⟩ h' , h (h' x)
theorem not_exists : ¬(∃ x, p x) → (∀ x, ¬p x) := λ h x h', h ⟨x, h'⟩
theorem not_forall_not : ¬(∀ x, ¬p x) → ¬¬(∃ x, p x) := (∘ not_exists)
theorem not_exists_iff_forall_not : ¬(∃ x, p x) ↔ (∀ x, ¬p x) := ⟨not_exists, forall_not⟩
theorem not_forall_not_iff_exists : ¬(∀ x, ¬p x) ↔ ¬¬(∃ x, p x) := ⟨not_forall_not, λ h h', h (λ ⟨x, h''⟩, h' x h'')⟩
theorem not_exists_not : ¬(∃ x, ¬p x) → ¬¬(∀ x, p x) := λ h h', h _
theorem not_forall : ¬(∀ x, p x) → ¬¬(∃ x, ¬p x) := sorry
example : (∀ x, ¬p x) ↔ ¬(∃ x, p x) := ⟨forall_not, not_exists⟩
theorem not_forall : ¬(∀ x, p x) → ¬¬(∃ x, ¬p x) := λ h h', h (λ x, _)
example : (∀ x, ¬¬p x) → ¬¬(∀ x, p x) := λ h h', h' (λ x, let y := h x in _)
-/