1911
+ − 1
theory SingleLet
2474
+ − 2
imports "../Nominal2"
1596
+ − 3
begin
+ − 4
+ − 5
atom_decl name
+ − 6
2436
+ − 7
declare [[STEPS = 100]]
2294
+ − 8
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 9
nominal_datatype single_let: trm =
1911
+ − 10
Var "name"
+ − 11
| App "trm" "trm"
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 12
| Lam x::"name" t::"trm" bind x in t
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 13
| Let a::"assg" t::"trm" bind "bn a" in t
2424
621ebd8b13c4
changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 14
| Foo x::"name" y::"name" t::"trm" t1::"trm" t2::"trm" bind (set) x in y t t1 t2
2296
+ − 15
| Bar x::"name" y::"name" t::"trm" bind y x in t x y
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 16
| Baz x::"name" t1::"trm" t2::"trm" bind (set) x in t1, bind (set) x in t2
1911
+ − 17
and assg =
2320
+ − 18
As "name" x::"name" t::"trm" bind x in t
1596
+ − 19
binder
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 20
bn::"assg \<Rightarrow> atom list"
1596
+ − 21
where
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 22
"bn (As x y t) = [atom x]"
1911
+ − 23
2448
+ − 24
2436
+ − 25
thm single_let.distinct
+ − 26
thm single_let.induct
2474
+ − 27
thm single_let.inducts
2436
+ − 28
thm single_let.exhaust
+ − 29
thm single_let.fv_defs
+ − 30
thm single_let.bn_defs
+ − 31
thm single_let.perm_simps
+ − 32
thm single_let.eq_iff
+ − 33
thm single_let.fv_bn_eqvt
+ − 34
thm single_let.size_eqvt
2448
+ − 35
thm single_let.supports
2450
+ − 36
thm single_let.fsupp
2475
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 37
thm single_let.supp
2430
+ − 38
2461
+ − 39
lemma test2:
+ − 40
assumes "fv_trm t = supp t"
+ − 41
shows "\<forall>p. fv_trm (p \<bullet> t) = supp (p \<bullet> t)"
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 42
apply(rule allI)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 43
apply(rule_tac p="-p" in permute_boolE)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 44
apply(perm_simp add: single_let.fv_bn_eqvt permute_minus_cancel)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 45
apply(rule assms)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 46
done
2461
+ − 47
2361
+ − 48
lemma supp_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>
diff
changeset
+ − 49
"fv_trm x = supp x"
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 50
"fv_assg xa = supp xa"
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 51
"fv_bn xa = supp_rel alpha_bn xa"
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 52
apply(induct rule: single_let.inducts)
2473
+ − 53
-- " 0A "
+ − 54
apply(simp only: single_let.fv_defs supp_Pair[symmetric])
+ − 55
apply(simp (no_asm) only: supp_def)
+ − 56
apply(perm_simp add: single_let.perm_simps single_let.fv_bn_eqvt)
+ − 57
apply(simp (no_asm) only: single_let.eq_iff Abs_eq_iff)
+ − 58
-- " 0B"
+ − 59
apply(simp only: single_let.fv_defs supp_Pair[symmetric])
+ − 60
apply(simp (no_asm) only: supp_def)
+ − 61
apply(perm_simp add: single_let.perm_simps single_let.fv_bn_eqvt)
+ − 62
apply(simp (no_asm) only: single_let.eq_iff Abs_eq_iff)
+ − 63
apply(simp only: alphas prod_alpha_def prod_fv.simps prod_rel.simps permute_prod_def prod.recs prod.cases prod.inject)
2461
+ − 64
--" 1 "
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 65
apply(simp only: single_let.fv_defs supp_Pair[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>
diff
changeset
+ − 66
apply(tactic {* EqSubst.eqsubst_tac @{context} [1] @{thms supp_abs(3)[symmetric]} 1 *})
2461
+ − 67
apply(simp (no_asm) only: supp_def)
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 68
apply(perm_simp add: single_let.perm_simps single_let.fv_bn_eqvt)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 69
apply(simp (no_asm) only: single_let.eq_iff Abs_eq_iff)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 70
apply(simp only: alphas prod_alpha_def prod_fv.simps prod_rel.simps permute_prod_def prod.recs prod.cases prod.inject)
2461
+ − 71
apply(drule test2)
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 72
apply(simp only:)
2461
+ − 73
-- " 2 "
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 74
apply(simp only: single_let.fv_defs supp_Pair[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>
diff
changeset
+ − 75
apply(subst supp_abs(3)[symmetric])
2473
+ − 76
apply(simp (no_asm) only: supp_def supp_rel_def)
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 77
apply(perm_simp add: single_let.perm_simps single_let.fv_bn_eqvt)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 78
apply(simp (no_asm) only: single_let.eq_iff Abs_eq_iff)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 79
apply(simp only: de_Morgan_conj Collect_disj_eq finite_Un)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 80
apply(simp only: alphas prod_alpha_def prod_fv.simps prod_rel.simps permute_prod_def prod.recs prod.cases prod.inject)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 81
apply(drule test2)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 82
apply(simp only:)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 83
-- " 3 "
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 84
apply(simp only: single_let.fv_defs supp_Pair[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>
diff
changeset
+ − 85
apply(subst supp_abs(1)[symmetric])
2473
+ − 86
apply(simp (no_asm) only: supp_def supp_rel_def)
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 87
apply(perm_simp add: single_let.perm_simps single_let.fv_bn_eqvt)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 88
apply(simp (no_asm) only: single_let.eq_iff Abs_eq_iff)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 89
apply(simp only: alphas prod_alpha_def prod_fv.simps prod_rel.simps permute_prod_def prod.recs prod.cases prod.inject)
2461
+ − 90
apply(drule test2)+
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 91
apply(simp only: supp_Pair Un_assoc conj_assoc)
2461
+ − 92
-- " Bar "
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 93
apply(simp only: single_let.fv_defs supp_Pair[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>
diff
changeset
+ − 94
apply(subst supp_abs(3)[symmetric])
2461
+ − 95
apply(simp (no_asm) only: supp_def)
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 96
apply(perm_simp add: single_let.perm_simps single_let.fv_bn_eqvt)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 97
apply(simp (no_asm) only: single_let.eq_iff Abs_eq_iff)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 98
apply(simp only: alphas prod_alpha_def prod_fv.simps prod_rel.simps permute_prod_def prod.recs prod.cases prod.inject)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 99
apply(drule test2)+
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 100
apply(simp only: supp_Pair Un_assoc conj_assoc)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 101
-- " Baz "
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 102
apply(simp only: single_let.fv_defs supp_Pair[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>
diff
changeset
+ − 103
apply(subst supp_abs(1)[symmetric])
486d4647bb37
supp-proofs work except for CoreHaskell and Modules (induct is probably not finding the correct instance)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 104
apply(subst supp_abs(1)[symmetric])
2461
+ − 105
apply(simp (no_asm) only: supp_def)
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 106
apply(perm_simp add: single_let.perm_simps single_let.fv_bn_eqvt)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 107
apply(simp (no_asm) only: single_let.eq_iff Abs_eq_iff)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 108
apply(simp only: alphas prod_alpha_def prod_fv.simps prod_rel.simps permute_prod_def prod.recs prod.cases prod.inject)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 109
apply(simp only: de_Morgan_conj Collect_disj_eq finite_Un)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 110
apply(drule test2)+
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 111
apply(simp only: supp_Pair Un_assoc conj_assoc)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 112
-- "last"
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 113
apply(simp only: single_let.fv_defs supp_Pair[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>
diff
changeset
+ − 114
apply(tactic {* EqSubst.eqsubst_tac @{context} [1] @{thms supp_abs(3)[symmetric]} 1 *})
2473
+ − 115
apply(simp (no_asm) only: supp_def supp_rel_def)
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 116
apply(perm_simp add: single_let.perm_simps single_let.fv_bn_eqvt)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 117
apply(simp (no_asm) only: single_let.eq_iff Abs_eq_iff)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 118
apply(simp only: alphas prod_alpha_def prod_fv.simps prod_rel.simps permute_prod_def prod.recs prod.cases prod.inject)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 119
apply(simp only: de_Morgan_conj Collect_disj_eq finite_Un)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 120
apply(drule test2)+
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 121
apply(simp only: supp_Pair Un_assoc conj_assoc)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 122
-- "other case"
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 123
apply(simp only: single_let.fv_defs supp_Pair[symmetric])
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 124
apply(simp only: supp_abs(3)[symmetric])
2473
+ − 125
apply(simp (no_asm) only: supp_def supp_rel_def)
2464
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 126
apply(perm_simp add: single_let.perm_simps single_let.fv_bn_eqvt)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 127
apply(simp (no_asm) only: single_let.eq_iff Abs_eq_iff)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 128
apply(simp only: alphas prod_alpha_def prod_fv.simps prod_rel.simps permute_prod_def prod.recs prod.cases prod.inject)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 129
apply(simp only: de_Morgan_conj Collect_disj_eq finite_Un)?
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 130
apply(drule test2)+
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 131
apply(simp only: supp_Pair Un_assoc conj_assoc)
f4eba60cbd69
made the fv-definition aggree more with alpha (needed in the support proofs)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 132
done
2461
+ − 133
+ − 134
+ − 135
+ − 136
+ − 137
+ − 138
text {* *}
+ − 139
2448
+ − 140
(*
2365
+ − 141
consts perm_bn_trm :: "perm \<Rightarrow> trm \<Rightarrow> trm"
+ − 142
consts perm_bn_assg :: "perm \<Rightarrow> assg \<Rightarrow> assg"
+ − 143
+ − 144
lemma y:
+ − 145
"perm_bn_trm p (Var x) = (Var x)"
+ − 146
"perm_bn_trm p (App t1 t2) = (App t1 t2)"
+ − 147
"perm_bn_trm p ("
+ − 148
+ − 149
2361
+ − 150
2336
+ − 151
typ trm
+ − 152
typ assg
+ − 153
1911
+ − 154
thm trm_assg.fv
+ − 155
thm trm_assg.supp
2024
+ − 156
thm trm_assg.eq_iff
1911
+ − 157
thm trm_assg.bn
+ − 158
thm trm_assg.perm
+ − 159
thm trm_assg.induct
+ − 160
thm trm_assg.inducts
+ − 161
thm trm_assg.distinct
+ − 162
ML {* Sign.of_sort @{theory} (@{typ trm}, @{sort fs}) *}
2436
+ − 163
*)
2024
+ − 164
2436
+ − 165
2064
2725853f43b9
solved the problem with equivariance by first eta-normalising the goal
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 166
1596
+ − 167
end
+ − 168
+ − 169
+ − 170