Nominal/Ex/BetaCR.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Tue, 20 Dec 2011 16:49:03 +0900
changeset 3081 660a4f5adee8
parent 3080 9253984db291
child 3085 25d813c5042d
permissions -rw-r--r--
Remove 'HERE1' and 'HERE3'.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3078
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
theory BetaCR
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     2
imports 
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
  "../Nominal2"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
begin
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
atom_decl name
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
nominal_datatype lam =
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
  Var "name"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
| App "lam" "lam"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
| Lam x::"name" l::"lam"  binds x in l ("Lam [_]. _" [100, 100] 100)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
nominal_primrec
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
  subst :: "lam \<Rightarrow> name \<Rightarrow> lam \<Rightarrow> lam"  ("_ [_ ::= _]" [90, 90, 90] 90)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
where
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
  "(Var x)[y ::= s] = (if x = y then s else (Var x))"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
| "(App t1 t2)[y ::= s] = App (t1[y ::= s]) (t2[y ::= s])"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
| "atom x \<sharp> (y, s) \<Longrightarrow> (Lam [x]. t)[y ::= s] = Lam [x].(t[y ::= s])"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
  unfolding eqvt_def subst_graph_def
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
  apply (rule, perm_simp, rule)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
  apply(rule TrueI)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    22
  apply(auto simp add: lam.distinct lam.eq_iff)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    23
  apply(rule_tac y="a" and c="(aa, b)" in lam.strong_exhaust)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
  apply(blast)+
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
  apply(simp_all add: fresh_star_def fresh_Pair_elim)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
  apply (erule_tac c="(ya,sa)" in Abs_lst1_fcb2)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
  apply(simp_all add: Abs_fresh_iff)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
  apply(simp add: fresh_star_def fresh_Pair)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
  apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    30
  apply(simp add: eqvt_at_def atom_eqvt fresh_star_Pair perm_supp_eq)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
done
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
termination (eqvt)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    34
  by lexicographic_order
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    35
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
lemma fresh_fact:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
  fixes z::"name"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    38
  assumes a: "atom z \<sharp> s"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
      and b: "z = y \<or> atom z \<sharp> t"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
  shows "atom z \<sharp> t[y ::= s]"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
  using a b
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    42
  by (nominal_induct t avoiding: z y s rule: lam.strong_induct)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    43
      (auto simp add: lam.fresh fresh_at_base)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
inductive 
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    46
  beta :: "lam \<Rightarrow> lam \<Rightarrow> bool" (" _ \<longrightarrow>b _" [80,80] 80)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    47
where
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    48
  b1[intro]: "t1 \<longrightarrow>b t2 \<Longrightarrow> App t1 s \<longrightarrow>b App t2 s"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    49
| b2[intro]: "s1 \<longrightarrow>b s2 \<Longrightarrow> App t s1 \<longrightarrow>b App t s2"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
| b3[intro]: "t1 \<longrightarrow>b t2 \<Longrightarrow> Lam [x]. t1 \<longrightarrow>b Lam [x]. t2"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    51
| b4[intro]: "atom x \<sharp> s \<Longrightarrow> App (Lam [x]. t) s \<longrightarrow>b t[x ::= s]"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53
equivariance beta
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    55
nominal_inductive beta
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    56
  avoids b3: x
3081
660a4f5adee8 Remove 'HERE1' and 'HERE3'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3080
diff changeset
    57
       | b4: x
3078
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    58
  by (simp_all add: fresh_star_def fresh_Pair lam.fresh fresh_fact)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    59
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    60
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    61
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    62
(* The combination should look like this: *)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    63
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    64
inductive
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    65
  beta_star :: "lam \<Rightarrow> lam \<Rightarrow> bool" (" _ \<longrightarrow>b* _" [80,80] 80)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    66
where
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    67
  bs1[intro, simp]: "M \<longrightarrow>b* M"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    68
| bs2[intro]: "\<lbrakk>M1\<longrightarrow>b* M2; M2 \<longrightarrow>b M3\<rbrakk> \<Longrightarrow> M1 \<longrightarrow>b* M3"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    69
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    70
lemma beta_star_trans:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    71
  assumes "A \<longrightarrow>b* B"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    72
  and     "B \<longrightarrow>b* C"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    73
  shows   "A \<longrightarrow>b* C"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    74
  using assms(2) assms(1)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    75
  by induct auto
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    76
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    77
(* HERE 2: Does not work:*)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    78
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    79
(* equivariance beta_star *)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    80
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    81
(* proved manually below. *)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    82
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    83
lemma eqvt_helper: "x1 \<longrightarrow>b* x2 \<Longrightarrow>  (p \<bullet> x1) \<longrightarrow>b* (p \<bullet> x2)"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    84
  apply (erule beta_star.induct)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    85
  apply auto
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    86
  using eqvt(1) bs2
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    87
  by blast
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    88
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    89
lemma [eqvt]: "p \<bullet> (x1 \<longrightarrow>b* x2) = ((p \<bullet> x1) \<longrightarrow>b* (p \<bullet> x2))"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    90
  apply rule
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    91
  apply (drule permute_boolE)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    92
  apply (erule eqvt_helper)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    93
  apply (intro permute_boolI)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    94
  apply (drule_tac p="-p" in eqvt_helper)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    95
  by simp
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    96
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    97
definition
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    98
  equ :: "lam \<Rightarrow> lam \<Rightarrow> bool" ("_ \<approx> _")
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    99
where
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   100
  "t \<approx> s \<longleftrightarrow> (\<exists>r. t \<longrightarrow>b* r \<and> s \<longrightarrow>b* r)"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   101
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   102
lemma equ_refl:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   103
  shows "t \<approx> t"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   104
  unfolding equ_def by auto
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   105
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   106
lemma equ_sym:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   107
  assumes "t \<approx> s"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   108
  shows "s \<approx> t"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   109
  using assms unfolding equ_def
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   110
  by auto
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   111
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   112
(* can be ported from nominal1 *)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   113
lemma cr:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   114
  assumes "t \<longrightarrow>b* t1" and "t \<longrightarrow>b* t2" shows "\<exists>t3. t1 \<longrightarrow>b* t3 \<and> t2 \<longrightarrow>b* t3"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   115
  sorry
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   116
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   117
lemma equ_trans:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   118
  assumes "A \<approx> B" "B \<approx> C"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   119
  shows "A \<approx> C"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   120
  using assms unfolding equ_def
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   121
proof (elim exE conjE)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   122
  fix D E
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   123
  assume a: "A \<longrightarrow>b* D" "B \<longrightarrow>b* D" "B \<longrightarrow>b* E" "C \<longrightarrow>b* E"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   124
  then obtain F where "D \<longrightarrow>b* F" "E \<longrightarrow>b* F" using cr by blast
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   125
  then have "A \<longrightarrow>b* F \<and> C \<longrightarrow>b* F" using a beta_star_trans by blast
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   126
  then show "\<exists>F. A \<longrightarrow>b* F \<and> C \<longrightarrow>b* F" by blast
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   127
qed
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   128
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   129
lemma App_beta: "A \<longrightarrow>b* B \<Longrightarrow> C \<longrightarrow>b* D \<Longrightarrow> App A C \<longrightarrow>b* App B D"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   130
  apply (erule beta_star.induct)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   131
  apply auto
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   132
  apply (erule beta_star.induct)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   133
  apply auto
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   134
  done
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   135
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   136
lemma Lam_beta: "A \<longrightarrow>b* B \<Longrightarrow> Lam [x]. A \<longrightarrow>b* Lam [x]. B"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   137
  by (erule beta_star.induct) auto
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   138
3080
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   139
lemma Lam_rsp: "A \<approx> B \<Longrightarrow> Lam [x]. A \<approx> Lam [x]. B"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   140
  unfolding equ_def
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   141
  apply auto
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   142
  apply (rule_tac x="Lam [x]. r" in exI)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   143
  apply (auto simp add: Lam_beta)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   144
  done
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   145
3078
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   146
lemma [quot_respect]:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   147
  shows "(op = ===> equ) Var Var"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   148
  and   "(equ ===> equ ===> equ) App App"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   149
  and   "(op = ===> equ ===> equ) BetaCR.Lam BetaCR.Lam"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   150
  unfolding fun_rel_def equ_def
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   151
  apply auto
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   152
  apply (rule_tac x="App r ra" in exI)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   153
  apply (auto simp add: App_beta)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   154
  apply (rule_tac x="Lam [x]. r" in exI)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   155
  apply (auto simp add: Lam_beta)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   156
  done
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   157
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   158
lemma beta_subst1_pre: "B \<longrightarrow>b C \<Longrightarrow> A [x ::= B] \<longrightarrow>b* A [x ::= C]"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   159
  by (nominal_induct A avoiding: x B C rule: lam.strong_induct)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   160
     (auto simp add: App_beta Lam_beta)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   161
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   162
lemma beta_subst1: "B \<longrightarrow>b* C \<Longrightarrow> A [x ::= B] \<longrightarrow>b* A [x ::= C]"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   163
  apply (erule beta_star.induct)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   164
  apply auto
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   165
  apply (subgoal_tac "A [x ::= M2] \<longrightarrow>b* A [x ::= M3]")
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   166
  apply (rotate_tac 1)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   167
  apply (erule beta_star_trans)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   168
  apply assumption
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   169
  apply (simp add: beta_subst1_pre)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   170
  done
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   171
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   172
lemma forget:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   173
  shows "atom x \<sharp> t \<Longrightarrow> t[x ::= s] = t"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   174
  by (nominal_induct t avoiding: x s rule: lam.strong_induct)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   175
     (auto simp add: lam.fresh fresh_at_base)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   176
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   177
lemma substitution_lemma:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   178
  assumes a: "x \<noteq> y" "atom x \<sharp> u"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   179
  shows "t[x ::= s][y ::= u] = t[y ::= u][x ::= s[y ::= u]]"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   180
  using a
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   181
  by (nominal_induct t avoiding: x y s u rule: lam.strong_induct)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   182
     (auto simp add: fresh_fact forget)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   183
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   184
lemma beta_subst2_pre:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   185
  assumes "A \<longrightarrow>b B" shows "A [x ::= C] \<longrightarrow>b* B [x ::= C]"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   186
  using assms
3081
660a4f5adee8 Remove 'HERE1' and 'HERE3'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3080
diff changeset
   187
  apply (nominal_induct avoiding: x C rule: beta.strong_induct)
3078
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   188
  apply (auto simp add: App_beta fresh_star_def fresh_Pair Lam_beta)[3]
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   189
  apply (subst substitution_lemma)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   190
  apply (auto simp add: fresh_star_def fresh_Pair fresh_at_base)[2]
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   191
  apply (auto simp add: fresh_star_def fresh_Pair)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   192
  apply (rule beta_star.intros)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   193
  defer
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   194
  apply (subst beta.intros)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   195
  apply (auto simp add: fresh_fact)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   196
  done
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   197
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   198
lemma beta_subst2: "A \<longrightarrow>b* B \<Longrightarrow> A [x ::= C] \<longrightarrow>b* B [x ::= C]"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   199
  apply (erule beta_star.induct)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   200
  apply auto
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   201
  apply (subgoal_tac "M2[x ::= C] \<longrightarrow>b* M3[x ::= C]")
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   202
  apply (rotate_tac 1)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   203
  apply (erule beta_star_trans)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   204
  apply assumption
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   205
  apply (simp add: beta_subst2_pre)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   206
  done
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   207
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   208
lemma beta_subst: "A \<longrightarrow>b* B \<Longrightarrow> C \<longrightarrow>b* D \<Longrightarrow> A [x ::= C] \<longrightarrow>b* B [x ::= D]"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   209
  using beta_subst1 beta_subst2 beta_star_trans by metis
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   210
3080
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   211
lemma subst_rsp_pre:
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   212
  "x \<approx> y \<Longrightarrow> xb \<approx> ya \<Longrightarrow> x [xa ::= xb] \<approx> y [xa ::= ya]"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   213
  unfolding equ_def
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   214
  apply auto
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   215
  apply (rule_tac x="r [xa ::= ra]" in exI)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   216
  apply (simp add: beta_subst)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   217
  done
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   218
3078
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   219
lemma [quot_respect]:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   220
  shows "(equ ===> op = ===> equ ===> equ) subst subst"
3080
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   221
unfolding fun_rel_def by (auto simp add: subst_rsp_pre)
3078
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   222
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   223
lemma [quot_respect]:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   224
  shows "(op = ===> equ ===> equ) permute permute"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   225
  unfolding fun_rel_def equ_def
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   226
  apply (auto intro: eqvts)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   227
  apply (rule_tac x="x \<bullet> r" in exI)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   228
  using eqvts(1) permute_boolI by metis
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   229
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   230
quotient_type qlam = lam / equ
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   231
  by (auto intro!: equivpI reflpI sympI transpI simp add: equ_refl equ_sym)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   232
     (erule equ_trans, assumption)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   233
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   234
quotient_definition "QVar::name \<Rightarrow> qlam" is Var
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   235
quotient_definition "QApp::qlam \<Rightarrow> qlam \<Rightarrow> qlam" is App
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   236
quotient_definition QLam ("QLam [_]._")
3079
a303ef51cd97 Tuned renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3078
diff changeset
   237
  where "QLam::name \<Rightarrow> qlam \<Rightarrow> qlam" is BetaCR.Lam
3078
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   238
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   239
lemmas qlam_strong_induct = lam.strong_induct[quot_lifted]
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   240
lemmas qlam_induct = lam.induct[quot_lifted]
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   241
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   242
instantiation qlam :: pt
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   243
begin
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   244
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   245
quotient_definition "permute_qlam::perm \<Rightarrow> qlam \<Rightarrow> qlam" 
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   246
  is "permute::perm \<Rightarrow> lam \<Rightarrow> lam"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   247
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   248
instance
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   249
apply default
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   250
apply(descending)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   251
apply(simp)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   252
apply(rule equ_refl)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   253
apply(descending)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   254
apply(simp)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   255
apply(rule equ_refl)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   256
done
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   257
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   258
end
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   259
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   260
lemma qlam_perm[simp, eqvt]:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   261
  shows "p \<bullet> (QVar x) = QVar (p \<bullet> x)"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   262
  and "p \<bullet> (QApp t s) = QApp (p \<bullet> t) (p \<bullet> s)"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   263
  and "p \<bullet> (QLam [x].t) = QLam [p \<bullet> x].(p \<bullet> t)"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   264
  by(descending, simp add: equ_refl)+
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   265
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   266
lemma qlam_supports:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   267
  shows "{atom x} supports (QVar x)"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   268
  and   "supp (t, s) supports (QApp t s)"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   269
  and   "supp (x, t) supports (QLam [x].t)"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   270
unfolding supports_def fresh_def[symmetric]
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   271
by (auto simp add: swap_fresh_fresh)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   272
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   273
lemma qlam_fs:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   274
  fixes t::"qlam"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   275
  shows "finite (supp t)"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   276
apply(induct t rule: qlam_induct)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   277
apply(rule supports_finite)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   278
apply(rule qlam_supports)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   279
apply(simp)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   280
apply(rule supports_finite)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   281
apply(rule qlam_supports)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   282
apply(simp add: supp_Pair)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   283
apply(rule supports_finite)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   284
apply(rule qlam_supports)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   285
apply(simp add: supp_Pair finite_supp)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   286
done
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   287
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   288
instantiation qlam :: fs
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   289
begin
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   290
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   291
instance
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   292
apply(default)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   293
apply(rule qlam_fs)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   294
done
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   295
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   296
end
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   297
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   298
quotient_definition subst_qlam ("_[_ ::q= _]")
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   299
  where "subst_qlam::qlam \<Rightarrow> name \<Rightarrow> qlam \<Rightarrow> qlam" is subst  
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   300
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   301
definition
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   302
  "Supp t = \<Inter>{supp s | s. s \<approx> t}"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   303
3080
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   304
lemma Supp_rsp:
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   305
  "a \<approx> b \<Longrightarrow> Supp a = Supp b"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   306
  unfolding Supp_def
3078
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   307
  apply(rule_tac f="Inter" in arg_cong)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   308
  apply(auto)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   309
  apply (metis equ_trans)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   310
  by (metis equivp_def qlam_equivp)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   311
3080
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   312
lemma [quot_respect]:
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   313
  shows "(equ ===> op=) Supp Supp"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   314
  unfolding fun_rel_def by (auto simp add: Supp_rsp)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   315
3078
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   316
quotient_definition "supp_qlam::qlam \<Rightarrow> atom set" 
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   317
  is "Supp::lam \<Rightarrow> atom set"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   318
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   319
lemma Supp_supp:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   320
  "Supp t \<subseteq> supp t"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   321
unfolding Supp_def
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   322
apply(auto)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   323
apply(drule_tac x="supp t" in spec)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   324
apply(auto simp add: equ_refl)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   325
done
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   326
3080
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   327
lemma supp_subst:
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   328
  shows "supp (t[x ::= s]) \<subseteq> (supp t - {atom x}) \<union> supp s"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   329
  by (induct t x s rule: subst.induct) (auto simp add: lam.supp supp_at_base)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   330
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   331
lemma supp_beta: "x \<longrightarrow>b r \<Longrightarrow> supp r \<subseteq> supp x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   332
  apply (induct rule: beta.induct)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   333
  apply (simp_all add: lam.supp)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   334
  apply blast+
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   335
  using supp_subst by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   336
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   337
lemma supp_beta_star: "x \<longrightarrow>b* r \<Longrightarrow> supp r \<subseteq> supp x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   338
  apply (erule beta_star.induct)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   339
  apply auto
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   340
  using supp_beta by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   341
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   342
lemma supp_equ: "x \<approx> y \<Longrightarrow> \<exists>z. z \<approx> x \<and> supp z \<subseteq> supp x \<inter> supp y"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   343
  unfolding equ_def
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   344
  apply (simp (no_asm) only: equ_def[symmetric])
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   345
  apply (elim exE)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   346
  apply (rule_tac x=r in exI)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   347
  apply rule
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   348
  apply (metis bs1 equ_def)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   349
  using supp_beta_star by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   350
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   351
lemma supp_psubset: "Supp x \<subset> supp x \<Longrightarrow> \<exists>t. t \<approx> x \<and> supp t \<subset> supp x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   352
proof -
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   353
  assume "Supp x \<subset> supp x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   354
  then obtain a where "a \<in> supp x" "a \<notin> Supp x" by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   355
  then obtain y where nin: "y \<approx> x" "a \<notin> supp y" unfolding Supp_def by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   356
  then obtain t where eq: "t \<approx> x" "supp t \<subseteq> supp x \<inter> supp y"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   357
    using supp_equ equ_sym by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   358
  then have "supp t \<subset> supp x" using nin
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   359
    by (metis `(a\<Colon>atom) \<in> supp (x\<Colon>lam)` le_infE psubset_eq set_rev_mp)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   360
  then show "\<exists>t. t \<approx> x \<and> supp t \<subset> supp x" using eq by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   361
qed
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   362
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   363
lemma Supp_exists: "\<exists>t. supp t = Supp t \<and> t \<approx> x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   364
proof -
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   365
  have "\<And>fs x. supp x = fs \<Longrightarrow> \<exists>t. supp t = Supp t \<and> t \<approx> x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   366
  proof -
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   367
    fix fs
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   368
    show "\<And>x. supp x = fs \<Longrightarrow> \<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   369
    proof (cases "finite fs")
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   370
      case True
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   371
      assume fs: "finite fs"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   372
      then show "\<And>x. supp x = fs \<Longrightarrow> \<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   373
      proof (induct fs rule: finite_psubset_induct, clarify)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   374
        fix A :: "atom set" fix x :: lam
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   375
        assume IH: "\<And>B xa. \<lbrakk>B \<subset> supp x; supp xa = B\<rbrakk> \<Longrightarrow> \<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> xa"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   376
        show "\<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   377
        proof (cases "supp x = Supp x")
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   378
          assume "supp x = Supp x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   379
          then show "\<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   380
            by (rule_tac x="x" in exI) (simp add: equ_refl)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   381
        next
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   382
          assume "supp x \<noteq> Supp x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   383
          then have "Supp x \<subset> supp x" using Supp_supp by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   384
          then obtain y where a1: "supp y \<subset> supp x" "y \<approx> x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   385
            using supp_psubset by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   386
          then obtain t where "supp t = Supp t \<and> t \<approx> y"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   387
            using IH[of "supp y" y] by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   388
          then show "\<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x" using a1 equ_trans
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   389
            by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   390
        qed
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   391
      qed
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   392
    next
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   393
      case False
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   394
      fix x :: lam
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   395
      assume "supp x = fs" "infinite fs"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   396
      then show "\<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   397
        by (auto simp add: finite_supp)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   398
    qed simp
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   399
  qed
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   400
  then show "\<exists>t\<Colon>lam. supp t = Supp t \<and> t \<approx> x" by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   401
qed
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   402
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   403
lemma subst3: "x \<noteq> y \<and> atom x \<notin> Supp s \<Longrightarrow> Lam [x]. t [y ::= s] \<approx> Lam [x]. (t [y ::= s])"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   404
proof -
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   405
  assume as: "x \<noteq> y \<and> atom x \<notin> Supp s"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   406
  obtain s' where s: "supp s' = Supp s'" "s' \<approx> s" using Supp_exists[of s] by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   407
  then have lhs: "Lam [x]. t [y ::= s] \<approx> Lam [x]. t [y ::= s']" using subst_rsp_pre equ_refl equ_sym by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   408
  have supp: "Supp s' = Supp s" using Supp_rsp s(2) by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   409
  have lhs_rhs: "Lam [x]. t [y ::= s'] = Lam [x]. (t [y ::= s'])"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   410
    by (simp add: fresh_def supp_Pair s supp as supp_at_base)
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   411
  have "t [y ::= s'] \<approx> t [y ::= s]"
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   412
    using subst_rsp_pre[OF equ_refl s(2)] .
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   413
  with Lam_rsp have rhs: "Lam [x]. (t [y ::= s']) \<approx> Lam [x]. (t [y ::= s])" .
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   414
  show ?thesis 
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   415
    using lhs[unfolded lhs_rhs] rhs equ_trans by blast
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   416
qed
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   417
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   418
thm subst3[quot_lifted]
9253984db291 Lift substitution of an Abstraction for BetaCR :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 3079
diff changeset
   419
3078
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   420
lemma Supp_Lam:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   421
  "atom a \<notin> Supp (Lam [a].t)"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   422
proof -
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   423
  have "atom a \<notin> supp (Lam [a].t)" by (simp add: lam.supp)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   424
  then show ?thesis using Supp_supp
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   425
    by blast
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   426
qed
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   427
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   428
lemma [eqvt]: "(p \<bullet> (a \<approx> b)) = ((p \<bullet> a) \<approx> (p \<bullet> b))"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   429
  unfolding equ_def
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   430
  by perm_simp rule
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   431
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   432
lemma [eqvt]: "p \<bullet> (Supp x) = Supp (p \<bullet> x)"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   433
  unfolding Supp_def
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   434
  by perm_simp rule
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   435
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   436
lemmas s = Supp_Lam[quot_lifted]
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   437
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   438
lemma var_beta_pre: "s \<longrightarrow>b* r \<Longrightarrow> s = Var name \<Longrightarrow> r = Var name"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   439
  apply (induct rule: beta_star.induct)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   440
  apply simp
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   441
  apply (subgoal_tac "M2 = Var name")
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   442
  apply (thin_tac "M1 \<longrightarrow>b* M2")
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   443
  apply (thin_tac "M1 = Var name")
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   444
  apply (thin_tac "M1 = Var name \<Longrightarrow> M2 = Var name")
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   445
  defer
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   446
  apply simp
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   447
  apply (erule_tac beta.cases)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   448
  apply simp_all
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   449
  done
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   450
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   451
lemma var_beta: "Var name \<longrightarrow>b* r \<longleftrightarrow> r = Var name"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   452
  by (auto simp add: var_beta_pre)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   453
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   454
lemma qlam_eq_iff:
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   455
  "(QVar n = QVar m) = (n = m)"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   456
  apply descending unfolding equ_def var_beta by auto
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   457
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   458
lemma "supp (QVar n) = {atom n}"
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   459
  unfolding supp_def
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   460
  apply simp
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   461
  unfolding qlam_eq_iff
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   462
  apply (fold supp_def)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   463
  apply (simp add: supp_at_base)
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   464
  done
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   465
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   466
end
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   467
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   468
abf147627b4b Retry Beta using a reduction relation and its reflexive-symmetric-transitive closure.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   469