127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
1 |
signature QUOTIENT =
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
2 |
sig
|
130
|
3 |
type maps_info = {mapfun: string, relfun: string}
|
170
|
4 |
type quotient_info = {qtyp: typ, rtyp: typ, rel: term}
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
5 |
val mk_quotient_type: ((binding * mixfix) * (typ * term)) list -> Proof.context -> Proof.state
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
6 |
val mk_quotient_type_cmd: (((bstring * mixfix) * string) * string) list -> Proof.context -> Proof.state
|
128
|
7 |
val define: binding * mixfix * term -> local_theory -> (term * thm) * local_theory
|
|
8 |
val note: binding * thm -> local_theory -> thm * local_theory
|
130
|
9 |
val maps_lookup: theory -> string -> maps_info option
|
|
10 |
val maps_update: string -> maps_info -> theory -> theory
|
148
8e24e65f1e9b
tuned and attempted to store data about the quotients (does not work yet)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
11 |
val print_quotdata: Proof.context -> unit
|
170
|
12 |
val quotdata_lookup: theory -> quotient_info list
|
|
13 |
val quotdata_update_thy: (typ * typ * term) -> theory -> theory
|
|
14 |
val quotdata_update: (typ * typ * term) -> Proof.context -> Proof.context
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
15 |
end;
|
71
|
16 |
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
17 |
structure Quotient: QUOTIENT =
|
71
|
18 |
struct
|
|
19 |
|
130
|
20 |
(* data containers *)
|
|
21 |
(*******************)
|
|
22 |
|
135
|
23 |
(* info about map- and rel-functions *)
|
130
|
24 |
type maps_info = {mapfun: string, relfun: string}
|
|
25 |
|
135
|
26 |
structure MapsData = TheoryDataFun
|
130
|
27 |
(type T = maps_info Symtab.table
|
|
28 |
val empty = Symtab.empty
|
|
29 |
val copy = I
|
|
30 |
val extend = I
|
|
31 |
fun merge _ = Symtab.merge (K true))
|
135
|
32 |
|
|
33 |
val maps_lookup = Symtab.lookup o MapsData.get
|
|
34 |
fun maps_update k v = MapsData.map (Symtab.update (k, v))
|
|
35 |
|
|
36 |
|
|
37 |
(* info about the quotient types *)
|
|
38 |
type quotient_info = {qtyp: typ, rtyp: typ, rel: term}
|
|
39 |
|
|
40 |
structure QuotData = TheoryDataFun
|
|
41 |
(type T = quotient_info list
|
|
42 |
val empty = []
|
|
43 |
val copy = I
|
|
44 |
val extend = I
|
|
45 |
fun merge _ = (op @))
|
|
46 |
|
|
47 |
val quotdata_lookup = QuotData.get
|
170
|
48 |
fun quotdata_update_thy (qty, rty, rel) =
|
135
|
49 |
QuotData.map (fn ls => {qtyp = qty, rtyp = rty, rel = rel}::ls)
|
|
50 |
|
170
|
51 |
fun quotdata_update (qty, rty, rel) = ProofContext.theory (quotdata_update_thy (qty, rty, rel))
|
|
52 |
|
135
|
53 |
fun print_quotdata ctxt =
|
|
54 |
let
|
148
8e24e65f1e9b
tuned and attempted to store data about the quotients (does not work yet)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
55 |
val quots = QuotData.get (ProofContext.theory_of ctxt)
|
8e24e65f1e9b
tuned and attempted to store data about the quotients (does not work yet)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
56 |
fun prt_quot {qtyp, rtyp, rel} =
|
8e24e65f1e9b
tuned and attempted to store data about the quotients (does not work yet)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
57 |
Pretty.block [Pretty.str ("quotient:"),
|
8e24e65f1e9b
tuned and attempted to store data about the quotients (does not work yet)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
58 |
Pretty.brk 2, Syntax.pretty_typ ctxt qtyp,
|
8e24e65f1e9b
tuned and attempted to store data about the quotients (does not work yet)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
59 |
Pretty.brk 2, Syntax.pretty_typ ctxt rtyp,
|
8e24e65f1e9b
tuned and attempted to store data about the quotients (does not work yet)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
60 |
Pretty.brk 2, Syntax.pretty_term ctxt rel]
|
130
|
61 |
in
|
135
|
62 |
[Pretty.big_list "quotients:" (map prt_quot quots)]
|
|
63 |
|> Pretty.chunks |> Pretty.writeln
|
130
|
64 |
end
|
|
65 |
|
135
|
66 |
val _ =
|
|
67 |
OuterSyntax.improper_command "print_quotients" "print quotient types of this theory"
|
|
68 |
OuterKeyword.diag (Scan.succeed (Toplevel.keep (print_quotdata o Toplevel.context_of)))
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
(* wrappers for define and note *)
|
|
73 |
fun define (name, mx, rhs) lthy =
|
|
74 |
let
|
|
75 |
val ((rhs, (_ , thm)), lthy') =
|
|
76 |
LocalTheory.define Thm.internalK ((name, mx), (Attrib.empty_binding, rhs)) lthy
|
|
77 |
in
|
|
78 |
((rhs, thm), lthy')
|
|
79 |
end
|
|
80 |
|
|
81 |
fun note (name, thm) lthy =
|
|
82 |
let
|
|
83 |
val ((_,[thm']), lthy') = LocalTheory.note Thm.theoremK ((name, []), [thm]) lthy
|
|
84 |
in
|
|
85 |
(thm', lthy')
|
|
86 |
end
|
|
87 |
|
|
88 |
|
130
|
89 |
|
|
90 |
(* definition of the quotient type *)
|
|
91 |
(***********************************)
|
|
92 |
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
93 |
(* constructs the term lambda (c::rty => bool). EX (x::rty). c = rel x *)
|
71
|
94 |
fun typedef_term rel rty lthy =
|
|
95 |
let
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
96 |
val [x, c] = [("x", rty), ("c", HOLogic.mk_setT rty)]
|
71
|
97 |
|> Variable.variant_frees lthy [rel]
|
|
98 |
|> map Free
|
|
99 |
in
|
|
100 |
lambda c
|
|
101 |
(HOLogic.exists_const rty $
|
|
102 |
lambda x (HOLogic.mk_eq (c, (rel $ x))))
|
|
103 |
end
|
|
104 |
|
|
105 |
(* makes the new type definitions and proves non-emptyness*)
|
|
106 |
fun typedef_make (qty_name, mx, rel, rty) lthy =
|
|
107 |
let
|
|
108 |
val typedef_tac =
|
|
109 |
EVERY1 [rewrite_goal_tac @{thms mem_def},
|
|
110 |
rtac @{thm exI},
|
|
111 |
rtac @{thm exI},
|
|
112 |
rtac @{thm refl}]
|
|
113 |
val tfrees = map fst (Term.add_tfreesT rty [])
|
|
114 |
in
|
|
115 |
LocalTheory.theory_result
|
|
116 |
(Typedef.add_typedef false NONE
|
|
117 |
(qty_name, tfrees, mx)
|
|
118 |
(typedef_term rel rty lthy)
|
|
119 |
NONE typedef_tac) lthy
|
|
120 |
end
|
|
121 |
|
|
122 |
(* tactic to prove the QUOT_TYPE theorem for the new type *)
|
|
123 |
fun typedef_quot_type_tac equiv_thm (typedef_info: Typedef.info) =
|
|
124 |
let
|
|
125 |
val unfold_mem = MetaSimplifier.rewrite_rule @{thms mem_def}
|
|
126 |
val rep_thm = #Rep typedef_info |> unfold_mem
|
|
127 |
val rep_inv = #Rep_inverse typedef_info
|
|
128 |
val abs_inv = #Abs_inverse typedef_info |> unfold_mem
|
|
129 |
val rep_inj = #Rep_inject typedef_info
|
|
130 |
in
|
|
131 |
EVERY1 [rtac @{thm QUOT_TYPE.intro},
|
|
132 |
rtac equiv_thm,
|
|
133 |
rtac rep_thm,
|
|
134 |
rtac rep_inv,
|
|
135 |
rtac abs_inv,
|
|
136 |
rtac @{thm exI},
|
|
137 |
rtac @{thm refl},
|
|
138 |
rtac rep_inj]
|
|
139 |
end
|
|
140 |
|
|
141 |
(* proves the QUOT_TYPE theorem *)
|
|
142 |
fun typedef_quot_type_thm (rel, abs, rep, equiv_thm, typedef_info) lthy =
|
|
143 |
let
|
|
144 |
val quot_type_const = Const (@{const_name "QUOT_TYPE"}, dummyT)
|
|
145 |
val goal = HOLogic.mk_Trueprop (quot_type_const $ rel $ abs $ rep)
|
|
146 |
|> Syntax.check_term lthy
|
|
147 |
in
|
|
148 |
Goal.prove lthy [] [] goal
|
|
149 |
(K (typedef_quot_type_tac equiv_thm typedef_info))
|
|
150 |
end
|
|
151 |
|
|
152 |
(* proves the quotient theorem *)
|
|
153 |
fun typedef_quotient_thm (rel, abs, rep, abs_def, rep_def, quot_type_thm) lthy =
|
|
154 |
let
|
|
155 |
val quotient_const = Const (@{const_name "QUOTIENT"}, dummyT)
|
|
156 |
val goal = HOLogic.mk_Trueprop (quotient_const $ rel $ abs $ rep)
|
|
157 |
|> Syntax.check_term lthy
|
|
158 |
|
|
159 |
val typedef_quotient_thm_tac =
|
|
160 |
EVERY1 [K (rewrite_goals_tac [abs_def, rep_def]),
|
|
161 |
rtac @{thm QUOT_TYPE.QUOTIENT},
|
|
162 |
rtac quot_type_thm]
|
|
163 |
in
|
|
164 |
Goal.prove lthy [] [] goal
|
|
165 |
(K typedef_quotient_thm_tac)
|
|
166 |
end
|
|
167 |
|
|
168 |
(* main function for constructing the quotient type *)
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
169 |
fun mk_typedef_main (((qty_name, mx), (rty, rel)), equiv_thm) lthy =
|
71
|
170 |
let
|
|
171 |
(* generates typedef *)
|
|
172 |
val ((_, typedef_info), lthy1) = typedef_make (qty_name, mx, rel, rty) lthy
|
|
173 |
|
|
174 |
(* abs and rep functions *)
|
|
175 |
val abs_ty = #abs_type typedef_info
|
|
176 |
val rep_ty = #rep_type typedef_info
|
|
177 |
val abs_name = #Abs_name typedef_info
|
|
178 |
val rep_name = #Rep_name typedef_info
|
|
179 |
val abs = Const (abs_name, rep_ty --> abs_ty)
|
|
180 |
val rep = Const (rep_name, abs_ty --> rep_ty)
|
|
181 |
|
148
8e24e65f1e9b
tuned and attempted to store data about the quotients (does not work yet)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
182 |
(* storing the quot-info *)
|
170
|
183 |
(*val _ = quotdata_update (abs_ty, rty, rel) (ProofContext.theory_of lthy)*)
|
148
8e24e65f1e9b
tuned and attempted to store data about the quotients (does not work yet)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
184 |
|
71
|
185 |
(* ABS and REP definitions *)
|
|
186 |
val ABS_const = Const (@{const_name "QUOT_TYPE.ABS"}, dummyT )
|
|
187 |
val REP_const = Const (@{const_name "QUOT_TYPE.REP"}, dummyT )
|
|
188 |
val ABS_trm = Syntax.check_term lthy1 (ABS_const $ rel $ abs)
|
|
189 |
val REP_trm = Syntax.check_term lthy1 (REP_const $ rep)
|
|
190 |
val ABS_name = Binding.prefix_name "ABS_" qty_name
|
|
191 |
val REP_name = Binding.prefix_name "REP_" qty_name
|
|
192 |
val (((ABS, ABS_def), (REP, REP_def)), lthy2) =
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
193 |
lthy1 |> define (ABS_name, NoSyn, ABS_trm)
|
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
194 |
||>> define (REP_name, NoSyn, REP_trm)
|
71
|
195 |
|
|
196 |
(* quot_type theorem *)
|
|
197 |
val quot_thm = typedef_quot_type_thm (rel, abs, rep, equiv_thm, typedef_info) lthy2
|
|
198 |
val quot_thm_name = Binding.prefix_name "QUOT_TYPE_" qty_name
|
|
199 |
|
|
200 |
(* quotient theorem *)
|
|
201 |
val quotient_thm = typedef_quotient_thm (rel, ABS, REP, ABS_def, REP_def, quot_thm) lthy2
|
|
202 |
val quotient_thm_name = Binding.prefix_name "QUOTIENT_" qty_name
|
|
203 |
|
|
204 |
(* interpretation *)
|
|
205 |
val bindd = ((Binding.make ("", Position.none)), ([]: Attrib.src list))
|
|
206 |
val ((_, [eqn1pre]), lthy3) = Variable.import true [ABS_def] lthy2;
|
|
207 |
val eqn1i = Thm.prop_of (symmetric eqn1pre)
|
|
208 |
val ((_, [eqn2pre]), lthy4) = Variable.import true [REP_def] lthy3;
|
|
209 |
val eqn2i = Thm.prop_of (symmetric eqn2pre)
|
|
210 |
|
|
211 |
val exp_morphism = ProofContext.export_morphism lthy4 (ProofContext.init (ProofContext.theory_of lthy4));
|
|
212 |
val exp_term = Morphism.term exp_morphism;
|
|
213 |
val exp = Morphism.thm exp_morphism;
|
|
214 |
|
|
215 |
val mthd = Method.SIMPLE_METHOD ((rtac quot_thm 1) THEN
|
|
216 |
ALLGOALS (simp_tac (HOL_basic_ss addsimps [(symmetric (exp ABS_def)), (symmetric (exp REP_def))])))
|
|
217 |
val mthdt = Method.Basic (fn _ => mthd)
|
|
218 |
val bymt = Proof.global_terminal_proof (mthdt, NONE)
|
|
219 |
val exp_i = [(@{const_name QUOT_TYPE}, ((("QUOT_TYPE_I_" ^ (Binding.name_of qty_name)), true),
|
170
|
220 |
Expression.Named [("R", rel), ("Abs", abs), ("Rep", rep) ]))]
|
71
|
221 |
in
|
|
222 |
lthy4
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
223 |
|> note (quot_thm_name, quot_thm)
|
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
224 |
||>> note (quotient_thm_name, quotient_thm)
|
71
|
225 |
||> LocalTheory.theory (fn thy =>
|
|
226 |
let
|
|
227 |
val global_eqns = map exp_term [eqn2i, eqn1i];
|
|
228 |
(* Not sure if the following context should not be used *)
|
|
229 |
val (global_eqns2, lthy5) = Variable.import_terms true global_eqns lthy4;
|
|
230 |
val global_eqns3 = map (fn t => (bindd, t)) global_eqns2;
|
|
231 |
in ProofContext.theory_of (bymt (Expression.interpretation (exp_i, []) global_eqns3 thy)) end)
|
|
232 |
end
|
|
233 |
|
130
|
234 |
|
|
235 |
|
|
236 |
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
237 |
(* interface and syntax setup *)
|
75
|
238 |
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
239 |
(* the ML-interface takes a list of 4-tuples consisting of *)
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
240 |
(* *)
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
241 |
(* - the name of the quotient type *)
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
242 |
(* - its mixfix annotation *)
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
243 |
(* - the type to be quotient *)
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
244 |
(* - the relation according to which the type is quotient *)
|
130
|
245 |
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
246 |
fun mk_quotient_type quot_list lthy =
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
247 |
let
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
248 |
fun get_goal (rty, rel) =
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
249 |
let
|
148
8e24e65f1e9b
tuned and attempted to store data about the quotients (does not work yet)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
250 |
val EQUIV_ty = ([rty, rty] ---> @{typ bool}) --> @{typ bool}
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
251 |
in
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
252 |
(HOLogic.mk_Trueprop (Const (@{const_name EQUIV}, EQUIV_ty) $ rel), [])
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
253 |
end
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
254 |
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
255 |
val goals = map (get_goal o snd) quot_list
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
256 |
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
257 |
fun after_qed thms lthy =
|
135
|
258 |
fold_map mk_typedef_main (quot_list ~~ (flat thms)) lthy |> snd
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
259 |
in
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
260 |
Proof.theorem_i NONE after_qed [goals] lthy
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
261 |
end
|
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
262 |
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
263 |
val quotspec_parser =
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
264 |
OuterParse.and_list1
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
265 |
(OuterParse.short_ident -- OuterParse.opt_infix --
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
266 |
(OuterParse.$$$ "=" |-- OuterParse.typ) --
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
267 |
(OuterParse.$$$ "/" |-- OuterParse.term))
|
75
|
268 |
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
269 |
fun mk_quotient_type_cmd spec lthy =
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
270 |
let
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
271 |
fun parse_spec (((qty_str, mx), rty_str), rel_str) =
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
272 |
let
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
273 |
val qty_name = Binding.name qty_str
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
274 |
val rty = Syntax.parse_typ lthy rty_str
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
275 |
val rel = Syntax.parse_term lthy rel_str
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
276 |
|> Syntax.check_term lthy
|
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
277 |
in
|
148
8e24e65f1e9b
tuned and attempted to store data about the quotients (does not work yet)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
278 |
((qty_name, mx), (rty, rel))
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
279 |
end
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
280 |
in
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
281 |
mk_quotient_type (map parse_spec spec) lthy
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
282 |
end
|
75
|
283 |
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
284 |
val _ = OuterKeyword.keyword "/"
|
75
|
285 |
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
286 |
val _ =
|
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
287 |
OuterSyntax.local_theory_to_proof "quotient"
|
82
|
288 |
"quotient type definitions (requires equivalence proofs)"
|
127
b054cf6bd179
the command "quotient" can now define more than one quotient at the same time; quotients need to be separated by and
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
289 |
OuterKeyword.thy_goal (quotspec_parser >> mk_quotient_type_cmd)
|
79
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
290 |
|
c0c41fefeb06
added quotient command (you need to update isar-keywords-prove.el)
Christian Urban <urbanc@in.tum.de>
diff
changeset
|
291 |
end; (* structure *)
|
71
|
292 |
|
|
293 |
open Quotient |