-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathChap4Ex.lean
207 lines (167 loc) · 6.83 KB
/
Chap4Ex.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import HTPILib.Chap4
namespace HTPI.Exercises
/- Section 4.2 -/
-- 1.
theorem Exercise_4_2_9a {A B C : Type} (R : Set (A × B))
(S : Set (B × C)) : Dom (comp S R) ⊆ Dom R := sorry
-- 2.
theorem Exercise_4_2_9b {A B C : Type} (R : Set (A × B))
(S : Set (B × C)) : Ran R ⊆ Dom S → Dom (comp S R) = Dom R := sorry
-- 3.
--Fill in the blank to get a correct theorem and then prove the theorem
theorem Exercise_4_2_9c {A B C : Type} (R : Set (A × B))
(S : Set (B × C)) : ___ → Ran (comp S R) = Ran S := sorry
-- 4.
theorem Exercise_4_2_12a {A B C : Type}
(R : Set (A × B)) (S T : Set (B × C)) :
(comp S R) \ (comp T R) ⊆ comp (S \ T) R := sorry
-- 5.
--You won't be able to complete this proof
theorem Exercise_4_2_12b {A B C : Type}
(R : Set (A × B)) (S T : Set (B × C)) :
comp (S \ T) R ⊆ (comp S R) \ (comp T R) := sorry
-- 6.
--You might not be able to complete this proof
theorem Exercise_4_2_14c {A B C : Type}
(R : Set (A × B)) (S T : Set (B × C)) :
comp (S ∩ T) R = (comp S R) ∩ (comp T R) := sorry
-- 7.
--You might not be able to complete this proof
theorem Exercise_4_2_14d {A B C : Type}
(R : Set (A × B)) (S T : Set (B × C)) :
comp (S ∪ T) R = (comp S R) ∪ (comp T R) := sorry
/- Section 4.3 -/
-- 1.
example :
elementhood Int 6 {n : Int | ∃ (k : Int), n = 2 * k} := sorry
-- 2.
theorem Theorem_4_3_4_1 {A : Type} (R : BinRel A) :
reflexive R ↔ {(x, y) : A × A | x = y} ⊆ extension R := sorry
-- 3.
theorem Theorem_4_3_4_3 {A : Type} (R : BinRel A) :
transitive R ↔
comp (extension R) (extension R) ⊆ extension R := sorry
-- 4.
theorem Exercise_4_3_12a {A : Type} (R : BinRel A) (h1 : reflexive R) :
reflexive (RelFromExt (inv (extension R))) := sorry
-- 5.
theorem Exercise_4_3_12c {A : Type} (R : BinRel A) (h1 : transitive R) :
transitive (RelFromExt (inv (extension R))) := sorry
-- 6.
theorem Exercise_4_3_18 {A : Type}
(R S : BinRel A) (h1 : transitive R) (h2 : transitive S)
(h3 : comp (extension S) (extension R) ⊆
comp (extension R) (extension S)) :
transitive (RelFromExt (comp (extension R) (extension S))) := sorry
-- 7.
theorem Exercise_4_3_20 {A : Type} (R : BinRel A) (S : BinRel (Set A))
(h : ∀ (X Y : Set A), S X Y ↔ X ≠ ∅ ∧ Y ≠ ∅ ∧
∀ (x y : A), x ∈ X → y ∈ Y → R x y) :
transitive R → transitive S := sorry
-- 8.
--You might not be able to complete this proof
theorem Exercise_4_3_13b {A : Type}
(R1 R2 : BinRel A) (h1 : symmetric R1) (h2 : symmetric R2) :
symmetric (RelFromExt ((extension R1) ∪ (extension R2))) := sorry
-- 9.
--You might not be able to complete this proof
theorem Exercise_4_3_13c {A : Type}
(R1 R2 : BinRel A) (h1 : transitive R1) (h2 : transitive R2) :
transitive (RelFromExt ((extension R1) ∪ (extension R2))) := sorry
-- 10.
--You might not be able to complete this proof
theorem Exercise_4_3_19 {A : Type} (R : BinRel A) (S : BinRel (Set A))
(h : ∀ (X Y : Set A), S X Y ↔ ∃ (x y : A), x ∈ X ∧ y ∈ Y ∧ R x y) :
transitive R → transitive S := sorry
/- Section 4.4 -/
-- 1.
theorem Example_4_4_3_1 {A : Type} : partial_order (sub A) := sorry
-- 2.
theorem Theorem_4_4_6_1 {A : Type} (R : BinRel A) (B : Set A) (b : A)
(h1 : partial_order R) (h2 : smallestElt R b B) :
∀ (c : A), smallestElt R c B → b = c := sorry
-- 3.
--If F is a set of sets, then ⋃₀ F is the lub of F in the subset ordering
theorem Theorem_4_4_11 {A : Type} (F : Set (Set A)) :
lub (sub A) (⋃₀ F) F := sorry
-- 4.
theorem Exercise_4_4_8 {A B : Type} (R : BinRel A) (S : BinRel B)
(T : BinRel (A × B)) (h1 : partial_order R) (h2 : partial_order S)
(h3 : ∀ (a a' : A) (b b' : B),
T (a, b) (a', b') ↔ R a a' ∧ S b b') :
partial_order T := sorry
-- 5.
theorem Exercise_4_4_9_part {A B : Type} (R : BinRel A) (S : BinRel B)
(L : BinRel (A × B)) (h1 : total_order R) (h2 : total_order S)
(h3 : ∀ (a a' : A) (b b' : B),
L (a, b) (a', b') ↔ R a a' ∧ (a = a' → S b b')) :
∀ (a a' : A) (b b' : B),
L (a, b) (a', b') ∨ L (a', b') (a, b) := sorry
-- 6.
theorem Exercise_4_4_15a {A : Type}
(R1 R2 : BinRel A) (B : Set A) (b : A)
(h1 : partial_order R1) (h2 : partial_order R2)
(h3 : extension R1 ⊆ extension R2) :
smallestElt R1 b B → smallestElt R2 b B := sorry
-- 7.
theorem Exercise_4_4_15b {A : Type}
(R1 R2 : BinRel A) (B : Set A) (b : A)
(h1 : partial_order R1) (h2 : partial_order R2)
(h3 : extension R1 ⊆ extension R2) :
minimalElt R2 b B → minimalElt R1 b B := sorry
-- 8.
theorem Exercise_4_4_18a {A : Type}
(R : BinRel A) (B1 B2 : Set A) (h1 : partial_order R)
(h2 : ∀ x ∈ B1, ∃ y ∈ B2, R x y) (h3 : ∀ x ∈ B2, ∃ y ∈ B1, R x y) :
∀ (x : A), upperBd R x B1 ↔ upperBd R x B2 := sorry
-- 9.
theorem Exercise_4_4_22 {A : Type}
(R : BinRel A) (B1 B2 : Set A) (x1 x2 : A)
(h1 : partial_order R) (h2 : lub R x1 B1) (h3 : lub R x2 B2) :
B1 ⊆ B2 → R x1 x2 := sorry
-- 10.
theorem Exercise_4_4_24 {A : Type} (R : Set (A × A)) :
smallestElt (sub (A × A)) (R ∪ (inv R))
{T : Set (A × A) | R ⊆ T ∧ symmetric (RelFromExt T)} := sorry
/- Section 4.5 -/
-- 1.
lemma overlap_implies_equal {A : Type}
(F : Set (Set A)) (h : partition F) :
∀ X ∈ F, ∀ Y ∈ F, ∀ (x : A), x ∈ X → x ∈ Y → X = Y := sorry
-- 2.
lemma Lemma_4_5_7_ref {A : Type} (F : Set (Set A)) (h : partition F) :
reflexive (EqRelFromPart F) := sorry
-- 3.
lemma Lemma_4_5_7_symm {A : Type} (F : Set (Set A)) (h : partition F) :
symmetric (EqRelFromPart F) := sorry
-- 4.
lemma Lemma_4_5_7_trans {A : Type} (F : Set (Set A)) (h : partition F) :
transitive (EqRelFromPart F) := sorry
-- 5.
lemma Lemma_4_5_8 {A : Type} (F : Set (Set A)) (h : partition F) :
∀ X ∈ F, ∀ x ∈ X, equivClass (EqRelFromPart F) x = X := sorry
-- 6.
lemma elt_mod_equiv_class_of_elt
{A : Type} (R : BinRel A) (h : equiv_rel R) :
∀ X ∈ mod A R, ∀ x ∈ X, equivClass R x = X := sorry
-- Definitions for next three exercises:
def dot {A : Type} (F G : Set (Set A)) : Set (Set A) :=
{Z : Set A | ¬empty Z ∧ ∃ X ∈ F, ∃ Y ∈ G, Z = X ∩ Y}
def conj {A : Type} (R S : BinRel A) (x y : A) : Prop :=
R x y ∧ S x y
-- 7.
theorem Exercise_4_5_20a {A : Type} (R S : BinRel A)
(h1 : equiv_rel R) (h2 : equiv_rel S) :
equiv_rel (conj R S) := sorry
-- 8.
theorem Exercise_4_5_20b {A : Type} (R S : BinRel A)
(h1 : equiv_rel R) (h2 : equiv_rel S) :
∀ (x : A), equivClass (conj R S) x =
equivClass R x ∩ equivClass S x := sorry
-- 9.
theorem Exercise_4_5_20c {A : Type} (R S : BinRel A)
(h1 : equiv_rel R) (h2 : equiv_rel S) :
mod A (conj R S) = dot (mod A R) (mod A S) := sorry
-- 10.
def equiv_mod (m x y : Int) : Prop := m ∣ (x - y)
theorem Theorem_4_5_10 : ∀ (m : Int), equiv_rel (equiv_mod m) := sorry