author | Christian Urban <urbanc@in.tum.de> |
Mon, 16 Aug 2010 17:39:16 +0800 | |
changeset 2401 | 7645e18e8b19 |
parent 2400 | c6d30d5f5ba1 |
child 2426 | deb5be0115a7 |
permissions | -rw-r--r-- |
2337
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
1 |
(* Title: nominal_dt_alpha.ML |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
2 |
Author: Christian Urban |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
3 |
Author: Cezary Kaliszyk |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
4 |
|
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
5 |
Performing quotient constructions |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
6 |
*) |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
7 |
|
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
8 |
signature NOMINAL_DT_QUOT = |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
9 |
sig |
2400
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
10 |
val define_qtypes: (string list * binding * mixfix) list -> typ list -> term list -> |
2337
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
11 |
thm list -> local_theory -> Quotient_Info.quotdata_info list * local_theory |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
12 |
|
2400
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
13 |
val define_qconsts: typ list -> (string * term * mixfix) list -> local_theory -> |
2337
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
14 |
Quotient_Info.qconsts_info list * local_theory |
2346 | 15 |
|
2400
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
16 |
val define_qperms: typ list -> string list -> (string * term * mixfix) list -> |
2401
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
17 |
thm list -> local_theory -> local_theory |
2400
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
18 |
|
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
19 |
val define_qsizes: typ list -> string list -> (string * term * mixfix) list -> |
2401
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
20 |
local_theory -> local_theory |
2337
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
21 |
end |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
22 |
|
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
23 |
structure Nominal_Dt_Quot: NOMINAL_DT_QUOT = |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
24 |
struct |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
25 |
|
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
26 |
(* defines the quotient types *) |
2400
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
27 |
fun define_qtypes qtys_descr alpha_tys alpha_trms alpha_equivp_thms lthy = |
2337
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
28 |
let |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
29 |
val qty_args1 = map2 (fn ty => fn trm => (ty, trm, false)) alpha_tys alpha_trms |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
30 |
val qty_args2 = (qtys_descr ~~ qty_args1) ~~ alpha_equivp_thms |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
31 |
in |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
32 |
fold_map Quotient_Type.add_quotient_type qty_args2 lthy |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
33 |
end |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
34 |
|
2338 | 35 |
|
2337
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
36 |
(* defines quotient constants *) |
2400
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
37 |
fun define_qconsts qtys consts_specs lthy = |
2337
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
38 |
let |
2338 | 39 |
val (qconst_infos, lthy') = |
40 |
fold_map (Quotient_Def.lift_raw_const qtys) consts_specs lthy |
|
2337
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
41 |
val phi = ProofContext.export_morphism lthy' lthy |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
42 |
in |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
43 |
(map (Quotient_Info.transform_qconsts phi) qconst_infos, lthy') |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
44 |
end |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
45 |
|
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
46 |
|
2400
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
47 |
(* defines the quotient permutations and proves pt-class *) |
2401
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
48 |
fun define_qperms qtys qfull_ty_names perm_specs raw_perm_laws lthy = |
2346 | 49 |
let |
2401
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
50 |
val lthy' = |
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
51 |
lthy |
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
52 |
|> Local_Theory.exit_global |
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
53 |
|> Class.instantiation (qfull_ty_names, [], @{sort pt}) |
2398 | 54 |
|
2401
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
55 |
val (_, lthy'') = define_qconsts qtys perm_specs lthy' |
2398 | 56 |
|
2401
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
57 |
val lifted_perm_laws = map (Quotient_Tacs.lifted qtys lthy'') raw_perm_laws |
2398 | 58 |
|
2346 | 59 |
fun tac _ = |
60 |
Class.intro_classes_tac [] THEN |
|
2400
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
61 |
(ALLGOALS (resolve_tac lifted_perm_laws)) |
2346 | 62 |
in |
2401
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
63 |
lthy'' |
2398 | 64 |
|> Class.prove_instantiation_exit tac |
2401
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
65 |
|> Named_Target.theory_init |
2346 | 66 |
end |
67 |
||
2337
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
68 |
|
2400
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
69 |
(* defines the size functions and proves size-class *) |
2401
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
70 |
fun define_qsizes qtys qfull_ty_names size_specs lthy = |
2400
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
71 |
let |
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
72 |
fun tac _ = Class.intro_classes_tac [] |
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
73 |
in |
2401
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
74 |
lthy |
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
75 |
|> Local_Theory.exit_global |
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
76 |
|> Class.instantiation (qfull_ty_names, [], @{sort size}) |
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
77 |
|> snd o (define_qconsts qtys size_specs) |
2400
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
78 |
|> Class.prove_instantiation_exit tac |
2401
7645e18e8b19
modified the code for class instantiations (with help from Florian)
Christian Urban <urbanc@in.tum.de>
parents:
2400
diff
changeset
|
79 |
|> Named_Target.theory_init |
2400
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
80 |
end |
c6d30d5f5ba1
defined qperms and qsizes
Christian Urban <urbanc@in.tum.de>
parents:
2398
diff
changeset
|
81 |
|
2337
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
82 |
end (* structure *) |
b151399bd2c3
fixed according to changes in quotient
Christian Urban <urbanc@in.tum.de>
parents:
diff
changeset
|
83 |