src/HOL/Nominal/Examples/CR.thy
author wenzelm
Tue, 10 Jul 2007 23:29:43 +0200
changeset 23719 ccd9cb15c062
parent 23393 31781b2de73d
child 23760 aca2c7f80e2f
permissions -rw-r--r--
more markup for inner and outer syntax; added enclose;
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
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
     3
theory CR
21138
afdd72fc6c4f changed to use Lam_Funs
urbanc
parents: 21101
diff changeset
     4
imports Lam_Funs
18106
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: 
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    10
  assumes asm: "x\<sharp>L"
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    11
  shows "L[x::=P] = L"
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    12
using asm
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    13
proof (nominal_induct L avoiding: x P rule: lam.induct)
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    14
  case (Var z)
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    15
  have "x\<sharp>Var z" by fact
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    16
  thus "(Var z)[x::=P] = (Var z)" by (simp add: fresh_atm)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    17
next 
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    18
  case (App M1 M2)
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    19
  have "x\<sharp>App M1 M2" by fact
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    20
  moreover
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    21
  have ih1: "x\<sharp>M1 \<Longrightarrow> M1[x::=P] = M1" by fact
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    22
  moreover
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    23
  have ih1: "x\<sharp>M2 \<Longrightarrow> M2[x::=P] = M2" by fact
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    24
  ultimately show "(App M1 M2)[x::=P] = (App M1 M2)" by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    25
next
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    26
  case (Lam z M)
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 22823
diff changeset
    27
  have vc: "z\<sharp>x" "z\<sharp>P" by fact+
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    28
  have ih: "x\<sharp>M \<Longrightarrow>  M[x::=P] = M" by fact
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    29
  have asm: "x\<sharp>Lam [z].M" by fact
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
    30
  then have "x\<sharp>M" using vc by (simp add: fresh_atm abs_fresh)
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
    31
  then have "M[x::=P] = M" using ih by simp
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
    32
  then show "(Lam [z].M)[x::=P] = Lam [z].M" using vc by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    33
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    34
18378
urbanc
parents: 18344
diff changeset
    35
lemma forget_automatic: 
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    36
  assumes asm: "x\<sharp>L"
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    37
  shows "L[x::=P] = L"
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
    38
  using asm 
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
    39
by (nominal_induct L avoiding: x P rule: lam.induct)
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
    40
   (auto simp add: abs_fresh fresh_atm)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    41
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    42
lemma fresh_fact: 
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    43
  fixes z::"name"
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    44
  assumes asms: "z\<sharp>N" "z\<sharp>L"
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    45
  shows "z\<sharp>(N[y::=L])"
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    46
using asms
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    47
proof (nominal_induct N avoiding: z y L rule: lam.induct)
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    48
  case (Var u)
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 22823
diff changeset
    49
  have "z\<sharp>(Var u)" "z\<sharp>L" by fact+
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    50
  thus "z\<sharp>((Var u)[y::=L])" by simp
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    51
next
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    52
  case (App N1 N2)
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    53
  have ih1: "\<lbrakk>z\<sharp>N1; z\<sharp>L\<rbrakk> \<Longrightarrow> z\<sharp>N1[y::=L]" by fact
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    54
  moreover
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    55
  have ih2: "\<lbrakk>z\<sharp>N2; z\<sharp>L\<rbrakk> \<Longrightarrow> z\<sharp>N2[y::=L]" by fact
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    56
  moreover 
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 22823
diff changeset
    57
  have "z\<sharp>App N1 N2" "z\<sharp>L" by fact+
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    58
  ultimately show "z\<sharp>((App N1 N2)[y::=L])" by simp 
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    59
next
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    60
  case (Lam u N1)
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 22823
diff changeset
    61
  have vc: "u\<sharp>z" "u\<sharp>y" "u\<sharp>L" by fact+
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    62
  have "z\<sharp>Lam [u].N1" by fact
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    63
  hence "z\<sharp>N1" using vc by (simp add: abs_fresh fresh_atm)
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    64
  moreover
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    65
  have ih: "\<lbrakk>z\<sharp>N1; z\<sharp>L\<rbrakk> \<Longrightarrow> z\<sharp>(N1[y::=L])" by fact
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    66
  moreover
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    67
  have  "z\<sharp>L" by fact
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    68
  ultimately show "z\<sharp>(Lam [u].N1)[y::=L]" using vc by (simp add: abs_fresh)
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    69
qed
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
    70
18378
urbanc
parents: 18344
diff changeset
    71
lemma fresh_fact_automatic: 
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    72
  fixes z::"name"
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    73
  assumes asms: "z\<sharp>N" "z\<sharp>L"
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    74
  shows "z\<sharp>(N[y::=L])"
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
    75
  using asms 
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
    76
by (nominal_induct N avoiding: z y L rule: lam.induct)
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
    77
   (auto simp add: abs_fresh fresh_atm)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    78
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
    79
lemma fresh_fact': 
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
    80
  fixes a::"name"
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
    81
  assumes a: "a\<sharp>t2"
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
    82
  shows "a\<sharp>t1[a::=t2]"
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
    83
using a 
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
    84
by (nominal_induct t1 avoiding: a t2 rule: lam.induct)
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
    85
   (auto simp add: abs_fresh fresh_atm)
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
    86
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
    87
lemma substitution_lemma:  
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    88
  assumes a: "x\<noteq>y"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    89
  and     b: "x\<sharp>L"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    90
  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
    91
using a b
18659
2ff0ae57431d changes to make use of the new induction principle proved by
urbanc
parents: 18378
diff changeset
    92
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
    93
  case (Var z) (* case 1: Variables*)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    94
  have "x\<noteq>y" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    95
  have "x\<sharp>L" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    96
  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
    97
  proof -
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    98
    { (*Case 1.1*)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
    99
      assume  "z=x"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   100
      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
   101
      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
   102
      from "(1)" "(2)" have "?LHS = ?RHS"  by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   103
    }
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   104
    moreover 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   105
    { (*Case 1.2*)
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
   106
      assume "z=y" and "z\<noteq>x" 
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   107
      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
   108
      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
   109
      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
   110
      from "(1)" "(2)" "(3)" have "?LHS = ?RHS" by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   111
    }
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   112
    moreover 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   113
    { (*Case 1.3*)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   114
      assume "z\<noteq>x" and "z\<noteq>y"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   115
      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
   116
      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
   117
      from "(1)" "(2)" have "?LHS = ?RHS" by simp
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   118
    }
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   119
    ultimately show "?LHS = ?RHS" by blast
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   120
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   121
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   122
  case (Lam z M1) (* case 2: lambdas *)
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
   123
  have ih: "\<lbrakk>x\<noteq>y; x\<sharp>L\<rbrakk> \<Longrightarrow> M1[x::=N][y::=L] = M1[y::=L][x::=N[y::=L]]" by fact
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   124
  have "x\<noteq>y" by fact
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   125
  have "x\<sharp>L" by fact
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 22823
diff changeset
   126
  have fs: "z\<sharp>x" "z\<sharp>y" "z\<sharp>N" "z\<sharp>L" by fact+
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   127
  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
   128
  show "(Lam [z].M1)[x::=N][y::=L] = (Lam [z].M1)[y::=L][x::=N[y::=L]]" (is "?LHS=?RHS") 
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
   129
  proof - 
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   130
    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
   131
    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
   132
    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
   133
    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
   134
    finally show "?LHS = ?RHS" .
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   135
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   136
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   137
  case (App M1 M2) (* case 3: applications *)
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   138
  thus "(App M1 M2)[x::=N][y::=L] = (App M1 M2)[y::=L][x::=N[y::=L]]" by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   139
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   140
20955
65a9a30b8ece made some proof look more like the ones in Barendregt
urbanc
parents: 20503
diff changeset
   141
lemma substitution_lemma_automatic:  
19172
ad36a9b42cf3 made some small changes to generate nicer latex-output
urbanc
parents: 18882
diff changeset
   142
  assumes asm: "x\<noteq>y" "x\<sharp>L"
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   143
  shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]"
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   144
  using asm 
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   145
by (nominal_induct M avoiding: x y N L rule: lam.induct)
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   146
   (auto simp add: fresh_fact forget)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   147
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   148
section {* Beta Reduction *}
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   149
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   150
inductive2
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   151
  "Beta" :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>\<beta> _" [80,80] 80)
21366
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   152
where
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   153
    b1[intro]: "s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (App s1 t)\<longrightarrow>\<^isub>\<beta>(App s2 t)"
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   154
  | b2[intro]: "s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (App t s1)\<longrightarrow>\<^isub>\<beta>(App t s2)"
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   155
  | b3[intro]: "s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (Lam [a].s1)\<longrightarrow>\<^isub>\<beta> (Lam [a].s2)"
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   156
  | b4[intro]: "a\<sharp>s2 \<Longrightarrow> (App (Lam [a].s1) s2)\<longrightarrow>\<^isub>\<beta>(s1[a::=s2])"
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   157
22730
8bcc8809ed3b nominal_inductive no longer proves equivariance.
berghofe
parents: 22542
diff changeset
   158
equivariance Beta
8bcc8809ed3b nominal_inductive no longer proves equivariance.
berghofe
parents: 22542
diff changeset
   159
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   160
nominal_inductive Beta
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   161
  by (simp_all add: abs_fresh fresh_fact')
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   162
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   163
inductive2
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   164
  "Beta_star"  :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>\<beta>\<^sup>* _" [80,80] 80)
21366
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   165
where
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   166
    bs1[intro, simp]: "M \<longrightarrow>\<^isub>\<beta>\<^sup>* M"
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   167
  | bs2[intro]: "\<lbrakk>M1\<longrightarrow>\<^isub>\<beta>\<^sup>* M2; M2 \<longrightarrow>\<^isub>\<beta> M3\<rbrakk> \<Longrightarrow> M1 \<longrightarrow>\<^isub>\<beta>\<^sup>* M3"
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   168
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   169
equivariance Beta_star
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   170
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   171
lemma beta_star_trans:
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   172
  assumes a1: "M1\<longrightarrow>\<^isub>\<beta>\<^sup>* M2"
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   173
  and     a2: "M2\<longrightarrow>\<^isub>\<beta>\<^sup>* M3"
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   174
  shows "M1 \<longrightarrow>\<^isub>\<beta>\<^sup>* M3"
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   175
using a2 a1
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   176
by (induct) (auto)
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   177
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   178
section {* One-Reduction *}
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   179
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   180
inductive2
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   181
  One :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>1 _" [80,80] 80)
21366
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   182
where
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   183
    o1[intro!]:      "M\<longrightarrow>\<^isub>1M"
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   184
  | o2[simp,intro!]: "\<lbrakk>t1\<longrightarrow>\<^isub>1t2;s1\<longrightarrow>\<^isub>1s2\<rbrakk> \<Longrightarrow> (App t1 s1)\<longrightarrow>\<^isub>1(App t2 s2)"
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   185
  | o3[simp,intro!]: "s1\<longrightarrow>\<^isub>1s2 \<Longrightarrow> (Lam [a].s1)\<longrightarrow>\<^isub>1(Lam [a].s2)"
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   186
  | o4[simp,intro!]: "\<lbrakk>a\<sharp>(s1,s2); s1\<longrightarrow>\<^isub>1s2;t1\<longrightarrow>\<^isub>1t2\<rbrakk> \<Longrightarrow> (App (Lam [a].t1) s1)\<longrightarrow>\<^isub>1(t2[a::=s2])"
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   187
22730
8bcc8809ed3b nominal_inductive no longer proves equivariance.
berghofe
parents: 22542
diff changeset
   188
equivariance One
8bcc8809ed3b nominal_inductive no longer proves equivariance.
berghofe
parents: 22542
diff changeset
   189
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   190
nominal_inductive One
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   191
  by (simp_all add: abs_fresh fresh_fact')
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   192
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   193
inductive2
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   194
  "One_star"  :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>1\<^sup>* _" [80,80] 80)
21366
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   195
where
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   196
    os1[intro, simp]: "M \<longrightarrow>\<^isub>1\<^sup>* M"
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   197
  | os2[intro]: "\<lbrakk>M1\<longrightarrow>\<^isub>1\<^sup>* M2; M2 \<longrightarrow>\<^isub>1 M3\<rbrakk> \<Longrightarrow> M1 \<longrightarrow>\<^isub>1\<^sup>* M3"
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   198
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   199
equivariance One_star 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   200
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   201
lemma one_star_trans:
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   202
  assumes a1: "M1\<longrightarrow>\<^isub>1\<^sup>* M2" 
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   203
  and     a2: "M2\<longrightarrow>\<^isub>1\<^sup>* M3"
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   204
  shows "M1\<longrightarrow>\<^isub>1\<^sup>* M3"
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   205
using a2 a1
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   206
by (induct) (auto)
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   207
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   208
lemma one_fresh_preserv:
18378
urbanc
parents: 18344
diff changeset
   209
  fixes a :: "name"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   210
  assumes a: "t\<longrightarrow>\<^isub>1s"
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   211
  and     b: "a\<sharp>t"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   212
  shows "a\<sharp>s"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   213
using a b
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   214
proof (induct)
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   215
  case o1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   216
next
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   217
  case o2 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   218
next
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   219
  case (o3 s1 s2 c)
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   220
  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
   221
  have c: "a\<sharp>Lam [c].s1" by fact
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   222
  show ?case
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   223
  proof (cases "a=c")
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   224
    assume "a=c" thus "a\<sharp>Lam [c].s2" by (simp add: abs_fresh)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   225
  next
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   226
    assume d: "a\<noteq>c" 
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   227
    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
   228
    hence "a\<sharp>s2" using ih by simp
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   229
    thus "a\<sharp>Lam [c].s2" using d by (simp add: abs_fresh) 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   230
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   231
next 
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   232
  case (o4 c t1 t2 s1 s2)
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   233
  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
   234
  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
   235
  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
   236
  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
   237
  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
   238
  show "a\<sharp>s2[c::=t2]"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   239
  proof (cases "a=c")
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   240
    assume "a=c"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   241
    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
   242
  next
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   243
    assume d1: "a\<noteq>c"
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   244
    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
   245
    hence "a\<sharp>s2" using i2 by simp
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   246
    thus "a\<sharp>s2[c::=t2]" using c3 by (simp add: fresh_fact)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   247
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   248
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   249
22823
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   250
lemma one_fresh_preserv_automatic:
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   251
  fixes a :: "name"
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   252
  assumes a: "t\<longrightarrow>\<^isub>1s"
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   253
  and     b: "a\<sharp>t"
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   254
  shows "a\<sharp>s"
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   255
using a b
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   256
apply(nominal_induct avoiding: a rule: One.strong_induct)
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   257
apply(auto simp add: abs_fresh fresh_atm fresh_fact)
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   258
done
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   259
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   260
lemma subst_rename: 
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   261
  assumes a: "c\<sharp>t1"
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   262
  shows "t1[a::=t2] = ([(c,a)]\<bullet>t1)[c::=t2]"
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   263
using a
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   264
by (nominal_induct t1 avoiding: a c t2 rule: lam.induct)
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   265
   (auto simp add: calc_atm fresh_atm abs_fresh)
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   266
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   267
lemma one_abs: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   268
  fixes    t :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   269
  and      t':: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   270
  and      a :: "name"
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   271
  assumes a: "(Lam [a].t)\<longrightarrow>\<^isub>1t'"
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   272
  shows "\<exists>t''. t'=Lam [a].t'' \<and> t\<longrightarrow>\<^isub>1t''"
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   273
  using a
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   274
  apply -
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   275
  apply(ind_cases2 "(Lam [a].t)\<longrightarrow>\<^isub>1t'")
22823
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   276
  apply(auto simp add: lam.inject alpha)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   277
  apply(rule_tac x="[(a,aa)]\<bullet>s2" in exI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   278
  apply(rule conjI)
22823
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   279
  apply(perm_simp)
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   280
  apply(simp add: fresh_left calc_atm)
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   281
  apply(simp add: One.eqvt)
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   282
  apply(simp add: one_fresh_preserv)
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   283
done  
fa9ff469247f tuned some proofs in CR and properly included CR_Takahashi
urbanc
parents: 22730
diff changeset
   284
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   285
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   286
lemma one_app: 
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   287
  assumes a: "App t1 t2 \<longrightarrow>\<^isub>1 t'"
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   288
  shows "(\<exists>s1 s2. t' = App s1 s2 \<and> t1 \<longrightarrow>\<^isub>1 s1 \<and> t2 \<longrightarrow>\<^isub>1 s2) \<or> 
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   289
         (\<exists>a s s1 s2. t1 = Lam [a].s \<and> a\<sharp>(t2,s2) \<and> t' = s1[a::=s2] \<and> s \<longrightarrow>\<^isub>1 s1 \<and> t2 \<longrightarrow>\<^isub>1 s2)" 
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   290
  using a
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   291
  apply -
21366
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   292
  apply(ind_cases2 "App t1 t2 \<longrightarrow>\<^isub>1 t'")
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   293
  apply(auto simp add: lam.distinct lam.inject)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   294
  done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   295
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   296
lemma one_red: 
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   297
  assumes a: "App (Lam [a].t1) t2 \<longrightarrow>\<^isub>1 M"
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   298
  shows "(\<exists>s1 s2. M = App (Lam [a].s1) s2 \<and> t1 \<longrightarrow>\<^isub>1 s1 \<and> t2 \<longrightarrow>\<^isub>1 s2) \<or> 
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   299
         (\<exists>s1 s2. M = s1[a::=s2] \<and> t1 \<longrightarrow>\<^isub>1 s1 \<and> t2 \<longrightarrow>\<^isub>1 s2)" 
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   300
  using a
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   301
  apply -
21366
564a6d908297 inductive2: canonical specification syntax;
wenzelm
parents: 21143
diff changeset
   302
  apply(ind_cases2 "App (Lam [a].t1) t2 \<longrightarrow>\<^isub>1 M")
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   303
  apply(simp_all add: lam.inject)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   304
  apply(force)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   305
  apply(erule conjE)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   306
  apply(drule sym[of "Lam [a].t1"])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   307
  apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   308
  apply(drule one_abs)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   309
  apply(erule exE)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   310
  apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   311
  apply(force simp add: alpha)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   312
  apply(erule conjE)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   313
  apply(simp add: lam.inject alpha)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   314
  apply(erule disjE)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   315
  apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   316
  apply(force)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   317
  apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   318
  apply(rule disjI2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   319
  apply(rule_tac x="[(a,aa)]\<bullet>t2a" in exI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   320
  apply(rule_tac x="s2" in exI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   321
  apply(auto)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   322
  apply(subgoal_tac "a\<sharp>t2a")(*A*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   323
  apply(simp add: subst_rename)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   324
  (*A*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   325
  apply(force intro: one_fresh_preserv)
22542
8279a25ad0ae - Renamed <predicate>_eqvt to <predicate>.eqvt
berghofe
parents: 22540
diff changeset
   326
  apply(force intro: One.eqvt)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   327
  done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   328
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   329
text {* first case in Lemma 3.2.4*}
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   330
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   331
lemma one_subst_aux:
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   332
  assumes a: "N\<longrightarrow>\<^isub>1N'"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   333
  shows "M[x::=N] \<longrightarrow>\<^isub>1 M[x::=N']"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   334
using a
18659
2ff0ae57431d changes to make use of the new induction principle proved by
urbanc
parents: 18378
diff changeset
   335
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
   336
  case (Var y) 
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 22823
diff changeset
   337
  thus "Var y[x::=N] \<longrightarrow>\<^isub>1 Var y[x::=N']" by (cases "x=y") auto
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   338
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   339
  case (App P Q) (* application case - third line *)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   340
  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
   341
next 
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   342
  case (Lam y P) (* abstraction case - fourth line *)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   343
  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
   344
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   345
18378
urbanc
parents: 18344
diff changeset
   346
lemma one_subst_aux_automatic:
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   347
  assumes a: "N\<longrightarrow>\<^isub>1N'"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   348
  shows "M[x::=N] \<longrightarrow>\<^isub>1 M[x::=N']"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   349
using a
18659
2ff0ae57431d changes to make use of the new induction principle proved by
urbanc
parents: 18378
diff changeset
   350
apply(nominal_induct M avoiding: x N N' rule: lam.induct)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   351
apply(auto simp add: fresh_prod fresh_atm)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   352
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   353
18312
c68296902ddb cleaned up further the proofs (diamond still needs work);
urbanc
parents: 18303
diff changeset
   354
lemma one_subst: 
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   355
  assumes a: "M\<longrightarrow>\<^isub>1M'"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   356
  and     b: "N\<longrightarrow>\<^isub>1N'"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   357
  shows "M[x::=N]\<longrightarrow>\<^isub>1M'[x::=N']" 
18773
0eabf66582d0 the additional freshness-condition in the one-induction
urbanc
parents: 18659
diff changeset
   358
using a b
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   359
proof (nominal_induct M M' avoiding: N N' x rule: One.strong_induct)
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   360
  case (o1 M)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   361
  thus ?case by (simp add: one_subst_aux)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   362
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   363
  case (o2 M1 M2 N1 N2)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   364
  thus ?case by simp
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   365
next
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   366
  case (o3 a M1 M2)
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   367
  thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   368
next
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   369
  case (o4 a N1 N2 M1 M2 N N' x)
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 22823
diff changeset
   370
  have vc: "a\<sharp>N" "a\<sharp>N'" "a\<sharp>x" "a\<sharp>N1" "a\<sharp>N2" by fact+
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   371
  have asm: "N\<longrightarrow>\<^isub>1N'" by fact
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   372
  show ?case
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   373
  proof -
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   374
    have "(App (Lam [a].M1) N1)[x::=N] = App (Lam [a].(M1[x::=N])) (N1[x::=N])" using vc by simp
21143
56695d1f45cf changed a misplaced "also" to a "moreover" (caused a loop somehow)
urbanc
parents: 21138
diff changeset
   375
    moreover have "App (Lam [a].(M1[x::=N])) (N1[x::=N]) \<longrightarrow>\<^isub>1 M2[x::=N'][a::=N2[x::=N']]" 
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   376
      using o4 asm by (simp add: fresh_fact)
21143
56695d1f45cf changed a misplaced "also" to a "moreover" (caused a loop somehow)
urbanc
parents: 21138
diff changeset
   377
    moreover have "M2[x::=N'][a::=N2[x::=N']] = M2[a::=N2][x::=N']" 
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   378
      using vc by (simp add: substitution_lemma fresh_atm)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   379
    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
   380
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   381
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   382
18378
urbanc
parents: 18344
diff changeset
   383
lemma one_subst_automatic: 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   384
  assumes a: "M\<longrightarrow>\<^isub>1M'" 
18303
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   385
  and     b: "N\<longrightarrow>\<^isub>1N'"
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   386
  shows "M[x::=N]\<longrightarrow>\<^isub>1M'[x::=N']" 
b18fabea0fd0 modified almost everything for the new nominal_induct
urbanc
parents: 18269
diff changeset
   387
using a b
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   388
apply(nominal_induct M M' avoiding: N N' x rule: One.strong_induct)
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   389
apply(auto simp add: one_subst_aux substitution_lemma fresh_atm fresh_fact)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   390
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   391
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   392
lemma diamond[rule_format]:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   393
  fixes    M :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   394
  and      M1:: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   395
  assumes a: "M\<longrightarrow>\<^isub>1M1" 
18344
urbanc
parents: 18312
diff changeset
   396
  and     b: "M\<longrightarrow>\<^isub>1M2"
urbanc
parents: 18312
diff changeset
   397
  shows "\<exists>M3. M1\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3"
urbanc
parents: 18312
diff changeset
   398
  using a b
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   399
proof (nominal_induct avoiding: M1 M2 rule: One.strong_induct)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   400
  case (o1 M) (* case 1 --- M1 = M *)
18344
urbanc
parents: 18312
diff changeset
   401
  thus "\<exists>M3. M\<longrightarrow>\<^isub>1M3 \<and>  M2\<longrightarrow>\<^isub>1M3" by blast
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   402
next
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   403
  case (o4 x Q Q' P P') (* case 2 --- a beta-reduction occurs*)
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 22823
diff changeset
   404
  have vc: "x\<sharp>Q" "x\<sharp>Q'" by fact+
18344
urbanc
parents: 18312
diff changeset
   405
  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
   406
  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
   407
  have "App (Lam [x].P) Q \<longrightarrow>\<^isub>1 M2" by fact
urbanc
parents: 18312
diff changeset
   408
  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
   409
         (\<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
   410
  moreover (* subcase 2.1 *)
urbanc
parents: 18312
diff changeset
   411
  { 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
   412
    then obtain P'' and Q'' where 
urbanc
parents: 18312
diff changeset
   413
      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
   414
    from b2 i2 have "(\<exists>M3. P'\<longrightarrow>\<^isub>1M3 \<and> P''\<longrightarrow>\<^isub>1M3)" by simp
urbanc
parents: 18312
diff changeset
   415
    then obtain P''' where
urbanc
parents: 18312
diff changeset
   416
      c1: "P'\<longrightarrow>\<^isub>1P'''" and c2: "P''\<longrightarrow>\<^isub>1P'''" by force
urbanc
parents: 18312
diff changeset
   417
    from b3 i1 have "(\<exists>M3. Q'\<longrightarrow>\<^isub>1M3 \<and> Q''\<longrightarrow>\<^isub>1M3)" by simp
urbanc
parents: 18312
diff changeset
   418
    then obtain Q''' where
urbanc
parents: 18312
diff changeset
   419
      d1: "Q'\<longrightarrow>\<^isub>1Q'''" and d2: "Q''\<longrightarrow>\<^isub>1Q'''" by force
urbanc
parents: 18312
diff changeset
   420
    from c1 c2 d1 d2 
urbanc
parents: 18312
diff changeset
   421
    have "P'[x::=Q']\<longrightarrow>\<^isub>1P'''[x::=Q'''] \<and> App (Lam [x].P'') Q'' \<longrightarrow>\<^isub>1 P'''[x::=Q''']" 
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   422
      using vc b3 by (auto simp add: one_subst one_fresh_preserv)
18344
urbanc
parents: 18312
diff changeset
   423
    hence "\<exists>M3. P'[x::=Q']\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3" using b1 by blast
urbanc
parents: 18312
diff changeset
   424
  }
urbanc
parents: 18312
diff changeset
   425
  moreover (* subcase 2.2 *)
urbanc
parents: 18312
diff changeset
   426
  { assume "\<exists>P' Q'. M2 = P'[x::=Q'] \<and> P\<longrightarrow>\<^isub>1P' \<and> Q\<longrightarrow>\<^isub>1Q'"
urbanc
parents: 18312
diff changeset
   427
    then obtain P'' Q'' where
urbanc
parents: 18312
diff changeset
   428
      b1: "M2=P''[x::=Q'']" and b2: "P\<longrightarrow>\<^isub>1P''" and  b3: "Q\<longrightarrow>\<^isub>1Q''" by blast
urbanc
parents: 18312
diff changeset
   429
    from b2 i2 have "(\<exists>M3. P'\<longrightarrow>\<^isub>1M3 \<and> P''\<longrightarrow>\<^isub>1M3)" by simp
urbanc
parents: 18312
diff changeset
   430
    then obtain P''' where
urbanc
parents: 18312
diff changeset
   431
      c1: "P'\<longrightarrow>\<^isub>1P'''" and c2: "P''\<longrightarrow>\<^isub>1P'''" by blast
urbanc
parents: 18312
diff changeset
   432
    from b3 i1 have "(\<exists>M3. Q'\<longrightarrow>\<^isub>1M3 \<and> Q''\<longrightarrow>\<^isub>1M3)" by simp
urbanc
parents: 18312
diff changeset
   433
    then obtain Q''' where
urbanc
parents: 18312
diff changeset
   434
      d1: "Q'\<longrightarrow>\<^isub>1Q'''" and d2: "Q''\<longrightarrow>\<^isub>1Q'''" by blast
urbanc
parents: 18312
diff changeset
   435
    from c1 c2 d1 d2 
urbanc
parents: 18312
diff changeset
   436
    have "P'[x::=Q']\<longrightarrow>\<^isub>1P'''[x::=Q'''] \<and> P''[x::=Q'']\<longrightarrow>\<^isub>1P'''[x::=Q''']" 
urbanc
parents: 18312
diff changeset
   437
      by (force simp add: one_subst)
urbanc
parents: 18312
diff changeset
   438
    hence "\<exists>M3. P'[x::=Q']\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3" using b1 by blast
urbanc
parents: 18312
diff changeset
   439
  }
urbanc
parents: 18312
diff changeset
   440
  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
   441
next
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   442
  case (o2 P P' Q Q') (* case 3 *)
18344
urbanc
parents: 18312
diff changeset
   443
  have i0: "P\<longrightarrow>\<^isub>1P'" by fact
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   444
  have i0': "Q\<longrightarrow>\<^isub>1Q'" by fact
18344
urbanc
parents: 18312
diff changeset
   445
  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
   446
  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
   447
  assume "App P Q \<longrightarrow>\<^isub>1 M2"
urbanc
parents: 18312
diff changeset
   448
  hence "(\<exists>P'' Q''. M2 = App P'' Q'' \<and> P\<longrightarrow>\<^isub>1P'' \<and> Q\<longrightarrow>\<^isub>1Q'') \<or> 
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   449
         (\<exists>x P' P'' Q'. P = Lam [x].P' \<and> x\<sharp>(Q,Q') \<and> M2 = P''[x::=Q'] \<and> P'\<longrightarrow>\<^isub>1 P'' \<and> Q\<longrightarrow>\<^isub>1Q')" 
18344
urbanc
parents: 18312
diff changeset
   450
    by (simp add: one_app[simplified])
urbanc
parents: 18312
diff changeset
   451
  moreover (* subcase 3.1 *)
urbanc
parents: 18312
diff changeset
   452
  { assume "\<exists>P'' Q''. M2 = App P'' Q'' \<and> P\<longrightarrow>\<^isub>1P'' \<and> Q\<longrightarrow>\<^isub>1Q''"
urbanc
parents: 18312
diff changeset
   453
    then obtain P'' and Q'' where 
urbanc
parents: 18312
diff changeset
   454
      b1: "M2=App P'' Q''" and b2: "P\<longrightarrow>\<^isub>1P''" and b3: "Q\<longrightarrow>\<^isub>1Q''" by blast
urbanc
parents: 18312
diff changeset
   455
    from b2 i2 have "(\<exists>M3. P'\<longrightarrow>\<^isub>1M3 \<and> P''\<longrightarrow>\<^isub>1M3)" by simp
urbanc
parents: 18312
diff changeset
   456
    then obtain P''' where
urbanc
parents: 18312
diff changeset
   457
      c1: "P'\<longrightarrow>\<^isub>1P'''" and c2: "P''\<longrightarrow>\<^isub>1P'''" by blast
urbanc
parents: 18312
diff changeset
   458
    from b3 i1 have "\<exists>M3. Q'\<longrightarrow>\<^isub>1M3 \<and> Q''\<longrightarrow>\<^isub>1M3" by simp
urbanc
parents: 18312
diff changeset
   459
    then obtain Q''' where
urbanc
parents: 18312
diff changeset
   460
      d1: "Q'\<longrightarrow>\<^isub>1Q'''" and d2: "Q''\<longrightarrow>\<^isub>1Q'''" by blast
urbanc
parents: 18312
diff changeset
   461
    from c1 c2 d1 d2 
urbanc
parents: 18312
diff changeset
   462
    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
   463
    hence "\<exists>M3. App P' Q'\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3" using b1 by blast
urbanc
parents: 18312
diff changeset
   464
  }
urbanc
parents: 18312
diff changeset
   465
  moreover (* subcase 3.2 *)
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   466
  { assume "\<exists>x P1 P'' Q''. P = Lam [x].P1 \<and> x\<sharp>(Q,Q'') \<and> M2 = P''[x::=Q''] \<and> P1\<longrightarrow>\<^isub>1 P'' \<and> Q\<longrightarrow>\<^isub>1Q''"
18344
urbanc
parents: 18312
diff changeset
   467
    then obtain x P1 P1'' Q'' where
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   468
      b0: "P = Lam [x].P1" and b1: "M2 = P1''[x::=Q'']" and 
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   469
      b2: "P1\<longrightarrow>\<^isub>1P1''" and  b3: "Q\<longrightarrow>\<^isub>1Q''" and vc: "x\<sharp>(Q,Q'')" by blast
18344
urbanc
parents: 18312
diff changeset
   470
    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
   471
    then obtain P1' where g1: "P'=Lam [x].P1'" and g2: "P1\<longrightarrow>\<^isub>1P1'" by blast 
urbanc
parents: 18312
diff changeset
   472
    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
   473
    then obtain P1''' where
urbanc
parents: 18312
diff changeset
   474
      c1: "(Lam [x].P1')\<longrightarrow>\<^isub>1P1'''" and c2: "(Lam [x].P1'')\<longrightarrow>\<^isub>1P1'''" by blast
urbanc
parents: 18312
diff changeset
   475
    from c1 have "\<exists>R1. P1'''=Lam [x].R1 \<and> P1'\<longrightarrow>\<^isub>1R1" by (simp add: one_abs)
urbanc
parents: 18312
diff changeset
   476
    then obtain R1 where r1: "P1'''=Lam [x].R1" and r2: "P1'\<longrightarrow>\<^isub>1R1" by blast
urbanc
parents: 18312
diff changeset
   477
    from c2 have "\<exists>R2. P1'''=Lam [x].R2 \<and> P1''\<longrightarrow>\<^isub>1R2" by (simp add: one_abs)
urbanc
parents: 18312
diff changeset
   478
    then obtain R2 where r3: "P1'''=Lam [x].R2" and r4: "P1''\<longrightarrow>\<^isub>1R2" by blast
urbanc
parents: 18312
diff changeset
   479
    from r1 r3 have r5: "R1=R2" by (simp add: lam.inject alpha)
urbanc
parents: 18312
diff changeset
   480
    from b3 i1 have "(\<exists>M3. Q'\<longrightarrow>\<^isub>1M3 \<and> Q''\<longrightarrow>\<^isub>1M3)" by simp
urbanc
parents: 18312
diff changeset
   481
    then obtain Q''' where
urbanc
parents: 18312
diff changeset
   482
      d1: "Q'\<longrightarrow>\<^isub>1Q'''" and d2: "Q''\<longrightarrow>\<^isub>1Q'''" by blast
urbanc
parents: 18312
diff changeset
   483
    from g1 r2 d1 r4 r5 d2 
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   484
    have "App P' Q'\<longrightarrow>\<^isub>1R1[x::=Q'''] \<and> P1''[x::=Q'']\<longrightarrow>\<^isub>1R1[x::=Q''']" 
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   485
      using vc i0' by (simp add: one_subst one_fresh_preserv)
18344
urbanc
parents: 18312
diff changeset
   486
    hence "\<exists>M3. App P' Q'\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1M3" using b1 by blast
urbanc
parents: 18312
diff changeset
   487
  }
urbanc
parents: 18312
diff changeset
   488
  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
   489
next
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   490
  case (o3 P P' x) (* case 4 *)
18344
urbanc
parents: 18312
diff changeset
   491
  have i1: "P\<longrightarrow>\<^isub>1P'" by fact
urbanc
parents: 18312
diff changeset
   492
  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
   493
  have "(Lam [x].P)\<longrightarrow>\<^isub>1 M2" by fact
urbanc
parents: 18312
diff changeset
   494
  hence "\<exists>P''. M2=Lam [x].P'' \<and> P\<longrightarrow>\<^isub>1P''" by (simp add: one_abs)
urbanc
parents: 18312
diff changeset
   495
  then obtain P'' where b1: "M2=Lam [x].P''" and b2: "P\<longrightarrow>\<^isub>1P''" by blast
urbanc
parents: 18312
diff changeset
   496
  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
   497
  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
   498
  from c1 have "\<exists>R1. M3=Lam [x].R1 \<and> P'\<longrightarrow>\<^isub>1R1" by (simp add: one_abs)
urbanc
parents: 18312
diff changeset
   499
  then obtain R1 where r1: "M3=Lam [x].R1" and r2: "P'\<longrightarrow>\<^isub>1R1" by blast
urbanc
parents: 18312
diff changeset
   500
  from c2 have "\<exists>R2. M3=Lam [x].R2 \<and> P''\<longrightarrow>\<^isub>1R2" by (simp add: one_abs)
urbanc
parents: 18312
diff changeset
   501
  then obtain R2 where r3: "M3=Lam [x].R2" and r4: "P''\<longrightarrow>\<^isub>1R2" by blast
urbanc
parents: 18312
diff changeset
   502
  from r1 r3 have r5: "R1=R2" by (simp add: lam.inject alpha)
urbanc
parents: 18312
diff changeset
   503
  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
   504
    by (simp add: one_subst)
urbanc
parents: 18312
diff changeset
   505
  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
   506
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   507
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   508
lemma one_lam_cong: 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   509
  assumes a: "t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   510
  shows "(Lam [a].t1)\<longrightarrow>\<^isub>\<beta>\<^sup>*(Lam [a].t2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   511
  using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   512
proof induct
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   513
  case bs1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   514
next
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   515
  case (bs2 y z) 
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   516
  thus ?case by (blast dest: b3)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   517
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   518
18378
urbanc
parents: 18344
diff changeset
   519
lemma one_app_congL: 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   520
  assumes a: "t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   521
  shows "App t1 s\<longrightarrow>\<^isub>\<beta>\<^sup>* App t2 s"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   522
  using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   523
proof induct
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   524
  case bs1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   525
next
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   526
  case bs2 thus ?case by (blast dest: b1)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   527
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   528
  
18378
urbanc
parents: 18344
diff changeset
   529
lemma one_app_congR: 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   530
  assumes a: "t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   531
  shows "App s t1 \<longrightarrow>\<^isub>\<beta>\<^sup>* App s t2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   532
using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   533
proof induct
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   534
  case bs1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   535
next 
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   536
  case bs2 thus ?case by (blast dest: b2)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   537
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   538
18378
urbanc
parents: 18344
diff changeset
   539
lemma one_app_cong: 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   540
  assumes a1: "t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2" 
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   541
  and     a2: "s1\<longrightarrow>\<^isub>\<beta>\<^sup>*s2" 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   542
  shows "App t1 s1\<longrightarrow>\<^isub>\<beta>\<^sup>* App t2 s2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   543
proof -
18378
urbanc
parents: 18344
diff changeset
   544
  have "App t1 s1 \<longrightarrow>\<^isub>\<beta>\<^sup>* App t2 s1" using a1 by (rule one_app_congL)
urbanc
parents: 18344
diff changeset
   545
  moreover
urbanc
parents: 18344
diff changeset
   546
  have "App t2 s1 \<longrightarrow>\<^isub>\<beta>\<^sup>* App t2 s2" using a2 by (rule one_app_congR)
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   547
  ultimately show ?thesis by (rule beta_star_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   548
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   549
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   550
lemma one_beta_star: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   551
  assumes a: "(t1\<longrightarrow>\<^isub>1t2)" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   552
  shows "(t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   553
  using a
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   554
proof(nominal_induct rule: One.strong_induct)
18378
urbanc
parents: 18344
diff changeset
   555
  case o1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   556
next
18378
urbanc
parents: 18344
diff changeset
   557
  case o2 thus ?case by (blast intro!: one_app_cong)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   558
next
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   559
  case o3 thus ?case by (blast intro!: one_lam_cong)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   560
next 
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   561
  case (o4 a s1 s2 t1 t2)
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 22823
diff changeset
   562
  have vc: "a\<sharp>s1" "a\<sharp>s2" by fact+
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 22823
diff changeset
   563
  have a1: "t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t2" and a2: "s1\<longrightarrow>\<^isub>\<beta>\<^sup>*s2" by fact+
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   564
  have c1: "(App (Lam [a].t2) s2) \<longrightarrow>\<^isub>\<beta> (t2 [a::= s2])" using vc by (simp add: b4)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   565
  from a1 a2 have c2: "App (Lam [a].t1 ) s1 \<longrightarrow>\<^isub>\<beta>\<^sup>* App (Lam [a].t2 ) s2" 
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   566
    by (blast intro!: one_app_cong one_lam_cong)
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   567
  show ?case using c2 c1 by (blast intro: beta_star_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   568
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   569
 
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   570
lemma one_star_lam_cong: 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   571
  assumes a: "t1\<longrightarrow>\<^isub>1\<^sup>*t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   572
  shows "(Lam  [a].t1)\<longrightarrow>\<^isub>1\<^sup>* (Lam [a].t2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   573
  using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   574
proof induct
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   575
  case os1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   576
next
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   577
  case os2 thus ?case by (blast intro: one_star_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   578
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   579
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   580
lemma one_star_app_congL: 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   581
  assumes a: "t1\<longrightarrow>\<^isub>1\<^sup>*t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   582
  shows "App t1 s\<longrightarrow>\<^isub>1\<^sup>* App t2 s"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   583
  using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   584
proof induct
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   585
  case os1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   586
next
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   587
  case os2 thus ?case by (blast intro: one_star_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   588
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   589
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   590
lemma one_star_app_congR: 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   591
  assumes a: "t1\<longrightarrow>\<^isub>1\<^sup>*t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   592
  shows "App s t1 \<longrightarrow>\<^isub>1\<^sup>* App s t2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   593
  using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   594
proof induct
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   595
  case os1 thus ?case by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   596
next
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   597
  case os2 thus ?case by (blast intro: one_star_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   598
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   599
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   600
lemma beta_one_star: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   601
  assumes a: "t1\<longrightarrow>\<^isub>\<beta>t2" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   602
  shows "t1\<longrightarrow>\<^isub>1\<^sup>*t2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   603
  using a
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   604
proof(induct)
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   605
  case b1 thus ?case by (blast intro!: one_star_app_congL)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   606
next
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   607
  case b2 thus ?case by (blast intro!: one_star_app_congR)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   608
next
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   609
  case b3 thus ?case by (blast intro!: one_star_lam_cong)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   610
next
22540
e4817fa0f6a1 adapted to new nominal_inductive
urbanc
parents: 21555
diff changeset
   611
  case b4 thus ?case by auto 
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   612
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   613
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   614
lemma trans_closure: 
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   615
  shows "(M1\<longrightarrow>\<^isub>1\<^sup>*M2) = (M1\<longrightarrow>\<^isub>\<beta>\<^sup>*M2)"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   616
proof
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   617
  assume "M1 \<longrightarrow>\<^isub>1\<^sup>* M2"
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   618
  then show "M1\<longrightarrow>\<^isub>\<beta>\<^sup>*M2"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   619
  proof induct
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   620
    case (os1 M1) thus "M1\<longrightarrow>\<^isub>\<beta>\<^sup>*M1" by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   621
  next
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   622
    case (os2 M1 M2 M3)
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   623
    have "M2\<longrightarrow>\<^isub>1M3" by fact
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   624
    then have "M2\<longrightarrow>\<^isub>\<beta>\<^sup>*M3" by (rule one_beta_star)
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   625
    moreover have "M1\<longrightarrow>\<^isub>\<beta>\<^sup>*M2" by fact
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   626
    ultimately show "M1\<longrightarrow>\<^isub>\<beta>\<^sup>*M3" by (auto intro: beta_star_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   627
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   628
next
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   629
  assume "M1 \<longrightarrow>\<^isub>\<beta>\<^sup>* M2" 
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   630
  then show "M1\<longrightarrow>\<^isub>1\<^sup>*M2"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   631
  proof induct
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   632
    case (bs1 M1) thus  "M1\<longrightarrow>\<^isub>1\<^sup>*M1" by simp
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   633
  next
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   634
    case (bs2 M1 M2 M3) 
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   635
    have "M2\<longrightarrow>\<^isub>\<beta>M3" by fact
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   636
    then have "M2\<longrightarrow>\<^isub>1\<^sup>*M3" by (rule beta_one_star)
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   637
    moreover have "M1\<longrightarrow>\<^isub>1\<^sup>*M2" by fact
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   638
    ultimately show "M1\<longrightarrow>\<^isub>1\<^sup>*M3" by (auto intro: one_star_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   639
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   640
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   641
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   642
lemma cr_one:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   643
  assumes a: "t\<longrightarrow>\<^isub>1\<^sup>*t1" 
18344
urbanc
parents: 18312
diff changeset
   644
  and     b: "t\<longrightarrow>\<^isub>1t2"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   645
  shows "\<exists>t3. t1\<longrightarrow>\<^isub>1t3 \<and> t2\<longrightarrow>\<^isub>1\<^sup>*t3"
18344
urbanc
parents: 18312
diff changeset
   646
  using a b
20503
503ac4c5ef91 induct method: renamed 'fixing' to 'arbitrary';
wenzelm
parents: 19496
diff changeset
   647
proof (induct arbitrary: t2)
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   648
  case os1 thus ?case by force
18344
urbanc
parents: 18312
diff changeset
   649
next
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   650
  case (os2 t s1 s2 t2)  
18344
urbanc
parents: 18312
diff changeset
   651
  have b: "s1 \<longrightarrow>\<^isub>1 s2" by fact
urbanc
parents: 18312
diff changeset
   652
  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
   653
  have c: "t \<longrightarrow>\<^isub>1 t2" by fact
18378
urbanc
parents: 18344
diff changeset
   654
  show "\<exists>t3. s2 \<longrightarrow>\<^isub>1 t3 \<and>  t2 \<longrightarrow>\<^isub>1\<^sup>* t3" 
18344
urbanc
parents: 18312
diff changeset
   655
  proof -
18378
urbanc
parents: 18344
diff changeset
   656
    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
   657
    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
   658
    have "\<exists>t4. s2 \<longrightarrow>\<^isub>1 t4 \<and> t3 \<longrightarrow>\<^isub>1 t4" using b c1 by (blast intro: diamond)
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   659
    thus ?thesis using c2 by (blast intro: one_star_trans)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   660
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   661
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   662
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   663
lemma cr_one_star: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   664
  assumes a: "t\<longrightarrow>\<^isub>1\<^sup>*t2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   665
      and b: "t\<longrightarrow>\<^isub>1\<^sup>*t1"
18378
urbanc
parents: 18344
diff changeset
   666
    shows "\<exists>t3. t1\<longrightarrow>\<^isub>1\<^sup>*t3\<and>t2\<longrightarrow>\<^isub>1\<^sup>*t3"
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   667
using a b
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   668
proof (induct arbitrary: t1)
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   669
  case (os1 t) then show ?case by force
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   670
next 
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   671
  case (os2 t s1 s2 t1)
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   672
  have c: "t \<longrightarrow>\<^isub>1\<^sup>* s1" by fact
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   673
  have c': "t \<longrightarrow>\<^isub>1\<^sup>* t1" by fact
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   674
  have d: "s1 \<longrightarrow>\<^isub>1 s2" by fact
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   675
  have "t \<longrightarrow>\<^isub>1\<^sup>* t1 \<Longrightarrow> (\<exists>t3.  t1 \<longrightarrow>\<^isub>1\<^sup>* t3 \<and> s1 \<longrightarrow>\<^isub>1\<^sup>* t3)" by fact
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   676
  then obtain t3 where f1: "t1 \<longrightarrow>\<^isub>1\<^sup>* t3"
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   677
                   and f2: "s1 \<longrightarrow>\<^isub>1\<^sup>* t3" using c' by blast
18378
urbanc
parents: 18344
diff changeset
   678
  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
   679
  then obtain t4 where g1: "t3\<longrightarrow>\<^isub>1t4"
18378
urbanc
parents: 18344
diff changeset
   680
                   and g2: "s2\<longrightarrow>\<^isub>1\<^sup>*t4" by blast
21101
286d68ce3f5b adapted to Stefan's new inductive package
urbanc
parents: 20955
diff changeset
   681
  have "t1\<longrightarrow>\<^isub>1\<^sup>*t4" using f1 g1 by (blast intro: one_star_trans)
18378
urbanc
parents: 18344
diff changeset
   682
  thus ?case using g2 by blast
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   683
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   684
  
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   685
lemma cr_beta_star: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   686
  assumes a1: "t\<longrightarrow>\<^isub>\<beta>\<^sup>*t1" 
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   687
  and     a2: "t\<longrightarrow>\<^isub>\<beta>\<^sup>*t2" 
18378
urbanc
parents: 18344
diff changeset
   688
  shows "\<exists>t3. t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t3\<and>t2\<longrightarrow>\<^isub>\<beta>\<^sup>*t3"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   689
proof -
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   690
  from a1 have "t\<longrightarrow>\<^isub>1\<^sup>*t1" by (simp only: trans_closure)
18378
urbanc
parents: 18344
diff changeset
   691
  moreover
18882
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   692
  from a2 have "t\<longrightarrow>\<^isub>1\<^sup>*t2" by (simp only: trans_closure)
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   693
  ultimately have "\<exists>t3. t1\<longrightarrow>\<^isub>1\<^sup>*t3 \<and> t2\<longrightarrow>\<^isub>1\<^sup>*t3" by (blast intro: cr_one_star) 
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   694
  then obtain t3 where "t1\<longrightarrow>\<^isub>1\<^sup>*t3" and "t2\<longrightarrow>\<^isub>1\<^sup>*t3" by blast
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   695
  hence "t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t3" and "t2\<longrightarrow>\<^isub>\<beta>\<^sup>*t3" by (simp_all only: trans_closure)
454d09651d1a - renamed some lemmas (some had names coming from ancient
urbanc
parents: 18773
diff changeset
   696
  then show "\<exists>t3. t1\<longrightarrow>\<^isub>\<beta>\<^sup>*t3\<and>t2\<longrightarrow>\<^isub>\<beta>\<^sup>*t3" by blast
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   697
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   698
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   699
end
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   700