src/HOL/Nominal/Examples/CR.thy
author urbanc
Tue, 13 Dec 2005 18:11:21 +0100
changeset 18396 b3e7da94b51f
parent 18378 35fba71ec6ef
child 18659 2ff0ae57431d
permissions -rw-r--r--
added a fresh_left lemma that contains all instantiation for the various atom-types.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18269
3f36e2165e51 some small tuning
urbanc
parents: 18106
diff changeset
     1
(* $Id$ *)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
     2
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
     3
theory cr
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
     4
imports lam_substs
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
     5
begin
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
     6
18269
3f36e2165e51 some small tuning
urbanc
parents: 18106
diff changeset
     7
text {* The Church-Rosser proof from Barendregt's book *}
3f36e2165e51 some small tuning
urbanc
parents: 18106
diff changeset
     8
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
     9
lemma forget: 
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    10
  assumes a: "a\<sharp>t1"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    11
  shows "t1[a::=t2] = t1"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    12
using a
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    13
proof (nominal_induct t1 avoiding: a t2 rule: lam_induct)
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    14
  case (Var b) 
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    15
  thus ?case by (simp add: fresh_atm)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    16
next 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    17
  case App
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    18
  thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    19
next
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    20
  case (Lam c t)
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    21
  have ih: "\<And>c t2. c\<sharp>t \<Longrightarrow>  t[c::=t2] = t" by fact
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    22
  have a: "c\<sharp>t2" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    23
  have "c\<sharp>a" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    24
  hence b: "a\<noteq>c" by (simp add: fresh_atm)
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    25
  have "a\<sharp>Lam [c].t" by fact 
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    26
  hence "a\<sharp>t" using b by (simp add: abs_fresh)
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    27
  hence "t[a::=t2] = t" using ih by simp
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    28
  thus "(Lam [c].t)[a::=t2] = Lam [c].t" using a b by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    29
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    30
18378
urbanc
parents: 18344
diff changeset
    31
lemma forget_automatic: 
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    32
  assumes a: "a\<sharp>t1"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    33
  shows "t1[a::=t2] = t1"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    34
  using a
18344
urbanc
parents: 18312
diff changeset
    35
  by (nominal_induct t1 avoiding: a t2 rule: lam_induct)
urbanc
parents: 18312
diff changeset
    36
     (auto simp add: abs_fresh fresh_atm)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    37
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    38
lemma fresh_fact: 
18378
urbanc
parents: 18344
diff changeset
    39
  fixes a :: "name"
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    40
  assumes a: "a\<sharp>t1"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    41
  and     b: "a\<sharp>t2"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    42
  shows "a\<sharp>(t1[b::=t2])"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    43
using a b
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    44
proof (nominal_induct t1 avoiding: a b t2 rule: lam_induct)
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    45
  case (Var c) 
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    46
  thus ?case by simp
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    47
next
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    48
  case App thus ?case by simp 
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    49
next
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    50
  case (Lam c t)
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    51
  have ih: "\<And>(a::name) b t2. a\<sharp>t \<Longrightarrow> a\<sharp>t2 \<Longrightarrow> a\<sharp>(t[b::=t2])" by fact
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    52
  have fr: "c\<sharp>a" "c\<sharp>b" "c\<sharp>t2" by fact+
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    53
  hence fr': "c\<noteq>a" by (simp add: fresh_atm) 
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    54
  have a1: "a\<sharp>t2" by fact
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    55
  have a2: "a\<sharp>Lam [c].t" by fact
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    56
  hence "a\<sharp>t" using fr' by (simp add: abs_fresh)
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    57
  hence "a\<sharp>t[b::=t2]" using a1 ih by simp
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    58
  thus "a\<sharp>(Lam [c].t)[b::=t2]" using fr  by (simp add: abs_fresh)
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    59
qed
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    60
18378
urbanc
parents: 18344
diff changeset
    61
lemma fresh_fact_automatic: 
18344
urbanc
parents: 18312
diff changeset
    62
  fixes a::"name"
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    63
  assumes a: "a\<sharp>t1"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    64
  and     b: "a\<sharp>t2"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    65
  shows "a\<sharp>(t1[b::=t2])"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    66
using a b
18344
urbanc
parents: 18312
diff changeset
    67
by (nominal_induct t1 avoiding: a b t2 rule: lam_induct)
urbanc
parents: 18312
diff changeset
    68
   (auto simp add: abs_fresh fresh_atm)
urbanc
parents: 18312
diff changeset
    69
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    70
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    71
lemma subs_lemma:  
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    72
  fixes x::"name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    73
  and   y::"name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    74
  and   L::"lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    75
  and   M::"lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    76
  and   N::"lam"
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    77
  assumes a: "x\<noteq>y"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    78
  and     b: "x\<sharp>L"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    79
  shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    80
using a b
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    81
proof (nominal_induct M avoiding: x y N L rule: lam_induct)
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    82
  case (Var z) (* case 1: Variables*)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    83
  have "x\<noteq>y" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    84
  have "x\<sharp>L" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    85
  show "Var z[x::=N][y::=L] = Var z[y::=L][x::=N[y::=L]]" (is "?LHS = ?RHS")
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    86
  proof -
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    87
    { (*Case 1.1*)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    88
      assume  "z=x"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    89
      have "(1)": "?LHS = N[y::=L]" using `z=x` by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    90
      have "(2)": "?RHS = N[y::=L]" using `z=x` `x\<noteq>y` by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    91
      from "(1)" "(2)" have "?LHS = ?RHS"  by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    92
    }
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    93
    moreover 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    94
    { (*Case 1.2*)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    95
      assume "z\<noteq>x" and "z=y"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    96
      have "(1)": "?LHS = L"               using `z\<noteq>x` `z=y` by force
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    97
      have "(2)": "?RHS = L[x::=N[y::=L]]" using `z=y` by force
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    98
      have "(3)": "L[x::=N[y::=L]] = L"    using `x\<sharp>L` by (simp add: forget)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    99
      from "(1)" "(2)" "(3)" have "?LHS = ?RHS" by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   100
    }
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   101
    moreover 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   102
    { (*Case 1.3*)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   103
      assume "z\<noteq>x" and "z\<noteq>y"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   104
      have "(1)": "?LHS = Var z" using `z\<noteq>x` `z\<noteq>y` by force
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   105
      have "(2)": "?RHS = Var z" using `z\<noteq>x` `z\<noteq>y` by force
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   106
      from "(1)" "(2)" have "?LHS = ?RHS" by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   107
    }
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   108
    ultimately show "?LHS = ?RHS" by blast
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   109
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   110
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   111
  case (Lam z M1) (* case 2: lambdas *)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   112
  have ih: "\<And>x y N L. x\<noteq>y \<Longrightarrow> x\<sharp>L \<Longrightarrow> M1[x::=N][y::=L] = M1[y::=L][x::=N[y::=L]]" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   113
  have "x\<noteq>y" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   114
  have "x\<sharp>L" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   115
  have "z\<sharp>x" "z\<sharp>y" "z\<sharp>N" "z\<sharp>L" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   116
  hence "z\<sharp>N[y::=L]" by (simp add: fresh_fact)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   117
  show "(Lam [z].M1)[x::=N][y::=L] = (Lam [z].M1)[y::=L][x::=N[y::=L]]" (is "?LHS=?RHS") 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   118
  proof -
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   119
    have "?LHS = Lam [z].(M1[x::=N][y::=L])" using `z\<sharp>x` `z\<sharp>y` `z\<sharp>N` `z\<sharp>L` by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   120
    also from ih have "\<dots> = Lam [z].(M1[y::=L][x::=N[y::=L]])" using `x\<noteq>y` `x\<sharp>L` by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   121
    also have "\<dots> = (Lam [z].(M1[y::=L]))[x::=N[y::=L]]" using `z\<sharp>x` `z\<sharp>N[y::=L]` by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   122
    also have "\<dots> = ?RHS" using  `z\<sharp>y` `z\<sharp>L` by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   123
    finally show "?LHS = ?RHS" .
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   124
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   125
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   126
  case (App M1 M2) (* case 3: applications *)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   127
  thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   128
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   129
18378
urbanc
parents: 18344
diff changeset
   130
lemma subs_lemma_automatic:  
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   131
  assumes a: "x\<noteq>y"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   132
  and     b: "x\<sharp>L"
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   133
  shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]"
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   134
using a b
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   135
by (nominal_induct M avoiding: x y N L rule: lam_induct)
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   136
   (auto simp add: fresh_fact forget)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   137
18344
urbanc
parents: 18312
diff changeset
   138
lemma subst_rename: 
urbanc
parents: 18312
diff changeset
   139
  assumes a: "c\<sharp>t1"
urbanc
parents: 18312
diff changeset
   140
  shows "t1[a::=t2] = ([(c,a)]\<bullet>t1)[c::=t2]"
urbanc
parents: 18312
diff changeset
   141
using a
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   142
proof (nominal_induct t1 avoiding: a c t2 rule: lam_induct)
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   143
  case (Var b)
18344
urbanc
parents: 18312
diff changeset
   144
  thus "(Var b)[a::=t2] = ([(c,a)]\<bullet>(Var b))[c::=t2]" by (simp add: calc_atm fresh_atm)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   145
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   146
  case App thus ?case by force
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   147
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   148
  case (Lam b s)
18344
urbanc
parents: 18312
diff changeset
   149
  have i: "\<And>a c t2. c\<sharp>s \<Longrightarrow> (s[a::=t2] = ([(c,a)]\<bullet>s)[c::=t2])" by fact
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   150
  have f: "b\<sharp>a" "b\<sharp>c" "b\<sharp>t2" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   151
  from f have a:"b\<noteq>c" and b: "b\<noteq>a" and c: "b\<sharp>t2" by (simp add: fresh_atm)+
18344
urbanc
parents: 18312
diff changeset
   152
  have "c\<sharp>Lam [b].s" by fact
urbanc
parents: 18312
diff changeset
   153
  hence "c\<sharp>s" using a by (simp add: abs_fresh)
urbanc
parents: 18312
diff changeset
   154
  hence d: "s[a::=t2] = ([(c,a)]\<bullet>s)[c::=t2]" using i by simp
urbanc
parents: 18312
diff changeset
   155
  show "(Lam [b].s)[a::=t2] = ([(c,a)]\<bullet>(Lam [b].s))[c::=t2]" (is "?LHS = ?RHS")
urbanc
parents: 18312
diff changeset
   156
  proof -
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   157
    have    "?LHS = Lam [b].(s[a::=t2])" using b c by simp
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   158
    also have "\<dots> = Lam [b].(([(c,a)]\<bullet>s)[c::=t2])" using d by simp
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   159
    also have "\<dots> = (Lam [b].([(c,a)]\<bullet>s))[c::=t2]" using a c by simp
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   160
    also have "\<dots> = ?RHS" using a b by (simp add: calc_atm)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   161
    finally show "?LHS = ?RHS" by simp
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   162
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   163
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   164
18378
urbanc
parents: 18344
diff changeset
   165
lemma subst_rename_automatic: 
18344
urbanc
parents: 18312
diff changeset
   166
  assumes a: "c\<sharp>t1"
urbanc
parents: 18312
diff changeset
   167
  shows "t1[a::=t2] = ([(c,a)]\<bullet>t1)[c::=t2]"
urbanc
parents: 18312
diff changeset
   168
using a
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   169
apply(nominal_induct t1 avoiding: a c t2 rule: lam_induct)
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   170
apply(auto simp add: calc_atm fresh_atm abs_fresh)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   171
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   172
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   173
section {* Beta Reduction *}
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   174
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   175
consts
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   176
  Beta :: "(lam\<times>lam) set"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   177
syntax 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   178
  "_Beta"       :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>\<beta> _" [80,80] 80)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   179
  "_Beta_star"  :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>\<beta>\<^sup>* _" [80,80] 80)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   180
translations 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   181
  "t1 \<longrightarrow>\<^isub>\<beta> t2" \<rightleftharpoons> "(t1,t2) \<in> Beta"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   182
  "t1 \<longrightarrow>\<^isub>\<beta>\<^sup>* t2" \<rightleftharpoons> "(t1,t2) \<in> Beta\<^sup>*"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   183
inductive Beta
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   184
  intros
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   185
  b1[intro!]: "s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (App s1 t)\<longrightarrow>\<^isub>\<beta>(App s2 t)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   186
  b2[intro!]: "s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (App t s1)\<longrightarrow>\<^isub>\<beta>(App t s2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   187
  b3[intro!]: "s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (Lam [a].s1)\<longrightarrow>\<^isub>\<beta> (Lam [(a::name)].s2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   188
  b4[intro!]: "(App (Lam [(a::name)].s1) s2)\<longrightarrow>\<^isub>\<beta>(s1[a::=s2])"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   189
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   190
lemma eqvt_beta: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   191
  fixes pi :: "name prm"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   192
  and   t  :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   193
  and   s  :: "lam"
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   194
  assumes a: "t\<longrightarrow>\<^isub>\<beta>s"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   195
  shows "(pi\<bullet>t)\<longrightarrow>\<^isub>\<beta>(pi\<bullet>s)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   196
  using a by (induct, auto)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   197
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   198
lemma beta_induct[consumes 1, case_names b1 b2 b3 b4]:
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   199
  fixes  P :: "'a::fs_name\<Rightarrow>lam \<Rightarrow> lam \<Rightarrow>bool"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   200
  and    t :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   201
  and    s :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   202
  and    x :: "'a::fs_name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   203
  assumes a: "t\<longrightarrow>\<^isub>\<beta>s"
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   204
  and a1:    "\<And>t s1 s2 x. s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (\<And>z. P z s1 s2) \<Longrightarrow> P x (App s1 t) (App s2 t)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   205
  and a2:    "\<And>t s1 s2 x. s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (\<And>z. P z s1 s2) \<Longrightarrow> P x (App t s1) (App t s2)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   206
  and a3:    "\<And>a s1 s2 x. a\<sharp>x \<Longrightarrow> s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (\<And>z. P z s1 s2) \<Longrightarrow> P x (Lam [a].s1) (Lam [a].s2)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   207
  and a4:    "\<And>a t1 s1 x. a\<sharp>(s1,x) \<Longrightarrow> P x (App (Lam [a].t1) s1) (t1[a::=s1])"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   208
  shows "P x t s"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   209
proof -
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   210
  from a have "\<And>(pi::name prm) x. P x (pi\<bullet>t) (pi\<bullet>s)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   211
  proof (induct)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   212
    case b1 thus ?case using a1 by (simp, blast intro: eqvt_beta)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   213
  next
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   214
    case b2 thus ?case using a2 by (simp, blast intro: eqvt_beta)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   215
  next
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   216
    case (b3 a s1 s2)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   217
    have j1: "s1 \<longrightarrow>\<^isub>\<beta> s2" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   218
    have j2: "\<And>x (pi::name prm). P x (pi\<bullet>s1) (pi\<bullet>s2)" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   219
    show ?case 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   220
    proof (simp)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   221
      have f: "\<exists>c::name. c\<sharp>(pi\<bullet>a,pi\<bullet>s1,pi\<bullet>s2,x)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   222
	by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   223
      then obtain c::"name" 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   224
	where f1: "c\<noteq>(pi\<bullet>a)" and f2: "c\<sharp>x" and f3: "c\<sharp>(pi\<bullet>s1)" and f4: "c\<sharp>(pi\<bullet>s2)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   225
	by (force simp add: fresh_prod fresh_atm)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   226
      have x: "P x (Lam [c].(([(c,pi\<bullet>a)]@pi)\<bullet>s1)) (Lam [c].(([(c,pi\<bullet>a)]@pi)\<bullet>s2))"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   227
	using a3 f2 j1 j2 by (simp, blast intro: eqvt_beta)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   228
      have alpha1: "(Lam [c].([(c,pi\<bullet>a)]\<bullet>(pi\<bullet>s1))) = (Lam [(pi\<bullet>a)].(pi\<bullet>s1))" using f1 f3
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   229
	by (simp add: lam.inject alpha)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   230
      have alpha2: "(Lam [c].([(c,pi\<bullet>a)]\<bullet>(pi\<bullet>s2))) = (Lam [(pi\<bullet>a)].(pi\<bullet>s2))" using f1 f3
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   231
	by (simp add: lam.inject alpha)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   232
      show " P x (Lam [(pi\<bullet>a)].(pi\<bullet>s1)) (Lam [(pi\<bullet>a)].(pi\<bullet>s2))"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   233
	using x alpha1 alpha2 by (simp only: pt_name2)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   234
    qed
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   235
  next
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   236
    case (b4 a s1 s2)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   237
    show ?case
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   238
    proof (simp add: subst_eqvt)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   239
      have f: "\<exists>c::name. c\<sharp>(pi\<bullet>a,pi\<bullet>s1,pi\<bullet>s2,x)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   240
	by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   241
      then obtain c::"name" 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   242
	where f1: "c\<noteq>(pi\<bullet>a)" and f2: "c\<sharp>(pi\<bullet>s2,x)" and f3: "c\<sharp>(pi\<bullet>s1)" and f4: "c\<sharp>(pi\<bullet>s2)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   243
	by (force simp add: fresh_prod fresh_atm)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   244
      have x: "P x (App (Lam [c].(([(c,pi\<bullet>a)]@pi)\<bullet>s1)) (pi\<bullet>s2)) ((([(c,pi\<bullet>a)]@pi)\<bullet>s1)[c::=(pi\<bullet>s2)])"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   245
	using a4 f2 by (blast intro!: eqvt_beta)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   246
      have alpha1: "(Lam [c].([(c,pi\<bullet>a)]\<bullet>(pi\<bullet>s1))) = (Lam [(pi\<bullet>a)].(pi\<bullet>s1))" using f1 f3
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   247
	by (simp add: lam.inject alpha)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   248
      have alpha2: "(([(c,pi\<bullet>a)]@pi)\<bullet>s1)[c::=(pi\<bullet>s2)] = (pi\<bullet>s1)[(pi\<bullet>a)::=(pi\<bullet>s2)]"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   249
	using f3 by (simp only: subst_rename[symmetric] pt_name2)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   250
      show "P x (App (Lam [(pi\<bullet>a)].(pi\<bullet>s1)) (pi\<bullet>s2)) ((pi\<bullet>s1)[(pi\<bullet>a)::=(pi\<bullet>s2)])"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   251
	using x alpha1 alpha2 by (simp only: pt_name2)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   252
    qed
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   253
  qed
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   254
  hence "P x (([]::name prm)\<bullet>t) (([]::name prm)\<bullet>s)" by blast 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   255
  thus ?thesis by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   256
qed
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   257
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   258
section {* One-Reduction *}
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   259
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   260
consts
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   261
  One :: "(lam\<times>lam) set"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   262
syntax 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   263
  "_One"       :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>1 _" [80,80] 80)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   264
  "_One_star"  :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>1\<^sup>* _" [80,80] 80)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   265
translations 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   266
  "t1 \<longrightarrow>\<^isub>1 t2" \<rightleftharpoons> "(t1,t2) \<in> One"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   267
  "t1 \<longrightarrow>\<^isub>1\<^sup>* t2" \<rightleftharpoons> "(t1,t2) \<in> One\<^sup>*"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   268
inductive One
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   269
  intros
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   270
  o1[intro!]:      "M\<longrightarrow>\<^isub>1M"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   271
  o2[simp,intro!]: "\<lbrakk>t1\<longrightarrow>\<^isub>1t2;s1\<longrightarrow>\<^isub>1s2\<rbrakk> \<Longrightarrow> (App t1 s1)\<longrightarrow>\<^isub>1(App t2 s2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   272
  o3[simp,intro!]: "s1\<longrightarrow>\<^isub>1s2 \<Longrightarrow> (Lam [(a::name)].s1)\<longrightarrow>\<^isub>1(Lam [a].s2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   273
  o4[simp,intro!]: "\<lbrakk>s1\<longrightarrow>\<^isub>1s2;t1\<longrightarrow>\<^isub>1t2\<rbrakk> \<Longrightarrow> (App (Lam [(a::name)].t1) s1)\<longrightarrow>\<^isub>1(t2[a::=s2])"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   274
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   275
lemma eqvt_one: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   276
  fixes pi :: "name prm"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   277
  and   t  :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   278
  and   s  :: "lam"
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   279
  assumes a: "t\<longrightarrow>\<^isub>1s"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   280
  shows "(pi\<bullet>t)\<longrightarrow>\<^isub>1(pi\<bullet>s)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   281
  using a by (induct, auto)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   282
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   283
lemma one_induct[consumes 1, case_names o1 o2 o3 o4]:
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   284
  fixes  P :: "'a::fs_name\<Rightarrow>lam \<Rightarrow> lam \<Rightarrow>bool"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   285
  and    t :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   286
  and    s :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   287
  and    x :: "'a::fs_name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   288
  assumes a: "t\<longrightarrow>\<^isub>1s"
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   289
  and a1:    "\<And>t x. P x t t"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   290
  and a2:    "\<And>t1 t2 s1 s2 x. t1\<longrightarrow>\<^isub>1t2 \<Longrightarrow> (\<And>z. P z t1 t2) \<Longrightarrow> s1\<longrightarrow>\<^isub>1s2 \<Longrightarrow> (\<And>z. P z s1 s2) \<Longrightarrow> 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   291
              P x (App t1 s1) (App t2 s2)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   292
  and a3:    "\<And>a s1 s2 x. a\<sharp>x \<Longrightarrow> s1\<longrightarrow>\<^isub>1s2 \<Longrightarrow> (\<And>z. P z s1 s2) \<Longrightarrow> P x (Lam [a].s1) (Lam [a].s2)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   293
  and a4:    "\<And>a t1 t2 s1 s2 x. 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   294
              a\<sharp>(s1,s2,x) \<Longrightarrow> t1\<longrightarrow>\<^isub>1t2 \<Longrightarrow> (\<And>z. P z t1 t2) \<Longrightarrow> s1\<longrightarrow>\<^isub>1s2 \<Longrightarrow> (\<And>z. P z s1 s2) 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   295
              \<Longrightarrow> P x (App (Lam [a].t1) s1) (t2[a::=s2])"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   296
  shows "P x t s"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   297
proof -
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   298
  from a have "\<And>(pi::name prm) x. P x (pi\<bullet>t) (pi\<bullet>s)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   299
  proof (induct)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   300
    case o1 show ?case using a1 by force
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   301
  next
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   302
    case (o2 s1 s2 t1 t2) 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   303
    thus ?case using a2 by (simp, blast intro: eqvt_one)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   304
  next
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   305
    case (o3 a t1 t2)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   306
    have j1: "t1 \<longrightarrow>\<^isub>1 t2" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   307
    have j2: "\<And>(pi::name prm) x. P x (pi\<bullet>t1) (pi\<bullet>t2)" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   308
    show ?case 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   309
    proof (simp)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   310
      have f: "\<exists>c::name. c\<sharp>(pi\<bullet>a,pi\<bullet>t1,pi\<bullet>t2,x)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   311
	by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   312
      then obtain c::"name" 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   313
	where f1: "c\<noteq>(pi\<bullet>a)" and f2: "c\<sharp>x" and f3: "c\<sharp>(pi\<bullet>t1)" and f4: "c\<sharp>(pi\<bullet>t2)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   314
	by (force simp add: fresh_prod fresh_atm)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   315
      have x: "P x (Lam [c].(([(c,pi\<bullet>a)]@pi)\<bullet>t1)) (Lam [c].(([(c,pi\<bullet>a)]@pi)\<bullet>t2))"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   316
	using a3 f2 j1 j2 by (simp, blast intro: eqvt_one)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   317
      have alpha1: "(Lam [c].([(c,pi\<bullet>a)]\<bullet>(pi\<bullet>t1))) = (Lam [(pi\<bullet>a)].(pi\<bullet>t1))" using f1 f3
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   318
	by (simp add: lam.inject alpha)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   319
      have alpha2: "(Lam [c].([(c,pi\<bullet>a)]\<bullet>(pi\<bullet>t2))) = (Lam [(pi\<bullet>a)].(pi\<bullet>t2))" using f1 f3
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   320
	by (simp add: lam.inject alpha)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   321
      show " P x (Lam [(pi\<bullet>a)].(pi\<bullet>t1)) (Lam [(pi\<bullet>a)].(pi\<bullet>t2))"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   322
	using x alpha1 alpha2 by (simp only: pt_name2)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   323
    qed
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   324
  next
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   325
    case (o4 a s1 s2 t1 t2)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   326
    have j0: "t1 \<longrightarrow>\<^isub>1 t2" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   327
    have j1: "s1 \<longrightarrow>\<^isub>1 s2" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   328
    have j2: "\<And>(pi::name prm) x. P x (pi\<bullet>t1) (pi\<bullet>t2)" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   329
    have j3: "\<And>(pi::name prm) x. P x (pi\<bullet>s1) (pi\<bullet>s2)" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   330
    show ?case
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   331
    proof (simp)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   332
      have f: "\<exists>c::name. c\<sharp>(pi\<bullet>a,pi\<bullet>t1,pi\<bullet>t2,pi\<bullet>s1,pi\<bullet>s2,x)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   333
	by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   334
      then obtain c::"name" 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   335
	where f1: "c\<noteq>(pi\<bullet>a)" and f2: "c\<sharp>(pi\<bullet>s1,pi\<bullet>s2,x)" and f3: "c\<sharp>(pi\<bullet>t1)" and f4: "c\<sharp>(pi\<bullet>t2)"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   336
	by (force simp add: fresh_prod at_fresh[OF at_name_inst])
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   337
      have x: "P x (App (Lam [c].(([(c,pi\<bullet>a)]@pi)\<bullet>t1)) (pi\<bullet>s1)) ((([(c,pi\<bullet>a)]@pi)\<bullet>t2)[c::=(pi\<bullet>s2)])"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   338
	using a4 f2 j0 j1 j2 j3 by (simp, blast intro!: eqvt_one)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   339
      have alpha1: "(Lam [c].([(c,pi\<bullet>a)]\<bullet>(pi\<bullet>t1))) = (Lam [(pi\<bullet>a)].(pi\<bullet>t1))" using f1 f3
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   340
	by (simp add: lam.inject alpha)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   341
      have alpha2: "(([(c,pi\<bullet>a)]@pi)\<bullet>t2)[c::=(pi\<bullet>s2)] = (pi\<bullet>t2)[(pi\<bullet>a)::=(pi\<bullet>s2)]"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   342
	using f4 by (simp only: subst_rename[symmetric] pt_name2)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   343
      show "P x (App (Lam [(pi\<bullet>a)].(pi\<bullet>t1)) (pi\<bullet>s1)) ((pi\<bullet>t2)[(pi\<bullet>a)::=(pi\<bullet>s2)])"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   344
	using x alpha1 alpha2 by (simp only: pt_name2)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   345
    qed
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   346
  qed
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   347
  hence "P x (([]::name prm)\<bullet>t) (([]::name prm)\<bullet>s)" by blast
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   348
  thus ?thesis by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   349
qed
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   350
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   351
lemma fresh_fact':  
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   352
  assumes a: "a\<sharp>t2" 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   353
  shows "a\<sharp>(t1[a::=t2])"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   354
using a 
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   355
proof (nominal_induct t1 avoiding: a t2 rule: lam_induct)
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   356
  case (Var b) 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   357
  thus ?case by (simp add: fresh_atm)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   358
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   359
  case App thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   360
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   361
  case (Lam c t)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   362
  have "a\<sharp>t2" "c\<sharp>a" "c\<sharp>t2" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   363
  moreover
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   364
  have ih: "\<And>a t2. a\<sharp>t2 \<Longrightarrow> a\<sharp>(t[a::=t2])" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   365
  ultimately show ?case by (simp add: abs_fresh)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   366
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   367
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   368
lemma one_fresh_preserv:
18378
urbanc
parents: 18344
diff changeset
   369
  fixes a :: "name"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   370
  assumes a: "t\<longrightarrow>\<^isub>1s"
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   371
  and     b: "a\<sharp>t"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   372
  shows "a\<sharp>s"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   373
using a b
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   374
proof (induct)
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   375
  case o1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   376
next
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   377
  case o2 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   378
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   379
  case (o3 c s1 s2)
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   380
  have ih: "a\<sharp>s1 \<Longrightarrow>  a\<sharp>s2" by fact
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   381
  have c: "a\<sharp>Lam [c].s1" by fact
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   382
  show ?case
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   383
  proof (cases "a=c")
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   384
    assume "a=c" thus "a\<sharp>Lam [c].s2" by (simp add: abs_fresh)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   385
  next
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   386
    assume d: "a\<noteq>c" 
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   387
    with c have "a\<sharp>s1" by (simp add: abs_fresh)
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   388
    hence "a\<sharp>s2" using ih by simp
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   389
    thus "a\<sharp>Lam [c].s2" using d by (simp add: abs_fresh) 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   390
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   391
next 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   392
  case (o4 c t1 t2 s1 s2)
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   393
  have i1: "a\<sharp>t1 \<Longrightarrow> a\<sharp>t2" by fact
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   394
  have i2: "a\<sharp>s1 \<Longrightarrow> a\<sharp>s2" by fact
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   395
  have as: "a\<sharp>App (Lam [c].s1) t1" by fact
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   396
  hence c1: "a\<sharp>Lam [c].s1" and c2: "a\<sharp>t1" by (simp add: fresh_prod)+
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   397
  from c2 i1 have c3: "a\<sharp>t2" by simp
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   398
  show "a\<sharp>s2[c::=t2]"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   399
  proof (cases "a=c")
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   400
    assume "a=c"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   401
    thus "a\<sharp>s2[c::=t2]" using c3 by (simp add: fresh_fact')
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   402
  next
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   403
    assume d1: "a\<noteq>c"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   404
    from c1 d1 have "a\<sharp>s1" by (simp add: abs_fresh)
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   405
    hence "a\<sharp>s2" using i2 by simp
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   406
    thus "a\<sharp>s2[c::=t2]" using c3 by (simp add: fresh_fact)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   407
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   408
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   409
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   410
lemma one_abs: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   411
  fixes    t :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   412
  and      t':: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   413
  and      a :: "name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   414
  shows "(Lam [a].t)\<longrightarrow>\<^isub>1t'\<Longrightarrow>\<exists>t''. t'=Lam [a].t'' \<and> t\<longrightarrow>\<^isub>1t''"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   415
  apply(ind_cases "(Lam [a].t)\<longrightarrow>\<^isub>1t'")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   416
  apply(auto simp add: lam.distinct lam.inject alpha)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   417
  apply(rule_tac x="[(a,aa)]\<bullet>s2" in exI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   418
  apply(rule conjI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   419
  apply(rule pt_bij2[OF pt_name_inst, OF at_name_inst, symmetric])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   420
  apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   421
  apply(rule pt_name3)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   422
  apply(rule at_ds5[OF at_name_inst])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   423
  apply(frule_tac a="a" in one_fresh_preserv)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   424
  apply(assumption)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   425
  apply(rule conjI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   426
  apply(simp add: pt_fresh_left[OF pt_name_inst, OF at_name_inst])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   427
  apply(simp add: calc_atm)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   428
  apply(force intro!: eqvt_one)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   429
  done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   430
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   431
lemma one_app: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   432
  "App t1 t2 \<longrightarrow>\<^isub>1 t' \<Longrightarrow> 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   433
  (\<exists>s1 s2. t' = App s1 s2 \<and> t1 \<longrightarrow>\<^isub>1 s1 \<and> t2 \<longrightarrow>\<^isub>1 s2) \<or> 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   434
  (\<exists>a s s1 s2. t1 = Lam [a].s \<and> t' = s1[a::=s2] \<and> s \<longrightarrow>\<^isub>1 s1 \<and> t2 \<longrightarrow>\<^isub>1 s2)" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   435
  apply(ind_cases "App t1 s1 \<longrightarrow>\<^isub>1 t'")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   436
  apply(auto simp add: lam.distinct lam.inject)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   437
  done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   438
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   439
lemma one_red: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   440
  "App (Lam [a].t1) t2 \<longrightarrow>\<^isub>1 M \<Longrightarrow>
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   441
  (\<exists>s1 s2. M = App (Lam [a].s1) s2 \<and> t1 \<longrightarrow>\<^isub>1 s1 \<and> t2 \<longrightarrow>\<^isub>1 s2) \<or> 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   442
  (\<exists>s1 s2. M = s1[a::=s2] \<and> t1 \<longrightarrow>\<^isub>1 s1 \<and> t2 \<longrightarrow>\<^isub>1 s2)" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   443
  apply(ind_cases "App (Lam [a].t1) s1 \<longrightarrow>\<^isub>1 M")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   444
  apply(simp_all add: lam.inject)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   445
  apply(force)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   446
  apply(erule conjE)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   447
  apply(drule sym[of "Lam [a].t1"])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   448
  apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   449
  apply(drule one_abs)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   450
  apply(erule exE)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   451
  apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   452
  apply(force simp add: alpha)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   453
  apply(erule conjE)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   454
  apply(simp add: lam.inject alpha)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   455
  apply(erule disjE)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   456
  apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   457
  apply(force)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   458
  apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   459
  apply(rule disjI2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   460
  apply(rule_tac x="[(a,aa)]\<bullet>t2a" in exI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   461
  apply(rule_tac x="s2" in exI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   462
  apply(auto)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   463
  apply(subgoal_tac "a\<sharp>t2a")(*A*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   464
  apply(simp add: subst_rename)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   465
  (*A*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   466
  apply(force intro: one_fresh_preserv)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   467
  apply(force intro: eqvt_one)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   468
  done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   469
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   470
text {* first case in Lemma 3.2.4*}
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   471
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   472
lemma one_subst_aux:
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   473
  assumes a: "N\<longrightarrow>\<^isub>1N'"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   474
  shows "M[x::=N] \<longrightarrow>\<^isub>1 M[x::=N']"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   475
using a
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   476
proof (nominal_induct M avoiding: x N N' rule: lam_induct)
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   477
  case (Var y) 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   478
  show "Var y[x::=N] \<longrightarrow>\<^isub>1 Var y[x::=N']" by (cases "x=y", auto)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   479
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   480
  case (App P Q) (* application case - third line *)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   481
  thus "(App P Q)[x::=N] \<longrightarrow>\<^isub>1  (App P Q)[x::=N']" using o2 by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   482
next 
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   483
  case (Lam y P) (* abstraction case - fourth line *)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   484
  thus "(Lam [y].P)[x::=N] \<longrightarrow>\<^isub>1 (Lam [y].P)[x::=N']" using o3 by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   485
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   486
18378
urbanc
parents: 18344
diff changeset
   487
lemma one_subst_aux_automatic:
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   488
  assumes a: "N\<longrightarrow>\<^isub>1N'"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   489
  shows "M[x::=N] \<longrightarrow>\<^isub>1 M[x::=N']"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   490
using a
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   491
apply(nominal_induct M avoiding: x N N' rule: lam_induct)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   492
apply(auto simp add: fresh_prod fresh_atm)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   493
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   494
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   495
lemma one_subst: 
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   496
  assumes a: "M\<longrightarrow>\<^isub>1M'"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   497
  and     b: "N\<longrightarrow>\<^isub>1N'"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   498
  shows "M[x::=N]\<longrightarrow>\<^isub>1M'[x::=N']" 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   499
using prems
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   500
proof (nominal_induct M M' avoiding: N N' x rule: one_induct)
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   501
  case (o1 M)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   502
  thus ?case by (simp add: one_subst_aux)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   503
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   504
  case (o2 M1 M2 N1 N2)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   505
  thus ?case by simp
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   506
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   507
  case (o3 a M1 M2)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   508
  thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   509
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   510
  case (o4 a M1 M2 N1 N2)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   511
  have e3: "a\<sharp>N1" "a\<sharp>N2" "a\<sharp>N" "a\<sharp>N'" "a\<sharp>x" by fact
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   512
  show ?case
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   513
  proof -
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   514
    have "(App (Lam [a].M1) N1)[x::=N] = App (Lam [a].(M1[x::=N])) (N1[x::=N])" using e3 by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   515
    also have "App (Lam [a].(M1[x::=N])) (N1[x::=N]) \<longrightarrow>\<^isub>1 M2[x::=N'][a::=N2[x::=N']]" 
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   516
      using  o4 b by force
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   517
    also have "M2[x::=N'][a::=N2[x::=N']] = M2[a::=N2][x::=N']" 
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   518
      using e3 by (simp add: subs_lemma fresh_atm)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   519
    ultimately show "(App (Lam [a].M1) N1)[x::=N] \<longrightarrow>\<^isub>1 M2[a::=N2][x::=N']" by simp
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   520
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   521
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   522
18378
urbanc
parents: 18344
diff changeset
   523
lemma one_subst_automatic: 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   524
  assumes a: "M\<longrightarrow>\<^isub>1M'" 
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   525
  and     b: "N\<longrightarrow>\<^isub>1N'"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   526
  shows "M[x::=N]\<longrightarrow>\<^isub>1M'[x::=N']" 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   527
using a b
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   528
apply(nominal_induct M M' avoiding: N N' x rule: one_induct)
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   529
apply(auto simp add: one_subst_aux subs_lemma fresh_atm)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   530
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   531
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   532
lemma diamond[rule_format]:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   533
  fixes    M :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   534
  and      M1:: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   535
  assumes a: "M\<longrightarrow>\<^isub>1M1" 
18344
urbanc
parents: 18312
diff changeset
   536
  and     b: "M\<longrightarrow>\<^isub>1M2"
urbanc
parents: 18312
diff changeset
   537
  shows "\<exists>M3. M1\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3"
urbanc
parents: 18312
diff changeset
   538
  using a b
urbanc
parents: 18312
diff changeset
   539
proof (induct fixing: M2)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   540
  case (o1 M) (* case 1 --- M1 = M *)
18344
urbanc
parents: 18312
diff changeset
   541
  thus "\<exists>M3. M\<longrightarrow>\<^isub>1M3 \<and>  M2\<longrightarrow>\<^isub>1M3" by blast
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   542
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   543
  case (o4 x Q Q' P P') (* case 2 --- a beta-reduction occurs*)
18344
urbanc
parents: 18312
diff changeset
   544
  have i1: "\<And>M2. Q \<longrightarrow>\<^isub>1M2 \<Longrightarrow> (\<exists>M3. Q'\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3)" by fact
urbanc
parents: 18312
diff changeset
   545
  have i2: "\<And>M2. P \<longrightarrow>\<^isub>1M2 \<Longrightarrow> (\<exists>M3. P'\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3)" by fact
urbanc
parents: 18312
diff changeset
   546
  have "App (Lam [x].P) Q \<longrightarrow>\<^isub>1 M2" by fact
urbanc
parents: 18312
diff changeset
   547
  hence "(\<exists>P' Q'. M2 = App (Lam [x].P') Q' \<and> P\<longrightarrow>\<^isub>1P' \<and> Q\<longrightarrow>\<^isub>1Q') \<or> 
urbanc
parents: 18312
diff changeset
   548
         (\<exists>P' Q'. M2 = P'[x::=Q'] \<and> P\<longrightarrow>\<^isub>1P' \<and> Q\<longrightarrow>\<^isub>1Q')" by (simp add: one_red)
urbanc
parents: 18312
diff changeset
   549
  moreover (* subcase 2.1 *)
urbanc
parents: 18312
diff changeset
   550
  { assume "\<exists>P' Q'. M2 = App (Lam [x].P') Q' \<and> P\<longrightarrow>\<^isub>1P' \<and> Q\<longrightarrow>\<^isub>1Q'"
urbanc
parents: 18312
diff changeset
   551
    then obtain P'' and Q'' where 
urbanc
parents: 18312
diff changeset
   552
      b1: "M2=App (Lam [x].P'') Q''" and b2: "P\<longrightarrow>\<^isub>1P''" and b3: "Q\<longrightarrow>\<^isub>1Q''" by blast
urbanc
parents: 18312
diff changeset
   553
    from b2 i2 have "(\<exists>M3. P'\<longrightarrow>\<^isub>1M3 \<and> P''\<longrightarrow>\<^isub>1M3)" by simp
urbanc
parents: 18312
diff changeset
   554
    then obtain P''' where
urbanc
parents: 18312
diff changeset
   555
      c1: "P'\<longrightarrow>\<^isub>1P'''" and c2: "P''\<longrightarrow>\<^isub>1P'''" by force
urbanc
parents: 18312
diff changeset
   556
    from b3 i1 have "(\<exists>M3. Q'\<longrightarrow>\<^isub>1M3 \<and> Q''\<longrightarrow>\<^isub>1M3)" by simp
urbanc
parents: 18312
diff changeset
   557
    then obtain Q''' where
urbanc
parents: 18312
diff changeset
   558
      d1: "Q'\<longrightarrow>\<^isub>1Q'''" and d2: "Q''\<longrightarrow>\<^isub>1Q'''" by force
urbanc
parents: 18312
diff changeset
   559
    from c1 c2 d1 d2 
urbanc
parents: 18312
diff changeset
   560
    have "P'[x::=Q']\<longrightarrow>\<^isub>1P'''[x::=Q'''] \<and> App (Lam [x].P'') Q'' \<longrightarrow>\<^isub>1 P'''[x::=Q''']" 
urbanc
parents: 18312
diff changeset
   561
      by (force simp add: one_subst)
urbanc
parents: 18312
diff changeset
   562
    hence "\<exists>M3. P'[x::=Q']\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3" using b1 by blast
urbanc
parents: 18312
diff changeset
   563
  }
urbanc
parents: 18312
diff changeset
   564
  moreover (* subcase 2.2 *)
urbanc
parents: 18312
diff changeset
   565
  { assume "\<exists>P' Q'. M2 = P'[x::=Q'] \<and> P\<longrightarrow>\<^isub>1P' \<and> Q\<longrightarrow>\<^isub>1Q'"
urbanc
parents: 18312
diff changeset
   566
    then obtain P'' Q'' where
urbanc
parents: 18312
diff changeset
   567
      b1: "M2=P''[x::=Q'']" and b2: "P\<longrightarrow>\<^isub>1P''" and  b3: "Q\<longrightarrow>\<^isub>1Q''" by blast
urbanc
parents: 18312
diff changeset
   568
    from b2 i2 have "(\<exists>M3. P'\<longrightarrow>\<^isub>1M3 \<and> P''\<longrightarrow>\<^isub>1M3)" by simp
urbanc
parents: 18312
diff changeset
   569
    then obtain P''' where
urbanc
parents: 18312
diff changeset
   570
      c1: "P'\<longrightarrow>\<^isub>1P'''" and c2: "P''\<longrightarrow>\<^isub>1P'''" by blast
urbanc
parents: 18312
diff changeset
   571
    from b3 i1 have "(\<exists>M3. Q'\<longrightarrow>\<^isub>1M3 \<and> Q''\<longrightarrow>\<^isub>1M3)" by simp
urbanc
parents: 18312
diff changeset
   572
    then obtain Q''' where
urbanc
parents: 18312
diff changeset
   573
      d1: "Q'\<longrightarrow>\<^isub>1Q'''" and d2: "Q''\<longrightarrow>\<^isub>1Q'''" by blast
urbanc
parents: 18312
diff changeset
   574
    from c1 c2 d1 d2 
urbanc
parents: 18312
diff changeset
   575
    have "P'[x::=Q']\<longrightarrow>\<^isub>1P'''[x::=Q'''] \<and> P''[x::=Q'']\<longrightarrow>\<^isub>1P'''[x::=Q''']" 
urbanc
parents: 18312
diff changeset
   576
      by (force simp add: one_subst)
urbanc
parents: 18312
diff changeset
   577
    hence "\<exists>M3. P'[x::=Q']\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3" using b1 by blast
urbanc
parents: 18312
diff changeset
   578
  }
urbanc
parents: 18312
diff changeset
   579
  ultimately show "\<exists>M3. P'[x::=Q']\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3" by blast
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   580
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   581
  case (o2 Q Q' P P') (* case 3 *)
18344
urbanc
parents: 18312
diff changeset
   582
  have i0: "P\<longrightarrow>\<^isub>1P'" by fact
urbanc
parents: 18312
diff changeset
   583
  have i1: "\<And>M2. Q \<longrightarrow>\<^isub>1M2 \<Longrightarrow> (\<exists>M3. Q'\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3)" by fact
urbanc
parents: 18312
diff changeset
   584
  have i2: "\<And>M2. P \<longrightarrow>\<^isub>1M2 \<Longrightarrow> (\<exists>M3. P'\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3)" by fact
urbanc
parents: 18312
diff changeset
   585
  assume "App P Q \<longrightarrow>\<^isub>1 M2"
urbanc
parents: 18312
diff changeset
   586
  hence "(\<exists>P'' Q''. M2 = App P'' Q'' \<and> P\<longrightarrow>\<^isub>1P'' \<and> Q\<longrightarrow>\<^isub>1Q'') \<or> 
urbanc
parents: 18312
diff changeset
   587
         (\<exists>x P' P'' Q'. P = Lam [x].P' \<and> M2 = P''[x::=Q'] \<and> P'\<longrightarrow>\<^isub>1 P'' \<and> Q\<longrightarrow>\<^isub>1Q')" 
urbanc
parents: 18312
diff changeset
   588
    by (simp add: one_app[simplified])
urbanc
parents: 18312
diff changeset
   589
  moreover (* subcase 3.1 *)
urbanc
parents: 18312
diff changeset
   590
  { assume "\<exists>P'' Q''. M2 = App P'' Q'' \<and> P\<longrightarrow>\<^isub>1P'' \<and> Q\<longrightarrow>\<^isub>1Q''"
urbanc
parents: 18312
diff changeset
   591
    then obtain P'' and Q'' where 
urbanc
parents: 18312
diff changeset
   592
      b1: "M2=App P'' Q''" and b2: "P\<longrightarrow>\<^isub>1P''" and b3: "Q\<longrightarrow>\<^isub>1Q''" by blast
urbanc
parents: 18312
diff changeset
   593
    from b2 i2 have "(\<exists>M3. P'\<longrightarrow>\<^isub>1M3 \<and> P''\<longrightarrow>\<^isub>1M3)" by simp
urbanc
parents: 18312
diff changeset
   594
    then obtain P''' where
urbanc
parents: 18312
diff changeset
   595
      c1: "P'\<longrightarrow>\<^isub>1P'''" and c2: "P''\<longrightarrow>\<^isub>1P'''" by blast
urbanc
parents: 18312
diff changeset
   596
    from b3 i1 have "\<exists>M3. Q'\<longrightarrow>\<^isub>1M3 \<and> Q''\<longrightarrow>\<^isub>1M3" by simp
urbanc
parents: 18312
diff changeset
   597
    then obtain Q''' where
urbanc
parents: 18312
diff changeset
   598
      d1: "Q'\<longrightarrow>\<^isub>1Q'''" and d2: "Q''\<longrightarrow>\<^isub>1Q'''" by blast
urbanc
parents: 18312
diff changeset
   599
    from c1 c2 d1 d2 
urbanc
parents: 18312
diff changeset
   600
    have "App P' Q'\<longrightarrow>\<^isub>1App P''' Q''' \<and> App P'' Q'' \<longrightarrow>\<^isub>1 App P''' Q'''" by blast
urbanc
parents: 18312
diff changeset
   601
    hence "\<exists>M3. App P' Q'\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3" using b1 by blast
urbanc
parents: 18312
diff changeset
   602
  }
urbanc
parents: 18312
diff changeset
   603
  moreover (* subcase 3.2 *)
urbanc
parents: 18312
diff changeset
   604
  { assume "\<exists>x P1 P'' Q''. P = Lam [x].P1 \<and> M2 = P''[x::=Q''] \<and> P1\<longrightarrow>\<^isub>1 P'' \<and> Q\<longrightarrow>\<^isub>1Q''"
urbanc
parents: 18312
diff changeset
   605
    then obtain x P1 P1'' Q'' where
urbanc
parents: 18312
diff changeset
   606
      b0: "P=Lam [x].P1" and b1: "M2=P1''[x::=Q'']" and 
urbanc
parents: 18312
diff changeset
   607
      b2: "P1\<longrightarrow>\<^isub>1P1''" and  b3: "Q\<longrightarrow>\<^isub>1Q''" by blast
urbanc
parents: 18312
diff changeset
   608
    from b0 i0 have "\<exists>P1'. P'=Lam [x].P1' \<and> P1\<longrightarrow>\<^isub>1P1'" by (simp add: one_abs)
urbanc
parents: 18312
diff changeset
   609
    then obtain P1' where g1: "P'=Lam [x].P1'" and g2: "P1\<longrightarrow>\<^isub>1P1'" by blast 
urbanc
parents: 18312
diff changeset
   610
    from g1 b0 b2 i2 have "(\<exists>M3. (Lam [x].P1')\<longrightarrow>\<^isub>1M3 \<and> (Lam [x].P1'')\<longrightarrow>\<^isub>1M3)" by simp
urbanc
parents: 18312
diff changeset
   611
    then obtain P1''' where
urbanc
parents: 18312
diff changeset
   612
      c1: "(Lam [x].P1')\<longrightarrow>\<^isub>1P1'''" and c2: "(Lam [x].P1'')\<longrightarrow>\<^isub>1P1'''" by blast
urbanc
parents: 18312
diff changeset
   613
    from c1 have "\<exists>R1. P1'''=Lam [x].R1 \<and> P1'\<longrightarrow>\<^isub>1R1" by (simp add: one_abs)
urbanc
parents: 18312
diff changeset
   614
    then obtain R1 where r1: "P1'''=Lam [x].R1" and r2: "P1'\<longrightarrow>\<^isub>1R1" by blast
urbanc
parents: 18312
diff changeset
   615
    from c2 have "\<exists>R2. P1'''=Lam [x].R2 \<and> P1''\<longrightarrow>\<^isub>1R2" by (simp add: one_abs)
urbanc
parents: 18312
diff changeset
   616
    then obtain R2 where r3: "P1'''=Lam [x].R2" and r4: "P1''\<longrightarrow>\<^isub>1R2" by blast
urbanc
parents: 18312
diff changeset
   617
    from r1 r3 have r5: "R1=R2" by (simp add: lam.inject alpha)
urbanc
parents: 18312
diff changeset
   618
    from b3 i1 have "(\<exists>M3. Q'\<longrightarrow>\<^isub>1M3 \<and> Q''\<longrightarrow>\<^isub>1M3)" by simp
urbanc
parents: 18312
diff changeset
   619
    then obtain Q''' where
urbanc
parents: 18312
diff changeset
   620
      d1: "Q'\<longrightarrow>\<^isub>1Q'''" and d2: "Q''\<longrightarrow>\<^isub>1Q'''" by blast
urbanc
parents: 18312
diff changeset
   621
    from g1 r2 d1 r4 r5 d2 
urbanc
parents: 18312
diff changeset
   622
    have "App P' Q'\<longrightarrow>\<^isub>1R1[x::=Q'''] \<and> P1''[x::=Q'']\<longrightarrow>\<^isub>1R1[x::=Q''']" by (simp add: one_subst)
urbanc
parents: 18312
diff changeset
   623
    hence "\<exists>M3. App P' Q'\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3" using b1 by blast
urbanc
parents: 18312
diff changeset
   624
  }
urbanc
parents: 18312
diff changeset
   625
  ultimately show "\<exists>M3. App P' Q'\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3" by blast
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   626
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   627
  case (o3 x P P') (* case 4 *)
18344
urbanc
parents: 18312
diff changeset
   628
  have i1: "P\<longrightarrow>\<^isub>1P'" by fact
urbanc
parents: 18312
diff changeset
   629
  have i2: "\<And>M2. P \<longrightarrow>\<^isub>1M2 \<Longrightarrow> (\<exists>M3. P'\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3)" by fact
urbanc
parents: 18312
diff changeset
   630
  have "(Lam [x].P)\<longrightarrow>\<^isub>1 M2" by fact
urbanc
parents: 18312
diff changeset
   631
  hence "\<exists>P''. M2=Lam [x].P'' \<and> P\<longrightarrow>\<^isub>1P''" by (simp add: one_abs)
urbanc
parents: 18312
diff changeset
   632
  then obtain P'' where b1: "M2=Lam [x].P''" and b2: "P\<longrightarrow>\<^isub>1P''" by blast
urbanc
parents: 18312
diff changeset
   633
  from i2 b1 b2 have "\<exists>M3. (Lam [x].P')\<longrightarrow>\<^isub>1M3 \<and> (Lam [x].P'')\<longrightarrow>\<^isub>1M3" by blast
urbanc
parents: 18312
diff changeset
   634
  then obtain M3 where c1: "(Lam [x].P')\<longrightarrow>\<^isub>1M3" and c2: "(Lam [x].P'')\<longrightarrow>\<^isub>1M3" by blast
urbanc
parents: 18312
diff changeset
   635
  from c1 have "\<exists>R1. M3=Lam [x].R1 \<and> P'\<longrightarrow>\<^isub>1R1" by (simp add: one_abs)
urbanc
parents: 18312
diff changeset
   636
  then obtain R1 where r1: "M3=Lam [x].R1" and r2: "P'\<longrightarrow>\<^isub>1R1" by blast
urbanc
parents: 18312
diff changeset
   637
  from c2 have "\<exists>R2. M3=Lam [x].R2 \<and> P''\<longrightarrow>\<^isub>1R2" by (simp add: one_abs)
urbanc
parents: 18312
diff changeset
   638
  then obtain R2 where r3: "M3=Lam [x].R2" and r4: "P''\<longrightarrow>\<^isub>1R2" by blast
urbanc
parents: 18312
diff changeset
   639
  from r1 r3 have r5: "R1=R2" by (simp add: lam.inject alpha)
urbanc
parents: 18312
diff changeset
   640
  from r2 r4 have "(Lam [x].P')\<longrightarrow>\<^isub>1(Lam [x].R1) \<and> (Lam [x].P'')\<longrightarrow>\<^isub>1(Lam [x].R2)" 
urbanc
parents: 18312
diff changeset
   641
    by (simp add: one_subst)
urbanc
parents: 18312
diff changeset
   642
  thus "\<exists>M3. (Lam [x].P')\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3" using b1 r5 by blast
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   643
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   644
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   645
lemma one_abs_cong: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   646
  assumes a: "t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   647
  shows "(Lam [a].t1)\<longrightarrow>\<^isub>\<beta>\<^sup>*(Lam [a].t2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   648
  using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   649
proof induct
18378
urbanc
parents: 18344
diff changeset
   650
  case 1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   651
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   652
  case (2 y z) 
18378
urbanc
parents: 18344
diff changeset
   653
  thus ?case by (blast dest: b3 intro: rtrancl_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   654
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   655
18378
urbanc
parents: 18344
diff changeset
   656
lemma one_app_congL: 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   657
  assumes a: "t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   658
  shows "App t1 s\<longrightarrow>\<^isub>\<beta>\<^sup>* App t2 s"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   659
  using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   660
proof induct
18378
urbanc
parents: 18344
diff changeset
   661
  case 1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   662
next
18378
urbanc
parents: 18344
diff changeset
   663
  case 2 thus ?case by (blast dest: b1 intro: rtrancl_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   664
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   665
  
18378
urbanc
parents: 18344
diff changeset
   666
lemma one_app_congR: 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   667
  assumes a: "t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   668
  shows "App s t1 \<longrightarrow>\<^isub>\<beta>\<^sup>* App s t2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   669
using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   670
proof induct
18378
urbanc
parents: 18344
diff changeset
   671
  case 1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   672
next 
18378
urbanc
parents: 18344
diff changeset
   673
  case 2 thus ?case by (blast dest: b2 intro: rtrancl_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   674
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   675
18378
urbanc
parents: 18344
diff changeset
   676
lemma one_app_cong: 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   677
  assumes a1: "t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   678
  and a2: "s1\<longrightarrow>\<^isub>\<beta>\<^sup>*s2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   679
  shows "App t1 s1\<longrightarrow>\<^isub>\<beta>\<^sup>* App t2 s2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   680
proof -
18378
urbanc
parents: 18344
diff changeset
   681
  have "App t1 s1 \<longrightarrow>\<^isub>\<beta>\<^sup>* App t2 s1" using a1 by (rule one_app_congL)
urbanc
parents: 18344
diff changeset
   682
  moreover
urbanc
parents: 18344
diff changeset
   683
  have "App t2 s1 \<longrightarrow>\<^isub>\<beta>\<^sup>* App t2 s2" using a2 by (rule one_app_congR)
urbanc
parents: 18344
diff changeset
   684
  ultimately show ?thesis by (blast intro: rtrancl_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   685
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   686
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   687
lemma one_beta_star: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   688
  assumes a: "(t1\<longrightarrow>\<^isub>1t2)" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   689
  shows "(t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   690
  using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   691
proof induct
18378
urbanc
parents: 18344
diff changeset
   692
  case o1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   693
next
18378
urbanc
parents: 18344
diff changeset
   694
  case o2 thus ?case by (blast intro!: one_app_cong)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   695
next
18378
urbanc
parents: 18344
diff changeset
   696
  case o3 thus ?case by (blast intro!: one_abs_cong)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   697
next 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   698
  case (o4 a s1 s2 t1 t2)
18378
urbanc
parents: 18344
diff changeset
   699
  have a1: "t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2" and a2: "s1\<longrightarrow>\<^isub>\<beta>\<^sup>*s2" by fact
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   700
  have c1: "(App (Lam [a].t2) s2) \<longrightarrow>\<^isub>\<beta> (t2 [a::= s2])" by (rule b4)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   701
  from a1 a2 have c2: "App (Lam [a].t1 ) s1 \<longrightarrow>\<^isub>\<beta>\<^sup>* App (Lam [a].t2 ) s2" 
18378
urbanc
parents: 18344
diff changeset
   702
    by (blast intro!: one_app_cong one_abs_cong)
urbanc
parents: 18344
diff changeset
   703
  show ?case using c1 c2 by (blast intro: rtrancl_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   704
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   705
 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   706
lemma one_star_abs_cong: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   707
  assumes a: "t1\<longrightarrow>\<^isub>1\<^sup>*t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   708
  shows "(Lam  [a].t1)\<longrightarrow>\<^isub>1\<^sup>* (Lam [a].t2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   709
  using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   710
proof induct
18378
urbanc
parents: 18344
diff changeset
   711
  case 1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   712
next
18378
urbanc
parents: 18344
diff changeset
   713
  case 2 thus ?case by (blast intro: rtrancl_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   714
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   715
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   716
lemma one_star_pr_congL: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   717
  assumes a: "t1\<longrightarrow>\<^isub>1\<^sup>*t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   718
  shows "App t1 s\<longrightarrow>\<^isub>1\<^sup>* App t2 s"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   719
  using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   720
proof induct
18378
urbanc
parents: 18344
diff changeset
   721
  case 1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   722
next
18378
urbanc
parents: 18344
diff changeset
   723
  case 2 thus ?case by (blast intro: rtrancl_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   724
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   725
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   726
lemma one_star_pr_congR: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   727
  assumes a: "t1\<longrightarrow>\<^isub>1\<^sup>*t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   728
  shows "App s t1 \<longrightarrow>\<^isub>1\<^sup>* App s t2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   729
  using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   730
proof induct
18378
urbanc
parents: 18344
diff changeset
   731
  case 1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   732
next
18378
urbanc
parents: 18344
diff changeset
   733
  case 2 thus ?case by (blast intro: rtrancl_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   734
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   735
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   736
lemma beta_one_star: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   737
  assumes a: "t1\<longrightarrow>\<^isub>\<beta>t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   738
  shows "t1\<longrightarrow>\<^isub>1\<^sup>*t2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   739
  using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   740
proof induct
18378
urbanc
parents: 18344
diff changeset
   741
  case b1 thus ?case by (blast intro!: one_star_pr_congL)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   742
next
18378
urbanc
parents: 18344
diff changeset
   743
  case b2 thus ?case by (blast intro!: one_star_pr_congR)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   744
next
18378
urbanc
parents: 18344
diff changeset
   745
  case b3 thus ?case by (blast intro!: one_star_abs_cong)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   746
next
18378
urbanc
parents: 18344
diff changeset
   747
  case b4 thus ?case by blast
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   748
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   749
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   750
lemma trans_closure: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   751
  shows "(t1\<longrightarrow>\<^isub>1\<^sup>*t2) = (t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   752
proof
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   753
  assume "t1 \<longrightarrow>\<^isub>1\<^sup>* t2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   754
  thus "t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   755
  proof induct
18378
urbanc
parents: 18344
diff changeset
   756
    case 1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   757
  next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   758
    case 2 thus ?case by (force intro: rtrancl_trans simp add: one_beta_star)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   759
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   760
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   761
  assume "t1 \<longrightarrow>\<^isub>\<beta>\<^sup>* t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   762
  thus "t1\<longrightarrow>\<^isub>1\<^sup>*t2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   763
  proof induct
18378
urbanc
parents: 18344
diff changeset
   764
    case 1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   765
  next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   766
    case 2 thus ?case by (force intro: rtrancl_trans simp add: beta_one_star)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   767
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   768
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   769
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   770
lemma cr_one:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   771
  assumes a: "t\<longrightarrow>\<^isub>1\<^sup>*t1" 
18344
urbanc
parents: 18312
diff changeset
   772
  and     b: "t\<longrightarrow>\<^isub>1t2"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   773
  shows "\<exists>t3. t1\<longrightarrow>\<^isub>1t3 \<and> t2\<longrightarrow>\<^isub>1\<^sup>*t3"
18344
urbanc
parents: 18312
diff changeset
   774
  using a b
urbanc
parents: 18312
diff changeset
   775
proof (induct fixing: t2)
urbanc
parents: 18312
diff changeset
   776
  case 1 thus ?case by force
urbanc
parents: 18312
diff changeset
   777
next
urbanc
parents: 18312
diff changeset
   778
  case (2 s1 s2)
urbanc
parents: 18312
diff changeset
   779
  have b: "s1 \<longrightarrow>\<^isub>1 s2" by fact
urbanc
parents: 18312
diff changeset
   780
  have h: "\<And>t2. t \<longrightarrow>\<^isub>1 t2 \<Longrightarrow> (\<exists>t3. s1 \<longrightarrow>\<^isub>1 t3 \<and> t2 \<longrightarrow>\<^isub>1\<^sup>* t3)" by fact
urbanc
parents: 18312
diff changeset
   781
  have c: "t \<longrightarrow>\<^isub>1 t2" by fact
18378
urbanc
parents: 18344
diff changeset
   782
  show "\<exists>t3. s2 \<longrightarrow>\<^isub>1 t3 \<and>  t2 \<longrightarrow>\<^isub>1\<^sup>* t3" 
18344
urbanc
parents: 18312
diff changeset
   783
  proof -
18378
urbanc
parents: 18344
diff changeset
   784
    from c h have "\<exists>t3. s1 \<longrightarrow>\<^isub>1 t3 \<and> t2 \<longrightarrow>\<^isub>1\<^sup>* t3" by blast
urbanc
parents: 18344
diff changeset
   785
    then obtain t3 where c1: "s1 \<longrightarrow>\<^isub>1 t3" and c2: "t2 \<longrightarrow>\<^isub>1\<^sup>* t3" by blast
urbanc
parents: 18344
diff changeset
   786
    have "\<exists>t4. s2 \<longrightarrow>\<^isub>1 t4 \<and> t3 \<longrightarrow>\<^isub>1 t4" using b c1 by (blast intro: diamond)
urbanc
parents: 18344
diff changeset
   787
    thus ?thesis using c2 by (blast intro: rtrancl_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   788
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   789
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   790
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   791
lemma cr_one_star: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   792
  assumes a: "t\<longrightarrow>\<^isub>1\<^sup>*t2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   793
      and b: "t\<longrightarrow>\<^isub>1\<^sup>*t1"
18378
urbanc
parents: 18344
diff changeset
   794
    shows "\<exists>t3. t1\<longrightarrow>\<^isub>1\<^sup>*t3\<and>t2\<longrightarrow>\<^isub>1\<^sup>*t3"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   795
using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   796
proof induct
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   797
  case 1
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   798
  show ?case using b by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   799
next 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   800
  case (2 s1 s2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   801
  assume d: "s1 \<longrightarrow>\<^isub>1 s2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   802
  assume "\<exists>t3.  t1 \<longrightarrow>\<^isub>1\<^sup>* t3 \<and>  s1 \<longrightarrow>\<^isub>1\<^sup>* t3"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   803
  then obtain t3 where f1: "t1 \<longrightarrow>\<^isub>1\<^sup>* t3"
18378
urbanc
parents: 18344
diff changeset
   804
                   and f2: "s1 \<longrightarrow>\<^isub>1\<^sup>* t3" by blast
urbanc
parents: 18344
diff changeset
   805
  from cr_one d f2 have "\<exists>t4. t3\<longrightarrow>\<^isub>1t4 \<and> s2\<longrightarrow>\<^isub>1\<^sup>*t4" by blast
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   806
  then obtain t4 where g1: "t3\<longrightarrow>\<^isub>1t4"
18378
urbanc
parents: 18344
diff changeset
   807
                   and g2: "s2\<longrightarrow>\<^isub>1\<^sup>*t4" by blast
urbanc
parents: 18344
diff changeset
   808
  have "t1\<longrightarrow>\<^isub>1\<^sup>*t4" using f1 g1 by (blast intro: rtrancl_trans)
urbanc
parents: 18344
diff changeset
   809
  thus ?case using g2 by blast
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   810
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   811
  
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   812
lemma cr_beta_star: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   813
  assumes a1: "t\<longrightarrow>\<^isub>\<beta>\<^sup>*t1" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   814
  and a2: "t\<longrightarrow>\<^isub>\<beta>\<^sup>*t2" 
18378
urbanc
parents: 18344
diff changeset
   815
  shows "\<exists>t3. t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t3\<and>t2\<longrightarrow>\<^isub>\<beta>\<^sup>*t3"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   816
proof -
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   817
  from a1 have b1: "t\<longrightarrow>\<^isub>1\<^sup>*t1" by (simp add: trans_closure[symmetric])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   818
  from a2 have b2: "t\<longrightarrow>\<^isub>1\<^sup>*t2" by (simp add: trans_closure[symmetric])
18378
urbanc
parents: 18344
diff changeset
   819
  from b1 and b2 have c: "\<exists>t3. t1\<longrightarrow>\<^isub>1\<^sup>*t3 \<and> t2\<longrightarrow>\<^isub>1\<^sup>*t3" by (blast intro!: cr_one_star) 
urbanc
parents: 18344
diff changeset
   820
  from c obtain t3 where d1: "t1\<longrightarrow>\<^isub>1\<^sup>*t3" and d2: "t2\<longrightarrow>\<^isub>1\<^sup>*t3" by blast
urbanc
parents: 18344
diff changeset
   821
  have "t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t3" using d1 by (simp add: trans_closure)
urbanc
parents: 18344
diff changeset
   822
  moreover
urbanc
parents: 18344
diff changeset
   823
  have "t2\<longrightarrow>\<^isub>\<beta>\<^sup>*t3" using d2 by (simp add: trans_closure)
urbanc
parents: 18344
diff changeset
   824
  ultimately show ?thesis by blast
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   825
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   826
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   827
end
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   828