author | Cezary Kaliszyk <kaliszyk@in.tum.de> |
Tue, 26 Jan 2010 13:53:56 +0100 | |
changeset 941 | 2c72447cdc0c |
parent 912 | aa960d16570f |
permissions | -rw-r--r-- |
226 | 1 |
(*notation ( output) "prop" ("#_" [1000] 1000) *) |
2 |
notation ( output) "Trueprop" ("#_" [1000] 1000) |
|
101
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
3 |
|
806
43336511993f
Readded 'regularize_to_injection' which I believe will be needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
685
diff
changeset
|
4 |
lemma regularize_to_injection: |
43336511993f
Readded 'regularize_to_injection' which I believe will be needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
685
diff
changeset
|
5 |
shows "(QUOT_TRUE l \<Longrightarrow> y) \<Longrightarrow> (l = r) \<longrightarrow> y" |
43336511993f
Readded 'regularize_to_injection' which I believe will be needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
685
diff
changeset
|
6 |
by(auto simp add: QUOT_TRUE_def) |
43336511993f
Readded 'regularize_to_injection' which I believe will be needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
685
diff
changeset
|
7 |
|
912
aa960d16570f
Lifted Peter's Sigma lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
870
diff
changeset
|
8 |
syntax |
aa960d16570f
Lifted Peter's Sigma lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
870
diff
changeset
|
9 |
"Bexeq" :: "id \<Rightarrow> ('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool" ("(3\<exists>!!_\<in>_./ _)" [0, 0, 10] 10) |
aa960d16570f
Lifted Peter's Sigma lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
870
diff
changeset
|
10 |
translations |
aa960d16570f
Lifted Peter's Sigma lemma with Ex1.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
870
diff
changeset
|
11 |
"\<exists>!!x\<in>A. P" == "Bexeq A (%x. P)" |
806
43336511993f
Readded 'regularize_to_injection' which I believe will be needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
685
diff
changeset
|
12 |
|
43336511993f
Readded 'regularize_to_injection' which I believe will be needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
685
diff
changeset
|
13 |
|
870
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
14 |
(* Atomize infrastructure *) |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
15 |
(* FIXME/TODO: is this really needed? *) |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
16 |
(* |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
17 |
lemma atomize_eqv: |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
18 |
shows "(Trueprop A \<equiv> Trueprop B) \<equiv> (A \<equiv> B)" |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
19 |
proof |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
20 |
assume "A \<equiv> B" |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
21 |
then show "Trueprop A \<equiv> Trueprop B" by unfold |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
22 |
next |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
23 |
assume *: "Trueprop A \<equiv> Trueprop B" |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
24 |
have "A = B" |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
25 |
proof (cases A) |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
26 |
case True |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
27 |
have "A" by fact |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
28 |
then show "A = B" using * by simp |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
29 |
next |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
30 |
case False |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
31 |
have "\<not>A" by fact |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
32 |
then show "A = B" using * by auto |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
33 |
qed |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
34 |
then show "A \<equiv> B" by (rule eq_reflection) |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
35 |
qed |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
36 |
*) |
2a19e0a37131
Remove SOLVED from quotient_tac. Move atomize_eqv to 'Unused'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
806
diff
changeset
|
37 |
|
806
43336511993f
Readded 'regularize_to_injection' which I believe will be needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
685
diff
changeset
|
38 |
|
101
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
39 |
ML {* |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
40 |
fun dest_cbinop t = |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
41 |
let |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
42 |
val (t2, rhs) = Thm.dest_comb t; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
43 |
val (bop, lhs) = Thm.dest_comb t2; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
44 |
in |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
45 |
(bop, (lhs, rhs)) |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
46 |
end |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
47 |
*} |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
48 |
|
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
49 |
ML {* |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
50 |
fun dest_ceq t = |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
51 |
let |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
52 |
val (bop, pair) = dest_cbinop t; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
53 |
val (bop_s, _) = Term.dest_Const (Thm.term_of bop); |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
54 |
in |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
55 |
if bop_s = "op =" then pair else (raise CTERM ("Not an equality", [t])) |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
56 |
end |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
57 |
*} |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
58 |
|
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
59 |
ML {* |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
60 |
fun split_binop_conv t = |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
61 |
let |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
62 |
val (lhs, rhs) = dest_ceq t; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
63 |
val (bop, _) = dest_cbinop lhs; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
64 |
val [clT, cr2] = bop |> Thm.ctyp_of_term |> Thm.dest_ctyp; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
65 |
val [cmT, crT] = Thm.dest_ctyp cr2; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
66 |
in |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
67 |
Drule.instantiate' [SOME clT, SOME cmT, SOME crT] [NONE, NONE, NONE, NONE, SOME bop] @{thm arg_cong2} |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
68 |
end |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
69 |
*} |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
70 |
|
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
71 |
|
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
72 |
ML {* |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
73 |
fun split_arg_conv t = |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
74 |
let |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
75 |
val (lhs, rhs) = dest_ceq t; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
76 |
val (lop, larg) = Thm.dest_comb lhs; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
77 |
val [caT, crT] = lop |> Thm.ctyp_of_term |> Thm.dest_ctyp; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
78 |
in |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
79 |
Drule.instantiate' [SOME caT, SOME crT] [NONE, NONE, SOME lop] @{thm arg_cong} |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
80 |
end |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
81 |
*} |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
82 |
|
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
83 |
ML {* |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
84 |
fun split_binop_tac n thm = |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
85 |
let |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
86 |
val concl = Thm.cprem_of thm n; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
87 |
val (_, cconcl) = Thm.dest_comb concl; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
88 |
val rewr = split_binop_conv cconcl; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
89 |
in |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
90 |
rtac rewr n thm |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
91 |
end |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
92 |
handle CTERM _ => Seq.empty |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
93 |
*} |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
94 |
|
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
95 |
|
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
96 |
ML {* |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
97 |
fun split_arg_tac n thm = |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
98 |
let |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
99 |
val concl = Thm.cprem_of thm n; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
100 |
val (_, cconcl) = Thm.dest_comb concl; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
101 |
val rewr = split_arg_conv cconcl; |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
102 |
in |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
103 |
rtac rewr n thm |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
104 |
end |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
105 |
handle CTERM _ => Seq.empty |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
106 |
*} |
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
107 |
|
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
108 |
|
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
109 |
lemma trueprop_cong: |
303
991b0e53f9dc
More code cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
301
diff
changeset
|
110 |
shows "(a \<equiv> b) \<Longrightarrow> (Trueprop a \<equiv> Trueprop b)" |
101
4f93c5a026d2
Reordering the code, part 3
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff
changeset
|
111 |
by auto |
226 | 112 |
|
113 |
lemma list_induct_hol4: |
|
303
991b0e53f9dc
More code cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
301
diff
changeset
|
114 |
fixes P :: "'a list \<Rightarrow> bool" |
991b0e53f9dc
More code cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
301
diff
changeset
|
115 |
assumes a: "((P []) \<and> (\<forall>t. (P t) \<longrightarrow> (\<forall>h. (P (h # t)))))" |
991b0e53f9dc
More code cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
301
diff
changeset
|
116 |
shows "\<forall>l. (P l)" |
226 | 117 |
using a |
118 |
apply (rule_tac allI) |
|
119 |
apply (induct_tac "l") |
|
120 |
apply (simp) |
|
121 |
apply (metis) |
|
122 |
done |
|
123 |
||
301
40bb0c4718a6
Cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
226
diff
changeset
|
124 |
ML {* |
40bb0c4718a6
Cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
226
diff
changeset
|
125 |
val no_vars = Thm.rule_attribute (fn context => fn th => |
40bb0c4718a6
Cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
226
diff
changeset
|
126 |
let |
40bb0c4718a6
Cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
226
diff
changeset
|
127 |
val ctxt = Variable.set_body false (Context.proof_of context); |
40bb0c4718a6
Cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
226
diff
changeset
|
128 |
val ((_, [th']), _) = Variable.import true [th] ctxt; |
40bb0c4718a6
Cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
226
diff
changeset
|
129 |
in th' end); |
40bb0c4718a6
Cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
226
diff
changeset
|
130 |
*} |
303
991b0e53f9dc
More code cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
301
diff
changeset
|
131 |
|
991b0e53f9dc
More code cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
301
diff
changeset
|
132 |
(*lemma equality_twice: |
991b0e53f9dc
More code cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
301
diff
changeset
|
133 |
"a = c \<Longrightarrow> b = d \<Longrightarrow> (a = b \<longrightarrow> c = d)" |
991b0e53f9dc
More code cleaning and commenting
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
301
diff
changeset
|
134 |
by auto*) |
685
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
135 |
|
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
136 |
|
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
137 |
(*interpretation code *) |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
138 |
(*val bindd = ((Binding.make ("", Position.none)), ([]: Attrib.src list)) |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
139 |
val ((_, [eqn1pre]), lthy5) = Variable.import true [ABS_def] lthy4; |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
140 |
val eqn1i = Thm.prop_of (symmetric eqn1pre) |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
141 |
val ((_, [eqn2pre]), lthy6) = Variable.import true [REP_def] lthy5; |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
142 |
val eqn2i = Thm.prop_of (symmetric eqn2pre) |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
143 |
|
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
144 |
val exp_morphism = ProofContext.export_morphism lthy6 (ProofContext.init (ProofContext.theory_of lthy6)); |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
145 |
val exp_term = Morphism.term exp_morphism; |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
146 |
val exp = Morphism.thm exp_morphism; |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
147 |
|
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
148 |
val mthd = Method.SIMPLE_METHOD ((rtac quot_thm 1) THEN |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
149 |
ALLGOALS (simp_tac (HOL_basic_ss addsimps [(symmetric (exp ABS_def)), (symmetric (exp REP_def))]))) |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
150 |
val mthdt = Method.Basic (fn _ => mthd) |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
151 |
val bymt = Proof.global_terminal_proof (mthdt, NONE) |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
152 |
val exp_i = [(@{const_name QUOT_TYPE}, ((("QUOT_TYPE_I_" ^ (Binding.name_of qty_name)), true), |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
153 |
Expression.Named [("R", rel), ("Abs", abs), ("Rep", rep) ]))]*) |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
154 |
|
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
155 |
(*||> Local_Theory.theory (fn thy => |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
156 |
let |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
157 |
val global_eqns = map exp_term [eqn2i, eqn1i]; |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
158 |
(* Not sure if the following context should not be used *) |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
159 |
val (global_eqns2, lthy7) = Variable.import_terms true global_eqns lthy6; |
b12f0321dfb0
moved the interpretation code into Unused.thy
Christian Urban <urbanc@in.tum.de>
parents:
303
diff
changeset
|
160 |
val global_eqns3 = map (fn t => (bindd, t)) global_eqns2; |
806
43336511993f
Readded 'regularize_to_injection' which I believe will be needed.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
685
diff
changeset
|
161 |
in ProofContext.theory_of (bymt (Expression.interpretation (exp_i, []) global_eqns3 thy)) end)*) |