Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
File size: 9,946 Bytes
4365a98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
(*                (c) Copyright, Bill Richter 2013                           *)
(*          Distributed under the same license as HOL Light                  *)
(*                                                                           *)
(* Definitions of FunctionSpace and FunctionComposition.   A proof that the  *)
(* Cartesian product satisfies the universal property that given functions   *)
(* Ξ± ∈ M β†’ A and Ξ² ∈ M β†’ B, there is a unique Ξ³ ∈ M β†’ A ∏ B whose            *)
(* projections to A and B are f and g.                                       *)

needs "RichterHilbertAxiomGeometry/readable.ml";;

ParseAsInfix("βˆ‰",(11, "right"));;
ParseAsInfix("∏",(20, "right"));;
ParseAsInfix("∘",(20, "right"));;
ParseAsInfix("β†’",(13,"right"));;

(*
βˆ‰ |- βˆ€a l. a βˆ‰ l ⇔ Β¬(a ∈ l)

CartesianProduct
  |- βˆ€X Y. X ∏ Y = {x,y | x ∈ X ∧ y ∈ Y}

FUNCTION |- βˆ€Ξ±. FUNCTION Ξ± ⇔
             (βˆƒf s t.  Ξ± = t,f,s ∧
                  (βˆ€x. x ∈ s β‡’ f x ∈ t) ∧ (βˆ€x. x βˆ‰ s β‡’ f x = (@y. T)))

SOURCE |- βˆ€Ξ±. SOURCE Ξ± = SND (SND Ξ±)

FUN |- βˆ€Ξ±. FUN Ξ± = FST (SND Ξ±)

TARGET |- βˆ€Ξ±. TARGET Ξ± = FST Ξ±

FunctionSpace
  |- βˆ€s t.  s β†’ t = {Ξ± | FUNCTION Ξ± ∧ s = SOURCE Ξ± ∧ t = TARGET Ξ±}

makeFunction
  |- βˆ€t f s. makeFunction t f s = t,(Ξ»x. if x ∈ s then f x else @y. T),s

Projection1Function
  |- βˆ€X Y. Pi1 X Y = makeFunction X FST (X ∏ Y)

Projection2Function
  |- βˆ€X Y. Pi2 X Y = makeFunction Y SND (X ∏ Y)

FunctionComposition
  |- βˆ€Ξ± Ξ².  Ξ± ∘ Ξ² = makeFunction (TARGET Ξ±) (FUN Ξ± o FUN Ξ²) (SOURCE Ξ²)

IN_CartesianProduct
  |- βˆ€X Y x y. x,y ∈ X ∏ Y ⇔ x ∈ X ∧ y ∈ Y

CartesianFstSnd
  |- βˆ€pair. pair ∈ X ∏ Y β‡’ FST pair ∈ X ∧ SND pair ∈ Y

FUNCTION_EQ
  |- βˆ€Ξ± Ξ².  FUNCTION Ξ± ∧ FUNCTION Ξ² ∧ SOURCE Ξ± = SOURCE Ξ² ∧ FUN Ξ± = FUN Ξ² ∧
        TARGET Ξ± = TARGET Ξ²  β‡’  Ξ± = Ξ²

IN_FunctionSpace
  |- βˆ€s t Ξ±.  Ξ± ∈ s β†’ t ⇔
         FUNCTION α ∧ s = SOURCE α ∧ t = TARGET α

makeFunction_EQ
  |- βˆ€f g s t.  (βˆ€x. x ∈ s β‡’ f x = g x)
         β‡’ makeFunction t f s = makeFunction t g s

makeFunctionyieldsFUN
  |- βˆ€Ξ± g t f s.  Ξ± = makeFunction t f s ∧ g = FUN Ξ±
         β‡’ βˆ€x. x ∈ s β‡’ f x = g x

makeFunctionEq
  |- βˆ€Ξ± Ξ² f g s t.
         α = makeFunction t f s ∧ β = makeFunction t g s ∧
         (βˆ€x. x ∈ s β‡’ f x = g x)  β‡’  Ξ± = Ξ²

FunctionSpaceOnSource
  |- βˆ€Ξ± f s t.  Ξ± ∈ s β†’ t ∧ f = FUN Ξ±  β‡’  (βˆ€x. x ∈ s β‡’ f x ∈ t)

FunctionSpaceOnOffSource
  |- βˆ€Ξ± f s t.  Ξ± ∈ s β†’ t ∧ f = FUN Ξ±
         β‡’ (βˆ€x. x ∈ s β‡’ f x ∈ t) ∧ (βˆ€x. x βˆ‰ s β‡’ f x = (@y. T))

ImpliesTruncatedFunctionSpace
  |- βˆ€Ξ± s t f.
         Ξ± = makeFunction t f s ∧ (βˆ€x. x ∈ s β‡’ f x ∈ t)
         β‡’ Ξ± ∈ s β†’ t

FunFunctionSpaceImplyFunction
  |- βˆ€Ξ± s t f.  Ξ± ∈ s β†’ t ∧ f = FUN Ξ±  β‡’  Ξ± = makeFunction t f s

UseFunctionComposition
  |- βˆ€Ξ± Ξ² u f t g s.
         Ξ± = makeFunction u f t ∧ Ξ² = makeFunction t g s ∧ Ξ² ∈ s β†’ t
         β‡’ Ξ± ∘ Ξ² = makeFunction u (f o g) s

PairProjectionFunctions
  |- βˆ€X Y. Pi1 X Y ∈ X ∏ Y β†’ X ∧ Pi2 X Y ∈ X ∏ Y β†’ Y

UniversalPropertyProduct
  |- βˆ€M A B Ξ± Ξ².  Ξ± ∈ M β†’ A ∧ Ξ² ∈ M β†’ B
                    β‡’ (βˆƒ!Ξ³. Ξ³ ∈ M β†’ A ∏ B ∧
                       Pi1 A B ∘ γ = α ∧ Pi2 A B ∘ γ = β)

*)

let NOTIN = NewDefinition `;
  βˆ€a l. a βˆ‰ l ⇔ Β¬(a ∈ l)`;;

let CartesianProduct = NewDefinition `;
  βˆ€X Y. X ∏ Y = {x,y | x ∈ X ∧ y ∈ Y}`;;

let FUNCTION = NewDefinition `;
  FUNCTION Ξ±  ⇔  βˆƒf s t. Ξ± = (t, f, s)  ∧
    (βˆ€x. x IN s β‡’ f x  IN t) ∧ βˆ€x. x βˆ‰ s β‡’ f x  = @y. T`;;

let SOURCE = NewDefinition `;
  SOURCE Ξ± = SND (SND Ξ±)`;;

let FUN = NewDefinition `;
  FUN Ξ± = FST (SND Ξ±)`;;

let TARGET = NewDefinition `;
  TARGET Ξ± = FST Ξ±`;;

let FunctionSpace = NewDefinition `;
  βˆ€s t. s β†’ t = {Ξ± | FUNCTION Ξ±  ∧  s = SOURCE Ξ±  ∧ t = TARGET Ξ±}`;;

let makeFunction = NewDefinition `;
  βˆ€t f s. makeFunction t f s = (t, (Ξ»x. if x ∈ s then f x else @y. T), s)`;;

let Projection1Function = NewDefinition `;
  Pi1 X Y = makeFunction X FST (X ∏ Y)`;;

let Projection2Function = NewDefinition `;
  Pi2 X Y = makeFunction Y SND (X ∏ Y)`;;

let FunctionComposition = NewDefinition `;
  βˆ€Ξ± Ξ².  Ξ± ∘ Ξ² = makeFunction (TARGET Ξ±) (FUN Ξ± o FUN Ξ²) (SOURCE Ξ²)`;;

let IN_CartesianProduct = theorem `;
  βˆ€X Y x y. x,y ∈ X ∏ Y  ⇔  x ∈ X ∧ y ∈ Y

  proof
    rewrite IN_ELIM_THM CartesianProduct;     fol PAIR_EQ;     qed;
`;;

let IN_CartesianProduct = theorem `;
  βˆ€X Y x y. x,y ∈ X ∏ Y  ⇔  x ∈ X ∧ y ∈ Y

  proof
    rewrite IN_ELIM_THM CartesianProduct;     fol PAIR_EQ;     qed;
`;;

let CartesianFstSnd = theorem `;
  βˆ€pair. pair ∈ X ∏ Y  β‡’  FST pair ∈ X ∧ SND pair ∈ Y
  by rewrite FORALL_PAIR_THM PAIR_EQ IN_CartesianProduct`;;

let FUNCTION_EQ = theorem `;
  βˆ€Ξ± Ξ². FUNCTION Ξ±  ∧  FUNCTION Ξ²  ∧  SOURCE Ξ± = SOURCE Ξ²  ∧
    FUN α = FUN β  ∧  TARGET α = TARGET β
    β‡’ Ξ± = Ξ²
  by simplify FORALL_PAIR_THM FUNCTION SOURCE TARGET FUN PAIR_EQ`;;

let IN_FunctionSpace = theorem `;
  βˆ€s t Ξ±. Ξ± ∈ s β†’ t
    ⇔  FUNCTION Ξ±  ∧  s = SOURCE Ξ±  ∧  t = TARGET Ξ±
  by rewrite IN_ELIM_THM FunctionSpace`;;

let makeFunction_EQ = theorem `;
  βˆ€f g s t.  (βˆ€x. x ∈ s β‡’ f x = g x)
    β‡’  makeFunction t f s = makeFunction t g s
  by simplify makeFunction βˆ‰ FUN_EQ_THM`;;

let makeFunctionyieldsFUN = theorem `;
  βˆ€Ξ± g t f s.  Ξ± = makeFunction t f s ∧ g = FUN Ξ±
    β‡’ βˆ€x. x ∈ s β‡’ f x = g x
  by simplify makeFunction FORALL_PAIR_THM FUN PAIR_EQ`;;

let makeFunctionEq = theorem `;
  βˆ€Ξ± Ξ² f g s t.  Ξ± = makeFunction t f s  ∧ Ξ² = makeFunction t g s  ∧
    (βˆ€x. x ∈ s β‡’ f x = g x)  β‡’  Ξ± = Ξ²
  by simplify FORALL_PAIR_THM makeFunction PAIR_EQ`;;

let FunctionSpaceOnSource = theorem `;
  βˆ€Ξ± f s t.  Ξ± ∈ s β†’ t  ∧  f = FUN Ξ±
    β‡’  βˆ€x. x ∈ s β‡’ f x ∈ t

  proof
    rewrite FORALL_PAIR_THM IN_FunctionSpace FUNCTION SOURCE TARGET PAIR_EQ FUN;
    fol;     qed;
`;;

let FunctionSpaceOnOffSource = theorem `;
  βˆ€Ξ± f s t.  Ξ± ∈ s β†’ t  ∧  f = FUN Ξ±
    β‡’  (βˆ€x. x ∈ s β‡’ f x ∈ t) ∧ βˆ€x. x βˆ‰ s β‡’ f x = @y. T

  proof
    rewrite FORALL_PAIR_THM IN_FunctionSpace FUNCTION SOURCE TARGET PAIR_EQ FUN;
    fol;     qed;
`;;

let ImpliesTruncatedFunctionSpace = theorem `;
  βˆ€Ξ± s t f.  Ξ± = makeFunction t f s  ∧  (βˆ€x. x ∈ s β‡’ f x ∈ t)
    β‡’ Ξ± ∈ s β†’ t

  proof
    rewrite FORALL_PAIR_THM IN_FunctionSpace makeFunction FUNCTION SOURCE TARGET NOTIN PAIR_EQ;
    fol;
  qed;
`;;

let FunFunctionSpaceImplyFunction = theorem `;
  βˆ€Ξ± s t f.  Ξ± ∈ s β†’ t  ∧  f = FUN Ξ±  β‡’  Ξ± = makeFunction t f s

  proof
    rewrite FORALL_PAIR_THM IN_FunctionSpace makeFunction FUNCTION SOURCE TARGET FUN NOTIN PAIR_EQ;
    fol FUN_EQ_THM;
  qed;
`;;

let UseFunctionComposition = theorem `;
  βˆ€Ξ± Ξ² u f t g s. Ξ± = makeFunction u f t  ∧
    Ξ² = makeFunction t g s  ∧  Ξ² ∈ s β†’ t
    β‡’ Ξ± _o_ Ξ² = makeFunction u (f o g) s

  proof
    rewrite FORALL_PAIR_THM makeFunction FunctionComposition SOURCE TARGET FUN BETA_THM o_THM IN_FunctionSpace FUNCTION SOURCE TARGET NOTIN PAIR_EQ;
    intro_TAC βˆ€[u'] [f'] [t'] [t1] [g1] [s1] [u] [f] [t] [g] [s],
    HΞ± HΞ² HΞ²_st Hs Ht;
    (βˆ€x. x ∈ s β‡’ g x ∈ t)     [g_st] by fol HΞ²_st HΞ²;
    simplify HΞ± GSYM Hs HΞ² g_st;
  qed;
`;;

let PairProjectionFunctions = theorem `;
  βˆ€X Y. Pi1 X Y ∈ X ∏ Y β†’ X  ∧  Pi2 X Y ∈ X ∏ Y β†’ Y

  proof
    intro_TAC βˆ€X Y;
    βˆ€pair. pair ∈ X ∏ Y  β‡’  FST pair ∈ X  ∧ SND pair ∈ Y     [] by fol CartesianFstSnd;
    fol Projection1Function Projection2Function - ImpliesTruncatedFunctionSpace;
  qed;
`;;

let UniversalPropertyProduct = theorem `;
  βˆ€M A B Ξ± Ξ².  Ξ± ∈ M β†’ A  ∧  Ξ² ∈ M β†’ B
      β‡’  βˆƒ!Ξ³.  Ξ³ ∈ M β†’ A ∏ B  ∧  Pi1 A B ∘ Ξ³ = Ξ±  ∧  Pi2 A B ∘ Ξ³ = Ξ²

  proof
    intro_TAC βˆ€M A B Ξ± Ξ², H1;
    consider f g such that f = FUN α ∧ g = FUN β     [fgExist] by fol;
    consider h such that h = Ξ»x. (f x,g x)     [hExists] by fol;
    βˆ€x. x ∈ M  β‡’  h x ∈ A ∏ B     [hProd] by fol hExists IN_CartesianProduct H1 fgExist FunctionSpaceOnSource;
    consider γ such that γ = makeFunction (A ∏ B) h  M     [γExists] by fol;
    Ξ³ ∈ M β†’ A ∏ B     [Ξ³FunSpace] by fol - hProd ImpliesTruncatedFunctionSpace;
    βˆ€x. x ∈ M  β‡’  (FST o h) x = f x  ∧  (SND o h) x = g x     [h_fg] by simplify hExists PAIR o_THM;
    Pi1 A B ∘ γ = makeFunction A (FST o h) M  ∧
    Pi2 A B ∘ γ = makeFunction B (SND o h) M     [] by fol Projection1Function Projection2Function γExists  γFunSpace UseFunctionComposition;
    Pi1 A B ∘ γ = α  ∧  Pi2 A B ∘ γ = β     [γWorks] by fol - h_fg makeFunction_EQ H1 fgExist FunFunctionSpaceImplyFunction;
   βˆ€ΞΈ.  ΞΈ ∈ M β†’ A ∏ B  ∧  Pi1 A B ∘ ΞΈ = Ξ±  ∧  Pi2 A B ∘ ΞΈ = Ξ²  β‡’ ΞΈ = Ξ³     []
     proof
      intro_TAC βˆ€ΞΈ, ΞΈWorks;
      consider k such that k = FUN ΞΈ     [kExists] by fol;
      θ = makeFunction (A ∏ B) k M     [θFUNk] by fol θWorks - FunFunctionSpaceImplyFunction;
      α = makeFunction A (FST o k) M  ∧  β = makeFunction B (SND o k) M     [] by fol Projection1Function Projection2Function θFUNk θWorks UseFunctionComposition;
      βˆ€x. x ∈ M  β‡’  f x = (FST o k) x ∧ g x = (SND o k) x     [fg_k] by fol ISPECL [Ξ±; f; A; (FST o k); M] makeFunctionyieldsFUN ISPECL [Ξ²; g; B; (SND o k); M] makeFunctionyieldsFUN - fgExist;
      βˆ€x. x ∈ M β‡’ k x = ((FST o k) x, (SND o k) x)     [] by fol PAIR o_THM;
      βˆ€x. x ∈ M β‡’ k x = (f x, g x)     [] by fol - fg_k PAIR_EQ;
      fol hExists ΞΈFUNk Ξ³Exists  - makeFunctionEq;
     qed;
     fol Ξ³FunSpace Ξ³Works - EXISTS_UNIQUE_THM;
  qed;
`;;