34 |
34 |
35 lemma real_alpha: |
35 lemma real_alpha: |
36 assumes "t = ([(a,b)]\<bullet>s)" "a\<sharp>s" |
36 assumes "t = ([(a,b)]\<bullet>s)" "a\<sharp>s" |
37 shows "Lam a t = Lam b s" |
37 shows "Lam a t = Lam b s" |
38 sorry |
38 sorry |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 (* Construction Site code *) |
|
45 |
|
46 lemma perm_rsp: "op = ===> alpha ===> alpha op \<bullet> op \<bullet>" sorry |
|
47 lemma fresh_rsp: "op = ===> (alpha ===> op =) fresh fresh" sorry |
|
48 lemma rLam_rsp: "op = ===> (alpha ===> alpha) rLam rLam" sorry |
|
49 |
|
50 ML {* val defs = @{thms Var_def App_def Lam_def} *} |
|
51 ML {* val consts = [@{const_name "rVar"}, @{const_name "rApp"}, @{const_name "rLam"}]; *} |
|
52 |
|
53 ML {* val rty = @{typ "rlam"} *} |
|
54 ML {* val qty = @{typ "lam"} *} |
|
55 ML {* val rel = @{term "alpha"} *} |
|
56 ML {* val rel_eqv = (#equiv_thm o hd) (quotdata_lookup @{theory}) *} |
|
57 ML {* val rel_refl = @{thm EQUIV_REFL} OF [rel_eqv] *} |
|
58 ML {* val quot = @{thm QUOTIENT_lam} *} |
|
59 ML {* val rsp_thms = @{thms perm_rsp fresh_rsp rLam_rsp} @ @{thms ho_all_prs ho_ex_prs} *} |
|
60 ML {* val trans2 = @{thm QUOT_TYPE_I_lam.R_trans2} *} |
|
61 ML {* val reps_same = @{thm QUOT_TYPE_I_lam.REPS_same} *} |
|
62 |
|
63 thm a3 |
|
64 ML {* val t_a = atomize_thm @{thm a3} *} |
|
65 ML {* val t_r = regularize t_a rty rel rel_eqv @{context} *} |
|
66 ML {* val t_t = repabs @{context} t_r consts rty qty quot rel_refl trans2 rsp_thms *} |
|
67 ML {* val abs = findabs rty (prop_of t_a) *} |
|
68 ML {* val simp_lam_prs_thms = map (make_simp_lam_prs_thm @{context} quot) abs *} |
|
69 ML {* val t_l = repeat_eqsubst_thm @{context} simp_lam_prs_thms t_t *} |
|
70 ML {* val t_c = simp_allex_prs @{context} quot t_l *} |
|
71 ML {* val t_defs_sym = add_lower_defs @{context} defs *} |
|
72 ML {* val t_d = repeat_eqsubst_thm @{context} t_defs_sym t_c *} |
|
73 ML {* val t_b = MetaSimplifier.rewrite_rule [reps_same] t_d *} |
|
74 ML {* ObjectLogic.rulify t_b *} |
|
75 |
|
76 local_setup {* |
|
77 make_const_def @{binding lfresh} @{term "fresh :: 'a \<Rightarrow> rlam \<Rightarrow> bool"} NoSyn @{typ "rlam"} @{typ "lam"} #> snd #> |
|
78 make_const_def @{binding lperm} @{term "perm :: ('a \<times> 'a) list \<Rightarrow> rlam \<Rightarrow> rlam"} NoSyn @{typ "rlam"} @{typ "lam"} #> snd |
|
79 *} |
|
80 |
|
81 ML {* val consts = @{const_name fresh} :: @{const_name perm} :: consts *} |
|
82 ML {* val defs = @{thms lfresh_def lperm_def} @ defs *} |
|
83 ML {* val t_t = Toplevel.program (fn () => repabs @{context} t_r consts rty qty quot rel_refl trans2 rsp_thms) *} |
|
84 ML {* val t_l = repeat_eqsubst_thm @{context} simp_lam_prs_thms t_t *} |
|
85 ML {* val t_c = simp_allex_prs @{context} quot t_l *} |
|
86 ML {* val t_defs_sym = add_lower_defs @{context} defs *} |
|
87 ML {* val t_d = repeat_eqsubst_thm @{context} t_defs_sym t_c *} |
|
88 ML {* val t_b = MetaSimplifier.rewrite_rule [reps_same] t_d *} |
|
89 ML {* ObjectLogic.rulify t_b *} |
|
90 ML {* val rr = (add_lower_defs @{context} @{thms lperm_def}) *} |
|
91 ML {* val rrr = @{thm eq_reflection} OF [rr] *} |
|
92 ML {* MetaSimplifier.rewrite_rule [rrr] t_b *} |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 ML {* |
|
99 fun lift_thm_lam lthy t = |
|
100 lift_thm lthy consts rty qty rel rel_eqv rel_refl quot rsp_thms trans2 reps_same defs t |
|
101 *} |
|
102 |
|
103 ML {* Toplevel.program (fn () => lift_thm_lam @{context} @{thm a3}) *} |
|
104 |