1797
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 1
theory Lambda
2454
+ − 2
imports "../Nominal2"
1594
+ − 3
begin
+ − 4
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 5
lemma Abs_lst_fcb2:
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 6
fixes as bs :: "atom list"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 7
and x y :: "'b :: fs"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 8
and c::"'c::fs"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 9
assumes eq: "[as]lst. x = [bs]lst. y"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 10
and fcb1: "(set as) \<sharp>* f as x c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 11
and fresh1: "set as \<sharp>* c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 12
and fresh2: "set bs \<sharp>* c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 13
and perm1: "\<And>p. supp p \<sharp>* c \<Longrightarrow> p \<bullet> (f as x c) = f (p \<bullet> as) (p \<bullet> x) c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 14
and perm2: "\<And>p. supp p \<sharp>* c \<Longrightarrow> p \<bullet> (f bs y c) = f (p \<bullet> bs) (p \<bullet> y) c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 15
shows "f as x c = f bs y c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 16
proof -
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 17
have "supp (as, x, c) supports (f as x c)"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 18
unfolding supports_def fresh_def[symmetric]
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 19
by (simp add: fresh_Pair perm1 fresh_star_def supp_swap swap_fresh_fresh)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 20
then have fin1: "finite (supp (f as x c))"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 21
by (auto intro: supports_finite simp add: finite_supp)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 22
have "supp (bs, y, c) supports (f bs y c)"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 23
unfolding supports_def fresh_def[symmetric]
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 24
by (simp add: fresh_Pair perm2 fresh_star_def supp_swap swap_fresh_fresh)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 25
then have fin2: "finite (supp (f bs y c))"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 26
by (auto intro: supports_finite simp add: finite_supp)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 27
obtain q::"perm" where
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 28
fr1: "(q \<bullet> (set as)) \<sharp>* (x, c, f as x c, f bs y c)" and
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 29
fr2: "supp q \<sharp>* Abs_lst as x" and
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 30
inc: "supp q \<subseteq> (set as) \<union> q \<bullet> (set as)"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 31
using at_set_avoiding3[where xs="set as" and c="(x, c, f as x c, f bs y c)" and x="[as]lst. x"]
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 32
fin1 fin2
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 33
by (auto simp add: supp_Pair finite_supp Abs_fresh_star dest: fresh_star_supp_conv)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 34
have "Abs_lst (q \<bullet> as) (q \<bullet> x) = q \<bullet> Abs_lst as x" by simp
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 35
also have "\<dots> = Abs_lst as x"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 36
by (simp only: fr2 perm_supp_eq)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 37
finally have "Abs_lst (q \<bullet> as) (q \<bullet> x) = Abs_lst bs y" using eq by simp
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 38
then obtain r::perm where
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 39
qq1: "q \<bullet> x = r \<bullet> y" and
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 40
qq2: "q \<bullet> as = r \<bullet> bs" and
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 41
qq3: "supp r \<subseteq> (q \<bullet> (set as)) \<union> set bs"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 42
apply(drule_tac sym)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 43
apply(simp only: Abs_eq_iff2 alphas)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 44
apply(erule exE)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 45
apply(erule conjE)+
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 46
apply(drule_tac x="p" in meta_spec)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 47
apply(simp add: set_eqvt)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 48
apply(blast)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 49
done
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 50
have "(set as) \<sharp>* f as x c" by (rule fcb1)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 51
then have "q \<bullet> ((set as) \<sharp>* f as x c)"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 52
by (simp add: permute_bool_def)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 53
then have "set (q \<bullet> as) \<sharp>* f (q \<bullet> as) (q \<bullet> x) c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 54
apply(simp add: fresh_star_eqvt set_eqvt)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 55
apply(subst (asm) perm1)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 56
using inc fresh1 fr1
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 57
apply(auto simp add: fresh_star_def fresh_Pair)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 58
done
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 59
then have "set (r \<bullet> bs) \<sharp>* f (r \<bullet> bs) (r \<bullet> y) c" using qq1 qq2 by simp
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 60
then have "r \<bullet> ((set bs) \<sharp>* f bs y c)"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 61
apply(simp add: fresh_star_eqvt set_eqvt)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 62
apply(subst (asm) perm2[symmetric])
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 63
using qq3 fresh2 fr1
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 64
apply(auto simp add: set_eqvt fresh_star_def fresh_Pair)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 65
done
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 66
then have fcb2: "(set bs) \<sharp>* f bs y c" by (simp add: permute_bool_def)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 67
have "f as x c = q \<bullet> (f as x c)"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 68
apply(rule perm_supp_eq[symmetric])
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 69
using inc fcb1 fr1 by (auto simp add: fresh_star_def)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 70
also have "\<dots> = f (q \<bullet> as) (q \<bullet> x) c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 71
apply(rule perm1)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 72
using inc fresh1 fr1 by (auto simp add: fresh_star_def)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 73
also have "\<dots> = f (r \<bullet> bs) (r \<bullet> y) c" using qq1 qq2 by simp
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 74
also have "\<dots> = r \<bullet> (f bs y c)"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 75
apply(rule perm2[symmetric])
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 76
using qq3 fresh2 fr1 by (auto simp add: fresh_star_def)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 77
also have "... = f bs y c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 78
apply(rule perm_supp_eq)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 79
using qq3 fr1 fcb2 by (auto simp add: fresh_star_def)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 80
finally show ?thesis by simp
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 81
qed
2784
+ − 82
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 83
lemma Abs_lst1_fcb2:
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 84
fixes a b :: "atom"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 85
and x y :: "'b :: fs"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 86
and c::"'c :: fs"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 87
assumes e: "(Abs_lst [a] x) = (Abs_lst [b] y)"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 88
and fcb1: "a \<sharp> f a x c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 89
and fresh: "{a, b} \<sharp>* c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 90
and perm1: "\<And>p. supp p \<sharp>* c \<Longrightarrow> p \<bullet> (f a x c) = f (p \<bullet> a) (p \<bullet> x) c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 91
and perm2: "\<And>p. supp p \<sharp>* c \<Longrightarrow> p \<bullet> (f b y c) = f (p \<bullet> b) (p \<bullet> y) c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 92
shows "f a x c = f b y c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 93
using e
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 94
apply(drule_tac Abs_lst_fcb2[where c="c" and f="\<lambda>(as::atom list) . f (hd as)"])
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 95
apply(simp_all)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 96
using fcb1 fresh perm1 perm2
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 97
apply(simp_all add: fresh_star_def)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 98
done
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 99
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 100
lemma Abs_lst1_fcb2':
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 101
fixes a b :: "'a::at"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 102
and x y :: "'b :: fs"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 103
and c::"'c :: fs"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 104
assumes e: "(Abs_lst [atom a] x) = (Abs_lst [atom b] y)"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 105
and fcb1: "atom a \<sharp> f a x c"
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 106
and fresh: "{atom a, atom b} \<sharp>* c"
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 107
and perm1: "\<And>p. supp p \<sharp>* c \<Longrightarrow> p \<bullet> (f a x c) = f (p \<bullet> a) (p \<bullet> x) c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 108
and perm2: "\<And>p. supp p \<sharp>* c \<Longrightarrow> p \<bullet> (f b y c) = f (p \<bullet> b) (p \<bullet> y) c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 109
shows "f a x c = f b y c"
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 110
using e
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 111
apply(drule_tac Abs_lst1_fcb2[where c="c" and f="\<lambda>a . f ((inv atom) a)"])
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 112
using fcb1 fresh perm1 perm2
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 113
apply(simp_all add: fresh_star_def inv_f_f inj_on_def atom_eqvt)
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 114
done
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 115
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 116
1594
+ − 117
atom_decl name
+ − 118
2436
+ − 119
nominal_datatype lam =
1800
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 120
Var "name"
2436
+ − 121
| App "lam" "lam"
2683
+ − 122
| Lam x::"name" l::"lam" bind x in l ("Lam [_]. _" [100, 100] 100)
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 123
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 124
ML {* Method.SIMPLE_METHOD' *}
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 125
ML {* Sign.intern_const *}
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 126
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 127
ML {*
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 128
val test:((Proof.context -> Method.method) context_parser) =
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 129
Scan.succeed (fn ctxt =>
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 130
let
2891
304dfe6cc83a
the simplifier can simplify "sort (atom a)" if a is a concrete atom type declared with atom_decl
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 131
val _ = Inductive.the_inductive ctxt "local.frees_lst_graph"
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 132
in
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 133
Method.SIMPLE_METHOD' (K all_tac)
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 134
end)
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 135
*}
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 136
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 137
method_setup test = {* test *} {* test *}
2868
+ − 138
+ − 139
section {* free name function *}
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 140
2860
+ − 141
text {* first returns an atom list *}
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 142
2885
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 143
ML Thm.implies_intr
1264f2a21ea9
some rudimentary infrastructure for storing data about nominal datatypes
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 144
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 145
nominal_primrec
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 146
frees_lst :: "lam \<Rightarrow> atom list"
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 147
where
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 148
"frees_lst (Var x) = [atom x]"
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 149
| "frees_lst (App t1 t2) = frees_lst t1 @ frees_lst t2"
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 150
| "frees_lst (Lam [x]. t) = removeAll (atom x) (frees_lst t)"
2868
+ − 151
unfolding eqvt_def
+ − 152
unfolding frees_lst_graph_def
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 153
apply (rule, perm_simp, rule)
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 154
apply(rule TrueI)
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 155
apply(rule_tac y="x" in lam.exhaust)
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 156
apply(auto)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 157
apply (erule_tac c="()" in Abs_lst1_fcb2)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 158
apply(simp add: supp_removeAll fresh_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 159
apply(simp add: fresh_star_def fresh_Unit)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 160
apply(simp add: eqvt_at_def removeAll_eqvt atom_eqvt)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 161
apply(simp add: eqvt_at_def removeAll_eqvt atom_eqvt)
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 162
done
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 163
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 164
termination
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 165
by lexicographic_order
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 166
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 167
text {* a small test lemma *}
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 168
lemma shows "supp t = set (frees_lst t)"
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 169
by (induct t rule: frees_lst.induct) (simp_all add: lam.supp supp_at_base)
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 170
2860
+ − 171
text {* second returns an atom set - therefore needs an invariant *}
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 172
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 173
nominal_primrec (invariant "\<lambda>x (y::atom set). finite y")
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 174
frees_set :: "lam \<Rightarrow> atom set"
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 175
where
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 176
"frees_set (Var x) = {atom x}"
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 177
| "frees_set (App t1 t2) = frees_set t1 \<union> frees_set t2"
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 178
| "frees_set (Lam [x]. t) = (frees_set t) - {atom x}"
2845
+ − 179
apply(simp add: eqvt_def frees_set_graph_def)
+ − 180
apply(rule, perm_simp, rule)
+ − 181
apply(erule frees_set_graph.induct)
+ − 182
apply(auto)[9]
+ − 183
apply(rule_tac y="x" in lam.exhaust)
+ − 184
apply(auto)[3]
+ − 185
apply(simp)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 186
apply(erule_tac c="()" in Abs_lst1_fcb2)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 187
apply(simp add: fresh_minus_atom_set)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 188
apply(simp add: fresh_star_def fresh_Unit)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 189
apply(simp add: Diff_eqvt eqvt_at_def, perm_simp, rule refl)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 190
apply(simp add: Diff_eqvt eqvt_at_def, perm_simp, rule refl)
2845
+ − 191
done
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 192
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 193
termination
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 194
by lexicographic_order
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 195
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 196
lemma "frees_set t = supp t"
2845
+ − 197
by (induct rule: frees_set.induct) (simp_all add: lam.supp supp_at_base)
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 198
2809
+ − 199
lemma fresh_fun_eqvt_app3:
+ − 200
assumes a: "eqvt f"
+ − 201
and b: "a \<sharp> x" "a \<sharp> y" "a \<sharp> z"
+ − 202
shows "a \<sharp> f x y z"
+ − 203
using fresh_fun_eqvt_app[OF a b(1)] a b
+ − 204
by (metis fresh_fun_app)
+ − 205
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 206
2868
+ − 207
section {* A test with a locale and an interpretation. *}
+ − 208
+ − 209
text {* conclusion: it is no necessary *}
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 210
2814
+ − 211
locale test =
+ − 212
fixes f1::"name \<Rightarrow> ('a::pt)"
+ − 213
and f2::"lam \<Rightarrow> lam \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> ('a::pt)"
+ − 214
and f3::"name \<Rightarrow> lam \<Rightarrow> 'a \<Rightarrow> ('a::pt)"
+ − 215
assumes fs: "finite (supp (f1, f2, f3))"
+ − 216
and eq: "eqvt f1" "eqvt f2" "eqvt f3"
+ − 217
and fcb: "\<forall>x t r. atom x \<sharp> f3 x t r"
+ − 218
begin
+ − 219
2845
+ − 220
nominal_primrec
2814
+ − 221
f :: "lam \<Rightarrow> ('a::pt)"
2807
13af2c8d7329
a test with a recursion combinator defined on top of nominal_primrec
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 222
where
2814
+ − 223
"f (Var x) = f1 x"
+ − 224
| "f (App t1 t2) = f2 t1 t2 (f t1) (f t2)"
2816
+ − 225
| "f (Lam [x].t) = f3 x t (f t)"
2809
+ − 226
apply (simp add: eqvt_def f_graph_def)
2814
+ − 227
apply (perm_simp)
+ − 228
apply(simp add: eq[simplified eqvt_def])
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 229
apply(rule TrueI)
2816
+ − 230
apply(rule_tac y="x" in lam.exhaust)
2809
+ − 231
apply(auto simp add: fresh_star_def)
2843
+ − 232
apply(erule Abs_lst1_fcb)
2809
+ − 233
apply simp_all
2814
+ − 234
apply(simp add: fcb)
2816
+ − 235
apply (rule fresh_fun_eqvt_app3[OF eq(3)])
+ − 236
apply (simp add: fresh_at_base)
+ − 237
apply assumption
+ − 238
apply (erule fresh_eqvt_at)
+ − 239
apply (simp add: finite_supp)
+ − 240
apply assumption
2814
+ − 241
apply (subgoal_tac "\<And>p y r. p \<bullet> (f3 x y r) = f3 (p \<bullet> x) (p \<bullet> y) (p \<bullet> r)")
2816
+ − 242
apply (simp add: eqvt_at_def)
+ − 243
apply (simp add: permute_fun_app_eq eq[unfolded eqvt_def])
+ − 244
done
2807
13af2c8d7329
a test with a recursion combinator defined on top of nominal_primrec
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 245
2816
+ − 246
termination
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 247
by lexicographic_order
2821
c7d4bd9e89e0
fixed problem with earlier commit about nominal_function_common; added facility for specifying an invariant - added a definition of frees_set which need a finiteness invariant
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 248
2814
+ − 249
end
2807
13af2c8d7329
a test with a recursion combinator defined on top of nominal_primrec
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 250
2816
+ − 251
interpretation hei: test
+ − 252
"%n. (1 :: nat)"
+ − 253
"%t1 t2 r1 r2. (r1 + r2)"
+ − 254
"%n t r. r + 1"
+ − 255
apply default
+ − 256
apply (auto simp add: pure_fresh supp_Pair)
+ − 257
apply (simp_all add: fresh_def supp_def permute_fun_def permute_pure)[3]
+ − 258
apply (simp_all add: eqvt_def permute_fun_def permute_pure)
+ − 259
done
+ − 260
2868
+ − 261
section {* height function *}
2431
331873ebc5cd
can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 262
2666
+ − 263
nominal_primrec
2678
+ − 264
height :: "lam \<Rightarrow> int"
2666
+ − 265
where
2678
+ − 266
"height (Var x) = 1"
2683
+ − 267
| "height (App t1 t2) = max (height t1) (height t2) + 1"
+ − 268
| "height (Lam [x].t) = height t + 1"
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 269
apply(simp add: eqvt_def height_graph_def)
2791
+ − 270
apply (rule, perm_simp, rule)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 271
apply(rule TrueI)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 272
apply(rule_tac y="x" in lam.exhaust)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 273
apply(auto)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 274
apply (erule_tac c="()" in Abs_lst1_fcb2)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 275
apply(simp_all add: fresh_def pure_supp eqvt_at_def fresh_star_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 276
done
2666
+ − 277
+ − 278
termination
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 279
by lexicographic_order
2666
+ − 280
2707
+ − 281
thm height.simps
+ − 282
2683
+ − 283
2868
+ − 284
section {* capture-avoiding substitution *}
2683
+ − 285
2675
+ − 286
nominal_primrec
2683
+ − 287
subst :: "lam \<Rightarrow> name \<Rightarrow> lam \<Rightarrow> lam" ("_ [_ ::= _]" [90, 90, 90] 90)
2675
+ − 288
where
2683
+ − 289
"(Var x)[y ::= s] = (if x = y then s else (Var x))"
+ − 290
| "(App t1 t2)[y ::= s] = App (t1[y ::= s]) (t2[y ::= s])"
+ − 291
| "atom x \<sharp> (y, s) \<Longrightarrow> (Lam [x]. t)[y ::= s] = Lam [x].(t[y ::= s])"
2791
+ − 292
unfolding eqvt_def subst_graph_def
+ − 293
apply (rule, perm_simp, rule)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 294
apply(rule TrueI)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 295
apply(auto simp add: lam.distinct lam.eq_iff)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 296
apply(rule_tac y="a" and c="(aa, b)" in lam.strong_exhaust)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 297
apply(blast)+
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 298
apply(simp_all add: fresh_star_def fresh_Pair_elim)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 299
apply (erule_tac c="(ya,sa)" in Abs_lst1_fcb2)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 300
apply(simp_all add: Abs_fresh_iff)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 301
apply(simp add: fresh_star_def fresh_Pair)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 302
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 303
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
2675
+ − 304
done
+ − 305
2678
+ − 306
termination
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 307
by lexicographic_order
2683
+ − 308
+ − 309
lemma subst_eqvt[eqvt]:
+ − 310
shows "(p \<bullet> t[x ::= s]) = (p \<bullet> t)[(p \<bullet> x) ::= (p \<bullet> s)]"
+ − 311
by (induct t x s rule: subst.induct) (simp_all)
+ − 312
+ − 313
lemma forget:
+ − 314
shows "atom x \<sharp> t \<Longrightarrow> t[x ::= s] = t"
2845
+ − 315
by (nominal_induct t avoiding: x s rule: lam.strong_induct)
+ − 316
(auto simp add: lam.fresh fresh_at_base)
2683
+ − 317
+ − 318
text {* same lemma but with subst.induction *}
+ − 319
lemma forget2:
+ − 320
shows "atom x \<sharp> t \<Longrightarrow> t[x ::= s] = t"
2845
+ − 321
by (induct t x s rule: subst.induct)
+ − 322
(auto simp add: lam.fresh fresh_at_base fresh_Pair)
2683
+ − 323
+ − 324
lemma fresh_fact:
+ − 325
fixes z::"name"
+ − 326
assumes a: "atom z \<sharp> s"
2845
+ − 327
and b: "z = y \<or> atom z \<sharp> t"
2683
+ − 328
shows "atom z \<sharp> t[y ::= s]"
2845
+ − 329
using a b
+ − 330
by (nominal_induct t avoiding: z y s rule: lam.strong_induct)
+ − 331
(auto simp add: lam.fresh fresh_at_base)
2683
+ − 332
+ − 333
lemma substitution_lemma:
+ − 334
assumes a: "x \<noteq> y" "atom x \<sharp> u"
+ − 335
shows "t[x ::= s][y ::= u] = t[y ::= u][x ::= s[y ::= u]]"
+ − 336
using a
+ − 337
by (nominal_induct t avoiding: x y s u rule: lam.strong_induct)
+ − 338
(auto simp add: fresh_fact forget)
+ − 339
+ − 340
lemma subst_rename:
+ − 341
assumes a: "atom y \<sharp> t"
+ − 342
shows "t[x ::= s] = ((y \<leftrightarrow> x) \<bullet>t)[y ::= s]"
+ − 343
using a
+ − 344
apply (nominal_induct t avoiding: x y s rule: lam.strong_induct)
+ − 345
apply (auto simp add: lam.fresh fresh_at_base)
+ − 346
done
+ − 347
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 348
lemma height_ge_one:
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 349
shows "1 \<le> (height e)"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 350
by (induct e rule: lam.induct) (simp_all)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 351
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 352
theorem height_subst:
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 353
shows "height (e[x::=e']) \<le> ((height e) - 1) + (height e')"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 354
proof (nominal_induct e avoiding: x e' rule: lam.strong_induct)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 355
case (Var y)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 356
have "1 \<le> height e'" by (rule height_ge_one)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 357
then show "height (Var y[x::=e']) \<le> height (Var y) - 1 + height e'" by simp
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 358
next
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 359
case (Lam y e1)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 360
hence ih: "height (e1[x::=e']) \<le> ((height e1) - 1) + (height e')" by simp
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 361
moreover
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 362
have vc: "atom y\<sharp>x" "atom y\<sharp>e'" by fact+ (* usual variable convention *)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 363
ultimately show "height ((Lam [y]. e1)[x::=e']) \<le> height (Lam [y]. e1) - 1 + height e'" by simp
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 364
next
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 365
case (App e1 e2)
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 366
hence ih1: "height (e1[x::=e']) \<le> ((height e1) - 1) + (height e')"
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 367
and ih2: "height (e2[x::=e']) \<le> ((height e2) - 1) + (height e')" by simp_all
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 368
then show "height ((App e1 e2)[x::=e']) \<le> height (App e1 e2) - 1 + height e'" by simp
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 369
qed
2683
+ − 370
+ − 371
subsection {* single-step beta-reduction *}
+ − 372
+ − 373
inductive
+ − 374
beta :: "lam \<Rightarrow> lam \<Rightarrow> bool" (" _ \<longrightarrow>b _" [80,80] 80)
+ − 375
where
+ − 376
b1[intro]: "t1 \<longrightarrow>b t2 \<Longrightarrow> App t1 s \<longrightarrow>b App t2 s"
+ − 377
| b2[intro]: "s1 \<longrightarrow>b s2 \<Longrightarrow> App t s1 \<longrightarrow>b App t s2"
+ − 378
| b3[intro]: "t1 \<longrightarrow>b t2 \<Longrightarrow> Lam [x]. t1 \<longrightarrow>b Lam [x]. t2"
+ − 379
| b4[intro]: "atom x \<sharp> s \<Longrightarrow> App (Lam [x]. t) s \<longrightarrow>b t[x ::= s]"
+ − 380
+ − 381
equivariance beta
+ − 382
+ − 383
nominal_inductive beta
+ − 384
avoids b4: "x"
+ − 385
by (simp_all add: fresh_star_def fresh_Pair lam.fresh fresh_fact)
+ − 386
+ − 387
text {* One-Reduction *}
+ − 388
+ − 389
inductive
+ − 390
One :: "lam \<Rightarrow> lam \<Rightarrow> bool" (" _ \<longrightarrow>1 _" [80,80] 80)
+ − 391
where
+ − 392
o1[intro]: "Var x \<longrightarrow>1 Var x"
+ − 393
| o2[intro]: "\<lbrakk>t1 \<longrightarrow>1 t2; s1 \<longrightarrow>1 s2\<rbrakk> \<Longrightarrow> App t1 s1 \<longrightarrow>1 App t2 s2"
+ − 394
| o3[intro]: "t1 \<longrightarrow>1 t2 \<Longrightarrow> Lam [x].t1 \<longrightarrow>1 Lam [x].t2"
+ − 395
| o4[intro]: "\<lbrakk>atom x \<sharp> (s1, s2); t1 \<longrightarrow>1 t2; s1 \<longrightarrow>1 s2\<rbrakk> \<Longrightarrow> App (Lam [x].t1) s1 \<longrightarrow>1 t2[x ::= s2]"
+ − 396
+ − 397
equivariance One
+ − 398
+ − 399
nominal_inductive One
+ − 400
avoids o3: "x"
+ − 401
| o4: "x"
+ − 402
by (simp_all add: fresh_star_def fresh_Pair lam.fresh fresh_fact)
+ − 403
+ − 404
lemma One_refl:
+ − 405
shows "t \<longrightarrow>1 t"
+ − 406
by (nominal_induct t rule: lam.strong_induct) (auto)
+ − 407
+ − 408
lemma One_subst:
+ − 409
assumes a: "t1 \<longrightarrow>1 t2" "s1 \<longrightarrow>1 s2"
+ − 410
shows "t1[x ::= s1] \<longrightarrow>1 t2[x ::= s2]"
+ − 411
using a
+ − 412
apply(nominal_induct t1 t2 avoiding: s1 s2 x rule: One.strong_induct)
+ − 413
apply(auto simp add: substitution_lemma fresh_at_base fresh_fact fresh_Pair)
+ − 414
done
+ − 415
+ − 416
lemma better_o4_intro:
+ − 417
assumes a: "t1 \<longrightarrow>1 t2" "s1 \<longrightarrow>1 s2"
+ − 418
shows "App (Lam [x]. t1) s1 \<longrightarrow>1 t2[ x ::= s2]"
+ − 419
proof -
2685
+ − 420
obtain y::"name" where fs: "atom y \<sharp> (x, t1, s1, t2, s2)" by (rule obtain_fresh)
2683
+ − 421
have "App (Lam [x]. t1) s1 = App (Lam [y]. ((y \<leftrightarrow> x) \<bullet> t1)) s1" using fs
+ − 422
by (auto simp add: lam.eq_iff Abs1_eq_iff' flip_def fresh_Pair fresh_at_base)
+ − 423
also have "\<dots> \<longrightarrow>1 ((y \<leftrightarrow> x) \<bullet> t2)[y ::= s2]" using fs a by (auto simp add: One.eqvt)
+ − 424
also have "\<dots> = t2[x ::= s2]" using fs by (simp add: subst_rename[symmetric])
+ − 425
finally show "App (Lam [x].t1) s1 \<longrightarrow>1 t2[x ::= s2]" by simp
+ − 426
qed
+ − 427
+ − 428
section {* Locally Nameless Terms *}
2678
+ − 429
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 430
nominal_datatype ln =
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 431
LNBnd nat
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 432
| LNVar name
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 433
| LNApp ln ln
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 434
| LNLam ln
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 435
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 436
fun
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 437
lookup :: "name list \<Rightarrow> nat \<Rightarrow> name \<Rightarrow> ln"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 438
where
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 439
"lookup [] n x = LNVar x"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 440
| "lookup (y # ys) n x = (if x = y then LNBnd n else (lookup ys (n + 1) x))"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 441
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 442
lemma supp_lookup:
2824
+ − 443
shows "supp (lookup xs n x) \<subseteq> {atom x}"
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 444
apply(induct arbitrary: n rule: lookup.induct)
2824
+ − 445
apply(simp add: ln.supp supp_at_base)
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 446
apply(simp add: ln.supp pure_supp)
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 447
done
2824
+ − 448
+ − 449
lemma supp_lookup_in:
+ − 450
shows "x \<in> set xs \<Longrightarrow> supp (lookup xs n x) = {}"
+ − 451
by (induct arbitrary: n rule: lookup.induct)(auto simp add: ln.supp pure_supp)
+ − 452
+ − 453
lemma supp_lookup_notin:
+ − 454
shows "x \<notin> set xs \<Longrightarrow> supp (lookup xs n x) = {atom x}"
+ − 455
by (induct arbitrary: n rule: lookup.induct) (auto simp add: ln.supp pure_supp supp_at_base)
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 456
2829
+ − 457
lemma supp_lookup_fresh:
+ − 458
shows "atom ` set xs \<sharp>* lookup xs n x"
+ − 459
by (case_tac "x \<in> set xs") (auto simp add: fresh_star_def fresh_def supp_lookup_in supp_lookup_notin)
+ − 460
+ − 461
lemma lookup_eqvt[eqvt]:
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 462
shows "(p \<bullet> lookup xs n x) = lookup (p \<bullet> xs) (p \<bullet> n) (p \<bullet> x)"
2767
94f6f70e3067
New way of forward elimination of Abs1_eq and simplifications of the function obligation proofs.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 463
by (induct xs arbitrary: n) (simp_all add: permute_pure)
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 464
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 465
text {* Function that translates lambda-terms into locally nameless terms *}
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 466
2826
+ − 467
nominal_primrec (invariant "\<lambda>(_, xs) y. atom ` set xs \<sharp>* y")
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 468
trans :: "lam \<Rightarrow> name list \<Rightarrow> ln"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 469
where
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 470
"trans (Var x) xs = lookup xs 0 x"
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 471
| "trans (App t1 t2) xs = LNApp (trans t1 xs) (trans t2 xs)"
2685
+ − 472
| "atom x \<sharp> xs \<Longrightarrow> trans (Lam [x]. t) xs = LNLam (trans t (x # xs))"
2829
+ − 473
apply (simp add: eqvt_def trans_graph_def)
+ − 474
apply (rule, perm_simp, rule)
2824
+ − 475
apply (erule trans_graph.induct)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 476
apply (auto simp add: ln.fresh)[3]
2829
+ − 477
apply (simp add: supp_lookup_fresh)
2824
+ − 478
apply (simp add: fresh_star_def ln.fresh)
+ − 479
apply (simp add: ln.fresh fresh_star_def)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 480
apply(auto)[1]
2829
+ − 481
apply (rule_tac y="a" and c="b" in lam.strong_exhaust)
+ − 482
apply (auto simp add: fresh_star_def)[3]
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 483
apply(simp_all)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 484
apply(erule conjE)+
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 485
apply (erule_tac Abs_lst1_fcb2')
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 486
apply (simp add: fresh_star_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 487
apply (simp add: fresh_star_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 488
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 489
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
2829
+ − 490
done
2669
1d1772a89026
the function translating lambda terms to locally nameless lambda terms; still needs a stronger abs_eq_iff lemma...at the moment only proved for restrictions
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 491
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 492
termination
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 493
by lexicographic_order
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 494
2860
+ − 495
text {* count the bound-variable occurences in a lambda-term *}
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 496
2828
+ − 497
nominal_primrec
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 498
cbvs :: "lam \<Rightarrow> name list \<Rightarrow> nat"
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 499
where
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 500
"cbvs (Var x) xs = (if x \<in> set xs then 1 else 0)"
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 501
| "cbvs (App t1 t2) xs = (cbvs t1 xs) + (cbvs t2 xs)"
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 502
| "atom x \<sharp> xs \<Longrightarrow> cbvs (Lam [x]. t) xs = cbvs t (x # xs)"
2828
+ − 503
apply(simp add: eqvt_def cbvs_graph_def)
+ − 504
apply(rule, perm_simp, rule)
+ − 505
apply(simp_all)
+ − 506
apply(case_tac x)
+ − 507
apply(rule_tac y="a" and c="b" in lam.strong_exhaust)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 508
apply(auto simp add: fresh_star_def)[3]
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 509
apply(erule conjE)
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 510
apply(erule Abs_lst1_fcb2')
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 511
apply(simp add: pure_fresh fresh_star_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 512
apply(simp add: pure_fresh fresh_star_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 513
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 514
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
2828
+ − 515
done
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 516
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 517
termination
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 518
by lexicographic_order
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 519
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 520
section {* De Bruijn Terms *}
2827
394664816e24
defined the "count-bound-variables-occurences" function which has an accumulator like trans
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 521
2667
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 522
nominal_datatype db =
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 523
DBVar nat
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 524
| DBApp db db
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 525
| DBLam db
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 526
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 527
fun dbapp_in where
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 528
"dbapp_in None _ = None"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 529
| "dbapp_in (Some _ ) None = None"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 530
| "dbapp_in (Some x) (Some y) = Some (DBApp x y)"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 531
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 532
fun dblam_in where
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 533
"dblam_in None = None"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 534
| "dblam_in (Some x) = Some (DBLam x)"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 535
2798
+ − 536
lemma db_in_eqvt[eqvt]:
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 537
"p \<bullet> (dbapp_in x y) = dbapp_in (p \<bullet> x) (p \<bullet> y)"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 538
"p \<bullet> (dblam_in x) = dblam_in (p \<bullet> x)"
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 539
apply (case_tac [!] x)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 540
apply (simp_all add: eqvts)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 541
apply (case_tac y)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 542
apply (simp_all add: eqvts)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 543
done
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 544
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 545
instance db :: pure
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 546
apply default
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 547
apply (induct_tac x rule: db.induct)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 548
apply (simp_all add: permute_pure)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 549
done
2795
+ − 550
+ − 551
lemma fresh_at_list: "atom x \<sharp> xs \<longleftrightarrow> x \<notin> set xs"
+ − 552
unfolding fresh_def supp_set[symmetric]
2845
+ − 553
by (induct xs) (auto simp add: supp_of_finite_insert supp_at_base supp_set_empty)
2795
+ − 554
2800
+ − 555
fun
+ − 556
vindex :: "name list \<Rightarrow> name \<Rightarrow> nat \<Rightarrow> db option"
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 557
where
2800
+ − 558
"vindex [] v n = None"
+ − 559
| "vindex (h # t) v n = (if v = h then (Some (DBVar n)) else (vindex t v (Suc n)))"
+ − 560
+ − 561
lemma vindex_eqvt[eqvt]:
+ − 562
"(p \<bullet> vindex l v n) = vindex (p \<bullet> l) (p \<bullet> v) (p \<bullet> n)"
+ − 563
by (induct l arbitrary: n) (simp_all add: permute_pure)
+ − 564
+ − 565
nominal_primrec
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 566
transdb :: "lam \<Rightarrow> name list \<Rightarrow> db option"
2800
+ − 567
where
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 568
"transdb (Var x) l = vindex l x 0"
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 569
| "transdb (App t1 t2) xs = dbapp_in (transdb t1 xs) (transdb t2 xs)"
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 570
| "x \<notin> set xs \<Longrightarrow> transdb (Lam [x].t) xs = dblam_in (transdb t (x # xs))"
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 571
unfolding eqvt_def transdb_graph_def
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 572
apply (rule, perm_simp, rule)
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 573
apply(rule TrueI)
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 574
apply (case_tac x)
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 575
apply (rule_tac y="a" and c="b" in lam.strong_exhaust)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 576
apply (auto simp add: fresh_star_def fresh_at_list)[3]
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 577
apply(simp_all)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 578
apply(erule conjE)
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 579
apply (erule_tac c="xsa" in Abs_lst1_fcb2')
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 580
apply (simp add: pure_fresh)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 581
apply(simp add: fresh_star_def fresh_at_list)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 582
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq db_in_eqvt)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 583
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq db_in_eqvt)
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 584
done
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 585
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 586
termination
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 587
by lexicographic_order
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 588
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 589
lemma transdb_eqvt[eqvt]:
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 590
"p \<bullet> transdb t l = transdb (p \<bullet>t) (p \<bullet>l)"
2800
+ − 591
apply (nominal_induct t avoiding: l p rule: lam.strong_induct)
+ − 592
apply (simp add: vindex_eqvt)
+ − 593
apply (simp_all add: permute_pure)
2797
+ − 594
apply (simp add: fresh_at_list)
2822
23befefc6e73
cleaned ups a bit the examples with the invariant framework; exported nominal_function_config datatype into separate structure and file
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 595
apply (subst transdb.simps)
2797
+ − 596
apply (simp add: fresh_at_list[symmetric])
2800
+ − 597
apply (drule_tac x="name # l" in meta_spec)
+ − 598
apply auto
2797
+ − 599
done
+ − 600
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 601
lemma db_trans_test:
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 602
assumes a: "y \<noteq> x"
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 603
shows "transdb (Lam [x]. Lam [y]. App (Var x) (Var y)) [] =
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 604
Some (DBLam (DBLam (DBApp (DBVar 1) (DBVar 0))))"
2795
+ − 605
using a by simp
2792
c4ed08a7454a
Defined translation from nominal to de-Bruijn; with a freshness condition for the lambda case.
Cezary Kaliszyk <kaliszyk@in.tum.de>
diff
changeset
+ − 606
2667
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 607
abbreviation
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 608
mbind :: "'a option => ('a => 'b option) => 'b option" ("_ \<guillemotright>= _" [65,65] 65)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 609
where
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 610
"c \<guillemotright>= f \<equiv> case c of None => None | (Some v) => f v"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 611
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 612
lemma mbind_eqvt:
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 613
fixes c::"'a::pt option"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 614
shows "(p \<bullet> (c \<guillemotright>= f)) = ((p \<bullet> c) \<guillemotright>= (p \<bullet> f))"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 615
apply(cases c)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 616
apply(simp_all)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 617
apply(perm_simp)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 618
apply(rule refl)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 619
done
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 620
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 621
lemma mbind_eqvt_raw[eqvt_raw]:
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 622
shows "(p \<bullet> option_case) \<equiv> option_case"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 623
apply(rule eq_reflection)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 624
apply(rule ext)+
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 625
apply(case_tac xb)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 626
apply(simp_all)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 627
apply(rule_tac p="-p" in permute_boolE)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 628
apply(perm_simp add: permute_minus_cancel)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 629
apply(simp)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 630
apply(rule_tac p="-p" in permute_boolE)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 631
apply(perm_simp add: permute_minus_cancel)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 632
apply(simp)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 633
done
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 634
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 635
fun
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 636
index :: "atom list \<Rightarrow> nat \<Rightarrow> atom \<Rightarrow> nat option"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 637
where
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 638
"index [] n x = None"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 639
| "index (y # ys) n x = (if x = y then (Some n) else (index ys (n + 1) x))"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 640
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 641
lemma [eqvt]:
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 642
shows "(p \<bullet> index xs n x) = index (p \<bullet> xs) (p \<bullet> n) (p \<bullet> x)"
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 643
apply(induct xs arbitrary: n)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 644
apply(simp_all add: permute_pure)
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 645
done
e3f8673085b1
added a translation function from lambda-terms to deBruijn terms (equivariance fails at the moment)
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 646
2841
+ − 647
lemma supp_subst:
+ − 648
"supp (t[x ::= s]) \<subseteq> supp t \<union> supp s"
+ − 649
by (induct t x s rule: subst.induct) (auto simp add: lam.supp)
+ − 650
+ − 651
lemma var_fresh_subst:
+ − 652
"atom x \<sharp> s \<Longrightarrow> atom x \<sharp> (t[x ::= s])"
+ − 653
by (induct t x s rule: subst.induct) (auto simp add: lam.supp lam.fresh fresh_at_base)
+ − 654
2834
+ − 655
(* function that evaluates a lambda term *)
+ − 656
nominal_primrec
+ − 657
eval :: "lam \<Rightarrow> lam" and
2860
+ − 658
apply_subst :: "lam \<Rightarrow> lam \<Rightarrow> lam"
2834
+ − 659
where
+ − 660
"eval (Var x) = Var x"
+ − 661
| "eval (Lam [x].t) = Lam [x].(eval t)"
2860
+ − 662
| "eval (App t1 t2) = apply_subst (eval t1) (eval t2)"
+ − 663
| "apply_subst (Var x) t2 = App (Var x) t2"
+ − 664
| "apply_subst (App t0 t1) t2 = App (App t0 t1) t2"
+ − 665
| "atom x \<sharp> t2 \<Longrightarrow> apply_subst (Lam [x].t1) t2 = eval (t1[x::= t2])"
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 666
apply(simp add: eval_apply_subst_graph_def eqvt_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 667
apply(rule, perm_simp, rule)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 668
apply(rule TrueI)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 669
apply (case_tac x)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 670
apply (case_tac a rule: lam.exhaust)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 671
apply simp_all[3]
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 672
apply blast
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 673
apply (case_tac b)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 674
apply (rule_tac y="a" and c="ba" in lam.strong_exhaust)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 675
apply simp_all[3]
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 676
apply blast
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 677
apply blast
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 678
apply (simp add: Abs1_eq_iff fresh_star_def)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 679
apply(simp_all)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 680
apply(erule_tac c="()" in Abs_lst1_fcb2)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 681
apply (simp add: Abs_fresh_iff)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 682
apply(simp add: fresh_star_def fresh_Unit)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 683
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 684
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 685
apply(erule conjE)
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 686
apply(erule_tac c="t2a" in Abs_lst1_fcb2')
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 687
apply (erule fresh_eqvt_at)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 688
apply (simp add: finite_supp)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 689
apply (simp add: fresh_Inl var_fresh_subst)
2912
3c363a5070a5
copied all work to Lambda.thy; had to derive a special version of fcb1 for concrete atom
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 690
apply(simp add: fresh_star_def)
2902
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 691
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq subst_eqvt)
9c3f6a4d95d4
another change to the fcb2; this is needed in order to get all proofs through in Lambda.thy
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 692
apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq subst_eqvt)
2860
+ − 693
done
+ − 694
+ − 695
+ − 696
(* a small test
+ − 697
termination sorry
2845
+ − 698
2860
+ − 699
lemma
+ − 700
assumes "x \<noteq> y"
+ − 701
shows "eval (App (Lam [x].App (Var x) (Var x)) (Var y)) = App (Var y) (Var y)"
+ − 702
using assms
+ − 703
apply(simp add: lam.supp fresh_def supp_at_base)
+ − 704
done
+ − 705
*)
+ − 706
2852
+ − 707
+ − 708
text {* TODO: eqvt_at for the other side *}
+ − 709
nominal_primrec q where
+ − 710
"atom c \<sharp> (x, M) \<Longrightarrow> q (Lam [x]. M) (N :: lam) = Lam [x]. (Lam [c]. (App M (q (Var c) N)))"
+ − 711
| "q (Var x) N = Var x"
+ − 712
| "q (App l r) N = App l r"
+ − 713
unfolding eqvt_def q_graph_def
+ − 714
apply (rule, perm_simp, rule)
+ − 715
apply (rule TrueI)
+ − 716
apply (case_tac x)
+ − 717
apply (rule_tac y="a" in lam.exhaust)
+ − 718
apply simp_all
+ − 719
apply blast
+ − 720
apply blast
+ − 721
apply (rule_tac x="(name, lam)" and ?'a="name" in obtain_fresh)
+ − 722
apply blast
+ − 723
apply clarify
+ − 724
apply (rule_tac x="(x, xa, M, Ma, c, ca, Na)" and ?'a="name" in obtain_fresh)
+ − 725
apply (subgoal_tac "eqvt_at q_sumC (Var ca, Na)") --"Could come from nominal_function?"
+ − 726
apply (subgoal_tac "Lam [c]. App M (q_sumC (Var c, Na)) = Lam [a]. App M (q_sumC (Var a, Na))")
+ − 727
apply (subgoal_tac "Lam [ca]. App Ma (q_sumC (Var ca, Na)) = Lam [a]. App Ma (q_sumC (Var a, Na))")
+ − 728
apply (simp only:)
+ − 729
apply (erule Abs_lst1_fcb)
+ − 730
oops
+ − 731
2846
+ − 732
text {* Working Examples *}
+ − 733
+ − 734
nominal_primrec
+ − 735
map_term :: "(lam \<Rightarrow> lam) \<Rightarrow> lam \<Rightarrow> lam"
+ − 736
where
+ − 737
"eqvt f \<Longrightarrow> map_term f (Var x) = f (Var x)"
+ − 738
| "eqvt f \<Longrightarrow> map_term f (App t1 t2) = App (f t1) (f t2)"
+ − 739
| "eqvt f \<Longrightarrow> map_term f (Lam [x].t) = Lam [x].(f t)"
+ − 740
| "\<not>eqvt f \<Longrightarrow> map_term f t = t"
+ − 741
apply (simp add: eqvt_def map_term_graph_def)
+ − 742
apply (rule, perm_simp, rule)
+ − 743
apply(rule TrueI)
+ − 744
apply (case_tac x, case_tac "eqvt a", case_tac b rule: lam.exhaust)
+ − 745
apply auto
+ − 746
apply (erule Abs_lst1_fcb)
+ − 747
apply (simp_all add: Abs_fresh_iff fresh_fun_eqvt_app)
+ − 748
apply (simp add: eqvt_def permute_fun_app_eq)
+ − 749
done
+ − 750
+ − 751
termination
2858
de6b601c8d3d
added size-lemmas to simplifier; as a result termination can be proved by the standard lexicographic_order method
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 752
by lexicographic_order
2846
+ − 753
+ − 754
nominal_primrec
+ − 755
trans2 :: "lam \<Rightarrow> atom list \<Rightarrow> db option"
+ − 756
where
+ − 757
"trans2 (Var x) xs = (index xs 0 (atom x) \<guillemotright>= (\<lambda>n. Some (DBVar n)))"
+ − 758
| "trans2 (App t1 t2) xs = ((trans2 t1 xs) \<guillemotright>= (\<lambda>db1. (trans2 t2 xs) \<guillemotright>= (\<lambda>db2. Some (DBApp db1 db2))))"
+ − 759
| "trans2 (Lam [x].t) xs = (trans2 t (atom x # xs) \<guillemotright>= (\<lambda>db. Some (DBLam db)))"
+ − 760
oops
+ − 761
+ − 762
nominal_primrec
+ − 763
CPS :: "lam \<Rightarrow> (lam \<Rightarrow> lam) \<Rightarrow> lam"
+ − 764
where
+ − 765
"CPS (Var x) k = Var x"
+ − 766
| "CPS (App M N) k = CPS M (\<lambda>m. CPS N (\<lambda>n. n))"
+ − 767
oops
+ − 768
+ − 769
consts b :: name
+ − 770
nominal_primrec
+ − 771
Z :: "lam \<Rightarrow> (lam \<Rightarrow> lam) \<Rightarrow> lam"
+ − 772
where
+ − 773
"Z (App M N) k = Z M (%m. (Z N (%n.(App m n))))"
+ − 774
| "Z (App M N) k = Z M (%m. (Z N (%n.(App (App m n) (Abs b (k (Var b)))))))"
+ − 775
unfolding eqvt_def Z_graph_def
+ − 776
apply (rule, perm_simp, rule)
+ − 777
oops
2789
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 778
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 779
text {* tests of functions containing if and case *}
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 780
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 781
consts P :: "lam \<Rightarrow> bool"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 782
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 783
nominal_primrec
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 784
A :: "lam => lam"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 785
where
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 786
"A (App M N) = (if (True \<or> P M) then (A M) else (A N))"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 787
| "A (Var x) = (Var x)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 788
| "A (App M N) = (if True then M else A N)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 789
oops
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 790
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 791
nominal_primrec
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 792
C :: "lam => lam"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 793
where
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 794
"C (App M N) = (case (True \<or> P M) of True \<Rightarrow> (A M) | False \<Rightarrow> (A N))"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 795
| "C (Var x) = (Var x)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 796
| "C (App M N) = (if True then M else C N)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 797
oops
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 798
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 799
nominal_primrec
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 800
A :: "lam => lam"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 801
where
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 802
"A (Lam [x].M) = (Lam [x].M)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 803
| "A (Var x) = (Var x)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 804
| "A (App M N) = (if True then M else A N)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 805
oops
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 806
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 807
nominal_primrec
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 808
B :: "lam => lam"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 809
where
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 810
"B (Lam [x].M) = (Lam [x].M)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 811
| "B (Var x) = (Var x)"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 812
| "B (App M N) = (if True then M else (B N))"
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 813
unfolding eqvt_def
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 814
unfolding B_graph_def
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 815
apply(perm_simp)
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 816
apply(rule allI)
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 817
apply(rule refl)
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 818
oops
32979078bfe9
functions involving if and case do not throw exceptions anymore; but eqvt_at assumption has now a precondition
Christian Urban <urbanc@in.tum.de>
diff
changeset
+ − 819
1594
+ − 820
end
+ − 821
+ − 822
+ − 823