src/HOL/Nominal/Examples/SN.thy
author urbanc
Mon, 28 Nov 2005 05:03:00 +0100
changeset 18269 3f36e2165e51
parent 18263 7f75925498da
child 18313 e61d2424863d
permissions -rw-r--r--
some small tuning
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18263
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
     1
(* $Id$ *)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
     2
18269
3f36e2165e51 some small tuning
urbanc
parents: 18263
diff changeset
     3
3f36e2165e51 some small tuning
urbanc
parents: 18263
diff changeset
     4
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
     5
theory sn
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
     6
imports lam_substs  Accessible_Part
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
     7
begin
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
     8
18269
3f36e2165e51 some small tuning
urbanc
parents: 18263
diff changeset
     9
text {* Strong Normalisation proof from the Proofs and Types book *}
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    10
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    11
section {* Beta Reduction *}
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    12
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    13
lemma subst_rename[rule_format]: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    14
  fixes  c  :: "name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    15
  and    a  :: "name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    16
  and    t1 :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    17
  and    t2 :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    18
  shows "c\<sharp>t1 \<longrightarrow> (t1[a::=t2] = ([(c,a)]\<bullet>t1)[c::=t2])"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    19
apply(nominal_induct t1 rule: lam_induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    20
apply(auto simp add: calc_atm fresh_atm fresh_prod abs_fresh)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    21
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    22
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    23
lemma forget[rule_format]: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    24
  shows "a\<sharp>t1 \<longrightarrow> t1[a::=t2] = t1"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    25
apply (nominal_induct t1 rule: lam_induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    26
apply(auto simp add: abs_fresh fresh_atm fresh_prod)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    27
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    28
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    29
lemma fresh_fact[rule_format]: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    30
  fixes   b :: "name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    31
  and    a  :: "name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    32
  and    t1 :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    33
  and    t2 :: "lam" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    34
  shows "a\<sharp>t1\<longrightarrow>a\<sharp>t2\<longrightarrow>a\<sharp>(t1[b::=t2])"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    35
apply(nominal_induct t1 rule: lam_induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    36
apply(auto simp add: abs_fresh fresh_prod fresh_atm)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    37
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    38
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    39
lemma subs_lemma:  
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    40
  fixes x::"name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    41
  and   y::"name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    42
  and   L::"lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    43
  and   M::"lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    44
  and   N::"lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    45
  shows "x\<noteq>y\<longrightarrow>x\<sharp>L\<longrightarrow>M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    46
apply(nominal_induct M rule: lam_induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    47
apply(auto simp add: fresh_fact forget fresh_prod fresh_atm)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    48
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    49
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    50
lemma id_subs: "t[x::=Var x] = t"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    51
apply(nominal_induct t rule: lam_induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    52
apply(simp_all add: fresh_atm)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    53
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    54
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    55
consts
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    56
  Beta :: "(lam\<times>lam) set"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    57
syntax 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    58
  "_Beta"       :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>\<beta> _" [80,80] 80)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    59
  "_Beta_star"  :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>\<beta>\<^sup>* _" [80,80] 80)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    60
translations 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    61
  "t1 \<longrightarrow>\<^isub>\<beta> t2" \<rightleftharpoons> "(t1,t2) \<in> Beta"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    62
  "t1 \<longrightarrow>\<^isub>\<beta>\<^sup>* t2" \<rightleftharpoons> "(t1,t2) \<in> Beta\<^sup>*"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    63
inductive Beta
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    64
  intros
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    65
  b1[intro!]: "s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (App s1 t)\<longrightarrow>\<^isub>\<beta>(App s2 t)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    66
  b2[intro!]: "s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (App t s1)\<longrightarrow>\<^isub>\<beta>(App t s2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    67
  b3[intro!]: "s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (Lam [a].s1)\<longrightarrow>\<^isub>\<beta> (Lam [(a::name)].s2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    68
  b4[intro!]: "(App (Lam [(a::name)].s1) s2)\<longrightarrow>\<^isub>\<beta>(s1[a::=s2])"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    69
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    70
lemma eqvt_beta: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    71
  fixes pi :: "name prm"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    72
  and   t  :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    73
  and   s  :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    74
  shows "t\<longrightarrow>\<^isub>\<beta>s \<Longrightarrow> (pi\<bullet>t)\<longrightarrow>\<^isub>\<beta>(pi\<bullet>s)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    75
  apply(erule Beta.induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    76
  apply(auto)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    77
  done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    78
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    79
lemma beta_induct_aux[rule_format]:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    80
  fixes  P :: "lam \<Rightarrow> lam \<Rightarrow>'a::fs_name\<Rightarrow>bool"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    81
  and    t :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    82
  and    s :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    83
  assumes a: "t\<longrightarrow>\<^isub>\<beta>s"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    84
  and a1:    "\<And>x t s1 s2. 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    85
              s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (\<forall>z. P s1 s2 z) \<Longrightarrow> P (App s1 t) (App s2 t) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    86
  and a2:    "\<And>x t s1 s2. 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    87
              s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (\<forall>z. P s1 s2 z) \<Longrightarrow> P (App t s1) (App t s2) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    88
  and a3:    "\<And>x (a::name) s1 s2. 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    89
              a\<sharp>x \<Longrightarrow> s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (\<forall>z. P s1 s2 z) \<Longrightarrow> P (Lam [a].s1) (Lam [a].s2) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    90
  and a4:    "\<And>x (a::name) t1 s1. a\<sharp>(s1,x) \<Longrightarrow> P (App (Lam [a].t1) s1) (t1[a::=s1]) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    91
  shows "\<forall>x (pi::name prm). P (pi\<bullet>t) (pi\<bullet>s) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    92
using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    93
proof (induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    94
  case b1 thus ?case using a1 by (simp, blast intro: eqvt_beta)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    95
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    96
  case b2 thus ?case using a2 by (simp, blast intro: eqvt_beta)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    97
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    98
  case (b3 a s1 s2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
    99
  assume j1: "s1 \<longrightarrow>\<^isub>\<beta> s2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   100
  assume j2: "\<forall>x (pi::name prm). P (pi\<bullet>s1) (pi\<bullet>s2) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   101
  show ?case 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   102
  proof (simp, intro strip)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   103
    fix pi::"name prm" and x::"'a::fs_name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   104
     have f: "\<exists>c::name. c\<sharp>(pi\<bullet>a,pi\<bullet>s1,pi\<bullet>s2,x)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   105
      by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   106
    then obtain c::"name" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   107
      where f1: "c\<noteq>(pi\<bullet>a)" and f2: "c\<sharp>x" and f3: "c\<sharp>(pi\<bullet>s1)" and f4: "c\<sharp>(pi\<bullet>s2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   108
      by (force simp add: fresh_prod fresh_atm)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   109
    have x: "P (Lam [c].(([(c,pi\<bullet>a)]@pi)\<bullet>s1)) (Lam [c].(([(c,pi\<bullet>a)]@pi)\<bullet>s2)) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   110
      using a3 f2 j1 j2 by (simp, blast intro: eqvt_beta)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   111
    have alpha1: "(Lam [c].([(c,pi\<bullet>a)]\<bullet>(pi\<bullet>s1))) = (Lam [(pi\<bullet>a)].(pi\<bullet>s1))" using f1 f3
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   112
      by (simp add: lam.inject alpha)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   113
    have alpha2: "(Lam [c].([(c,pi\<bullet>a)]\<bullet>(pi\<bullet>s2))) = (Lam [(pi\<bullet>a)].(pi\<bullet>s2))" using f1 f3
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   114
      by (simp add: lam.inject alpha)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   115
    show " P (Lam [(pi\<bullet>a)].(pi\<bullet>s1)) (Lam [(pi\<bullet>a)].(pi\<bullet>s2)) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   116
      using x alpha1 alpha2 by (simp only: pt_name2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   117
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   118
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   119
  case (b4 a s1 s2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   120
  show ?case
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   121
  proof (simp add: subst_eqvt, intro strip)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   122
    fix pi::"name prm" and x::"'a::fs_name" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   123
    have f: "\<exists>c::name. c\<sharp>(pi\<bullet>a,pi\<bullet>s1,pi\<bullet>s2,x)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   124
      by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   125
    then obtain c::"name" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   126
      where f1: "c\<noteq>(pi\<bullet>a)" and f2: "c\<sharp>(pi\<bullet>s2,x)" and f3: "c\<sharp>(pi\<bullet>s1)" and f4: "c\<sharp>(pi\<bullet>s2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   127
      by (force simp add: fresh_prod fresh_atm)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   128
    have x: "P (App (Lam [c].(([(c,pi\<bullet>a)]@pi)\<bullet>s1)) (pi\<bullet>s2)) ((([(c,pi\<bullet>a)]@pi)\<bullet>s1)[c::=(pi\<bullet>s2)]) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   129
      using a4 f2 by (blast intro!: eqvt_beta)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   130
    have alpha1: "(Lam [c].([(c,pi\<bullet>a)]\<bullet>(pi\<bullet>s1))) = (Lam [(pi\<bullet>a)].(pi\<bullet>s1))" using f1 f3
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   131
      by (simp add: lam.inject alpha)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   132
    have alpha2: "(([(c,pi\<bullet>a)]@pi)\<bullet>s1)[c::=(pi\<bullet>s2)] = (pi\<bullet>s1)[(pi\<bullet>a)::=(pi\<bullet>s2)]"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   133
      using f3 by (simp only: subst_rename[symmetric] pt_name2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   134
    show "P (App (Lam [(pi\<bullet>a)].(pi\<bullet>s1)) (pi\<bullet>s2)) ((pi\<bullet>s1)[(pi\<bullet>a)::=(pi\<bullet>s2)]) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   135
      using x alpha1 alpha2 by (simp only: pt_name2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   136
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   137
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   138
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   139
lemma beta_induct[case_names b1 b2 b3 b4]:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   140
  fixes  P :: "lam \<Rightarrow> lam \<Rightarrow>'a::fs_name\<Rightarrow>bool"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   141
  and    t :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   142
  and    s :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   143
  and    x :: "'a::fs_name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   144
  assumes a: "t\<longrightarrow>\<^isub>\<beta>s"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   145
  and a1:    "\<And>x t s1 s2. 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   146
              s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (\<forall>z. P s1 s2 z) \<Longrightarrow> P (App s1 t) (App s2 t) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   147
  and a2:    "\<And>x t s1 s2. 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   148
              s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (\<forall>z. P s1 s2 z) \<Longrightarrow> P (App t s1) (App t s2) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   149
  and a3:    "\<And>x (a::name) s1 s2. 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   150
              a\<sharp>x \<Longrightarrow> s1\<longrightarrow>\<^isub>\<beta>s2 \<Longrightarrow> (\<forall>z. P s1 s2 z) \<Longrightarrow> P (Lam [a].s1) (Lam [a].s2) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   151
  and a4:    "\<And>x (a::name) t1 s1. 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   152
              a\<sharp>(s1,x) \<Longrightarrow> P (App (Lam [a].t1) s1) (t1[a::=s1]) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   153
  shows "P t s x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   154
using a a1 a2 a3 a4
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   155
by (auto intro!: beta_induct_aux[of "t" "s" "P" "[]" "x", simplified])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   156
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   157
lemma supp_beta: "t\<longrightarrow>\<^isub>\<beta> s\<Longrightarrow>(supp s)\<subseteq>((supp t)::name set)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   158
apply(erule Beta.induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   159
apply(auto intro!: simp add: abs_supp lam.supp subst_supp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   160
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   161
lemma beta_abs: "Lam [a].t\<longrightarrow>\<^isub>\<beta> t'\<Longrightarrow>\<exists>t''. t'=Lam [a].t'' \<and> t\<longrightarrow>\<^isub>\<beta> t''"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   162
apply(ind_cases "Lam [a].t  \<longrightarrow>\<^isub>\<beta> t'")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   163
apply(auto simp add: lam.distinct lam.inject)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   164
apply(auto simp add: alpha)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   165
apply(rule_tac x="[(a,aa)]\<bullet>s2" in exI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   166
apply(rule conjI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   167
apply(rule sym)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   168
apply(rule pt_bij2[OF pt_name_inst, OF at_name_inst])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   169
apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   170
apply(rule pt_name3)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   171
apply(simp add: at_ds5[OF at_name_inst])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   172
apply(rule conjI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   173
apply(simp add: pt_fresh_left[OF pt_name_inst, OF at_name_inst] calc_atm)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   174
apply(force dest!: supp_beta simp add: fresh_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   175
apply(force intro!: eqvt_beta)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   176
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   177
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   178
lemma beta_subst[rule_format]: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   179
  assumes a: "M \<longrightarrow>\<^isub>\<beta> M'"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   180
  shows "M[x::=N]\<longrightarrow>\<^isub>\<beta> M'[x::=N]" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   181
using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   182
apply(nominal_induct M M' rule: beta_induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   183
apply(auto simp add: fresh_prod fresh_atm subs_lemma)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   184
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   185
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   186
instance nat :: fs_name
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   187
apply(intro_classes)   
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   188
apply(simp_all add: supp_def perm_nat_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   189
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   190
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   191
datatype ty =
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   192
    TVar "string"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   193
  | TArr "ty" "ty" (infix "\<rightarrow>" 200)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   194
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   195
primrec
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   196
 "pi\<bullet>(TVar s) = TVar s"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   197
 "pi\<bullet>(\<tau> \<rightarrow> \<sigma>) = (\<tau> \<rightarrow> \<sigma>)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   198
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   199
lemma perm_ty[simp]:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   200
  fixes pi ::"name prm"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   201
  and   \<tau>  ::"ty"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   202
  shows "pi\<bullet>\<tau> = \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   203
  by (cases \<tau>, simp_all)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   204
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   205
lemma fresh_ty:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   206
  fixes a ::"name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   207
  and   \<tau>  ::"ty"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   208
  shows "a\<sharp>\<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   209
  by (simp add: fresh_def supp_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   210
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   211
instance ty :: pt_name
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   212
apply(intro_classes)   
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   213
apply(simp_all)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   214
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   215
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   216
instance ty :: fs_name
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   217
apply(intro_classes)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   218
apply(simp add: supp_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   219
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   220
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   221
(* valid contexts *)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   222
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   223
consts
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   224
  "dom_ty" :: "(name\<times>ty) list \<Rightarrow> (name list)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   225
primrec
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   226
  "dom_ty []    = []"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   227
  "dom_ty (x#\<Gamma>) = (fst x)#(dom_ty \<Gamma>)" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   228
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   229
consts
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   230
  ctxts :: "((name\<times>ty) list) set" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   231
  valid :: "(name\<times>ty) list \<Rightarrow> bool"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   232
translations
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   233
  "valid \<Gamma>" \<rightleftharpoons> "\<Gamma> \<in> ctxts"  
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   234
inductive ctxts
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   235
intros
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   236
v1[intro]: "valid []"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   237
v2[intro]: "\<lbrakk>valid \<Gamma>;a\<sharp>\<Gamma>\<rbrakk>\<Longrightarrow> valid ((a,\<sigma>)#\<Gamma>)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   238
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   239
lemma valid_eqvt:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   240
  fixes   pi:: "name prm"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   241
  assumes a: "valid \<Gamma>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   242
  shows   "valid (pi\<bullet>\<Gamma>)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   243
using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   244
apply(induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   245
apply(auto simp add: pt_fresh_bij[OF pt_name_inst, OF at_name_inst])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   246
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   247
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   248
(* typing judgements *)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   249
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   250
lemma fresh_context[rule_format]: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   251
  fixes  \<Gamma> :: "(name\<times>ty)list"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   252
  and    a :: "name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   253
  shows "a\<sharp>\<Gamma>\<longrightarrow>\<not>(\<exists>\<tau>::ty. (a,\<tau>)\<in>set \<Gamma>)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   254
apply(induct_tac \<Gamma>)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   255
apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   256
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   257
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   258
lemma valid_elim: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   259
  fixes  \<Gamma> :: "(name\<times>ty)list"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   260
  and    pi:: "name prm"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   261
  and    a :: "name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   262
  and    \<tau> :: "ty"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   263
  shows "valid ((a,\<tau>)#\<Gamma>) \<Longrightarrow> valid \<Gamma> \<and> a\<sharp>\<Gamma>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   264
apply(ind_cases "valid ((a,\<tau>)#\<Gamma>)", simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   265
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   266
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   267
lemma valid_unicity[rule_format]: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   268
  shows "valid \<Gamma>\<longrightarrow>(c,\<sigma>)\<in>set \<Gamma>\<longrightarrow>(c,\<tau>)\<in>set \<Gamma>\<longrightarrow>\<sigma>=\<tau>" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   269
apply(induct_tac \<Gamma>)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   270
apply(auto dest!: valid_elim fresh_context)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   271
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   272
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   273
consts
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   274
  typing :: "(((name\<times>ty) list)\<times>lam\<times>ty) set" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   275
syntax
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   276
  "_typing_judge" :: "(name\<times>ty) list\<Rightarrow>lam\<Rightarrow>ty\<Rightarrow>bool" (" _ \<turnstile> _ : _ " [80,80,80] 80) 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   277
translations
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   278
  "\<Gamma> \<turnstile> t : \<tau>" \<rightleftharpoons> "(\<Gamma>,t,\<tau>) \<in> typing"  
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   279
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   280
inductive typing
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   281
intros
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   282
t1[intro]: "\<lbrakk>valid \<Gamma>; (a,\<tau>)\<in>set \<Gamma>\<rbrakk>\<Longrightarrow> \<Gamma> \<turnstile> Var a : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   283
t2[intro]: "\<lbrakk>\<Gamma> \<turnstile> t1 : \<tau>\<rightarrow>\<sigma>; \<Gamma> \<turnstile> t2 : \<tau>\<rbrakk>\<Longrightarrow> \<Gamma> \<turnstile> App t1 t2 : \<sigma>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   284
t3[intro]: "\<lbrakk>a\<sharp>\<Gamma>;((a,\<tau>)#\<Gamma>) \<turnstile> t : \<sigma>\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> Lam [a].t : \<tau>\<rightarrow>\<sigma>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   285
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   286
lemma typing_eqvt: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   287
  fixes  \<Gamma> :: "(name\<times>ty) list"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   288
  and    t :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   289
  and    \<tau> :: "ty"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   290
  and    pi:: "name prm"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   291
  assumes a: "\<Gamma> \<turnstile> t : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   292
  shows "(pi\<bullet>\<Gamma>) \<turnstile> (pi\<bullet>t) : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   293
using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   294
proof (induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   295
  case (t1 \<Gamma> \<tau> a)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   296
  have "valid (pi\<bullet>\<Gamma>)" by (rule valid_eqvt)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   297
  moreover
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   298
  have "(pi\<bullet>(a,\<tau>))\<in>((pi::name prm)\<bullet>set \<Gamma>)" by (rule pt_set_bij2[OF pt_name_inst, OF at_name_inst])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   299
  ultimately show "(pi\<bullet>\<Gamma>) \<turnstile> (pi\<bullet>Var a) : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   300
    using typing.intros by (auto simp add: pt_list_set_pi[OF pt_name_inst])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   301
next 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   302
  case (t3 \<Gamma> \<sigma> \<tau> a t)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   303
  moreover have "(pi\<bullet>a)\<sharp>(pi\<bullet>\<Gamma>)" by (rule pt_fresh_bij1[OF pt_name_inst, OF at_name_inst])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   304
  ultimately show "(pi\<bullet>\<Gamma>) \<turnstile> (pi\<bullet>Lam [a].t) : \<tau>\<rightarrow>\<sigma>" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   305
    using typing.intros by (force)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   306
qed (auto)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   307
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   308
lemma typing_induct_aux[rule_format]:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   309
  fixes  P :: "(name\<times>ty) list \<Rightarrow> lam \<Rightarrow> ty \<Rightarrow>'a::fs_name\<Rightarrow>bool"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   310
  and    \<Gamma> :: "(name\<times>ty) list"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   311
  and    t :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   312
  and    \<tau> :: "ty"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   313
  assumes a: "\<Gamma> \<turnstile> t : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   314
  and a1:    "\<And>x \<Gamma> (a::name) \<tau>. valid \<Gamma> \<Longrightarrow> (a,\<tau>) \<in> set \<Gamma> \<Longrightarrow> P \<Gamma> (Var a) \<tau> x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   315
  and a2:    "\<And>x \<Gamma> \<tau> \<sigma> t1 t2. 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   316
              \<Gamma> \<turnstile> t1 : \<tau>\<rightarrow>\<sigma> \<Longrightarrow> (\<And>z. P \<Gamma> t1 (\<tau>\<rightarrow>\<sigma>) z) \<Longrightarrow> \<Gamma> \<turnstile> t2 : \<tau> \<Longrightarrow> (\<And>z. P \<Gamma> t2 \<tau> z)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   317
              \<Longrightarrow> P \<Gamma> (App t1 t2) \<sigma> x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   318
  and a3:    "\<And>x (a::name) \<Gamma> \<tau> \<sigma> t. 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   319
              a\<sharp>x \<Longrightarrow> a\<sharp>\<Gamma> \<Longrightarrow> ((a,\<tau>) # \<Gamma>) \<turnstile> t : \<sigma> \<Longrightarrow> (\<forall>z. P ((a,\<tau>)#\<Gamma>) t \<sigma> z)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   320
              \<Longrightarrow> P \<Gamma> (Lam [a].t) (\<tau>\<rightarrow>\<sigma>) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   321
  shows "\<forall>(pi::name prm) (x::'a::fs_name). P (pi\<bullet>\<Gamma>) (pi\<bullet>t) \<tau> x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   322
using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   323
proof (induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   324
  case (t1 \<Gamma> \<tau> a)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   325
  assume j1: "valid \<Gamma>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   326
  assume j2: "(a,\<tau>)\<in>set \<Gamma>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   327
  show ?case
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   328
  proof (intro strip, simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   329
    fix pi::"name prm" and x::"'a::fs_name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   330
    from j1 have j3: "valid (pi\<bullet>\<Gamma>)" by (rule valid_eqvt)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   331
    from j2 have "pi\<bullet>(a,\<tau>)\<in>pi\<bullet>(set \<Gamma>)" by (simp only: pt_set_bij[OF pt_name_inst, OF at_name_inst])  
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   332
    hence j4: "(pi\<bullet>a,\<tau>)\<in>set (pi\<bullet>\<Gamma>)" by (simp add: pt_list_set_pi[OF pt_name_inst])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   333
    show "P (pi\<bullet>\<Gamma>) (Var (pi\<bullet>a)) \<tau> x" using a1 j3 j4 by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   334
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   335
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   336
  case (t2 \<Gamma> \<sigma> \<tau> t1 t2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   337
  thus ?case using a2 by (simp, blast intro: typing_eqvt)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   338
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   339
  case (t3 \<Gamma> \<sigma> \<tau> a t)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   340
  have k1: "a\<sharp>\<Gamma>" by fact
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   341
  have k2: "((a,\<tau>)#\<Gamma>)\<turnstile>t:\<sigma>" by fact
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   342
  have k3: "\<forall>(pi::name prm) (x::'a::fs_name). P (pi \<bullet> ((a,\<tau>)#\<Gamma>)) (pi\<bullet>t) \<sigma> x" by fact
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   343
  show ?case
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   344
  proof (intro strip, simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   345
    fix pi::"name prm" and x::"'a::fs_name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   346
    have f: "\<exists>c::name. c\<sharp>(pi\<bullet>a,pi\<bullet>t,pi\<bullet>\<Gamma>,x)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   347
      by (rule at_exists_fresh[OF at_name_inst], simp add: fs_name1)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   348
    then obtain c::"name" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   349
      where f1: "c\<noteq>(pi\<bullet>a)" and f2: "c\<sharp>x" and f3: "c\<sharp>(pi\<bullet>t)" and f4: "c\<sharp>(pi\<bullet>\<Gamma>)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   350
      by (force simp add: fresh_prod fresh_atm)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   351
    from k1 have k1a: "(pi\<bullet>a)\<sharp>(pi\<bullet>\<Gamma>)" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   352
      by (simp add: pt_fresh_left[OF pt_name_inst, OF at_name_inst] 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   353
                    pt_rev_pi[OF pt_name_inst, OF at_name_inst])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   354
    have l1: "(([(c,pi\<bullet>a)]@pi)\<bullet>\<Gamma>) = (pi\<bullet>\<Gamma>)" using f4 k1a 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   355
      by (simp only: pt_name2, rule pt_fresh_fresh[OF pt_name_inst, OF at_name_inst])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   356
    have "\<forall>x. P (([(c,pi\<bullet>a)]@pi)\<bullet>((a,\<tau>)#\<Gamma>)) (([(c,pi\<bullet>a)]@pi)\<bullet>t) \<sigma> x" using k3 by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   357
    hence l2: "\<forall>x. P ((c, \<tau>)#(pi\<bullet>\<Gamma>)) (([(c,pi\<bullet>a)]@pi)\<bullet>t) \<sigma> x" using f1 l1
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   358
      by (force simp add: pt_name2  calc_atm split: if_splits)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   359
    have "(([(c,pi\<bullet>a)]@pi)\<bullet>((a,\<tau>)#\<Gamma>)) \<turnstile> (([(c,pi\<bullet>a)]@pi)\<bullet>t) : \<sigma>" using k2 by (rule typing_eqvt)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   360
    hence l3: "((c, \<tau>)#(pi\<bullet>\<Gamma>)) \<turnstile> (([(c,pi\<bullet>a)]@pi)\<bullet>t) : \<sigma>" using l1 f1 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   361
      by (force simp add: pt_name2 calc_atm split: if_splits)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   362
    have l4: "P (pi\<bullet>\<Gamma>) (Lam [c].(([(c,pi\<bullet>a)]@pi)\<bullet>t)) (\<tau> \<rightarrow> \<sigma>) x" using f2 f4 l2 l3 a3 by auto
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   363
    have alpha: "(Lam [c].([(c,pi\<bullet>a)]\<bullet>(pi\<bullet>t))) = (Lam [(pi\<bullet>a)].(pi\<bullet>t))" using f1 f3
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   364
      by (simp add: lam.inject alpha)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   365
    show "P (pi\<bullet>\<Gamma>) (Lam [(pi\<bullet>a)].(pi\<bullet>t)) (\<tau> \<rightarrow> \<sigma>) x" using l4 alpha 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   366
      by (simp only: pt_name2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   367
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   368
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   369
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   370
lemma typing_induct[case_names t1 t2 t3]:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   371
  fixes  P :: "(name\<times>ty) list \<Rightarrow> lam \<Rightarrow> ty \<Rightarrow>'a::fs_name\<Rightarrow>bool"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   372
  and    \<Gamma> :: "(name\<times>ty) list"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   373
  and    t :: "lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   374
  and    \<tau> :: "ty"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   375
  and    x :: "'a::fs_name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   376
  assumes a: "\<Gamma> \<turnstile> t : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   377
  and a1:    "\<And>x \<Gamma> (a::name) \<tau>. valid \<Gamma> \<Longrightarrow> (a,\<tau>) \<in> set \<Gamma> \<Longrightarrow> P \<Gamma> (Var a) \<tau> x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   378
  and a2:    "\<And>x \<Gamma> \<tau> \<sigma> t1 t2. 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   379
              \<Gamma> \<turnstile> t1 : \<tau>\<rightarrow>\<sigma> \<Longrightarrow> (\<forall>z. P \<Gamma> t1 (\<tau>\<rightarrow>\<sigma>) z) \<Longrightarrow> \<Gamma> \<turnstile> t2 : \<tau> \<Longrightarrow> (\<forall>z. P \<Gamma> t2 \<tau> z)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   380
              \<Longrightarrow> P \<Gamma> (App t1 t2) \<sigma> x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   381
  and a3:    "\<And>x (a::name) \<Gamma> \<tau> \<sigma> t. 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   382
              a\<sharp>x \<Longrightarrow> a\<sharp>\<Gamma> \<Longrightarrow> ((a,\<tau>) # \<Gamma>) \<turnstile> t : \<sigma> \<Longrightarrow> (\<forall>z. P ((a,\<tau>)#\<Gamma>) t \<sigma> z)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   383
              \<Longrightarrow> P \<Gamma> (Lam [a].t) (\<tau>\<rightarrow>\<sigma>) x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   384
  shows "P \<Gamma> t \<tau> x"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   385
using a a1 a2 a3 typing_induct_aux[of "\<Gamma>" "t" "\<tau>" "P" "[]" "x", simplified] by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   386
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   387
constdefs
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   388
  "sub" :: "(name\<times>ty) list \<Rightarrow> (name\<times>ty) list \<Rightarrow> bool" (" _ \<lless> _ " [80,80] 80)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   389
  "\<Gamma>1 \<lless> \<Gamma>2 \<equiv> \<forall>a \<sigma>. (a,\<sigma>)\<in>set \<Gamma>1 \<longrightarrow>  (a,\<sigma>)\<in>set \<Gamma>2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   390
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   391
lemma weakening[rule_format]: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   392
  assumes a: "\<Gamma>1 \<turnstile> t : \<sigma>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   393
  shows "valid \<Gamma>2 \<longrightarrow> \<Gamma>1 \<lless> \<Gamma>2 \<longrightarrow> \<Gamma>2 \<turnstile> t:\<sigma>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   394
using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   395
apply(nominal_induct \<Gamma>1 t \<sigma> rule: typing_induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   396
apply(auto simp add: sub_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   397
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   398
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   399
lemma in_ctxt[rule_format]: "(a,\<tau>)\<in>set \<Gamma> \<longrightarrow> (a\<in>set(dom_ty \<Gamma>))"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   400
apply(induct_tac \<Gamma>)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   401
apply(auto)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   402
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   403
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   404
lemma free_vars: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   405
  assumes a: "\<Gamma> \<turnstile> t : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   406
  shows " (supp t)\<subseteq>set(dom_ty \<Gamma>)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   407
using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   408
apply(nominal_induct \<Gamma> t \<tau> rule: typing_induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   409
apply(auto simp add: lam.supp abs_supp supp_atm in_ctxt)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   410
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   411
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   412
lemma t1_elim: "\<Gamma> \<turnstile> Var a : \<tau> \<Longrightarrow> valid \<Gamma> \<and> (a,\<tau>) \<in> set \<Gamma>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   413
apply(ind_cases "\<Gamma> \<turnstile> Var a : \<tau>")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   414
apply(auto simp add: lam.inject lam.distinct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   415
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   416
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   417
lemma t2_elim: "\<Gamma> \<turnstile> App t1 t2 : \<sigma> \<Longrightarrow> \<exists>\<tau>. (\<Gamma> \<turnstile> t1 : \<tau>\<rightarrow>\<sigma> \<and> \<Gamma> \<turnstile> t2 : \<tau>)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   418
apply(ind_cases "\<Gamma> \<turnstile> App t1 t2 : \<sigma>")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   419
apply(auto simp add: lam.inject lam.distinct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   420
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   421
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   422
lemma t3_elim: "\<lbrakk>\<Gamma> \<turnstile> Lam [a].t : \<sigma>;a\<sharp>\<Gamma>\<rbrakk>\<Longrightarrow> \<exists>\<tau> \<tau>'. \<sigma>=\<tau>\<rightarrow>\<tau>' \<and> ((a,\<tau>)#\<Gamma>) \<turnstile> t : \<tau>'"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   423
apply(ind_cases "\<Gamma> \<turnstile> Lam [a].t : \<sigma>")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   424
apply(auto simp add: lam.distinct lam.inject alpha) 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   425
apply(drule_tac pi="[(a,aa)]::name prm" in typing_eqvt)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   426
apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   427
apply(subgoal_tac "([(a,aa)]::name prm)\<bullet>\<Gamma> = \<Gamma>")(*A*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   428
apply(force simp add: calc_atm)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   429
(*A*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   430
apply(force intro!: pt_fresh_fresh[OF pt_name_inst, OF at_name_inst])
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   431
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   432
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   433
lemma typing_valid: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   434
  assumes a: "\<Gamma> \<turnstile> t : \<tau>" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   435
  shows "valid \<Gamma>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   436
using a by (induct, auto dest!: valid_elim)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   437
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   438
lemma ty_subs[rule_format]:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   439
  fixes \<Gamma> ::"(name\<times>ty) list"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   440
  and   t1 ::"lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   441
  and   t2 ::"lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   442
  and   \<tau>  ::"ty"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   443
  and   \<sigma>  ::"ty" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   444
  and   c  ::"name"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   445
  shows  "((c,\<sigma>)#\<Gamma>) \<turnstile> t1:\<tau>\<longrightarrow> \<Gamma>\<turnstile> t2:\<sigma>\<longrightarrow> \<Gamma> \<turnstile> t1[c::=t2]:\<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   446
proof(nominal_induct t1 rule: lam_induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   447
  case (Var \<Gamma> \<sigma> \<tau> c t2 a)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   448
  show ?case
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   449
  proof(intro strip)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   450
    assume a1: "\<Gamma> \<turnstile>t2:\<sigma>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   451
    assume a2: "((c,\<sigma>)#\<Gamma>) \<turnstile> Var a:\<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   452
    hence a21: "(a,\<tau>)\<in>set((c,\<sigma>)#\<Gamma>)" and a22: "valid((c,\<sigma>)#\<Gamma>)" by (auto dest: t1_elim)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   453
    from a22 have a23: "valid \<Gamma>" and a24: "c\<sharp>\<Gamma>" by (auto dest: valid_elim) 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   454
    from a24 have a25: "\<not>(\<exists>\<tau>. (c,\<tau>)\<in>set \<Gamma>)" by (rule fresh_context)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   455
    show "\<Gamma>\<turnstile>(Var a)[c::=t2] : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   456
    proof (cases "a=c", simp_all)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   457
      assume case1: "a=c"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   458
      show "\<Gamma> \<turnstile> t2:\<tau>" using a1
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   459
      proof (cases "\<sigma>=\<tau>")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   460
	assume "\<sigma>=\<tau>" thus ?thesis using a1 by simp 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   461
      next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   462
	assume a3: "\<sigma>\<noteq>\<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   463
	show ?thesis
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   464
	proof (rule ccontr)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   465
	  from a3 a21 have "(a,\<tau>)\<in>set \<Gamma>" by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   466
	  with case1 a25 show False by force 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   467
	qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   468
      qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   469
    next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   470
      assume case2: "a\<noteq>c"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   471
      with a21 have a26: "(a,\<tau>)\<in>set \<Gamma>" by force 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   472
      from a23 a26 show "\<Gamma> \<turnstile> Var a:\<tau>" by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   473
    qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   474
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   475
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   476
  case (App \<Gamma> \<sigma> \<tau> c t2 s1 s2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   477
  show ?case
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   478
  proof (intro strip, simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   479
    assume b1: "\<Gamma> \<turnstile>t2:\<sigma>" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   480
    assume b2: " ((c,\<sigma>)#\<Gamma>)\<turnstile>App s1 s2 : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   481
    hence "\<exists>\<tau>'. (((c,\<sigma>)#\<Gamma>)\<turnstile>s1:\<tau>'\<rightarrow>\<tau> \<and> ((c,\<sigma>)#\<Gamma>)\<turnstile>s2:\<tau>')" by (rule t2_elim) 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   482
    then obtain \<tau>' where b3a: "((c,\<sigma>)#\<Gamma>)\<turnstile>s1:\<tau>'\<rightarrow>\<tau>" and b3b: "((c,\<sigma>)#\<Gamma>)\<turnstile>s2:\<tau>'" by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   483
    show "\<Gamma> \<turnstile>  App (s1[c::=t2]) (s2[c::=t2]) : \<tau>" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   484
      using b1 b3a b3b App by (rule_tac \<tau>="\<tau>'" in t2, auto)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   485
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   486
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   487
  case (Lam \<Gamma> \<sigma> \<tau> c t2 a s)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   488
  assume "a\<sharp>(\<Gamma>,\<sigma>,\<tau>,c,t2)" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   489
  hence f1: "a\<sharp>\<Gamma>" and f2: "a\<noteq>c" and f2': "c\<sharp>a" and f3: "a\<sharp>t2" and f4: "a\<sharp>((c,\<sigma>)#\<Gamma>)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   490
    by (auto simp add: fresh_atm fresh_prod fresh_list_cons)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   491
  show ?case using f2 f3
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   492
  proof(intro strip, simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   493
    assume c1: "((c,\<sigma>)#\<Gamma>)\<turnstile>Lam [a].s : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   494
    hence "\<exists>\<tau>1 \<tau>2. \<tau>=\<tau>1\<rightarrow>\<tau>2 \<and> ((a,\<tau>1)#(c,\<sigma>)#\<Gamma>) \<turnstile> s : \<tau>2" using f4 by (auto dest: t3_elim) 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   495
    then obtain \<tau>1 \<tau>2 where c11: "\<tau>=\<tau>1\<rightarrow>\<tau>2" and c12: "((a,\<tau>1)#(c,\<sigma>)#\<Gamma>) \<turnstile> s : \<tau>2" by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   496
    from c12 have "valid ((a,\<tau>1)#(c,\<sigma>)#\<Gamma>)" by (rule typing_valid)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   497
    hence ca: "valid \<Gamma>" and cb: "a\<sharp>\<Gamma>" and cc: "c\<sharp>\<Gamma>" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   498
      by (auto dest: valid_elim simp add: fresh_list_cons) 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   499
    from c12 have c14: "((c,\<sigma>)#(a,\<tau>1)#\<Gamma>) \<turnstile> s : \<tau>2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   500
    proof -
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   501
      have c2: "((a,\<tau>1)#(c,\<sigma>)#\<Gamma>) \<lless> ((c,\<sigma>)#(a,\<tau>1)#\<Gamma>)" by (force simp add: sub_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   502
      have c3: "valid ((c,\<sigma>)#(a,\<tau>1)#\<Gamma>)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   503
	by (rule v2, rule v2, auto simp add: fresh_list_cons fresh_prod ca cb cc f2' fresh_ty)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   504
      from c12 c2 c3 show ?thesis by (force intro: weakening)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   505
    qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   506
    assume c8: "\<Gamma> \<turnstile> t2 : \<sigma>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   507
    have c81: "((a,\<tau>1)#\<Gamma>)\<turnstile>t2 :\<sigma>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   508
    proof -
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   509
      have c82: "\<Gamma> \<lless> ((a,\<tau>1)#\<Gamma>)" by (force simp add: sub_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   510
      have c83: "valid ((a,\<tau>1)#\<Gamma>)" using f1 ca by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   511
      with c8 c82 c83 show ?thesis by (force intro: weakening)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   512
    qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   513
    show "\<Gamma> \<turnstile> Lam [a].(s[c::=t2]) : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   514
      using c11 Lam c14 c81 f1 by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   515
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   516
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   517
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   518
lemma subject[rule_format]: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   519
  fixes \<Gamma>  ::"(name\<times>ty) list"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   520
  and   t1 ::"lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   521
  and   t2 ::"lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   522
  and   \<tau>  ::"ty"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   523
  assumes a: "t1\<longrightarrow>\<^isub>\<beta>t2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   524
  shows "(\<Gamma> \<turnstile> t1:\<tau>) \<longrightarrow> (\<Gamma> \<turnstile> t2:\<tau>)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   525
using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   526
proof (nominal_induct t1 t2 rule: beta_induct, auto)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   527
  case (b1 \<Gamma> \<tau> t s1 s2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   528
  assume i: "\<forall>\<Gamma> \<tau>. \<Gamma> \<turnstile> s1 : \<tau> \<longrightarrow> \<Gamma> \<turnstile> s2 : \<tau>" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   529
  assume "\<Gamma> \<turnstile> App s1 t : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   530
  hence "\<exists>\<sigma>. (\<Gamma> \<turnstile> s1 : \<sigma>\<rightarrow>\<tau> \<and> \<Gamma> \<turnstile> t : \<sigma>)" by (rule t2_elim)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   531
  then obtain \<sigma> where a1: "\<Gamma> \<turnstile> s1 : \<sigma>\<rightarrow>\<tau>" and a2: "\<Gamma> \<turnstile> t : \<sigma>" by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   532
  thus "\<Gamma> \<turnstile> App s2 t : \<tau>" using i by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   533
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   534
  case (b2 \<Gamma> \<tau> t s1 s2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   535
  assume i: "\<forall>\<Gamma> \<tau>. \<Gamma> \<turnstile> s1 : \<tau> \<longrightarrow> \<Gamma> \<turnstile> s2 : \<tau>" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   536
  assume "\<Gamma> \<turnstile> App t s1 : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   537
  hence "\<exists>\<sigma>. (\<Gamma> \<turnstile> t : \<sigma>\<rightarrow>\<tau> \<and> \<Gamma> \<turnstile> s1 : \<sigma>)" by (rule t2_elim)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   538
  then obtain \<sigma> where a1: "\<Gamma> \<turnstile> t : \<sigma>\<rightarrow>\<tau>" and a2: "\<Gamma> \<turnstile> s1 : \<sigma>" by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   539
  thus "\<Gamma> \<turnstile> App t s2 : \<tau>" using i by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   540
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   541
  case (b3 \<Gamma> \<tau> a s1 s2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   542
  assume "a\<sharp>(\<Gamma>,\<tau>)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   543
  hence f: "a\<sharp>\<Gamma>" by (simp add: fresh_prod)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   544
  assume i: "\<forall>\<Gamma> \<tau>. \<Gamma> \<turnstile> s1 : \<tau> \<longrightarrow> \<Gamma> \<turnstile> s2 : \<tau>" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   545
  assume "\<Gamma> \<turnstile> Lam [a].s1 : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   546
  with f have "\<exists>\<tau>1 \<tau>2. \<tau>=\<tau>1\<rightarrow>\<tau>2 \<and> ((a,\<tau>1)#\<Gamma>) \<turnstile> s1 : \<tau>2" by (force dest: t3_elim)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   547
  then obtain \<tau>1 \<tau>2 where a1: "\<tau>=\<tau>1\<rightarrow>\<tau>2" and a2: "((a,\<tau>1)#\<Gamma>) \<turnstile> s1 : \<tau>2" by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   548
  thus "\<Gamma> \<turnstile> Lam [a].s2 : \<tau>" using f i by force 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   549
next
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   550
  case (b4 \<Gamma> \<tau> a s1 s2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   551
  have "a\<sharp>(s2,\<Gamma>,\<tau>)" by fact
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   552
  hence f: "a\<sharp>\<Gamma>" by (simp add: fresh_prod)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   553
  assume "\<Gamma> \<turnstile> App (Lam [a].s1) s2 : \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   554
  hence "\<exists>\<sigma>. (\<Gamma> \<turnstile> (Lam [a].s1) : \<sigma>\<rightarrow>\<tau> \<and> \<Gamma> \<turnstile> s2 : \<sigma>)" by (rule t2_elim)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   555
  then obtain \<sigma> where a1: "\<Gamma> \<turnstile> (Lam [(a::name)].s1) : \<sigma>\<rightarrow>\<tau>" and a2: "\<Gamma> \<turnstile> s2 : \<sigma>" by force
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   556
  have  "((a,\<sigma>)#\<Gamma>) \<turnstile> s1 : \<tau>" using a1 f by (auto dest!: t3_elim)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   557
  with a2 show "\<Gamma> \<turnstile>  s1[a::=s2] : \<tau>" by (force intro: ty_subs)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   558
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   559
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   560
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   561
lemma subject[rule_format]: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   562
  fixes \<Gamma>  ::"(name\<times>ty) list"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   563
  and   t1 ::"lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   564
  and   t2 ::"lam"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   565
  and   \<tau>  ::"ty"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   566
  assumes a: "t1\<longrightarrow>\<^isub>\<beta>t2"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   567
  shows "\<Gamma> \<turnstile> t1:\<tau> \<longrightarrow> \<Gamma> \<turnstile> t2:\<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   568
using a
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   569
apply(nominal_induct t1 t2 rule: beta_induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   570
apply(auto dest!: t2_elim t3_elim intro: ty_subs simp add: fresh_prod)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   571
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   572
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   573
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   574
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   575
subsection {* some facts about beta *}
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   576
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   577
constdefs
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   578
  "NORMAL" :: "lam \<Rightarrow> bool"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   579
  "NORMAL t \<equiv> \<not>(\<exists>t'. t\<longrightarrow>\<^isub>\<beta> t')"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   580
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   581
constdefs
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   582
  "SN" :: "lam \<Rightarrow> bool"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   583
  "SN t \<equiv> t\<in>termi Beta"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   584
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   585
lemma qq1: "\<lbrakk>SN(t1);t1\<longrightarrow>\<^isub>\<beta> t2\<rbrakk>\<Longrightarrow>SN(t2)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   586
apply(simp add: SN_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   587
apply(drule_tac a="t2" in acc_downward)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   588
apply(auto)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   589
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   590
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   591
lemma qq2: "(\<forall>t2. t1\<longrightarrow>\<^isub>\<beta>t2 \<longrightarrow> SN(t2))\<Longrightarrow>SN(t1)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   592
apply(simp add: SN_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   593
apply(rule accI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   594
apply(auto)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   595
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   596
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   597
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   598
section {* Candidates *}
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   599
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   600
consts
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   601
  RED :: "ty \<Rightarrow> lam set"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   602
primrec
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   603
 "RED (TVar X) = {t. SN(t)}"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   604
 "RED (\<tau>\<rightarrow>\<sigma>) =   {t. \<forall>u. (u\<in>RED \<tau> \<longrightarrow> (App t u)\<in>RED \<sigma>)}"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   605
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   606
constdefs
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   607
  NEUT :: "lam \<Rightarrow> bool"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   608
  "NEUT t \<equiv> (\<exists>a. t=Var a)\<or>(\<exists>t1 t2. t=App t1 t2)" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   609
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   610
(* a slight hack to get the first element of applications *)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   611
consts
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   612
  FST :: "(lam\<times>lam) set"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   613
syntax 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   614
  "FST_judge"   :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<guillemotright> _" [80,80] 80)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   615
translations 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   616
  "t1 \<guillemotright> t2" \<rightleftharpoons> "(t1,t2) \<in> FST"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   617
inductive FST
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   618
intros
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   619
fst[intro!]:  "(App t s) \<guillemotright> t"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   620
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   621
lemma fst_elim[elim!]: "(App t s) \<guillemotright> t' \<Longrightarrow> t=t'"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   622
apply(ind_cases "App t s \<guillemotright> t'")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   623
apply(simp add: lam.inject)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   624
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   625
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   626
lemma qq3: "SN(App t s)\<Longrightarrow>SN(t)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   627
apply(simp add: SN_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   628
apply(subgoal_tac "\<forall>z. (App t s \<guillemotright> z) \<longrightarrow> z\<in>termi Beta")(*A*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   629
apply(force)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   630
(*A*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   631
apply(erule acc_induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   632
apply(clarify)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   633
apply(ind_cases "x \<guillemotright> z")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   634
apply(clarify)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   635
apply(rule accI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   636
apply(auto intro: b1)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   637
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   638
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   639
constdefs
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   640
   "CR1" :: "ty \<Rightarrow> bool"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   641
   "CR1 \<tau> \<equiv> \<forall> t. (t\<in>RED \<tau> \<longrightarrow> SN(t))"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   642
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   643
   "CR2" :: "ty \<Rightarrow> bool"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   644
   "CR2 \<tau> \<equiv> \<forall>t t'. ((t\<in>RED \<tau> \<and> t \<longrightarrow>\<^isub>\<beta> t') \<longrightarrow> t'\<in>RED \<tau>)"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   645
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   646
   "CR3_RED" :: "lam \<Rightarrow> ty \<Rightarrow> bool"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   647
   "CR3_RED t \<tau> \<equiv> \<forall>t'. (t\<longrightarrow>\<^isub>\<beta> t' \<longrightarrow>  t'\<in>RED \<tau>)" 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   648
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   649
   "CR3" :: "ty \<Rightarrow> bool"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   650
   "CR3 \<tau> \<equiv> \<forall>t. (NEUT t \<and> CR3_RED t \<tau>) \<longrightarrow> t\<in>RED \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   651
   
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   652
   "CR4" :: "ty \<Rightarrow> bool"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   653
   "CR4 \<tau> \<equiv> \<forall>t. (NEUT t \<and> NORMAL t) \<longrightarrow>t\<in>RED \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   654
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   655
lemma CR3_CR4: "CR3 \<tau> \<Longrightarrow> CR4 \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   656
apply(simp (no_asm_use) add: CR3_def CR3_RED_def CR4_def NORMAL_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   657
apply(blast)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   658
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   659
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   660
lemma sub_ind: 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   661
  "SN(u)\<Longrightarrow>(u\<in>RED \<tau>\<longrightarrow>(\<forall>t. (NEUT t\<and>CR2 \<tau>\<and>CR3 \<sigma>\<and>CR3_RED t (\<tau>\<rightarrow>\<sigma>))\<longrightarrow>(App t u)\<in>RED \<sigma>))"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   662
apply(simp add: SN_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   663
apply(erule acc_induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   664
apply(auto)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   665
apply(simp add: CR3_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   666
apply(rotate_tac 5)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   667
apply(drule_tac x="App t x" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   668
apply(drule mp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   669
apply(rule conjI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   670
apply(force simp only: NEUT_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   671
apply(simp (no_asm) add: CR3_RED_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   672
apply(clarify)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   673
apply(ind_cases "App t x \<longrightarrow>\<^isub>\<beta> t'")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   674
apply(simp_all add: lam.inject)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   675
apply(simp only:  CR3_RED_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   676
apply(drule_tac x="s2" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   677
apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   678
apply(drule_tac x="s2" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   679
apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   680
apply(drule mp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   681
apply(simp (no_asm_use) add: CR2_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   682
apply(blast)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   683
apply(drule_tac x="ta" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   684
apply(force)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   685
apply(auto simp only: NEUT_def lam.inject lam.distinct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   686
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   687
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   688
lemma RED_props: "CR1 \<tau> \<and> CR2 \<tau> \<and> CR3 \<tau>"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   689
apply(induct_tac \<tau>)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   690
apply(auto)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   691
(* atom types *)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   692
(* C1 *)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   693
apply(simp add: CR1_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   694
(* C2 *)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   695
apply(simp add: CR2_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   696
apply(clarify)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   697
apply(drule_tac ?t2.0="t'" in  qq1)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   698
apply(assumption)+
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   699
(* C3 *)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   700
apply(simp add: CR3_def CR3_RED_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   701
apply(clarify)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   702
apply(rule qq2)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   703
apply(assumption)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   704
(* arrow types *)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   705
(* C1 *)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   706
apply(simp (no_asm) add: CR1_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   707
apply(clarify)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   708
apply(subgoal_tac "NEUT (Var a)")(*A*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   709
apply(subgoal_tac "(Var a)\<in>RED ty1")(*C*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   710
apply(drule_tac x="Var a" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   711
apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   712
apply(simp add: CR1_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   713
apply(rotate_tac 1)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   714
apply(drule_tac x="App t (Var a)" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   715
apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   716
apply(drule qq3) 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   717
apply(assumption)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   718
(*C*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   719
apply(simp (no_asm_use) add: CR3_def CR3_RED_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   720
apply(drule_tac x="Var a" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   721
apply(drule mp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   722
apply(clarify)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   723
apply(ind_cases " Var a \<longrightarrow>\<^isub>\<beta> t'")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   724
apply(simp (no_asm_use) add: lam.distinct)+ 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   725
(*A*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   726
apply(simp (no_asm) only: NEUT_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   727
apply(rule disjCI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   728
apply(rule_tac x="a" in exI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   729
apply(simp (no_asm))
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   730
(* C2 *)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   731
apply(simp (no_asm) add: CR2_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   732
apply(clarify)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   733
apply(drule_tac x="u" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   734
apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   735
apply(subgoal_tac "App t u \<longrightarrow>\<^isub>\<beta> App t' u")(*X*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   736
apply(simp (no_asm_use) only: CR2_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   737
apply(blast)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   738
(*X*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   739
apply(force intro!: b1)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   740
(* C3 *)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   741
apply(unfold CR3_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   742
apply(rule allI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   743
apply(rule impI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   744
apply(erule conjE)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   745
apply(simp (no_asm))
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   746
apply(rule allI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   747
apply(rule impI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   748
apply(subgoal_tac "SN(u)")(*Z*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   749
apply(fold CR3_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   750
apply(drule_tac \<tau>="ty1" and \<sigma>="ty2" in sub_ind)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   751
apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   752
(*Z*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   753
apply(simp add: CR1_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   754
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   755
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   756
lemma double_acc_aux:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   757
  assumes a_acc: "a \<in> acc r"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   758
  and b_acc: "b \<in> acc r"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   759
  and hyp: "\<And>x z.
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   760
    (\<And>y. (y, x) \<in> r \<Longrightarrow> y \<in> acc r) \<Longrightarrow>
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   761
    (\<And>y. (y, x) \<in> r \<Longrightarrow> P y z) \<Longrightarrow>
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   762
    (\<And>u. (u, z) \<in> r \<Longrightarrow> u \<in> acc r) \<Longrightarrow>
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   763
    (\<And>u. (u, z) \<in> r \<Longrightarrow> P x u) \<Longrightarrow> P x z"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   764
  shows "P a b"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   765
proof -
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   766
  from a_acc
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   767
  have r: "\<And>b. b \<in> acc r \<Longrightarrow> P a b"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   768
  proof (induct a rule: acc.induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   769
    case (accI x)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   770
    note accI' = accI
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   771
    have "b \<in> acc r" .
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   772
    thus ?case
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   773
    proof (induct b rule: acc.induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   774
      case (accI y)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   775
      show ?case
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   776
	apply (rule hyp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   777
	apply (erule accI')
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   778
	apply (erule accI')
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   779
	apply (rule acc.accI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   780
	apply (erule accI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   781
	apply (erule accI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   782
	apply (erule accI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   783
	done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   784
    qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   785
  qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   786
  from b_acc show ?thesis by (rule r)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   787
qed
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   788
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   789
lemma double_acc:
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   790
  "\<lbrakk>a \<in> acc r; b \<in> acc r; \<forall>x z. ((\<forall>y. (y, x)\<in>r\<longrightarrow>P y z)\<and>(\<forall>u. (u, z)\<in>r\<longrightarrow>P x u))\<longrightarrow>P x z\<rbrakk>\<Longrightarrow>P a b"
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   791
apply(rule_tac r="r" in double_acc_aux)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   792
apply(assumption)+
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   793
apply(blast)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   794
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   795
18263
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   796
lemma abs_RED: "(\<forall>s\<in>RED \<tau>. t[x::=s]\<in>RED \<sigma>)\<longrightarrow>Lam [x].t\<in>RED (\<tau>\<rightarrow>\<sigma>)"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   797
apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   798
apply(clarify)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   799
apply(subgoal_tac "t\<in>termi Beta")(*1*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   800
apply(erule rev_mp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   801
apply(subgoal_tac "u \<in> RED \<tau>")(*A*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   802
apply(erule rev_mp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   803
apply(rule_tac a="t" and b="u" in double_acc)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   804
apply(assumption)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   805
apply(subgoal_tac "CR1 \<tau>")(*A*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   806
apply(simp add: CR1_def SN_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   807
(*A*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   808
apply(force simp add: RED_props)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   809
apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   810
apply(clarify)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   811
apply(subgoal_tac "CR3 \<sigma>")(*B*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   812
apply(simp add: CR3_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   813
apply(rotate_tac 6)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   814
apply(drule_tac x="App(Lam[x].xa ) z" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   815
apply(drule mp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   816
apply(rule conjI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   817
apply(force simp add: NEUT_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   818
apply(simp add: CR3_RED_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   819
apply(clarify)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   820
apply(ind_cases "App(Lam[x].xa) z \<longrightarrow>\<^isub>\<beta> t'")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   821
apply(auto simp add: lam.inject lam.distinct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   822
apply(drule beta_abs)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   823
apply(auto)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   824
apply(drule_tac x="t''" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   825
apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   826
apply(drule mp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   827
apply(clarify)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   828
apply(drule_tac x="s" in bspec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   829
apply(assumption)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   830
apply(subgoal_tac "xa [ x ::= s ] \<longrightarrow>\<^isub>\<beta>  t'' [ x ::= s ]")(*B*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   831
apply(subgoal_tac "CR2 \<sigma>")(*C*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   832
apply(simp (no_asm_use) add: CR2_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   833
apply(blast)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   834
(*C*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   835
apply(force simp add: RED_props)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   836
(*B*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   837
apply(force intro!: beta_subst)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   838
apply(assumption)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   839
apply(rotate_tac 3)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   840
apply(drule_tac x="s2" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   841
apply(subgoal_tac "s2\<in>RED \<tau>")(*D*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   842
apply(simp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   843
(*D*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   844
apply(subgoal_tac "CR2 \<tau>")(*E*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   845
apply(simp (no_asm_use) add: CR2_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   846
apply(blast)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   847
(*E*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   848
apply(force simp add: RED_props)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   849
apply(simp add: alpha)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   850
apply(erule disjE)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   851
apply(force)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   852
apply(auto)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   853
apply(simp add: subst_rename)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   854
apply(drule_tac x="z" in bspec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   855
apply(assumption)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   856
(*B*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   857
apply(force simp add: RED_props)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   858
(*1*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   859
apply(drule_tac x="Var x" in bspec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   860
apply(subgoal_tac "CR3 \<tau>")(*2*) 
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   861
apply(drule CR3_CR4)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   862
apply(simp add: CR4_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   863
apply(drule_tac x="Var x" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   864
apply(drule mp)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   865
apply(rule conjI)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   866
apply(force simp add: NEUT_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   867
apply(simp add: NORMAL_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   868
apply(clarify)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   869
apply(ind_cases "Var x \<longrightarrow>\<^isub>\<beta> t'")
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   870
apply(auto simp add: lam.inject lam.distinct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   871
apply(force simp add: RED_props)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   872
apply(simp add: id_subs)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   873
apply(subgoal_tac "CR1 \<sigma>")(*3*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   874
apply(simp add: CR1_def SN_def)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   875
(*3*)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   876
apply(force simp add: RED_props)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   877
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   878
18263
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   879
lemma fresh_domain[rule_format]: "a\<sharp>\<theta>\<longrightarrow>a\<notin>set(domain \<theta>)"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   880
apply(induct_tac \<theta>)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   881
apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   882
done
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   883
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   884
lemma fresh_at[rule_format]: "a\<in>set(domain \<theta>) \<longrightarrow> c\<sharp>\<theta>\<longrightarrow>c\<sharp>(\<theta><a>)"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   885
apply(induct_tac \<theta>)   
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   886
apply(auto simp add: fresh_prod fresh_list_cons)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   887
done
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   888
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   889
lemma psubs_subs[rule_format]: "c\<sharp>\<theta>\<longrightarrow> (t[<\<theta>>])[c::=s] = t[<((c,s)#\<theta>)>]"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   890
apply(nominal_induct t rule: lam_induct)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   891
apply(auto dest: fresh_domain)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   892
apply(drule fresh_at)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   893
apply(assumption)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   894
apply(rule forget)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   895
apply(assumption)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   896
apply(subgoal_tac "ab\<sharp>((aa,b)#a)")(*A*)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   897
apply(simp add: fresh_prod)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   898
(*A*)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   899
apply(simp add: fresh_list_cons fresh_prod)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   900
done
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   901
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   902
lemma all_RED: 
18263
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   903
  "\<Gamma>\<turnstile>t:\<tau> \<longrightarrow> (\<forall>a \<sigma>. (a,\<sigma>)\<in>set(\<Gamma>)\<longrightarrow>(a\<in>set(domain \<theta>)\<and>\<theta><a>\<in>RED \<sigma>)) \<longrightarrow>  (t[<\<theta>>]\<in>RED \<tau>)"
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   904
apply(nominal_induct t rule: lam_induct)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   905
(* Variables *)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   906
apply(force dest: t1_elim)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   907
(* Applications *)
18263
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   908
apply(clarify)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   909
apply(drule t2_elim)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   910
apply(erule exE, erule conjE)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   911
apply(drule_tac x="a" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   912
apply(drule_tac x="a" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   913
apply(drule_tac x="\<tau>\<rightarrow>aa" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   914
apply(drule_tac x="\<tau>" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   915
apply(drule_tac x="b" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   916
apply(drule_tac x="b" in spec)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   917
apply(force)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   918
(* Abstractions *)
18263
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   919
apply(clarify)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   920
apply(drule t3_elim)
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   921
apply(simp add: fresh_prod)
18263
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   922
apply(erule exE)+
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   923
apply(erule conjE)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   924
apply(simp only: fresh_prod psubst_Lam)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   925
apply(rule abs_RED[THEN mp])
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   926
apply(clarify)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   927
apply(drule_tac x="(ab,\<tau>)#a" in spec)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   928
apply(drule_tac x="\<tau>'" in spec)
18263
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   929
apply(drule_tac x="(ab,s)#b" in spec)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   930
apply(simp (no_asm_use))
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   931
apply(simp add: split_if)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   932
apply(auto)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   933
apply(drule fresh_context)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   934
apply(simp)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   935
apply(simp add: psubs_subs)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   936
done
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   937
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   938
lemma all_RED: 
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   939
 "\<Gamma>\<turnstile>t:\<tau> \<longrightarrow> (\<forall>a \<sigma>. (a,\<sigma>)\<in>set(\<Gamma>)\<longrightarrow>(a\<in>set(domain \<theta>)\<and>\<theta><a>\<in>RED \<sigma>)) \<longrightarrow>  (t[<\<theta>>]\<in>RED \<tau>)"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   940
apply(nominal_induct t rule: lam_induct)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   941
(* Variables *)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   942
apply(force dest: t1_elim)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   943
(* Applications *)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   944
apply(force dest!: t2_elim)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   945
(* Abstractions *)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   946
apply(auto dest!: t3_elim simp only:)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   947
apply(simp add: fresh_prod)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   948
apply(simp only: fresh_prod psubst_Lam)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   949
apply(rule abs_RED[THEN mp])
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   950
apply(force dest: fresh_context simp add: psubs_subs)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   951
done
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   952
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   953
lemma all_RED: 
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   954
 "\<Gamma>\<turnstile>t:\<tau> \<longrightarrow> (\<forall>a \<sigma>. (a,\<sigma>)\<in>set(\<Gamma>)\<longrightarrow>(a\<in>set(domain \<theta>)\<and>\<theta><a>\<in>RED \<sigma>)) \<longrightarrow>  (t[<\<theta>>]\<in>RED \<tau>)"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   955
proof(nominal_induct t rule: lam_induct)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   956
  case Var 
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   957
  show ?case by (force dest: t1_elim)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   958
next
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   959
  case App
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   960
  thus ?case by (force dest!: t2_elim)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   961
(* HERE *)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   962
next
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   963
  case (Lam \<Gamma> \<tau> \<theta> a t)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   964
  have ih: 
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   965
    "\<forall>\<Gamma> \<tau> \<theta>. (\<forall>\<sigma> c. (c,\<sigma>)\<in>set \<Gamma> \<longrightarrow> c\<in>set (domain \<theta>) \<and>  \<theta><c>\<in>RED \<sigma>) \<and> \<Gamma> \<turnstile> t : \<tau> \<longrightarrow> t[<\<theta>>]\<in>RED \<tau>"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   966
    by fact
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   967
  have "a\<sharp>(\<Gamma>,\<tau>,\<theta>)" by fact
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   968
  hence b1: "a\<sharp>\<Gamma>" and b2: "a\<sharp>\<tau>" and b3: "a\<sharp>\<theta>" by (simp_all add: fresh_prod)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   969
  from b1 have c1: "\<not>(\<exists>\<tau>. (a,\<tau>)\<in>set \<Gamma>)" by (rule fresh_context) 
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   970
  show ?case using b1 
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   971
  proof (auto dest!: t3_elim simp only: psubst_Lam)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   972
    fix \<sigma>1::"ty" and \<sigma>2::"ty"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   973
    assume a1: "((a,\<sigma>1)#\<Gamma>) \<turnstile> t : \<sigma>2"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   974
    and    a3: "\<forall>(\<sigma>\<Colon>ty) (c\<Colon>name). (c,\<sigma>) \<in> set \<Gamma> \<longrightarrow> c \<in> set (domain \<theta>) \<and>  \<theta> <c> \<in> RED \<sigma>"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   975
    have "\<forall>s\<in>RED \<sigma>1. (t[<\<theta>>])[a::=s]\<in>RED \<sigma>2" 
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   976
    proof
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   977
(* HERE *)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   978
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   979
      fix s::"lam"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   980
      assume a4: "s \<in> RED \<sigma>1"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   981
      from ih have "\<forall>\<sigma> c. (c,\<sigma>)\<in>set ((a,\<sigma>1)#\<Gamma>) \<longrightarrow> c\<in>set (domain ((c,s)#\<theta>)) \<and> (((c,s)#\<theta>)<c>)\<in>RED \<sigma>"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   982
	using c1 a4 proof (auto)
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
   983
apply(simp)
18263
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   984
	apply(rule allI)+
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   985
	apply(rule conjI)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   986
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   987
      proof (auto) *)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   988
      have "(((a,\<sigma>1)#\<Gamma>) \<turnstile> t : \<sigma>2) \<longrightarrow> t[<((a,s)#\<theta>)>] \<in> RED \<sigma>2" using Lam a3 b3 
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   989
	proof(blast dest: fresh_context)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   990
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   991
      show "(t[<\<theta>>])[a::=s] \<in> RED \<sigma>2"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   992
	
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   993
    qed
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   994
    thus "Lam [a].(t[<\<theta>>]) \<in> RED (\<sigma>1\<rightarrow>\<sigma>2)" by (simp only: abs_RED)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   995
  qed
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   996
qed
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   997
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   998
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
   999
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1000
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1001
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1002
    have "(((a,\<sigma>1)#\<Gamma>) \<turnstile> t : \<sigma>2) \<longrightarrow> t[<((a,u)#\<theta>)>] \<in> RED \<sigma>2" using Lam a3 sorry
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1003
    hence "t[<((a,u)#\<theta>)>] \<in> RED \<sigma>2" using a1 by simp
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1004
    hence "t[<\<theta>>][a::=u] \<in> RED \<sigma>2" using b3 by (simp add: psubs_subs)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1005
    show "Lam [a].(t[<\<theta>>]) \<in> RED (\<sigma>1\<rightarrow>\<sigma>2)" 
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1006
    hence "Lam [a].(t[<\<theta>>]) \<in> RED (\<tau>\<rightarrow>\<sigma>)" using a2 abs_RED by force
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1007
    show "App (Lam [a].(t[<\<theta>>])) u \<in> RED \<sigma>2"
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1008
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1009
    
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1010
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1011
  thus ?case using t2_elim 
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1012
    proof(auto, blast)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1013
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1014
qed
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1015
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1016
(* Variables *)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1017
apply(force dest: t1_elim)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1018
(* Applications *)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1019
apply(clarify)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1020
apply(drule t2_elim)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1021
apply(erule exE, erule conjE)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1022
apply(drule_tac x="a" in spec)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1023
apply(drule_tac x="a" in spec)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1024
apply(drule_tac x="\<tau>\<rightarrow>aa" in spec)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1025
apply(drule_tac x="\<tau>" in spec)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1026
apply(drule_tac x="b" in spec)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1027
apply(drule_tac x="b" in spec)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1028
apply(force)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1029
(* Abstractions *)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1030
apply(clarify)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1031
apply(drule t3_elim)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1032
apply(simp add: fresh_prod)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1033
apply(erule exE)+
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1034
apply(erule conjE)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1035
apply(simp only: fresh_prod psubst_Lam)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1036
apply(rule abs_RED)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1037
apply(auto)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1038
apply(drule_tac x="(ab,\<tau>)#a" in spec)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1039
apply(drule_tac x="\<tau>'" in spec)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1040
apply(drule_tac x="(ab,s)#b" in spec)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1041
apply(simp)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1042
apply(auto)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1043
apply(drule fresh_context)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1044
apply(simp)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1045
apply(simp add: psubs_subs)
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1046
done
7f75925498da cleaned up all examples so that they work with the
urbanc
parents: 18106
diff changeset
  1047
18106
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
  1048
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
  1049
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
  1050
done
836135c8acb2 Initial commit.
urbanc
parents:
diff changeset
  1051