Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
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;
`;;
|