author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Wed, 25 Nov 2009 11:41:42 +0100 | |
changeset 379 | 57bde65f6eb2 |
child 381 | 991db758a72d |
permissions | -rw-r--r-- |
379
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
1 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
2 |
text {* tyRel takes a type and builds a relation that a quantifier over this |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
3 |
type needs to respect. *} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
4 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
5 |
fun tyRel ty rty rel lthy = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
6 |
if Sign.typ_instance (ProofContext.theory_of lthy) (ty, rty) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
7 |
then rel |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
8 |
else (case ty of |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
9 |
Type (s, tys) => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
10 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
11 |
val tys_rel = map (fn ty => ty --> ty --> @{typ bool}) tys; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
12 |
val ty_out = ty --> ty --> @{typ bool}; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
13 |
val tys_out = tys_rel ---> ty_out; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
14 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
15 |
(case (maps_lookup (ProofContext.theory_of lthy) s) of |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
16 |
SOME (info) => list_comb (Const (#relfun info, tys_out), |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
17 |
map (fn ty => tyRel ty rty rel lthy) tys) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
18 |
| NONE => HOLogic.eq_const ty |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
19 |
) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
20 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
21 |
| _ => HOLogic.eq_const ty) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
22 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
23 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
24 |
(* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
25 |
ML {* cterm_of @{theory} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
26 |
(tyRel @{typ "'a \<Rightarrow> 'a list \<Rightarrow> 't \<Rightarrow> 't"} (Logic.varifyT @{typ "'a list"}) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
27 |
@{term "f::('a list \<Rightarrow> 'a list \<Rightarrow> bool)"} @{context}) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
28 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
29 |
*) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
30 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
31 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
32 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
33 |
fun mk_babs ty ty' = Const (@{const_name "Babs"}, [ty' --> @{typ bool}, ty] ---> ty) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
34 |
fun mk_ball ty = Const (@{const_name "Ball"}, [ty, ty] ---> @{typ bool}) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
35 |
fun mk_bex ty = Const (@{const_name "Bex"}, [ty, ty] ---> @{typ bool}) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
36 |
fun mk_resp ty = Const (@{const_name Respects}, [[ty, ty] ---> @{typ bool}, ty] ---> @{typ bool}) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
37 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
38 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
39 |
(* applies f to the subterm of an abstractions, otherwise to the given term *) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
40 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
41 |
fun apply_subt f trm = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
42 |
case trm of |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
43 |
Abs (x, T, t) => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
44 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
45 |
val (x', t') = Term.dest_abs (x, T, t) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
46 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
47 |
Term.absfree (x', T, f t') |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
48 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
49 |
| _ => f trm |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
50 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
51 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
52 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
53 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
54 |
(* FIXME: if there are more than one quotient, then you have to look up the relation *) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
55 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
56 |
fun my_reg lthy rel rty trm = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
57 |
case trm of |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
58 |
Abs (x, T, t) => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
59 |
if (needs_lift rty T) then |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
60 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
61 |
val rrel = tyRel T rty rel lthy |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
62 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
63 |
(mk_babs (fastype_of trm) T) $ (mk_resp T $ rrel) $ (apply_subt (my_reg lthy rel rty) trm) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
64 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
65 |
else |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
66 |
Abs(x, T, (apply_subt (my_reg lthy rel rty) t)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
67 |
| Const (@{const_name "All"}, ty) $ (t as Abs (x, T, _)) => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
68 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
69 |
val ty1 = domain_type ty |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
70 |
val ty2 = domain_type ty1 |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
71 |
val rrel = tyRel T rty rel lthy |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
72 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
73 |
if (needs_lift rty T) then |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
74 |
(mk_ball ty1) $ (mk_resp ty2 $ rrel) $ (apply_subt (my_reg lthy rel rty) t) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
75 |
else |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
76 |
Const (@{const_name "All"}, ty) $ apply_subt (my_reg lthy rel rty) t |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
77 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
78 |
| Const (@{const_name "Ex"}, ty) $ (t as Abs (x, T, _)) => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
79 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
80 |
val ty1 = domain_type ty |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
81 |
val ty2 = domain_type ty1 |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
82 |
val rrel = tyRel T rty rel lthy |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
83 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
84 |
if (needs_lift rty T) then |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
85 |
(mk_bex ty1) $ (mk_resp ty2 $ rrel) $ (apply_subt (my_reg lthy rel rty) t) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
86 |
else |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
87 |
Const (@{const_name "Ex"}, ty) $ apply_subt (my_reg lthy rel rty) t |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
88 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
89 |
| Const (@{const_name "op ="}, ty) $ t => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
90 |
if needs_lift rty (fastype_of t) then |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
91 |
(tyRel (fastype_of t) rty rel lthy) $ t (* FIXME: t should be regularised too *) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
92 |
else Const (@{const_name "op ="}, ty) $ (my_reg lthy rel rty t) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
93 |
| t1 $ t2 => (my_reg lthy rel rty t1) $ (my_reg lthy rel rty t2) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
94 |
| _ => trm |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
95 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
96 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
97 |
(* For polymorphic types we need to find the type of the Relation term. *) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
98 |
(* TODO: we assume that the relation is a Constant. Is this always true? *) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
99 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
100 |
fun my_reg_inst lthy rel rty trm = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
101 |
case rel of |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
102 |
Const (n, _) => Syntax.check_term lthy |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
103 |
(my_reg lthy (Const (n, dummyT)) (Logic.varifyT rty) trm) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
104 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
105 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
106 |
(* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
107 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
108 |
val r = Free ("R", dummyT); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
109 |
val t = (my_reg_inst @{context} r @{typ "'a list"} @{term "\<forall>(x::'b list). P x"}); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
110 |
val t2 = Syntax.check_term @{context} t; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
111 |
cterm_of @{theory} t2 |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
112 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
113 |
*) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
114 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
115 |
text {* Assumes that the given theorem is atomized *} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
116 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
117 |
fun build_regularize_goal thm rty rel lthy = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
118 |
Logic.mk_implies |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
119 |
((prop_of thm), |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
120 |
(my_reg_inst lthy rel rty (prop_of thm))) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
121 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
122 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
123 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
124 |
fun regularize thm rty rel rel_eqv rel_refl lthy = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
125 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
126 |
val goal = build_regularize_goal thm rty rel lthy; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
127 |
fun tac ctxt = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
128 |
(ObjectLogic.full_atomize_tac) THEN' |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
129 |
REPEAT_ALL_NEW (FIRST' [ |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
130 |
rtac rel_refl, |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
131 |
atac, |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
132 |
rtac @{thm universal_twice}, |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
133 |
(rtac @{thm impI} THEN' atac), |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
134 |
rtac @{thm implication_twice}, |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
135 |
EqSubst.eqsubst_tac ctxt [0] |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
136 |
[(@{thm equiv_res_forall} OF [rel_eqv]), |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
137 |
(@{thm equiv_res_exists} OF [rel_eqv])], |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
138 |
(* For a = b \<longrightarrow> a \<approx> b *) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
139 |
(rtac @{thm impI} THEN' (asm_full_simp_tac HOL_ss) THEN' rtac rel_refl), |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
140 |
(rtac @{thm RIGHT_RES_FORALL_REGULAR}) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
141 |
]); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
142 |
val cthm = Goal.prove lthy [] [] goal |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
143 |
(fn {context, ...} => tac context 1); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
144 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
145 |
cthm OF [thm] |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
146 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
147 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
148 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
149 |
(*consts Rl :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool" |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
150 |
axioms Rl_eq: "EQUIV Rl" |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
151 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
152 |
quotient ql = "'a list" / "Rl" |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
153 |
by (rule Rl_eq) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
154 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
155 |
ctyp_of @{theory} (exchange_ty @{context} (Logic.varifyT @{typ "'a list"}) (Logic.varifyT @{typ "'a ql"}) @{typ "nat list \<Rightarrow> (nat \<times> nat) list"}); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
156 |
ctyp_of @{theory} (exchange_ty @{context} (Logic.varifyT @{typ "nat \<times> nat"}) (Logic.varifyT @{typ "int"}) @{typ "nat list \<Rightarrow> (nat \<times> nat) list"}) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
157 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
158 |
*) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
159 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
160 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
161 |
(* returns all subterms where two types differ *) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
162 |
fun diff (T, S) Ds = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
163 |
case (T, S) of |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
164 |
(TVar v, TVar u) => if v = u then Ds else (T, S)::Ds |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
165 |
| (TFree x, TFree y) => if x = y then Ds else (T, S)::Ds |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
166 |
| (Type (a, Ts), Type (b, Us)) => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
167 |
if a = b then diffs (Ts, Us) Ds else (T, S)::Ds |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
168 |
| _ => (T, S)::Ds |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
169 |
and diffs (T::Ts, U::Us) Ds = diffs (Ts, Us) (diff (T, U) Ds) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
170 |
| diffs ([], []) Ds = Ds |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
171 |
| diffs _ _ = error "Unequal length of type arguments" |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
172 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
173 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
174 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
175 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
176 |
fun build_repabs_term lthy thm consts rty qty = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
177 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
178 |
(* TODO: The rty and qty stored in the quotient_info should |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
179 |
be varified, so this will soon not be needed *) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
180 |
val rty = Logic.varifyT rty; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
181 |
val qty = Logic.varifyT qty; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
182 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
183 |
fun mk_abs tm = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
184 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
185 |
val ty = fastype_of tm |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
186 |
in Syntax.check_term lthy ((get_fun_OLD absF (rty, qty) lthy ty) $ tm) end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
187 |
fun mk_repabs tm = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
188 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
189 |
val ty = fastype_of tm |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
190 |
in Syntax.check_term lthy ((get_fun_OLD repF (rty, qty) lthy ty) $ (mk_abs tm)) end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
191 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
192 |
fun is_lifted_const (Const (x, _)) = member (op =) consts x |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
193 |
| is_lifted_const _ = false; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
194 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
195 |
fun build_aux lthy tm = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
196 |
case tm of |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
197 |
Abs (a as (_, vty, _)) => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
198 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
199 |
val (vs, t) = Term.dest_abs a; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
200 |
val v = Free(vs, vty); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
201 |
val t' = lambda v (build_aux lthy t) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
202 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
203 |
if (not (needs_lift rty (fastype_of tm))) then t' |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
204 |
else mk_repabs ( |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
205 |
if not (needs_lift rty vty) then t' |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
206 |
else |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
207 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
208 |
val v' = mk_repabs v; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
209 |
(* TODO: I believe 'beta' is not needed any more *) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
210 |
val t1 = (* Envir.beta_norm *) (t' $ v') |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
211 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
212 |
lambda v t1 |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
213 |
end) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
214 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
215 |
| x => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
216 |
case Term.strip_comb tm of |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
217 |
(Const(@{const_name Respects}, _), _) => tm |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
218 |
| (opp, tms0) => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
219 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
220 |
val tms = map (build_aux lthy) tms0 |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
221 |
val ty = fastype_of tm |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
222 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
223 |
if (is_lifted_const opp andalso needs_lift rty ty) then |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
224 |
mk_repabs (list_comb (opp, tms)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
225 |
else if ((Term.is_Free opp) andalso (length tms > 0) andalso (needs_lift rty ty)) then |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
226 |
mk_repabs (list_comb (opp, tms)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
227 |
else if tms = [] then opp |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
228 |
else list_comb(opp, tms) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
229 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
230 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
231 |
repeat_eqsubst_prop lthy @{thms id_def_sym} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
232 |
(build_aux lthy (Thm.prop_of thm)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
233 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
234 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
235 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
236 |
text {* Builds provable goals for regularized theorems *} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
237 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
238 |
fun build_repabs_goal ctxt thm cons rty qty = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
239 |
Logic.mk_equals ((Thm.prop_of thm), (build_repabs_term ctxt thm cons rty qty)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
240 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
241 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
242 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
243 |
fun repabs lthy thm consts rty qty quot_thm reflex_thm trans_thm rsp_thms = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
244 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
245 |
val rt = build_repabs_term lthy thm consts rty qty; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
246 |
val rg = Logic.mk_equals ((Thm.prop_of thm), rt); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
247 |
fun tac ctxt = (ObjectLogic.full_atomize_tac) THEN' |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
248 |
(REPEAT_ALL_NEW (r_mk_comb_tac ctxt rty quot_thm reflex_thm trans_thm rsp_thms)); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
249 |
val cthm = Goal.prove lthy [] [] rg (fn x => tac (#context x) 1); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
250 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
251 |
@{thm Pure.equal_elim_rule1} OF [cthm, thm] |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
252 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
253 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
254 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
255 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
256 |
(* TODO: Check if it behaves properly with varifyed rty *) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
257 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
258 |
fun findabs_all rty tm = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
259 |
case tm of |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
260 |
Abs(_, T, b) => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
261 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
262 |
val b' = subst_bound ((Free ("x", T)), b); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
263 |
val tys = findabs_all rty b' |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
264 |
val ty = fastype_of tm |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
265 |
in if needs_lift rty ty then (ty :: tys) else tys |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
266 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
267 |
| f $ a => (findabs_all rty f) @ (findabs_all rty a) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
268 |
| _ => []; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
269 |
fun findabs rty tm = distinct (op =) (findabs_all rty tm) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
270 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
271 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
272 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
273 |
(* Currently useful only for LAMBDA_PRS *) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
274 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
275 |
fun make_simp_prs_thm lthy quot_thm thm typ = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
276 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
277 |
val (_, [lty, rty]) = dest_Type typ; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
278 |
val thy = ProofContext.theory_of lthy; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
279 |
val (lcty, rcty) = (ctyp_of thy lty, ctyp_of thy rty) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
280 |
val inst = [SOME lcty, NONE, SOME rcty]; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
281 |
val lpi = Drule.instantiate' inst [] thm; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
282 |
val tac = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
283 |
(compose_tac (false, lpi, 2)) THEN_ALL_NEW |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
284 |
(quotient_tac quot_thm); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
285 |
val gc = Drule.strip_imp_concl (cprop_of lpi); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
286 |
val t = Goal.prove_internal [] gc (fn _ => tac 1) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
287 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
288 |
MetaSimplifier.rewrite_rule [@{thm eq_reflection} OF @{thms id_apply}] t |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
289 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
290 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
291 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
292 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
293 |
fun findallex_all rty qty tm = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
294 |
case tm of |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
295 |
Const (@{const_name All}, T) $ (s as (Abs(_, _, b))) => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
296 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
297 |
val (tya, tye) = findallex_all rty qty s |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
298 |
in if needs_lift rty T then |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
299 |
((T :: tya), tye) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
300 |
else (tya, tye) end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
301 |
| Const (@{const_name Ex}, T) $ (s as (Abs(_, _, b))) => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
302 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
303 |
val (tya, tye) = findallex_all rty qty s |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
304 |
in if needs_lift rty T then |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
305 |
(tya, (T :: tye)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
306 |
else (tya, tye) end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
307 |
| Abs(_, T, b) => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
308 |
findallex_all rty qty (subst_bound ((Free ("x", T)), b)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
309 |
| f $ a => |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
310 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
311 |
val (a1, e1) = findallex_all rty qty f; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
312 |
val (a2, e2) = findallex_all rty qty a; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
313 |
in (a1 @ a2, e1 @ e2) end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
314 |
| _ => ([], []); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
315 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
316 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
317 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
318 |
fun findallex lthy rty qty tm = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
319 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
320 |
val (a, e) = findallex_all rty qty tm; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
321 |
val (ad, ed) = (map domain_type a, map domain_type e); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
322 |
val (au, eu) = (distinct (op =) ad, distinct (op =) ed); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
323 |
val (rty, qty) = (Logic.varifyT rty, Logic.varifyT qty) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
324 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
325 |
(map (exchange_ty lthy rty qty) au, map (exchange_ty lthy rty qty) eu) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
326 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
327 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
328 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
329 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
330 |
fun make_allex_prs_thm lthy quot_thm thm typ = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
331 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
332 |
val (_, [lty, rty]) = dest_Type typ; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
333 |
val thy = ProofContext.theory_of lthy; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
334 |
val (lcty, rcty) = (ctyp_of thy lty, ctyp_of thy rty) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
335 |
val inst = [NONE, SOME lcty]; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
336 |
val lpi = Drule.instantiate' inst [] thm; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
337 |
val tac = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
338 |
(compose_tac (false, lpi, 1)) THEN_ALL_NEW |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
339 |
(quotient_tac quot_thm); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
340 |
val gc = Drule.strip_imp_concl (cprop_of lpi); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
341 |
val t = Goal.prove_internal [] gc (fn _ => tac 1) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
342 |
val t_noid = MetaSimplifier.rewrite_rule |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
343 |
[@{thm eq_reflection} OF @{thms id_apply}] t; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
344 |
val t_sym = @{thm "HOL.sym"} OF [t_noid]; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
345 |
val t_eq = @{thm "eq_reflection"} OF [t_sym] |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
346 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
347 |
t_eq |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
348 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
349 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
350 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
351 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
352 |
fun lift_thm lthy qty qty_name rsp_thms defs rthm = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
353 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
354 |
val _ = tracing ("raw theorem:\n" ^ Syntax.string_of_term lthy (prop_of rthm)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
355 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
356 |
val (rty, rel, rel_refl, rel_eqv) = lookup_quot_data lthy qty; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
357 |
val (trans2, reps_same, absrep, quot) = lookup_quot_thms lthy qty_name; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
358 |
val consts = lookup_quot_consts defs; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
359 |
val t_a = atomize_thm rthm; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
360 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
361 |
val _ = tracing ("raw atomized theorem:\n" ^ Syntax.string_of_term lthy (prop_of t_a)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
362 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
363 |
val t_r = regularize t_a rty rel rel_eqv rel_refl lthy; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
364 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
365 |
val _ = tracing ("regularised theorem:\n" ^ Syntax.string_of_term lthy (prop_of t_r)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
366 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
367 |
val t_t = repabs lthy t_r consts rty qty quot rel_refl trans2 rsp_thms; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
368 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
369 |
val _ = tracing ("rep/abs injected theorem:\n" ^ Syntax.string_of_term lthy (prop_of t_t)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
370 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
371 |
val (alls, exs) = findallex lthy rty qty (prop_of t_a); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
372 |
val allthms = map (make_allex_prs_thm lthy quot @{thm FORALL_PRS}) alls |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
373 |
val exthms = map (make_allex_prs_thm lthy quot @{thm EXISTS_PRS}) exs |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
374 |
val t_a = MetaSimplifier.rewrite_rule (allthms @ exthms) t_t |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
375 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
376 |
val _ = tracing ("??:\n" ^ Syntax.string_of_term lthy (prop_of t_a)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
377 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
378 |
val abs = findabs rty (prop_of t_a); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
379 |
val aps = findaps rty (prop_of t_a); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
380 |
val app_prs_thms = map (applic_prs lthy rty qty absrep) aps; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
381 |
val lam_prs_thms = map (make_simp_prs_thm lthy quot @{thm LAMBDA_PRS}) abs; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
382 |
val t_l = repeat_eqsubst_thm lthy (lam_prs_thms @ app_prs_thms) t_a; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
383 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
384 |
val _ = tracing ("??:\n" ^ Syntax.string_of_term lthy (prop_of t_l)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
385 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
386 |
val defs_sym = flat (map (add_lower_defs lthy) defs); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
387 |
val defs_sym_eq = map (fn x => eq_reflection OF [x]) defs_sym; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
388 |
val t_id = simp_ids lthy t_l; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
389 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
390 |
val _ = tracing ("??:\n" ^ Syntax.string_of_term lthy (prop_of t_id)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
391 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
392 |
val t_d0 = MetaSimplifier.rewrite_rule defs_sym_eq t_id; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
393 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
394 |
val _ = tracing ("??:\n" ^ Syntax.string_of_term lthy (prop_of t_d0)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
395 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
396 |
val t_d = repeat_eqsubst_thm lthy defs_sym t_d0; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
397 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
398 |
val _ = tracing ("??:\n" ^ Syntax.string_of_term lthy (prop_of t_d)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
399 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
400 |
val t_r = MetaSimplifier.rewrite_rule [reps_same] t_d; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
401 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
402 |
val _ = tracing ("??:\n" ^ Syntax.string_of_term lthy (prop_of t_r)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
403 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
404 |
val t_rv = ObjectLogic.rulify t_r |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
405 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
406 |
val _ = tracing ("lifted theorem:\n" ^ Syntax.string_of_term lthy (prop_of t_rv)) |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
407 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
408 |
Thm.varifyT t_rv |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
409 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
410 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
411 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
412 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
413 |
fun lift_thm_note qty qty_name rsp_thms defs thm name lthy = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
414 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
415 |
val lifted_thm = lift_thm lthy qty qty_name rsp_thms defs thm; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
416 |
val (_, lthy2) = note (name, lifted_thm) lthy; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
417 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
418 |
lthy2 |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
419 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
420 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
421 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
422 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
423 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
424 |
fun regularize_goal lthy thm rel_eqv rel_refl qtrm = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
425 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
426 |
val reg_trm = mk_REGULARIZE_goal lthy (prop_of thm) qtrm; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
427 |
fun tac lthy = regularize_tac lthy rel_eqv rel_refl; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
428 |
val cthm = Goal.prove lthy [] [] reg_trm |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
429 |
(fn {context, ...} => tac context 1); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
430 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
431 |
cthm OF [thm] |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
432 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
433 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
434 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
435 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
436 |
fun repabs_goal lthy thm rty quot_thm reflex_thm trans_thm rsp_thms qtrm = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
437 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
438 |
val rg = Syntax.check_term lthy (mk_inj_REPABS_goal lthy ((prop_of thm), qtrm)); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
439 |
fun tac ctxt = (ObjectLogic.full_atomize_tac) THEN' |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
440 |
(REPEAT_ALL_NEW (r_mk_comb_tac ctxt rty quot_thm reflex_thm trans_thm rsp_thms)); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
441 |
val cthm = Goal.prove lthy [] [] rg (fn x => tac (#context x) 1); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
442 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
443 |
@{thm Pure.equal_elim_rule1} OF [cthm, thm] |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
444 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
445 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
446 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
447 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
448 |
fun lift_thm_goal lthy qty qty_name rsp_thms defs rthm goal = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
449 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
450 |
val (rty, rel, rel_refl, rel_eqv) = lookup_quot_data lthy qty; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
451 |
val (trans2, reps_same, absrep, quot) = lookup_quot_thms lthy qty_name; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
452 |
val t_a = atomize_thm rthm; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
453 |
val goal_a = atomize_goal (ProofContext.theory_of lthy) goal; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
454 |
val t_r = regularize_goal lthy t_a rel_eqv rel_refl goal_a; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
455 |
val t_t = repabs_goal lthy t_r rty quot rel_refl trans2 rsp_thms goal_a; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
456 |
val (alls, exs) = findallex lthy rty qty (prop_of t_a); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
457 |
val allthms = map (make_allex_prs_thm lthy quot @{thm FORALL_PRS}) alls |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
458 |
val exthms = map (make_allex_prs_thm lthy quot @{thm EXISTS_PRS}) exs |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
459 |
val t_a = MetaSimplifier.rewrite_rule (allthms @ exthms) t_t |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
460 |
val abs = findabs rty (prop_of t_a); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
461 |
val aps = findaps rty (prop_of t_a); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
462 |
val app_prs_thms = map (applic_prs lthy rty qty absrep) aps; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
463 |
val lam_prs_thms = map (make_simp_prs_thm lthy quot @{thm LAMBDA_PRS}) abs; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
464 |
val t_l = repeat_eqsubst_thm lthy (lam_prs_thms @ app_prs_thms) t_a; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
465 |
val defs_sym = flat (map (add_lower_defs lthy) defs); |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
466 |
val defs_sym_eq = map (fn x => eq_reflection OF [x]) defs_sym; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
467 |
val t_id = simp_ids lthy t_l; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
468 |
val t_d0 = MetaSimplifier.rewrite_rule defs_sym_eq t_id; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
469 |
val t_d = repeat_eqsubst_thm lthy defs_sym t_d0; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
470 |
val t_r = MetaSimplifier.rewrite_rule [reps_same] t_d; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
471 |
val t_rv = ObjectLogic.rulify t_r |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
472 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
473 |
Thm.varifyT t_rv |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
474 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
475 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
476 |
|
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
477 |
ML {* |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
478 |
fun lift_thm_goal_note lthy qty qty_name rsp_thms defs thm name goal = |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
479 |
let |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
480 |
val lifted_thm = lift_thm_goal lthy qty qty_name rsp_thms defs thm goal; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
481 |
val (_, lthy2) = note (name, lifted_thm) lthy; |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
482 |
in |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
483 |
lthy2 |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
484 |
end |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
485 |
*} |
57bde65f6eb2
Removed unused things from QuotMain.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
486 |