src/HOL/Nominal/Examples/CR_Takahashi.thy
author urbanc
Tue, 08 May 2007 01:40:30 +0200
changeset 22855 eb3643588781
parent 22833 51a16a718820
child 23159 792ff2490f91
permissions -rw-r--r--
polished some proofs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
     1
(* $Id$ *)
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
     2
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
     3
theory CR_Takahashi
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
     4
imports "../Nominal"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
     5
begin
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
     6
22829
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
     7
text {* Authors: Mathilde Arnaud and Christian Urban
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
     8
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
     9
        The Church-Rosser proof from a paper by Masako Takahashi.
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
    10
        This formalisation follows with some very slight exceptions 
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    11
        the one given by Randy Pollack in the paper:
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    12
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    13
           Polishing Up the Tait-Martin Löf Proof of the 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    14
           Church-Rosser Theorem (1995).
22829
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
    15
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
    16
  *}
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
    17
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    18
atom_decl name
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    19
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    20
nominal_datatype lam = 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    21
    Var "name"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    22
  | App "lam" "lam"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    23
  | Lam "\<guillemotleft>name\<guillemotright>lam" ("Lam [_]._" [100,100] 100)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    24
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    25
consts subst :: "lam \<Rightarrow> name \<Rightarrow> lam \<Rightarrow> lam"  ("_[_::=_]" [100,100,100] 100)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    26
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    27
nominal_primrec
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    28
  "(Var x)[y::=t'] = (if x=y then t' else (Var x))"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    29
  "(App t1 t2)[y::=t'] = App (t1[y::=t']) (t2[y::=t'])"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    30
  "x\<sharp>(y,t') \<Longrightarrow> (Lam [x].t)[y::=t'] = Lam [x].(t[y::=t'])"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    31
apply(finite_guess)+
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    32
apply(rule TrueI)+
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    33
apply(simp add: abs_fresh)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    34
apply(fresh_guess)+
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    35
done
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    36
22829
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
    37
section {* Lemmas about Capture-Avoiding Substitution *}
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
    38
 
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    39
lemma subst_eqvt[eqvt]:
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    40
  fixes pi:: "name prm"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    41
  shows "pi\<bullet>(t1[b::=t2]) = (pi\<bullet>t1)[(pi\<bullet>b)::=(pi\<bullet>t2)]"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    42
by (nominal_induct t1 avoiding: b t2 rule: lam.induct)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    43
   (auto simp add: perm_bij fresh_atm fresh_bij)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    44
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    45
lemma forget:
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    46
  assumes a: "x\<sharp>L"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    47
  shows "L[x::=P] = L"
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    48
using a by (nominal_induct L avoiding: x P rule: lam.induct)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    49
           (auto simp add: abs_fresh fresh_atm)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    50
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    51
lemma fresh_fact:
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    52
  fixes z::"name"
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    53
  assumes a: "z\<sharp>N" "z\<sharp>L"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    54
  shows "z\<sharp>(N[y::=L])"
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    55
using a by (nominal_induct N avoiding: z y L rule: lam.induct)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    56
           (auto simp add: abs_fresh fresh_atm)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    57
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    58
lemma fresh_fact': 
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    59
  fixes x::"name"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    60
  assumes a: "x\<sharp>N"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    61
  shows "x\<sharp>M[x::=N]"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    62
using a by (nominal_induct M avoiding: x N rule: lam.induct)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    63
           (auto simp add: abs_fresh fresh_atm)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    64
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    65
lemma substitution_lemma:  
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    66
  assumes a: "x\<noteq>y" "x\<sharp>L"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    67
  shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]"
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    68
using a by (nominal_induct M avoiding: x y N L rule: lam.induct)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    69
           (auto simp add: fresh_fact forget)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    70
22829
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
    71
lemma subst_rename: 
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    72
  assumes a: "y\<sharp>M"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    73
  shows "M[x::=N] = ([(y,x)]\<bullet>M)[y::=N]"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    74
using a by (nominal_induct M avoiding: x y N rule: lam.induct)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    75
           (auto simp add: calc_atm fresh_atm abs_fresh)
22829
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
    76
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    77
section {* Beta-Reduction *}
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    78
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    79
inductive2
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    80
  "Beta" :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>\<beta> _" [80,80] 80)
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    81
where
22855
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
    82
  b1[intro]: "M1\<longrightarrow>\<^isub>\<beta>M2 \<Longrightarrow> App M1 N \<longrightarrow>\<^isub>\<beta> App M2 N"
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
    83
| b2[intro]: "N1\<longrightarrow>\<^isub>\<beta>N2 \<Longrightarrow> App M N1 \<longrightarrow>\<^isub>\<beta> App M N2"
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
    84
| b3[intro]: "M1\<longrightarrow>\<^isub>\<beta>M2 \<Longrightarrow> Lam [x].M1 \<longrightarrow>\<^isub>\<beta> Lam [x].M2"
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
    85
| b4[intro]: "(App (Lam [x].M) N)\<longrightarrow>\<^isub>\<beta> M[x::=N]"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    86
22829
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
    87
section {* Transitive Closure of Beta *}
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
    88
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    89
inductive2
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    90
  "Beta_star"  :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>\<beta>\<^sup>* _" [80,80] 80)
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    91
where
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    92
  bs1[intro]: "M \<longrightarrow>\<^isub>\<beta>\<^sup>* M"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    93
| bs2[intro]: "\<lbrakk>M1\<longrightarrow>\<^isub>\<beta>\<^sup>* M2; M2 \<longrightarrow>\<^isub>\<beta> M3\<rbrakk> \<Longrightarrow> M1 \<longrightarrow>\<^isub>\<beta>\<^sup>* M3"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    94
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    95
lemma Beta_star_trans[trans]:
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    96
  assumes a1: "M1\<longrightarrow>\<^isub>\<beta>\<^sup>* M2"
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    97
  and     a2: "M2\<longrightarrow>\<^isub>\<beta>\<^sup>* M3"
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
    98
  shows "M1 \<longrightarrow>\<^isub>\<beta>\<^sup>* M3"
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
    99
using a2 a1 by (induct) (auto)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   100
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   101
section {* One-Reduction *}
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   102
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   103
inductive2
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   104
  One :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>1 _" [80,80] 80)
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   105
where
22855
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
   106
  o1[intro]: "Var x\<longrightarrow>\<^isub>1 Var x"
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   107
| o2[intro]: "\<lbrakk>M1\<longrightarrow>\<^isub>1M2; N1\<longrightarrow>\<^isub>1N2\<rbrakk> \<Longrightarrow> (App M1 N1)\<longrightarrow>\<^isub>1(App M2 N2)"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   108
| o3[intro]: "M1\<longrightarrow>\<^isub>1M2 \<Longrightarrow> (Lam [x].M1)\<longrightarrow>\<^isub>1(Lam [x].M2)"
22855
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
   109
| o4[intro]: "\<lbrakk>x\<sharp>(N1,N2); M1\<longrightarrow>\<^isub>1M2; N1\<longrightarrow>\<^isub>1N2\<rbrakk> \<Longrightarrow> (App (Lam [x].M1) N1)\<longrightarrow>\<^isub>1M2[x::=N2]"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   110
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   111
equivariance One
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   112
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   113
nominal_inductive One by (simp_all add: abs_fresh fresh_fact')
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   114
22855
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
   115
lemma One_refl:
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
   116
  shows "M\<longrightarrow>\<^isub>1M"
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
   117
by (nominal_induct M rule: lam.induct) (auto)
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   118
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   119
lemma One_subst: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   120
  assumes a: "M\<longrightarrow>\<^isub>1M'" "N\<longrightarrow>\<^isub>1N'"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   121
  shows "M[x::=N]\<longrightarrow>\<^isub>1M'[x::=N']" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   122
using a by (nominal_induct M M' avoiding: N N' x rule: One.strong_induct)
22855
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
   123
           (auto simp add: substitution_lemma fresh_atm fresh_fact)
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   124
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   125
lemma better_o4_intro:
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   126
  assumes a: "M1 \<longrightarrow>\<^isub>1 M2" "N1 \<longrightarrow>\<^isub>1 N2"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   127
  shows "App (Lam [x].M1) N1 \<longrightarrow>\<^isub>1 M2[x::=N2]"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   128
proof -
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   129
  obtain y::"name" where fs: "y\<sharp>(x,M1,N1,M2,N2)" by (rule exists_fresh, rule fin_supp,blast)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   130
  have "App (Lam [x].M1) N1 = App (Lam [y].([(y,x)]\<bullet>M1)) N1" using fs
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   131
    by (rule_tac sym, auto simp add: lam.inject alpha fresh_prod fresh_atm)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   132
  also have "\<dots> \<longrightarrow>\<^isub>1  ([(y,x)]\<bullet>M2)[y::=N2]" using fs a by (auto simp add: One.eqvt)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   133
  also have "\<dots> = M2[x::=N2]" using fs by (simp add: subst_rename[symmetric])
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   134
  finally show "App (Lam [x].M1) N1 \<longrightarrow>\<^isub>1 M2[x::=N2]" by simp
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   135
qed
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   136
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   137
lemma One_fresh_preserved:
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   138
  fixes a :: "name"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   139
  assumes a: "M\<longrightarrow>\<^isub>1N" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   140
  shows "a\<sharp>M \<Longrightarrow> a\<sharp>N"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   141
using a by (nominal_induct avoiding: a rule: One.strong_induct)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   142
           (auto simp add: abs_fresh fresh_atm fresh_fact)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   143
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   144
lemma One_Var:
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   145
  assumes a: "Var x \<longrightarrow>\<^isub>1 M"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   146
  shows "M = Var x"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   147
using a by (erule_tac One.cases) (simp_all) 
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   148
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   149
lemma One_Lam: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   150
  assumes a: "(Lam [x].N)\<longrightarrow>\<^isub>1 M"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   151
  shows "\<exists>M'. M = Lam [x].M' \<and> N \<longrightarrow>\<^isub>1 M'"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   152
using a
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   153
  apply(erule_tac One.cases)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   154
  apply(auto simp add: lam.inject alpha)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   155
  apply(rule_tac x="[(x,xa)]\<bullet>M2" in exI)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   156
  apply(perm_simp add: fresh_left calc_atm)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   157
  apply(auto simp add: One.eqvt One_fresh_preserved)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   158
done  
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   159
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   160
lemma One_App: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   161
  assumes a: "App M N \<longrightarrow>\<^isub>1 R"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   162
  shows "(\<exists>M' N'. R = App M' N' \<and> M \<longrightarrow>\<^isub>1 M' \<and> N \<longrightarrow>\<^isub>1 N') \<or> 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   163
         (\<exists>x P P' N'. M = Lam [x].P \<and> x\<sharp>(N,N') \<and> R = P'[x::=N'] \<and> P \<longrightarrow>\<^isub>1 P' \<and> N \<longrightarrow>\<^isub>1 N')" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   164
using a by (erule_tac One.cases) (auto simp add: lam.inject)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   165
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   166
lemma One_Redex: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   167
  assumes a: "App (Lam [x].M) N \<longrightarrow>\<^isub>1 R"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   168
  shows "(\<exists>M' N'. R = App (Lam [x].M') N' \<and> M \<longrightarrow>\<^isub>1 M' \<and> N \<longrightarrow>\<^isub>1 N') \<or> 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   169
         (\<exists>M' N'. R = M'[x::=N'] \<and> M \<longrightarrow>\<^isub>1 M' \<and> N \<longrightarrow>\<^isub>1 N')" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   170
  using a
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   171
  apply(erule_tac One.cases)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   172
  apply(simp_all)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   173
  apply(rule disjI1)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   174
  apply(auto simp add: lam.inject)[1]
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   175
  apply(drule One_Lam)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   176
  apply(simp)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   177
  apply(rule disjI2)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   178
  apply(auto simp add: lam.inject alpha)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   179
  apply(rule_tac x="[(x,xa)]\<bullet>M2" in exI)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   180
  apply(rule_tac x="N2" in exI)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   181
  apply(simp add: subst_rename One_fresh_preserved One.eqvt)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   182
  done
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   183
22829
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
   184
section {* Transitive Closure of One *}
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
   185
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   186
inductive2
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   187
  "One_star"  :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>1\<^sup>* _" [80,80] 80)
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   188
where
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   189
  os1[intro]: "M \<longrightarrow>\<^isub>1\<^sup>* M"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   190
| os2[intro]: "\<lbrakk>M1\<longrightarrow>\<^isub>1\<^sup>* M2; M2 \<longrightarrow>\<^isub>1 M3\<rbrakk> \<Longrightarrow> M1 \<longrightarrow>\<^isub>1\<^sup>* M3"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   191
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   192
lemma One_star_trans:
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   193
  assumes a1: "M1\<longrightarrow>\<^isub>1\<^sup>* M2" 
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   194
  and     a2: "M2\<longrightarrow>\<^isub>1\<^sup>* M3"
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   195
  shows "M1\<longrightarrow>\<^isub>1\<^sup>* M3"
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   196
using a2 a1 by (induct) (auto)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   197
22829
f1db55c7534d tuned some proofs and changed variable names in some definitions of Nominal.thy
urbanc
parents: 22821
diff changeset
   198
text {* Complete Development Reduction *}
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   199
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   200
inductive2
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   201
  Dev :: "lam \<Rightarrow> lam \<Rightarrow> bool" (" _ \<longrightarrow>\<^isub>d _" [80,80]80)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   202
where
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   203
    d1[intro]: "Var x \<longrightarrow>\<^isub>d Var x"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   204
  | d2[intro]: "M \<longrightarrow>\<^isub>d N \<Longrightarrow> Lam [x].M \<longrightarrow>\<^isub>d Lam[x].N"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   205
  | d3[intro]: "\<lbrakk>\<not>(\<exists>y M'. M1 = Lam [y].M'); M1 \<longrightarrow>\<^isub>d M2; N1 \<longrightarrow>\<^isub>d N2\<rbrakk> \<Longrightarrow> App M1 N1 \<longrightarrow>\<^isub>d App M2 N2"
22855
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
   206
  | d4[intro]: "\<lbrakk>x\<sharp>(N1,N2); M1 \<longrightarrow>\<^isub>d M2; N1 \<longrightarrow>\<^isub>d N2\<rbrakk> \<Longrightarrow> App (Lam [x].M1) N1 \<longrightarrow>\<^isub>d M2[x::=N2]"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   207
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   208
(* FIXME: needs to be in nominal_inductive *)
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   209
declare perm_pi_simp[eqvt_force]
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   210
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   211
equivariance Dev
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   212
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   213
nominal_inductive Dev by (simp_all add: abs_fresh fresh_fact')
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   214
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   215
lemma better_d4_intro:
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   216
  assumes a: "M1 \<longrightarrow>\<^isub>d M2" "N1 \<longrightarrow>\<^isub>d N2"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   217
  shows "App (Lam [x].M1) N1 \<longrightarrow>\<^isub>d M2[x::=N2]"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   218
proof -
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   219
  obtain y::"name" where fs: "y\<sharp>(x,M1,N1,M2,N2)" by (rule exists_fresh, rule fin_supp,blast)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   220
  have "App (Lam [x].M1) N1 = App (Lam [y].([(y,x)]\<bullet>M1)) N1" using fs
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   221
    by (rule_tac sym, auto simp add: lam.inject alpha fresh_prod fresh_atm)
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   222
  also have "\<dots> \<longrightarrow>\<^isub>d  ([(y,x)]\<bullet>M2)[y::=N2]" using fs a by (auto simp add: Dev.eqvt)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   223
  also have "\<dots> = M2[x::=N2]" using fs by (simp add: subst_rename[symmetric])
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   224
  finally show "App (Lam [x].M1) N1 \<longrightarrow>\<^isub>d M2[x::=N2]" by simp
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   225
qed
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   226
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   227
lemma Dev_fresh_preserved:
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   228
  fixes x::"name"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   229
  assumes a: "M\<longrightarrow>\<^isub>d N"  
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   230
  shows "x\<sharp>M \<Longrightarrow> x\<sharp>N"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   231
using a by (induct) (auto simp add: abs_fresh fresh_fact fresh_fact')
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   232
  
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   233
lemma Dev_Lam:
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   234
  assumes a: "Lam [x].M \<longrightarrow>\<^isub>d N"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   235
  shows "\<exists>N'. N = Lam [x].N' \<and> M \<longrightarrow>\<^isub>d N'"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   236
using a
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   237
apply(erule_tac Dev.cases)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   238
apply(auto simp add: lam.inject alpha)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   239
apply(rule_tac x="[(x,xa)]\<bullet>N" in exI)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   240
apply(perm_simp add: fresh_left Dev.eqvt Dev_fresh_preserved)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   241
done
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   242
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   243
lemma Development_existence:
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   244
  shows "\<exists>M'. M \<longrightarrow>\<^isub>d M'"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   245
by (nominal_induct M rule: lam.induct)
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   246
   (auto dest!: Dev_Lam intro: better_d4_intro)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   247
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   248
lemma Triangle:
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   249
  assumes a: "M \<longrightarrow>\<^isub>d M1" "M \<longrightarrow>\<^isub>1 M2"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   250
  shows "M2 \<longrightarrow>\<^isub>1 M1"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   251
using a by (nominal_induct avoiding: M2 rule: Dev.strong_induct)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   252
           (auto dest!: One_Var One_App One_Redex One_Lam intro: One_subst)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   253
(* Remark: we could here get away with a normal induction and appealing to One_fresh_preserved *)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   254
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   255
lemma Diamond_for_One:
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   256
  assumes a: "M \<longrightarrow>\<^isub>1 M1" "M \<longrightarrow>\<^isub>1 M2"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   257
  shows "\<exists>M3. M1 \<longrightarrow>\<^isub>1 M3 \<and> M2 \<longrightarrow>\<^isub>1 M3"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   258
proof -
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   259
  obtain Mc where "M \<longrightarrow>\<^isub>d Mc" using Development_existence by blast
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   260
  with a have "M1 \<longrightarrow>\<^isub>1 Mc" and "M2 \<longrightarrow>\<^isub>1 Mc" by (simp_all add: Triangle)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   261
  then show "\<exists>M3. M1 \<longrightarrow>\<^isub>1 M3 \<and> M2 \<longrightarrow>\<^isub>1 M3" by blast
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   262
qed
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   263
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   264
lemma Rectangle_for_One:
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   265
  assumes a: "M\<longrightarrow>\<^isub>1\<^sup>*M1" "M\<longrightarrow>\<^isub>1M2"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   266
  shows "\<exists>M3. M1\<longrightarrow>\<^isub>1M3 \<and> M2\<longrightarrow>\<^isub>1\<^sup>*M3"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   267
  using a
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   268
proof (induct arbitrary: M2)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   269
  case (os2 M1 M2 M3 M')  
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   270
  have a1: "M1 \<longrightarrow>\<^isub>1 M'" by fact
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   271
  have a2: "M2 \<longrightarrow>\<^isub>1 M3" by fact
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   272
  have ih: "M1 \<longrightarrow>\<^isub>1 M' \<Longrightarrow> (\<exists>M3'. M2 \<longrightarrow>\<^isub>1 M3' \<and> M' \<longrightarrow>\<^isub>1\<^sup>* M3')" by fact
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   273
  from a1 ih obtain M3' where b1: "M2 \<longrightarrow>\<^isub>1 M3'" and b2: "M' \<longrightarrow>\<^isub>1\<^sup>* M3'" by blast
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   274
  from a2 b1 obtain M4 where c1: "M3 \<longrightarrow>\<^isub>1 M4" and c2: "M3' \<longrightarrow>\<^isub>1 M4" by (auto dest: Diamond_for_One)  
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   275
  from b2 c2 have "M' \<longrightarrow>\<^isub>1\<^sup>* M4" by (blast intro: One_star.os2)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   276
  then show "\<exists>M4. M3 \<longrightarrow>\<^isub>1 M4 \<and>  M' \<longrightarrow>\<^isub>1\<^sup>* M4" using c1 by blast 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   277
qed (auto)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   278
  
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   279
lemma CR_for_One_star: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   280
  assumes a: "M\<longrightarrow>\<^isub>1\<^sup>*M1" "M\<longrightarrow>\<^isub>1\<^sup>*M2"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   281
    shows "\<exists>M3. M1\<longrightarrow>\<^isub>1\<^sup>*M3 \<and> M2\<longrightarrow>\<^isub>1\<^sup>*M3"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   282
using a 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   283
proof (induct arbitrary: M2)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   284
  case (os2 M1 M2 M3 M')
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   285
  have a1: "M1 \<longrightarrow>\<^isub>1\<^sup>* M'" by fact
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   286
  have a2: "M2 \<longrightarrow>\<^isub>1 M3" by fact
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   287
  have ih: "M1 \<longrightarrow>\<^isub>1\<^sup>* M' \<Longrightarrow> (\<exists>M3'. M2 \<longrightarrow>\<^isub>1\<^sup>* M3' \<and> M' \<longrightarrow>\<^isub>1\<^sup>* M3')" by fact
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   288
  from a1 ih obtain M3' where b1: "M2 \<longrightarrow>\<^isub>1\<^sup>* M3'" and b2: "M' \<longrightarrow>\<^isub>1\<^sup>* M3'" by blast
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   289
  from a2 b1 obtain M4 where c1: "M3 \<longrightarrow>\<^isub>1\<^sup>* M4" and c2: "M3' \<longrightarrow>\<^isub>1 M4" by (auto dest: Rectangle_for_One)  
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   290
  from b2 c2 have "M' \<longrightarrow>\<^isub>1\<^sup>* M4" by (blast intro: One_star.os2)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   291
  then show "\<exists>M4. M3 \<longrightarrow>\<^isub>1\<^sup>* M4 \<and>  M' \<longrightarrow>\<^isub>1\<^sup>* M4" using c1 by blast 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   292
qed (auto)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   293
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   294
section {* Establishing the Equivalence of Beta-star and One-star *}
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   295
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   296
lemma Beta_Lam_cong: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   297
  assumes a: "M1\<longrightarrow>\<^isub>\<beta>\<^sup>*M2" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   298
  shows "(Lam [x].M1)\<longrightarrow>\<^isub>\<beta>\<^sup>*(Lam [x].M2)"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   299
using a by (induct) (blast)+
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   300
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   301
lemma Beta_App_congL: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   302
  assumes a: "M1\<longrightarrow>\<^isub>\<beta>\<^sup>*M2" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   303
  shows "App M1 N\<longrightarrow>\<^isub>\<beta>\<^sup>* App M2 N"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   304
using a by (induct) (blast)+
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   305
  
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   306
lemma Beta_App_congR: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   307
  assumes a: "N1\<longrightarrow>\<^isub>\<beta>\<^sup>*N2" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   308
  shows "App M N1 \<longrightarrow>\<^isub>\<beta>\<^sup>* App M N2"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   309
using a by (induct) (blast)+
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   310
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   311
lemma Beta_App_cong: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   312
  assumes a: "M1\<longrightarrow>\<^isub>\<beta>\<^sup>*M2" "N1\<longrightarrow>\<^isub>\<beta>\<^sup>*N2" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   313
  shows "App M1 N1\<longrightarrow>\<^isub>\<beta>\<^sup>* App M2 N2"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   314
proof -
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   315
  have "App M1 N1 \<longrightarrow>\<^isub>\<beta>\<^sup>* App M2 N1" using a by (rule_tac Beta_App_congL)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   316
  also have "\<dots> \<longrightarrow>\<^isub>\<beta>\<^sup>* App M2 N2" using a by (rule_tac Beta_App_congR)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   317
  finally show "App M1 N1\<longrightarrow>\<^isub>\<beta>\<^sup>* App M2 N2" by simp
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   318
qed
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   319
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   320
lemmas Beta_congs = Beta_Lam_cong Beta_App_cong
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   321
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   322
lemma One_implies_Beta_star: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   323
  assumes a: "M\<longrightarrow>\<^isub>1N" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   324
  shows "M\<longrightarrow>\<^isub>\<beta>\<^sup>*N"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   325
using a by (induct) (auto intro: Beta_congs)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   326
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   327
lemma One_star_Lam_cong: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   328
  assumes a: "M1\<longrightarrow>\<^isub>1\<^sup>*M2" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   329
  shows "(Lam  [x].M1)\<longrightarrow>\<^isub>1\<^sup>* (Lam [x].M2)"
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   330
using a by (induct) (auto intro: One_star_trans)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   331
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   332
lemma One_star_App_congL: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   333
  assumes a: "M1\<longrightarrow>\<^isub>1\<^sup>*M2" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   334
  shows "App M1 N\<longrightarrow>\<^isub>1\<^sup>* App M2 N"
22855
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
   335
using a 
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
   336
by (induct) (auto intro: One_star_trans One_refl)
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   337
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   338
lemma One_star_App_congR: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   339
  assumes a: "t1\<longrightarrow>\<^isub>1\<^sup>*t2" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   340
  shows "App s t1 \<longrightarrow>\<^isub>1\<^sup>* App s t2"
22855
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
   341
using a by (induct) (auto intro: One_refl One_star_trans)
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   342
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   343
lemmas One_congs = One_star_App_congL One_star_App_congR One_star_Lam_cong
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   344
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   345
lemma Beta_implies_One_star: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   346
  assumes a: "t1\<longrightarrow>\<^isub>\<beta>t2" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   347
  shows "t1\<longrightarrow>\<^isub>1\<^sup>*t2"
22855
eb3643588781 polished some proofs
urbanc
parents: 22833
diff changeset
   348
using a by (induct) (auto intro: One_refl One_congs better_o4_intro)
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   349
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   350
lemma Beta_star_equals_One_star: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   351
  shows "M1\<longrightarrow>\<^isub>1\<^sup>*M2 = M1\<longrightarrow>\<^isub>\<beta>\<^sup>*M2"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   352
proof
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   353
  assume "M1 \<longrightarrow>\<^isub>1\<^sup>* M2"
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   354
  then show "M1\<longrightarrow>\<^isub>\<beta>\<^sup>*M2" by (induct) (auto intro: One_implies_Beta_star Beta_star_trans)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   355
next
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   356
  assume "M1 \<longrightarrow>\<^isub>\<beta>\<^sup>* M2" 
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   357
  then show "M1\<longrightarrow>\<^isub>1\<^sup>*M2" by (induct) (auto intro: Beta_implies_One_star One_star_trans)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   358
qed
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   359
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   360
section {* The Church-Rosser Theorem *}
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   361
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   362
theorem CR_for_Beta_star: 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   363
  assumes a: "M\<longrightarrow>\<^isub>\<beta>\<^sup>*M1" "M\<longrightarrow>\<^isub>\<beta>\<^sup>*M2" 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   364
  shows "\<exists>M3. M1\<longrightarrow>\<^isub>\<beta>\<^sup>*M3 \<and> M2\<longrightarrow>\<^isub>\<beta>\<^sup>*M3"
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   365
proof -
22833
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   366
  from a have "M\<longrightarrow>\<^isub>1\<^sup>*M1" and "M\<longrightarrow>\<^isub>1\<^sup>*M2" by (simp_all only: Beta_star_equals_One_star)
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   367
  then have "\<exists>M3. M1\<longrightarrow>\<^isub>1\<^sup>*M3 \<and> M2\<longrightarrow>\<^isub>1\<^sup>*M3" by (rule_tac CR_for_One_star) 
51a16a718820 polished all proofs and made the theory "self-contained"
urbanc
parents: 22829
diff changeset
   368
  then show "\<exists>M3. M1\<longrightarrow>\<^isub>\<beta>\<^sup>*M3 \<and> M2\<longrightarrow>\<^isub>\<beta>\<^sup>*M3" by (simp only: Beta_star_equals_One_star)
22821
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   369
qed
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   370
15b2e7ec1f3b alternative and much simpler proof for Church-Rosser of Beta-Reduction
urbanc
parents:
diff changeset
   371
end