Nominal/Ex/Beta.thy
author Christian Urban <urbanc@in.tum.de>
Thu, 15 Dec 2011 16:20:11 +0000
changeset 3064 ade2f8fcf8e8
parent 3054 da0fccee125c
child 3066 da60dc911055
permissions -rw-r--r--
a bit more on alpha-beta-equated terms
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3048
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory Beta
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
imports 
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
  "../Nominal2"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
begin
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
atom_decl name
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
3064
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
     9
3048
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
nominal_datatype lam =
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
  Var "name"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
| App "lam" "lam"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
| Lam x::"name" l::"lam"  binds x in l ("Lam [_]. _" [100, 100] 100)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
section {* capture-avoiding substitution *}
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
nominal_primrec
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
  subst :: "lam \<Rightarrow> name \<Rightarrow> lam \<Rightarrow> lam"  ("_ [_ ::= _]" [90, 90, 90] 90)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
where
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
  "(Var x)[y ::= s] = (if x = y then s else (Var x))"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
| "(App t1 t2)[y ::= s] = App (t1[y ::= s]) (t2[y ::= s])"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
| "\<lbrakk>atom x \<sharp> y; atom x \<sharp> s\<rbrakk> \<Longrightarrow> (Lam [x]. t)[y ::= s] = Lam [x].(t[y ::= s])"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
  unfolding eqvt_def subst_graph_def
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
  apply (rule, perm_simp, rule)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
  apply(rule TrueI)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
  apply(auto simp add: lam.distinct lam.eq_iff)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
  apply(rule_tac y="a" and c="(aa, b)" in lam.strong_exhaust)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
  apply(blast)+
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
  apply(simp_all add: fresh_star_def fresh_Pair_elim)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
  apply (erule_tac c="(ya,sa)" in Abs_lst1_fcb2)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
  apply(simp_all add: Abs_fresh_iff)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
  apply(simp add: fresh_star_def fresh_Pair)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
  apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
  apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
done
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
termination (eqvt)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
  by lexicographic_order
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
lemma forget:
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
  shows "atom x \<sharp> t \<Longrightarrow> t[x ::= s] = t"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
  by (nominal_induct t avoiding: x s rule: lam.strong_induct)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
     (auto simp add: lam.fresh fresh_at_base)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
lemma fresh_fact:
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
  fixes z::"name"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
  assumes a: "atom z \<sharp> s"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
      and b: "z = y \<or> atom z \<sharp> t"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
  shows "atom z \<sharp> t[y ::= s]"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
  using a b
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
  by (nominal_induct t avoiding: z y s rule: lam.strong_induct)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
     (auto simp add: lam.fresh fresh_at_base)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
lemma substitution_lemma:  
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
  assumes a: "x \<noteq> y" "atom x \<sharp> u"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
  shows "t[x ::= s][y ::= u] = t[y ::= u][x ::= s[y ::= u]]"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
using a 
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
by (nominal_induct t avoiding: x y s u rule: lam.strong_induct)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
   (auto simp add: fresh_fact forget)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
inductive
3064
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    62
  beta :: "lam \<Rightarrow> lam \<Rightarrow> bool" ("_ \<rightarrow> _")
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    63
where
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    64
  beta_beta:  "atom x \<sharp> s \<Longrightarrow> App (Lam [x].t) s \<rightarrow> t[x ::= s]"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    65
| beta_Lam:   "t \<rightarrow> s \<Longrightarrow> Lam [x].t \<rightarrow> Lam [x].s"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    66
| beta_App1:  "t \<rightarrow> s \<Longrightarrow> App t u \<rightarrow> App s u"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    67
| beta_App2:  "t \<rightarrow> s \<Longrightarrow> App u t \<rightarrow> App u s"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    68
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    69
equivariance beta
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    70
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    71
nominal_inductive beta
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    72
  avoids beta_beta: "x" 
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    73
       | beta_Lam: "x"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    74
by (simp_all add: fresh_star_def fresh_Pair lam.fresh fresh_fact)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    75
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    76
inductive
3048
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
  equ :: "lam \<Rightarrow> lam \<Rightarrow> bool" ("_ \<approx> _")
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
where
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
  equ_beta:  "atom x \<sharp> s \<Longrightarrow> App (Lam [x].t) s \<approx> t[x ::= s]"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
| equ_refl:  "t \<approx> t"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
| equ_sym:   "t \<approx> s \<Longrightarrow> s \<approx> t"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
| equ_trans: "\<lbrakk>t1 \<approx> t2; t2 \<approx> t3\<rbrakk> \<Longrightarrow> t1 \<approx> t3"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
| equ_Lam:   "t \<approx> s \<Longrightarrow> Lam [x].t \<approx> Lam [x].s"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
| equ_App1:  "t \<approx> s \<Longrightarrow> App t u \<approx> App s u"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
| equ_App2:  "t \<approx> s \<Longrightarrow> App u t \<approx> App u s"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
equivariance equ
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
nominal_inductive equ
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
  avoids equ_beta: "x" 
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
       | equ_Lam: "x"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
by (simp_all add: fresh_star_def fresh_Pair lam.fresh fresh_fact)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
3064
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    94
inductive
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    95
  equ2 :: "lam \<Rightarrow> lam \<Rightarrow> bool" ("_ \<approx>2 _")
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    96
where
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    97
  equ2_beta1:  "\<lbrakk>atom x \<sharp> (t2, s2); s1 \<approx>2 t1; t2 \<approx>2  s2\<rbrakk> \<Longrightarrow> App (Lam [x].t1) t2 \<approx>2 s1[x ::= s2]"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    98
| equ2_beta2:  "\<lbrakk>atom x \<sharp> (t2, s2); s1 \<approx>2 t1; t2 \<approx>2  s2\<rbrakk> \<Longrightarrow> s1[x ::= s2] \<approx>2 App (Lam [x].t1) t2"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
    99
| equ2_Var:   "Var x \<approx>2 Var x"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   100
| equ2_Lam:   "t \<approx>2 s \<Longrightarrow> Lam [x].t \<approx>2 Lam [x].s"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   101
| equ2_App:   "\<lbrakk>t1 \<approx>2 s1; t2 \<approx>2 s2\<rbrakk> \<Longrightarrow> App t1 t2 \<approx>2 App s1 s2"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   102
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   103
equivariance equ2
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   104
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   105
nominal_inductive equ2
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   106
  avoids equ2_beta1: "x"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   107
       | equ2_beta2: "x" 
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   108
       | equ2_Lam: "x"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   109
by (simp_all add: fresh_star_def fresh_Pair lam.fresh fresh_fact)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   110
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   111
lemma equ2_refl:
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   112
  fixes t::"lam"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   113
  shows "t \<approx>2 t"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   114
apply(induct t rule: lam.induct)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   115
apply(auto intro: equ2.intros)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   116
done
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   117
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   118
lemma equ2_symm:
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   119
  fixes t s::"lam"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   120
  assumes "t \<approx>2 s"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   121
  shows "s \<approx>2 t"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   122
using assms
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   123
apply(induct)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   124
apply(auto intro: equ2.intros)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   125
done
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   126
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   127
lemma equ2_trans:
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   128
  fixes t1 t2 t3::"lam"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   129
  assumes "t1 \<approx>2 t2" "t2 \<approx>2 t3"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   130
  shows "t1 \<approx>2 t3"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   131
using assms
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   132
apply(nominal_induct t1 t2 avoiding: t3 rule: equ2.strong_induct)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   133
defer
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   134
defer
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   135
apply(erule equ2.cases)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   136
apply(auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   137
apply(rule equ2_beta2)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   138
apply(simp)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   139
apply(simp)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   140
apply(simp)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   141
apply(rule equ2_refl)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   142
defer
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   143
apply(rotate_tac 4)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   144
apply(erule equ2.cases)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   145
apply(auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   146
oops
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   147
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   148
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   149
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   150
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   151
3048
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
lemma [quot_respect]:
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
  shows "(op = ===> equ) Var Var"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
  and   "(equ ===> equ ===> equ) App App"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
  and   "(op = ===> equ ===> equ) Beta.Lam Beta.Lam"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
unfolding fun_rel_def
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
by (auto intro: equ.intros)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
lemma equ_subst1:
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
  assumes "t \<approx> s"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
  shows "t[x ::= u] \<approx> s[x ::= u]"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
using assms
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
apply(nominal_induct avoiding: x u rule: equ.strong_induct)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
apply(simp)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
apply(rule equ_trans)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
apply(rule equ_beta)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
apply(simp add: fresh_fact)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
apply(subst (2) substitution_lemma)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
apply(simp add: fresh_at_base)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
apply(simp)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
apply(rule equ_refl)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
apply(rule equ_refl)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
apply(auto intro: equ_sym)[1]
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
apply(blast intro: equ_trans)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
apply(simp add: equ_Lam)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
apply(simp add: equ_App1)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
apply(simp add: equ_App2)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
done
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
lemma equ_subst2:
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
  assumes "t \<approx> s"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
  shows "u[x ::= t] \<approx> u[x ::= s]"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
using assms
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
apply(nominal_induct u avoiding: x t s rule: lam.strong_induct)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
apply(simp add: equ_refl)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
apply(simp)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
apply(smt equ_App1 equ_App2 equ_trans)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
apply(simp)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
apply(metis equ_Lam)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
done
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
lemma [quot_respect]:
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
  shows "(equ ===> op = ===> equ ===> equ) subst subst"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
unfolding fun_rel_def
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
by (metis equ_subst1 equ_subst2 equ_trans)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
lemma [quot_respect]:
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
  shows "(op = ===> equ ===> equ) permute permute"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
unfolding fun_rel_def
3064
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   200
by (auto intro: eqvts)
3048
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
quotient_type qlam = lam / equ
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
apply(rule equivpI)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
apply(rule reflpI)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
apply(simp add: equ_refl)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
apply(rule sympI)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
apply(simp add: equ_sym)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   208
apply(rule transpI)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
apply(auto intro: equ_trans)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
done
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   212
quotient_definition "QVar::name \<Rightarrow> qlam" is Var
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
quotient_definition "QApp::qlam \<Rightarrow> qlam \<Rightarrow> qlam" is App
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
quotient_definition QLam ("QLam [_]._") 
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   215
  where "QLam::name \<Rightarrow> qlam \<Rightarrow> qlam" is Beta.Lam
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
lemmas qlam_strong_induct = lam.strong_induct[quot_lifted]
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   218
lemmas qlam_induct = lam.induct[quot_lifted]
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   220
instantiation qlam :: pt
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
begin
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   222
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   223
quotient_definition "permute_qlam::perm \<Rightarrow> qlam \<Rightarrow> qlam" 
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   224
  is "permute::perm \<Rightarrow> lam \<Rightarrow> lam"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   225
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   226
instance
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   227
apply default
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   228
apply(descending)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   229
apply(simp)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   230
apply(rule equ_refl)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   231
apply(descending)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   232
apply(simp)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   233
apply(rule equ_refl)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   234
done
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   235
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   236
end
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   237
3064
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   238
lemma qlam_perm[simp]:
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   239
  shows "p \<bullet> (QVar x) = QVar (p \<bullet> x)"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   240
  and "p \<bullet> (QApp t s) = QApp (p \<bullet> t) (p \<bullet> s)"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   241
  and "p \<bullet> (QLam [x].t) = QLam [p \<bullet> x].(p \<bullet> t)"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   242
apply(descending)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   243
apply(simp add: equ_refl)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   244
apply(descending)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   245
apply(simp add: equ_refl)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   246
apply(descending)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   247
apply(simp add: equ_refl)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   248
done
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   249
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   250
lemma qlam_supports:
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   251
  shows "{atom x} supports (QVar x)"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   252
  and   "supp (t, s) supports (QApp t s)"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   253
  and   "supp (x, t) supports (QLam [x].t)"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   254
unfolding supports_def fresh_def[symmetric]
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   255
by (auto simp add: swap_fresh_fresh)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   256
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   257
lemma qlam_fs:
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   258
  fixes t::"qlam"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   259
  shows "finite (supp t)"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   260
apply(induct t rule: qlam_induct)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   261
apply(rule supports_finite)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   262
apply(rule qlam_supports)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   263
apply(simp)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   264
apply(rule supports_finite)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   265
apply(rule qlam_supports)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   266
apply(simp add: supp_Pair)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   267
apply(rule supports_finite)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   268
apply(rule qlam_supports)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   269
apply(simp add: supp_Pair finite_supp)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   270
done
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   271
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   272
instantiation qlam :: fs
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   273
begin
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   274
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   275
instance
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   276
apply(default)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   277
apply(rule qlam_fs)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   278
done
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   279
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   280
end
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   281
3054
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   282
quotient_definition subst_qlam ("_[_ ::q= _]")
3064
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   283
  where "subst_qlam::qlam \<Rightarrow> name \<Rightarrow> qlam \<Rightarrow> qlam" is subst  
3054
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   284
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   285
lemma
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   286
  "(QVar x)[y ::q= s] = (if x = y then s else (QVar x))"
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   287
apply(descending)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   288
apply(simp)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   289
apply(auto intro: equ_refl)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   290
done
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   291
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   292
lemma
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   293
  "(QApp t1 t2)[y ::q= s] = QApp (t1[y ::q= s]) (t2[y ::q= s])"
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   294
apply(descending)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   295
apply(simp)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   296
apply(rule equ_refl)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   297
done
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   298
3064
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   299
definition
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   300
  "Supp t = \<Inter>{supp s | s. s \<approx> t}"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   301
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   302
lemma [quot_respect]:
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   303
  shows "(equ ===> op=) Supp Supp"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   304
unfolding fun_rel_def
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   305
unfolding Supp_def
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   306
apply(rule allI)+
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   307
apply(rule impI)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   308
apply(rule_tac f="Inter" in arg_cong)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   309
apply(auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   310
apply (metis equ_trans)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   311
by (metis equivp_def qlam_equivp)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   312
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   313
quotient_definition "supp_qlam::qlam \<Rightarrow> atom set" 
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   314
  is "Supp::lam \<Rightarrow> atom set"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   315
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   316
lemma Supp_supp:
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   317
  "Supp t \<subseteq> supp t"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   318
unfolding Supp_def
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   319
apply(auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   320
apply(drule_tac x="supp t" in spec)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   321
apply(auto simp add: equ_refl)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   322
done
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   323
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   324
lemma Supp_Lam:
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   325
  "atom a \<notin> Supp (Lam [a].t)"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   326
proof -
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   327
  have "atom a \<notin> supp (Lam [a].t)" by (simp add: lam.supp)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   328
  then show ?thesis using Supp_supp
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   329
    by blast
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   330
qed
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   331
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   332
lemmas s = Supp_Lam[quot_lifted]
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   333
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   334
definition
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   335
  ssupp :: "atom set \<Rightarrow> 'a::pt \<Rightarrow> bool" ("_ ssupp _")
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   336
where
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   337
  "A ssupp x \<equiv> \<forall>p. (\<forall>a \<in> A. (p \<bullet> a) = a) \<longleftrightarrow> (p \<bullet> x) = x"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   338
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   339
lemma ssupp_supports:
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   340
  "A ssupp x \<Longrightarrow> A supports x"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   341
unfolding ssupp_def supports_def
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   342
apply(rule allI)+
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   343
apply(drule_tac x="(a \<rightleftharpoons> b)" in spec)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   344
apply(auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   345
by (metis swap_atom_simps(3))
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   346
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   347
lemma ssupp_supp:
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   348
  assumes a: "finite A"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   349
  and     b: "A ssupp x"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   350
  shows "supp x = A"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   351
proof -
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   352
  { assume 0: "A - supp x \<noteq> {}"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   353
    then obtain a where 1: "a \<in> A - supp x" by auto
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   354
    obtain a' where *: "a' \<in>  UNIV - A" and **: "sort_of a' = sort_of a"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   355
      by (rule obtain_atom[OF a]) (auto)  
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   356
    have "(a \<rightleftharpoons> a') \<bullet> a = a'" using 1 ** * by (auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   357
    then have w0: "(a \<rightleftharpoons> a') \<bullet> x \<noteq> x"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   358
      using b unfolding ssupp_def 
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   359
      apply -
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   360
      apply(drule_tac x="(a \<rightleftharpoons> a')" in spec)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   361
      apply(auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   362
      using 1 *
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   363
      apply(auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   364
      done
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   365
    have w1: "a \<sharp> x" unfolding fresh_def using 1 by auto 
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   366
    have w2: "a' \<sharp> x" using *
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   367
      apply(rule_tac supports_fresh)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   368
      apply(rule ssupp_supports)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   369
      apply(rule b)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   370
      apply(rule a)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   371
      apply(auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   372
      done
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   373
    have "False" using w0 w1 w2 by (simp add: swap_fresh_fresh)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   374
    then have "supp x = A" by simp }
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   375
  moreover
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   376
  { assume "A - supp x = {}"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   377
    moreover
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   378
    have "supp x \<subseteq> A"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   379
      apply(rule supp_is_subset)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   380
      apply(rule ssupp_supports)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   381
      apply(rule b)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   382
      apply(rule a)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   383
      done
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   384
    ultimately have "supp x = A"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   385
      by blast
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   386
  }
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   387
  ultimately show "supp x = A" by blast
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   388
qed
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   389
      
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   390
3054
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   391
lemma
3064
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   392
  "(supp x) ssupp x"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   393
unfolding ssupp_def
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   394
apply(auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   395
apply(rule supp_perm_eq)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   396
apply(simp add: fresh_star_def)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   397
apply(auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   398
apply(simp add: fresh_perm)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   399
apply(simp add: fresh_perm[symmetric])
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   400
(*Tzevelekos 2008, section 2.1.2 property 2.5*)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   401
oops
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   402
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   403
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   404
function
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   405
  qsubst :: "qlam \<Rightarrow> name \<Rightarrow> qlam \<Rightarrow> qlam"  ("_ [_ ::qq= _]" [90, 90, 90] 90)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   406
where
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   407
  "(QVar x)[y ::qq= s] = (if x = y then s else (QVar x))"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   408
| "(QApp t1 t2)[y ::qq= s] = QApp (t1[y ::qq= s]) (t2[y ::qq= s])"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   409
| "\<lbrakk>atom x \<sharp> y; atom x \<sharp> s\<rbrakk> \<Longrightarrow> (QLam [x]. t)[y ::qq= s] = QLam [x].(t[y ::qq= s])"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   410
apply(simp_all add:)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   411
oops
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   412
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   413
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   414
lemma
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   415
  assumes a: "Lam [x].t \<approx> s"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   416
  shows "\<exists>x' t'. s = Lam [x']. t' \<and> t \<approx> t'"
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   417
using a
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   418
apply(induct s rule:lam.induct)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   419
apply(erule equ.cases)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   420
apply(auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   421
apply(erule equ.cases)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   422
apply(auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   423
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   424
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   425
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   426
lemma
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   427
  "atom x \<sharp> y \<Longrightarrow> atom x \<notin> supp_qlam s \<Longrightarrow> (QLam [x].t)[y ::q= s] = QLam [x].(t[y ::q= s])"
3054
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   428
apply(descending)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   429
oops
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   430
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   431
3048
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   432
lemma [eqvt]: "(p \<bullet> abs_qlam t) = abs_qlam (p \<bullet> t)"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   433
 apply (subst fun_cong[OF fun_cong[OF meta_eq_to_obj_eq[OF permute_qlam_def]], of p, simplified])
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   434
 apply (subst Quotient_rel[OF Quotient_qlam, simplified equivp_reflp[OF qlam_equivp], simplified])
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   435
 by (metis Quotient_qlam equ_refl eqvt rep_abs_rsp_left)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   436
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   437
lemma supports_abs_qlam:
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   438
  "(supp t) supports (abs_qlam t)"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   439
unfolding supports_def
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   440
unfolding fresh_def[symmetric]
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   441
apply(auto)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   442
apply(perm_simp)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   443
apply(simp add: swap_fresh_fresh)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   444
done
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   445
3049
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   446
lemma rep_qlam_inverse:
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   447
  "abs_qlam (rep_qlam t) = t"
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   448
by (metis Quotient_abs_rep Quotient_qlam)
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   449
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   450
lemma supports_rep_qlam:
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   451
  "supp (rep_qlam t) supports t"
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   452
apply(subst (2) rep_qlam_inverse[symmetric])
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   453
apply(rule supports_abs_qlam)
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   454
done
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   455
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   456
 lemma supports_qvar:
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   457
  "{atom x} supports (QVar x)"
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   458
apply(subgoal_tac "supp (Var x) supports (abs_qlam (Var x))")
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   459
apply(simp add: lam.supp supp_at_base)
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   460
defer
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   461
apply(rule supports_abs_qlam)
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   462
apply(simp add: QVar_def)
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   463
done
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   464
3048
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   465
section {* Supp *}
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   466
3054
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   467
lemma s:
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   468
  assumes "s \<approx> t"
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   469
  shows "a \<sharp> (abs_qlam s) \<longleftrightarrow> a \<sharp> (abs_qlam t)"
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   470
using assms
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   471
by (metis Quotient_qlam Quotient_rel_abs)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   472
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   473
lemma ss:
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   474
  "Supp t supports (abs_qlam t)"
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   475
apply(simp only: supports_def)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   476
apply(rule allI)+
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   477
apply(rule impI)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   478
apply(rule swap_fresh_fresh)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   479
apply(drule conjunct1)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   480
apply(auto)[1]
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   481
apply(simp add: Supp_def)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   482
apply(auto)[1]
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   483
apply(simp add: s[symmetric])
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   484
apply(rule supports_fresh)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   485
apply(rule supports_abs_qlam)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   486
apply(simp add: finite_supp)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   487
apply(simp)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   488
apply(drule conjunct2)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   489
apply(auto)[1]
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   490
apply(simp add: Supp_def)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   491
apply(auto)[1]
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   492
apply(simp add: s[symmetric])
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   493
apply(rule supports_fresh)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   494
apply(rule supports_abs_qlam)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   495
apply(simp add: finite_supp)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   496
apply(simp)
da0fccee125c a few more experiments with alpha-beta
Christian Urban <urbanc@in.tum.de>
parents: 3049
diff changeset
   497
done
3048
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   498
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   499
lemma
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   500
  fixes t::"qlam"
3049
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   501
  shows "(supp x) supports (QVar x)"
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   502
apply(rule_tac x="QVar x" in Abs_qlam_cases)
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   503
apply(auto)
83744806b660 proved supp for QVar; QApp still fails - probably stronger condistion is needed
Christian Urban <urbanc@in.tum.de>
parents: 3048
diff changeset
   504
thm QVar_def
3048
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   505
oops
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   506
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   507
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   508
 
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   509
section {* Size *}
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   510
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   511
definition
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   512
  "Size t = Least {size s | s. s \<approx> t}" 
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   513
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   514
lemma [quot_respect]:
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   515
  shows "(equ ===> op=) Size Size"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   516
unfolding fun_rel_def
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   517
unfolding Size_def
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   518
apply(auto)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   519
apply(rule_tac f="Least" in arg_cong)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   520
apply(auto)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   521
apply (metis equ_trans)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   522
by (metis equivp_def qlam_equivp)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   523
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   524
instantiation qlam :: size
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   525
begin
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   526
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   527
quotient_definition "size_qlam::qlam \<Rightarrow> nat" 
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   528
  is "Size::lam \<Rightarrow> nat"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   529
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   530
instance
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   531
apply default
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   532
done
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   533
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   534
end
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   535
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   536
thm lam.size
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   537
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   538
lemma
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   539
  "size (QVar x) = 0"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   540
apply(descending)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   541
apply(simp add: Size_def)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   542
apply(rule Least_equality)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   543
apply(auto)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   544
apply(simp add: Collect_def)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   545
apply(rule_tac x="Var x" in exI)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   546
apply(auto intro: equ_refl)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   547
done
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   548
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   549
lemma
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   550
  "size (QLam [x].t) = Suc (size t)"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   551
apply(descending)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   552
apply(simp add: Size_def)
3064
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   553
thm Least_Suc
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   554
apply(rule trans)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   555
apply(rule_tac n="Suc (size t)" in Least_Suc)
3048
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   556
apply(simp add: Collect_def)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   557
apply(rule_tac x="Lam [x].t" in exI)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   558
apply(auto intro: equ_refl)[1]
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   559
apply(simp add: Collect_def)
3064
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   560
apply(auto)
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   561
defer
ade2f8fcf8e8 a bit more on alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents: 3054
diff changeset
   562
apply(simp add: Collect_def)
3048
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   563
apply(rule_tac x="t" in exI)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   564
apply(auto intro: equ_refl)[1]
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   565
apply(simp add: Collect_def)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   566
defer
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   567
apply(simp add: Collect_def)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   568
apply(auto)[1]
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   569
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   570
apply(auto)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   571
done
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   572
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   573
term rep_qlam
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   574
lemmas qlam_size_def = Size_def[quot_lifted]
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   575
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   576
lemma [quot_preserve]:
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   577
  assumes "Quotient equ Abs Rep"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   578
  shows "(id ---> Rep ---> id) fresh = fresh"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   579
using assms
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   580
unfolding Quotient_def
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   581
apply(simp add: map_fun_def)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   582
apply(simp add: comp_def fun_eq_iff)
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   583
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   584
sorry
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   585
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   586
lemma [simp]:
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   587
  shows "(QVar x)[y :::= s] = (if x = y then s else (QVar x))"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   588
  and "(QApp t1 t2)[y :::= s] = QApp (t1[y :::= s]) (t2[y :::= s])"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   589
  and "\<lbrakk>atom x \<sharp> y; atom x \<sharp> s\<rbrakk> \<Longrightarrow> (QLam [x]. t)[y :::= s] = QLam [x].(t[y :::= s])"
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   590
apply(lifting subst.simps(1))
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   591
apply(lifting subst.simps(2))
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   592
apply(lifting subst.simps(3))
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   593
done
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   594
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   595
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   596
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   597
end
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   598
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   599
fc4b3e367c86 added initial test about alpha-beta-equated terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   600