author | Christian Urban <urbanc@in.tum.de> |
Mon, 06 Dec 2010 14:24:17 +0000 | |
changeset 2593 | 25dcb2b1329e |
parent 2571 | f0252365936c |
child 2594 | 515e5496171c |
permissions | -rw-r--r-- |
2448 | 1 |
(* Title: nominal_dt_alpha.ML |
2 |
Author: Christian Urban |
|
3 |
Author: Cezary Kaliszyk |
|
4 |
||
5 |
Deriving support propoerties for the quotient types. |
|
6 |
*) |
|
7 |
||
8 |
signature NOMINAL_DT_SUPP = |
|
9 |
sig |
|
10 |
val prove_supports: Proof.context -> thm list -> term list -> thm list |
|
2450
217ef3e4282e
added proofs for fsupp properties
Christian Urban <urbanc@in.tum.de>
parents:
2449
diff
changeset
|
11 |
val prove_fsupp: Proof.context -> typ list -> thm -> thm list -> thm list |
2451
d2e929f51fa9
added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents:
2450
diff
changeset
|
12 |
|
d2e929f51fa9
added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents:
2450
diff
changeset
|
13 |
val fs_instance: typ list -> string list -> (string * sort) list -> thm list -> |
d2e929f51fa9
added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents:
2450
diff
changeset
|
14 |
local_theory -> local_theory |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
15 |
|
2483 | 16 |
val prove_fv_supp: typ list -> term list -> term list -> term list -> term list -> thm list -> |
2481
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
17 |
thm list -> thm list -> thm list -> thm -> bclause list list -> Proof.context -> thm list |
2571
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
18 |
|
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
19 |
val prove_bns_finite: typ list -> term list -> thm -> thm list -> Proof.context -> thm list |
2593
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
20 |
val prove_perm_bn_alpha_thms: typ list -> term list -> term list -> thm -> thm list -> thm list -> |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
21 |
Proof.context -> thm list |
2448 | 22 |
end |
23 |
||
24 |
structure Nominal_Dt_Supp: NOMINAL_DT_SUPP = |
|
25 |
struct |
|
26 |
||
2450
217ef3e4282e
added proofs for fsupp properties
Christian Urban <urbanc@in.tum.de>
parents:
2449
diff
changeset
|
27 |
(* supports lemmas for constructors *) |
2448 | 28 |
|
29 |
fun mk_supports_goal ctxt qtrm = |
|
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
30 |
let |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
31 |
val vs = fresh_args ctxt qtrm |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
32 |
val rhs = list_comb (qtrm, vs) |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
33 |
val lhs = fold (curry HOLogic.mk_prod) vs @{term "()"} |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
34 |
|> mk_supp |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
35 |
in |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
36 |
mk_supports lhs rhs |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
37 |
|> HOLogic.mk_Trueprop |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
38 |
end |
2448 | 39 |
|
40 |
fun supports_tac ctxt perm_simps = |
|
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
41 |
let |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
42 |
val ss1 = HOL_basic_ss addsimps @{thms supports_def fresh_def[symmetric]} |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
43 |
val ss2 = HOL_ss addsimps @{thms swap_fresh_fresh fresh_Pair} |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
44 |
in |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
45 |
EVERY' [ simp_tac ss1, |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
46 |
Nominal_Permeq.eqvt_strict_tac ctxt perm_simps [], |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
47 |
simp_tac ss2 ] |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
48 |
end |
2448 | 49 |
|
50 |
fun prove_supports_single ctxt perm_simps qtrm = |
|
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
51 |
let |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
52 |
val goal = mk_supports_goal ctxt qtrm |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
53 |
val ctxt' = Variable.auto_fixes goal ctxt |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
54 |
in |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
55 |
Goal.prove ctxt' [] [] goal |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
56 |
(K (HEADGOAL (supports_tac ctxt perm_simps))) |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
57 |
|> singleton (ProofContext.export ctxt' ctxt) |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
58 |
end |
2448 | 59 |
|
60 |
fun prove_supports ctxt perm_simps qtrms = |
|
61 |
map (prove_supports_single ctxt perm_simps) qtrms |
|
62 |
||
63 |
||
2450
217ef3e4282e
added proofs for fsupp properties
Christian Urban <urbanc@in.tum.de>
parents:
2449
diff
changeset
|
64 |
(* finite supp lemmas for qtypes *) |
2448 | 65 |
|
2450
217ef3e4282e
added proofs for fsupp properties
Christian Urban <urbanc@in.tum.de>
parents:
2449
diff
changeset
|
66 |
fun prove_fsupp ctxt qtys qinduct qsupports_thms = |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
67 |
let |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
68 |
val (vs, ctxt') = Variable.variant_fixes (replicate (length qtys) "x") ctxt |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
69 |
val goals = vs ~~ qtys |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
70 |
|> map Free |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
71 |
|> map (mk_finite o mk_supp) |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
72 |
|> foldr1 (HOLogic.mk_conj) |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
73 |
|> HOLogic.mk_Trueprop |
2450
217ef3e4282e
added proofs for fsupp properties
Christian Urban <urbanc@in.tum.de>
parents:
2449
diff
changeset
|
74 |
|
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
75 |
val tac = |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
76 |
EVERY' [ rtac @{thm supports_finite}, |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
77 |
resolve_tac qsupports_thms, |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
78 |
asm_simp_tac (HOL_ss addsimps @{thms finite_supp supp_Pair finite_Un}) ] |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
79 |
in |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
80 |
Goal.prove ctxt' [] [] goals |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
81 |
(K (HEADGOAL (rtac qinduct THEN_ALL_NEW tac))) |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
82 |
|> singleton (ProofContext.export ctxt' ctxt) |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
83 |
|> Datatype_Aux.split_conj_thm |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
84 |
|> map zero_var_indexes |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
85 |
end |
2448 | 86 |
|
2451
d2e929f51fa9
added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents:
2450
diff
changeset
|
87 |
|
d2e929f51fa9
added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents:
2450
diff
changeset
|
88 |
(* finite supp instances *) |
d2e929f51fa9
added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents:
2450
diff
changeset
|
89 |
|
d2e929f51fa9
added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents:
2450
diff
changeset
|
90 |
fun fs_instance qtys qfull_ty_names tvs qfsupp_thms lthy = |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
91 |
let |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
92 |
val lthy1 = |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
93 |
lthy |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
94 |
|> Local_Theory.exit_global |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
95 |
|> Class.instantiation (qfull_ty_names, tvs, @{sort fs}) |
2451
d2e929f51fa9
added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents:
2450
diff
changeset
|
96 |
|
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
97 |
fun tac _ = |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
98 |
Class.intro_classes_tac [] THEN |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
99 |
(ALLGOALS (resolve_tac qfsupp_thms)) |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
100 |
in |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
101 |
lthy1 |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
102 |
|> Class.prove_instantiation_exit tac |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
103 |
|> Named_Target.theory_init |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
104 |
end |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
105 |
|
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
106 |
|
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
107 |
(* proves that fv and fv_bn equals supp *) |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
108 |
|
2481
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
109 |
fun gen_mk_goals fv supp = |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
110 |
let |
2481
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
111 |
val arg_ty = |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
112 |
fastype_of fv |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
113 |
|> domain_type |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
114 |
in |
2481
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
115 |
(arg_ty, fn x => HOLogic.mk_eq (fv $ x, supp x)) |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
116 |
end |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
117 |
|
2481
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
118 |
fun mk_fvs_goals fv = gen_mk_goals fv mk_supp |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
119 |
fun mk_fv_bns_goals fv_bn alpha_bn = gen_mk_goals fv_bn (mk_supp_rel alpha_bn) |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
120 |
|
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
121 |
fun add_ss thms = |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
122 |
HOL_basic_ss addsimps thms |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
123 |
|
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
124 |
fun symmetric thms = |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
125 |
map (fn thm => thm RS @{thm sym}) thms |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
126 |
|
2491
d0961e6d6881
more consistent naming in Abs.thy
Christian Urban <urbanc@in.tum.de>
parents:
2483
diff
changeset
|
127 |
val supp_Abs_set = @{thms supp_Abs(1)[symmetric]} |
d0961e6d6881
more consistent naming in Abs.thy
Christian Urban <urbanc@in.tum.de>
parents:
2483
diff
changeset
|
128 |
val supp_Abs_res = @{thms supp_Abs(2)[symmetric]} |
d0961e6d6881
more consistent naming in Abs.thy
Christian Urban <urbanc@in.tum.de>
parents:
2483
diff
changeset
|
129 |
val supp_Abs_lst = @{thms supp_Abs(3)[symmetric]} |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
130 |
|
2491
d0961e6d6881
more consistent naming in Abs.thy
Christian Urban <urbanc@in.tum.de>
parents:
2483
diff
changeset
|
131 |
fun mk_supp_abs ctxt (BC (Set, _, _)) = EqSubst.eqsubst_tac ctxt [1] supp_Abs_set |
d0961e6d6881
more consistent naming in Abs.thy
Christian Urban <urbanc@in.tum.de>
parents:
2483
diff
changeset
|
132 |
| mk_supp_abs ctxt (BC (Res, _, _)) = EqSubst.eqsubst_tac ctxt [1] supp_Abs_res |
d0961e6d6881
more consistent naming in Abs.thy
Christian Urban <urbanc@in.tum.de>
parents:
2483
diff
changeset
|
133 |
| mk_supp_abs ctxt (BC (Lst, _, _)) = EqSubst.eqsubst_tac ctxt [1] supp_Abs_lst |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
134 |
|
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
135 |
fun mk_supp_abs_tac ctxt [] = [] |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
136 |
| mk_supp_abs_tac ctxt (BC (_, [], _)::xs) = mk_supp_abs_tac ctxt xs |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
137 |
| mk_supp_abs_tac ctxt (bc::xs) = (DETERM o mk_supp_abs ctxt bc)::mk_supp_abs_tac ctxt xs |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
138 |
|
2481
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
139 |
fun mk_bn_supp_abs_tac trm = |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
140 |
trm |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
141 |
|> fastype_of |
2481
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
142 |
|> body_type |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
143 |
|> (fn ty => case ty of |
2491
d0961e6d6881
more consistent naming in Abs.thy
Christian Urban <urbanc@in.tum.de>
parents:
2483
diff
changeset
|
144 |
@{typ "atom set"} => simp_tac (add_ss supp_Abs_set) |
d0961e6d6881
more consistent naming in Abs.thy
Christian Urban <urbanc@in.tum.de>
parents:
2483
diff
changeset
|
145 |
| @{typ "atom list"} => simp_tac (add_ss supp_Abs_lst) |
2481
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
146 |
| _ => raise TERM ("mk_bn_supp_abs_tac", [trm])) |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
147 |
|
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
148 |
|
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
149 |
val thms1 = @{thms supp_Pair supp_eqvt[symmetric] Un_assoc conj_assoc} |
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
150 |
val thms2 = @{thms de_Morgan_conj Collect_disj_eq finite_Un} |
2559
add799cf0817
adapted to changes by Florian on the quotient package and removed local fix for function package
Christian Urban <urbanc@in.tum.de>
parents:
2493
diff
changeset
|
151 |
val thms3 = @{thms alphas prod_alpha_def prod_fv.simps prod_rel_def permute_prod_def |
2571
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
152 |
prod.recs prod.cases prod.inject not_True_eq_False empty_def[symmetric] finite.emptyI} |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
153 |
|
2483 | 154 |
fun prove_fv_supp qtys qtrms fvs fv_bns alpha_bns fv_simps eq_iffs perm_simps |
2481
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
155 |
fv_bn_eqvts qinduct bclausess ctxt = |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
156 |
let |
2481
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
157 |
val goals1 = map mk_fvs_goals fvs |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
158 |
val goals2 = map2 mk_fv_bns_goals fv_bns alpha_bns |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
159 |
|
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
160 |
fun tac ctxt = |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
161 |
SUBGOAL (fn (goal, i) => |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
162 |
let |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
163 |
val (fv_fun, arg) = |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
164 |
goal |> Envir.eta_contract |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
165 |
|> Logic.strip_assums_concl |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
166 |
|> HOLogic.dest_Trueprop |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
167 |
|> fst o HOLogic.dest_eq |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
168 |
|> dest_comb |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
169 |
val supp_abs_tac = |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
170 |
case (AList.lookup (op=) (qtrms ~~ bclausess) (head_of arg)) of |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
171 |
SOME bclauses => EVERY' (mk_supp_abs_tac ctxt bclauses) |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
172 |
| NONE => mk_bn_supp_abs_tac fv_fun |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
173 |
in |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
174 |
EVERY' [ TRY o asm_full_simp_tac (add_ss (@{thm supp_Pair[symmetric]}::fv_simps)), |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
175 |
TRY o supp_abs_tac, |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
176 |
TRY o simp_tac (add_ss @{thms supp_def supp_rel_def}), |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
177 |
TRY o Nominal_Permeq.eqvt_tac ctxt (perm_simps @ fv_bn_eqvts) [], |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
178 |
TRY o simp_tac (add_ss (@{thms Abs_eq_iff} @ eq_iffs)), |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
179 |
TRY o asm_full_simp_tac (add_ss thms3), |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
180 |
TRY o simp_tac (add_ss thms2), |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
181 |
TRY o asm_full_simp_tac (add_ss (thms1 @ (symmetric fv_bn_eqvts)))] i |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
182 |
end) |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
183 |
in |
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
184 |
induct_prove qtys (goals1 @ goals2) qinduct tac ctxt |
2492
5ac9a74d22fd
post-processed eq_iff and supp threormes according to the fv-supp equality
Christian Urban <urbanc@in.tum.de>
parents:
2491
diff
changeset
|
185 |
|> map atomize |
5ac9a74d22fd
post-processed eq_iff and supp threormes according to the fv-supp equality
Christian Urban <urbanc@in.tum.de>
parents:
2491
diff
changeset
|
186 |
|> map (simplify (HOL_basic_ss addsimps @{thms fun_eq_iff[symmetric]})) |
2481
3a5ebb2fcdbf
made supp proofs more robust by not using the standard induction; renamed some example files
Christian Urban <urbanc@in.tum.de>
parents:
2475
diff
changeset
|
187 |
end |
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
parents:
2451
diff
changeset
|
188 |
|
2451
d2e929f51fa9
added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents:
2450
diff
changeset
|
189 |
|
2571
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
190 |
fun prove_bns_finite qtys qbns qinduct qbn_simps ctxt = |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
191 |
let |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
192 |
fun mk_goal qbn = |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
193 |
let |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
194 |
val arg_ty = domain_type (fastype_of qbn) |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
195 |
val finite = @{term "finite :: atom set => bool"} |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
196 |
in |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
197 |
(arg_ty, fn x => finite $ (to_set (qbn $ x))) |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
198 |
end |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
199 |
|
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
200 |
val props = map mk_goal qbns |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
201 |
val ss_tac = asm_full_simp_tac (HOL_basic_ss addsimps (qbn_simps @ |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
202 |
@{thms set.simps set_append finite_insert finite.emptyI finite_Un})) |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
203 |
in |
2593
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
204 |
induct_prove qtys props qinduct (K ss_tac) ctxt |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
205 |
end |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
206 |
|
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
207 |
fun prove_perm_bn_alpha_thms qtys qperm_bns alpha_bns qinduct qperm_bn_simps qeq_iffs ctxt = |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
208 |
let |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
209 |
val ([p], ctxt') = Variable.variant_fixes ["p"] ctxt |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
210 |
val p = Free (p, @{typ perm}) |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
211 |
|
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
212 |
fun mk_goal qperm_bn alpha_bn = |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
213 |
let |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
214 |
val arg_ty = domain_type (fastype_of alpha_bn) |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
215 |
in |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
216 |
(arg_ty, fn x => (mk_id (Abs ("", arg_ty, alpha_bn $ Bound 0 $ (qperm_bn $ p $ Bound 0)))) $ x) |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
217 |
end |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
218 |
|
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
219 |
val props = map2 mk_goal qperm_bns alpha_bns |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
220 |
val ss_tac = (K (print_tac "test")) THEN' |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
221 |
asm_full_simp_tac (HOL_ss addsimps (@{thm id_def}::qperm_bn_simps @ qeq_iffs)) |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
222 |
in |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
223 |
@{thms TrueI} |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
224 |
(*induct_prove qtys props qinduct (K ss_tac) ctxt' |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
225 |
|> ProofContext.export ctxt' ctxt |
25dcb2b1329e
ordered raw_bn_info to agree with the order of the raw_bn_functions; started alpha_bn proof
Christian Urban <urbanc@in.tum.de>
parents:
2571
diff
changeset
|
226 |
|> map (simplify (HOL_basic_ss addsimps @{thms id_def}))*) |
2571
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
227 |
end |
f0252365936c
proved that bn functions return a finite set
Christian Urban <urbanc@in.tum.de>
parents:
2559
diff
changeset
|
228 |
|
2451
d2e929f51fa9
added fs-instance proofs
Christian Urban <urbanc@in.tum.de>
parents:
2450
diff
changeset
|
229 |
|
2448 | 230 |
end (* structure *) |