src/HOL/Nominal/Examples/Class3.thy
author wenzelm
Wed Nov 28 15:59:18 2012 +0100 (2012-11-28)
changeset 50252 4aa34bd43228
parent 39246 9e58f0499f57
child 53015 a1119cf551e8
permissions -rw-r--r--
eliminated slightly odd identifiers;
     1 theory Class3
     2 imports Class2
     3 begin
     4 
     5 text {* 3rd Main Lemma *}
     6 
     7 lemma Cut_a_redu_elim:
     8   assumes a: "Cut <a>.M (x).N \<longrightarrow>\<^isub>a R"
     9   shows "(\<exists>M'. R = Cut <a>.M' (x).N \<and> M \<longrightarrow>\<^isub>a M') \<or>
    10          (\<exists>N'. R = Cut <a>.M (x).N' \<and> N \<longrightarrow>\<^isub>a N') \<or>
    11          (Cut <a>.M (x).N \<longrightarrow>\<^isub>c R) \<or>
    12          (Cut <a>.M (x).N \<longrightarrow>\<^isub>l R)"
    13 using a
    14 apply(erule_tac a_redu.cases)
    15 apply(simp_all)
    16 apply(simp_all add: trm.inject)
    17 apply(rule disjI1)
    18 apply(auto simp add: alpha)[1]
    19 apply(rule_tac x="[(a,aa)]\<bullet>M'" in exI)
    20 apply(perm_simp add: fresh_left calc_atm a_redu.eqvt fresh_a_redu)
    21 apply(rule_tac x="[(a,aa)]\<bullet>M'" in exI)
    22 apply(perm_simp add: fresh_left calc_atm a_redu.eqvt fresh_a_redu)
    23 apply(rule disjI2)
    24 apply(rule disjI1)
    25 apply(auto simp add: alpha)[1]
    26 apply(rule_tac x="[(x,xa)]\<bullet>N'" in exI)
    27 apply(perm_simp add: fresh_left calc_atm a_redu.eqvt fresh_a_redu)
    28 apply(rule_tac x="[(x,xa)]\<bullet>N'" in exI)
    29 apply(perm_simp add: fresh_left calc_atm a_redu.eqvt fresh_a_redu)
    30 done
    31 
    32 lemma Cut_c_redu_elim:
    33   assumes a: "Cut <a>.M (x).N \<longrightarrow>\<^isub>c R"
    34   shows "(R = M{a:=(x).N} \<and> \<not>fic M a) \<or>
    35          (R = N{x:=<a>.M} \<and> \<not>fin N x)"
    36 using a
    37 apply(erule_tac c_redu.cases)
    38 apply(simp_all)
    39 apply(simp_all add: trm.inject)
    40 apply(rule disjI1)
    41 apply(auto simp add: alpha)[1]
    42 apply(simp add: subst_rename fresh_atm)
    43 apply(simp add: subst_rename fresh_atm)
    44 apply(drule_tac pi="[(a,aa)]" in fic.eqvt(2))
    45 apply(perm_simp)
    46 apply(simp add: subst_rename fresh_atm fresh_prod)
    47 apply(drule_tac pi="[(a,aa)]" in fic.eqvt(2))
    48 apply(perm_simp)
    49 apply(rule disjI2)
    50 apply(auto simp add: alpha)[1]
    51 apply(simp add: subst_rename fresh_atm)
    52 apply(drule_tac pi="[(x,xa)]" in fin.eqvt(1))
    53 apply(perm_simp)
    54 apply(simp add: subst_rename fresh_atm fresh_prod)
    55 apply(simp add: subst_rename fresh_atm fresh_prod)
    56 apply(drule_tac pi="[(x,xa)]" in fin.eqvt(1))
    57 apply(perm_simp)
    58 done
    59 
    60 lemma not_fic_crename_aux:
    61   assumes a: "fic M c" "c\<sharp>(a,b)"
    62   shows "fic (M[a\<turnstile>c>b]) c" 
    63 using a
    64 apply(nominal_induct M avoiding: c a b rule: trm.strong_induct)
    65 apply(auto dest!: fic_elims intro!: fic.intros simp add: fresh_prod fresh_atm rename_fresh abs_fresh)
    66 done
    67 
    68 lemma not_fic_crename:
    69   assumes a: "\<not>(fic (M[a\<turnstile>c>b]) c)" "c\<sharp>(a,b)"
    70   shows "\<not>(fic M c)" 
    71 using a
    72 apply(auto dest:  not_fic_crename_aux)
    73 done
    74 
    75 lemma not_fin_crename_aux:
    76   assumes a: "fin M y"
    77   shows "fin (M[a\<turnstile>c>b]) y" 
    78 using a
    79 apply(nominal_induct M avoiding: a b rule: trm.strong_induct)
    80 apply(auto dest!: fin_elims intro!: fin.intros simp add: fresh_prod fresh_atm rename_fresh abs_fresh)
    81 done
    82 
    83 lemma not_fin_crename:
    84   assumes a: "\<not>(fin (M[a\<turnstile>c>b]) y)" 
    85   shows "\<not>(fin M y)" 
    86 using a
    87 apply(auto dest:  not_fin_crename_aux)
    88 done
    89 
    90 lemma crename_fresh_interesting1:
    91   fixes c::"coname"
    92   assumes a: "c\<sharp>(M[a\<turnstile>c>b])" "c\<sharp>(a,b)"
    93   shows "c\<sharp>M"
    94 using a
    95 apply(nominal_induct M avoiding: c a b rule: trm.strong_induct)
    96 apply(auto split: if_splits simp add: abs_fresh)
    97 done
    98 
    99 lemma crename_fresh_interesting2:
   100   fixes x::"name"
   101   assumes a: "x\<sharp>(M[a\<turnstile>c>b])" 
   102   shows "x\<sharp>M"
   103 using a
   104 apply(nominal_induct M avoiding: x a b rule: trm.strong_induct)
   105 apply(auto split: if_splits simp add: abs_fresh abs_supp fin_supp fresh_atm)
   106 done
   107 
   108 
   109 lemma fic_crename:
   110   assumes a: "fic (M[a\<turnstile>c>b]) c" "c\<sharp>(a,b)"
   111   shows "fic M c" 
   112 using a
   113 apply(nominal_induct M avoiding: c a b rule: trm.strong_induct)
   114 apply(auto dest!: fic_elims intro!: fic.intros simp add: fresh_prod fresh_atm rename_fresh abs_fresh
   115            split: if_splits)
   116 apply(auto dest: crename_fresh_interesting1 simp add: fresh_prod fresh_atm)
   117 done
   118 
   119 lemma fin_crename:
   120   assumes a: "fin (M[a\<turnstile>c>b]) x"
   121   shows "fin M x" 
   122 using a
   123 apply(nominal_induct M avoiding: x a b rule: trm.strong_induct)
   124 apply(auto dest!: fin_elims intro!: fin.intros simp add: fresh_prod fresh_atm rename_fresh abs_fresh
   125            split: if_splits)
   126 apply(auto dest: crename_fresh_interesting2 simp add: fresh_prod fresh_atm)
   127 done
   128 
   129 lemma crename_Cut:
   130   assumes a: "R[a\<turnstile>c>b] = Cut <c>.M (x).N" "c\<sharp>(a,b,N,R)" "x\<sharp>(M,R)"
   131   shows "\<exists>M' N'. R = Cut <c>.M' (x).N' \<and> M'[a\<turnstile>c>b] = M \<and> N'[a\<turnstile>c>b] = N \<and> c\<sharp>N' \<and> x\<sharp>M'"
   132 using a
   133 apply(nominal_induct R avoiding: a b c x M N rule: trm.strong_induct)
   134 apply(auto split: if_splits)
   135 apply(simp add: trm.inject)
   136 apply(auto simp add: alpha)
   137 apply(rule_tac x="[(name,x)]\<bullet>trm2" in exI)
   138 apply(perm_simp)
   139 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   140 apply(drule sym)
   141 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   142 apply(simp add: eqvts calc_atm)
   143 apply(rule_tac x="[(coname,c)]\<bullet>trm1" in exI)
   144 apply(perm_simp)
   145 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   146 apply(drule sym)
   147 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   148 apply(simp add: eqvts calc_atm)
   149 apply(auto simp add: fresh_atm)[1]
   150 apply(rule_tac x="[(coname,c)]\<bullet>trm1" in exI)
   151 apply(perm_simp)
   152 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   153 apply(rule_tac x="[(name,x)]\<bullet>trm2" in exI)
   154 apply(perm_simp)
   155 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   156 apply(drule sym)
   157 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   158 apply(simp add: eqvts calc_atm)
   159 apply(auto simp add: fresh_atm)[1]
   160 apply(drule sym)
   161 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   162 apply(simp add: eqvts calc_atm)
   163 apply(drule sym)
   164 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   165 apply(simp add: eqvts calc_atm)
   166 done
   167 
   168 lemma crename_NotR:
   169   assumes a: "R[a\<turnstile>c>b] = NotR (x).N c" "x\<sharp>R" "c\<sharp>(a,b)"
   170   shows "\<exists>N'. (R = NotR (x).N' c) \<and> N'[a\<turnstile>c>b] = N" 
   171 using a
   172 apply(nominal_induct R avoiding: a b c x N rule: trm.strong_induct)
   173 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   174 apply(rule_tac x="[(name,x)]\<bullet>trm" in exI)
   175 apply(perm_simp)
   176 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   177 apply(drule sym)
   178 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   179 apply(simp add: eqvts calc_atm)
   180 done
   181 
   182 lemma crename_NotR':
   183   assumes a: "R[a\<turnstile>c>b] = NotR (x).N c" "x\<sharp>R" "c\<sharp>a"
   184   shows "(\<exists>N'. (R = NotR (x).N' c) \<and> N'[a\<turnstile>c>b] = N) \<or> (\<exists>N'. (R = NotR (x).N' a) \<and> b=c \<and> N'[a\<turnstile>c>b] = N)"
   185 using a
   186 apply(nominal_induct R avoiding: a b c x N rule: trm.strong_induct)
   187 apply(auto split: if_splits simp add: fresh_prod fresh_atm abs_fresh alpha trm.inject)
   188 apply(rule_tac x="[(name,x)]\<bullet>trm" in exI)
   189 apply(perm_simp)
   190 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   191 apply(drule sym)
   192 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   193 apply(simp add: eqvts calc_atm)
   194 apply(rule_tac x="[(name,x)]\<bullet>trm" in exI)
   195 apply(perm_simp)
   196 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   197 apply(drule sym)
   198 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   199 apply(simp add: eqvts calc_atm)
   200 done
   201 
   202 lemma crename_NotR_aux:
   203   assumes a: "R[a\<turnstile>c>b] = NotR (x).N c" 
   204   shows "(a=c \<and> a=b) \<or> (a\<noteq>c)" 
   205 using a
   206 apply(nominal_induct R avoiding: a b c x N rule: trm.strong_induct)
   207 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   208 done
   209 
   210 lemma crename_NotL:
   211   assumes a: "R[a\<turnstile>c>b] = NotL <c>.N y" "c\<sharp>(R,a,b)"
   212   shows "\<exists>N'. (R = NotL <c>.N' y) \<and> N'[a\<turnstile>c>b] = N" 
   213 using a
   214 apply(nominal_induct R avoiding: a b c y N rule: trm.strong_induct)
   215 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   216 apply(rule_tac x="[(coname,c)]\<bullet>trm" in exI)
   217 apply(perm_simp)
   218 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   219 apply(drule sym)
   220 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   221 apply(simp add: eqvts calc_atm)
   222 done
   223 
   224 lemma crename_AndL1:
   225   assumes a: "R[a\<turnstile>c>b] = AndL1 (x).N y" "x\<sharp>R"
   226   shows "\<exists>N'. (R = AndL1 (x).N' y) \<and> N'[a\<turnstile>c>b] = N" 
   227 using a
   228 apply(nominal_induct R avoiding: a b x y N rule: trm.strong_induct)
   229 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   230 apply(rule_tac x="[(name1,x)]\<bullet>trm" in exI)
   231 apply(perm_simp)
   232 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   233 apply(drule sym)
   234 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   235 apply(simp add: eqvts calc_atm)
   236 done
   237 
   238 lemma crename_AndL2:
   239   assumes a: "R[a\<turnstile>c>b] = AndL2 (x).N y" "x\<sharp>R"
   240   shows "\<exists>N'. (R = AndL2 (x).N' y) \<and> N'[a\<turnstile>c>b] = N" 
   241 using a
   242 apply(nominal_induct R avoiding: a b x y N rule: trm.strong_induct)
   243 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   244 apply(rule_tac x="[(name1,x)]\<bullet>trm" in exI)
   245 apply(perm_simp)
   246 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   247 apply(drule sym)
   248 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   249 apply(simp add: eqvts calc_atm)
   250 done
   251 
   252 lemma crename_AndR_aux:
   253   assumes a: "R[a\<turnstile>c>b] = AndR <c>.M <d>.N e" 
   254   shows "(a=e \<and> a=b) \<or> (a\<noteq>e)" 
   255 using a
   256 apply(nominal_induct R avoiding: a b c d e M N rule: trm.strong_induct)
   257 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   258 done
   259 
   260 lemma crename_AndR:
   261   assumes a: "R[a\<turnstile>c>b] = AndR <c>.M <d>.N e" "c\<sharp>(a,b,d,e,N,R)" "d\<sharp>(a,b,c,e,M,R)" "e\<sharp>(a,b)"
   262   shows "\<exists>M' N'. R = AndR <c>.M' <d>.N' e \<and> M'[a\<turnstile>c>b] = M \<and> N'[a\<turnstile>c>b] = N \<and> c\<sharp>N' \<and> d\<sharp>M'"
   263 using a
   264 apply(nominal_induct R avoiding: a b c d e M N rule: trm.strong_induct)
   265 apply(auto split: if_splits simp add: trm.inject alpha)
   266 apply(simp add: fresh_atm fresh_prod)
   267 apply(rule_tac x="[(coname2,d)]\<bullet>trm2" in exI)
   268 apply(perm_simp)
   269 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   270 apply(rule_tac x="[(coname1,c)]\<bullet>trm1" in exI)
   271 apply(perm_simp)
   272 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   273 apply(rule_tac x="[(coname1,c)]\<bullet>trm1" in exI)
   274 apply(perm_simp)
   275 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   276 apply(rule_tac x="[(coname2,d)]\<bullet>trm2" in exI)
   277 apply(perm_simp)
   278 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   279 apply(rule_tac x="[(coname1,c)]\<bullet>trm1" in exI)
   280 apply(perm_simp)
   281 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   282 apply(rule_tac x="[(coname1,c)]\<bullet>trm1" in exI)
   283 apply(perm_simp)
   284 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   285 apply(rule_tac x="[(coname2,d)]\<bullet>trm2" in exI)
   286 apply(perm_simp)
   287 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   288 apply(drule sym)
   289 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   290 apply(simp add: eqvts calc_atm)
   291 apply(drule_tac s="trm2[a\<turnstile>c>b]" in  sym)
   292 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   293 apply(simp add: eqvts calc_atm)
   294 done
   295 
   296 lemma crename_AndR':
   297   assumes a: "R[a\<turnstile>c>b] = AndR <c>.M <d>.N e" "c\<sharp>(a,b,d,e,N,R)" "d\<sharp>(a,b,c,e,M,R)" "e\<sharp>a"
   298   shows "(\<exists>M' N'. R = AndR <c>.M' <d>.N' e \<and> M'[a\<turnstile>c>b] = M \<and> N'[a\<turnstile>c>b] = N \<and> c\<sharp>N' \<and> d\<sharp>M') \<or>
   299          (\<exists>M' N'. R = AndR <c>.M' <d>.N' a \<and> b=e \<and> M'[a\<turnstile>c>b] = M \<and> N'[a\<turnstile>c>b] = N \<and> c\<sharp>N' \<and> d\<sharp>M')"
   300 using a
   301 apply(nominal_induct R avoiding: a b c d e M N rule: trm.strong_induct)
   302 apply(auto split: if_splits simp add: trm.inject alpha)[1]
   303 apply(auto split: if_splits simp add: trm.inject alpha)[1]
   304 apply(auto split: if_splits simp add: trm.inject alpha)[1]
   305 apply(auto split: if_splits simp add: trm.inject alpha)[1]
   306 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm trm.inject alpha)[1]
   307 apply(case_tac "coname3=a")
   308 apply(simp)
   309 apply(rule_tac x="[(coname1,c)]\<bullet>trm1" in exI)
   310 apply(perm_simp)
   311 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   312 apply(rule_tac x="[(coname2,d)]\<bullet>trm2" in exI)
   313 apply(perm_simp)
   314 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm trm.inject alpha split: if_splits)[1]
   315 apply(drule sym)
   316 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   317 apply(simp add: eqvts calc_atm)
   318 apply(drule_tac s="trm2[a\<turnstile>c>e]" in  sym)
   319 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   320 apply(simp add: eqvts calc_atm)
   321 apply(simp)
   322 apply(rule_tac x="[(coname1,c)]\<bullet>trm1" in exI)
   323 apply(perm_simp)
   324 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   325 apply(rule_tac x="[(coname2,d)]\<bullet>trm2" in exI)
   326 apply(perm_simp)
   327 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm trm.inject alpha split: if_splits)[1]
   328 apply(drule sym)
   329 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   330 apply(simp add: eqvts calc_atm)
   331 apply(drule_tac s="trm2[a\<turnstile>c>b]" in  sym)
   332 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   333 apply(simp add: eqvts calc_atm)
   334 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   335 done
   336 
   337 lemma crename_OrR1_aux:
   338   assumes a: "R[a\<turnstile>c>b] = OrR1 <c>.M e" 
   339   shows "(a=e \<and> a=b) \<or> (a\<noteq>e)" 
   340 using a
   341 apply(nominal_induct R avoiding: a b c e M rule: trm.strong_induct)
   342 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   343 done
   344 
   345 lemma crename_OrR1:
   346   assumes a: "R[a\<turnstile>c>b] = OrR1 <c>.N d" "c\<sharp>(R,a,b)" "d\<sharp>(a,b)"
   347   shows "\<exists>N'. (R = OrR1 <c>.N' d) \<and> N'[a\<turnstile>c>b] = N" 
   348 using a
   349 apply(nominal_induct R avoiding: a b c d N rule: trm.strong_induct)
   350 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   351 apply(rule_tac x="[(coname1,c)]\<bullet>trm" in exI)
   352 apply(perm_simp)
   353 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   354 apply(drule sym)
   355 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   356 apply(simp add: eqvts calc_atm)
   357 done
   358 
   359 lemma crename_OrR1':
   360   assumes a: "R[a\<turnstile>c>b] = OrR1 <c>.N d" "c\<sharp>(R,a,b)" "d\<sharp>a"
   361   shows "(\<exists>N'. (R = OrR1 <c>.N' d) \<and> N'[a\<turnstile>c>b] = N) \<or>
   362          (\<exists>N'. (R = OrR1 <c>.N' a) \<and> b=d \<and> N'[a\<turnstile>c>b] = N)" 
   363 using a
   364 apply(nominal_induct R avoiding: a b c d N rule: trm.strong_induct)
   365 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   366 apply(rule_tac x="[(coname1,c)]\<bullet>trm" in exI)
   367 apply(perm_simp)
   368 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   369 apply(drule sym)
   370 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   371 apply(simp add: eqvts calc_atm)
   372 apply(rule_tac x="[(coname1,c)]\<bullet>trm" in exI)
   373 apply(perm_simp)
   374 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   375 apply(drule sym)
   376 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   377 apply(simp add: eqvts calc_atm)
   378 done
   379 
   380 lemma crename_OrR2_aux:
   381   assumes a: "R[a\<turnstile>c>b] = OrR2 <c>.M e" 
   382   shows "(a=e \<and> a=b) \<or> (a\<noteq>e)" 
   383 using a
   384 apply(nominal_induct R avoiding: a b c e M rule: trm.strong_induct)
   385 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   386 done
   387 
   388 lemma crename_OrR2:
   389   assumes a: "R[a\<turnstile>c>b] = OrR2 <c>.N d" "c\<sharp>(R,a,b)" "d\<sharp>(a,b)"
   390   shows "\<exists>N'. (R = OrR2 <c>.N' d) \<and> N'[a\<turnstile>c>b] = N" 
   391 using a
   392 apply(nominal_induct R avoiding: a b c d N rule: trm.strong_induct)
   393 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   394 apply(rule_tac x="[(coname1,c)]\<bullet>trm" in exI)
   395 apply(perm_simp)
   396 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   397 apply(drule sym)
   398 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   399 apply(simp add: eqvts calc_atm)
   400 done
   401 
   402 lemma crename_OrR2':
   403   assumes a: "R[a\<turnstile>c>b] = OrR2 <c>.N d" "c\<sharp>(R,a,b)" "d\<sharp>a"
   404   shows "(\<exists>N'. (R = OrR2 <c>.N' d) \<and> N'[a\<turnstile>c>b] = N) \<or>
   405          (\<exists>N'. (R = OrR2 <c>.N' a) \<and> b=d \<and> N'[a\<turnstile>c>b] = N)" 
   406 using a
   407 apply(nominal_induct R avoiding: a b c d N rule: trm.strong_induct)
   408 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   409 apply(rule_tac x="[(coname1,c)]\<bullet>trm" in exI)
   410 apply(perm_simp)
   411 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   412 apply(drule sym)
   413 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   414 apply(simp add: eqvts calc_atm)
   415 apply(rule_tac x="[(coname1,c)]\<bullet>trm" in exI)
   416 apply(perm_simp)
   417 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   418 apply(drule sym)
   419 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   420 apply(simp add: eqvts calc_atm)
   421 done
   422 
   423 lemma crename_OrL:
   424   assumes a: "R[a\<turnstile>c>b] = OrL (x).M (y).N z" "x\<sharp>(y,z,N,R)" "y\<sharp>(x,z,M,R)"
   425   shows "\<exists>M' N'. R = OrL (x).M' (y).N' z \<and> M'[a\<turnstile>c>b] = M \<and> N'[a\<turnstile>c>b] = N \<and> x\<sharp>N' \<and> y\<sharp>M'"
   426 using a
   427 apply(nominal_induct R avoiding: a b x y z M N rule: trm.strong_induct)
   428 apply(auto split: if_splits simp add: trm.inject alpha)
   429 apply(rule_tac x="[(name2,y)]\<bullet>trm2" in exI)
   430 apply(perm_simp)
   431 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   432 apply(rule_tac x="[(name1,x)]\<bullet>trm1" in exI)
   433 apply(perm_simp)
   434 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   435 apply(rule_tac x="[(name1,x)]\<bullet>trm1" in exI)
   436 apply(perm_simp)
   437 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   438 apply(rule_tac x="[(name2,y)]\<bullet>trm2" in exI)
   439 apply(perm_simp)
   440 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   441 apply(drule sym)
   442 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   443 apply(simp add: eqvts calc_atm)
   444 apply(drule_tac s="trm2[a\<turnstile>c>b]" in  sym)
   445 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   446 apply(simp add: eqvts calc_atm)
   447 done
   448 
   449 lemma crename_ImpL:
   450   assumes a: "R[a\<turnstile>c>b] = ImpL <c>.M (y).N z" "c\<sharp>(a,b,N,R)" "y\<sharp>(z,M,R)"
   451   shows "\<exists>M' N'. R = ImpL <c>.M' (y).N' z \<and> M'[a\<turnstile>c>b] = M \<and> N'[a\<turnstile>c>b] = N \<and> c\<sharp>N' \<and> y\<sharp>M'"
   452 using a
   453 apply(nominal_induct R avoiding: a b c y z M N rule: trm.strong_induct)
   454 apply(auto split: if_splits simp add: trm.inject alpha)
   455 apply(rule_tac x="[(name1,y)]\<bullet>trm2" in exI)
   456 apply(perm_simp)
   457 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   458 apply(rule_tac x="[(coname,c)]\<bullet>trm1" in exI)
   459 apply(perm_simp)
   460 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   461 apply(rule_tac x="[(coname,c)]\<bullet>trm1" in exI)
   462 apply(perm_simp)
   463 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   464 apply(rule_tac x="[(name1,y)]\<bullet>trm2" in exI)
   465 apply(perm_simp)
   466 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
   467 apply(drule sym)
   468 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   469 apply(simp add: eqvts calc_atm)
   470 apply(drule_tac s="trm2[a\<turnstile>c>b]" in  sym)
   471 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   472 apply(simp add: eqvts calc_atm)
   473 done
   474 
   475 lemma crename_ImpR_aux:
   476   assumes a: "R[a\<turnstile>c>b] = ImpR (x).<c>.M e" 
   477   shows "(a=e \<and> a=b) \<or> (a\<noteq>e)" 
   478 using a
   479 apply(nominal_induct R avoiding: x a b c e M rule: trm.strong_induct)
   480 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
   481 done
   482 
   483 lemma crename_ImpR:
   484   assumes a: "R[a\<turnstile>c>b] = ImpR (x).<c>.N d" "c\<sharp>(R,a,b)" "d\<sharp>(a,b)" "x\<sharp>R" 
   485   shows "\<exists>N'. (R = ImpR (x).<c>.N' d) \<and> N'[a\<turnstile>c>b] = N" 
   486 using a
   487 apply(nominal_induct R avoiding: a b x c d N rule: trm.strong_induct)
   488 apply(auto split: if_splits simp add: fresh_prod fresh_atm abs_perm alpha abs_fresh trm.inject)
   489 apply(rule_tac x="[(name,x)]\<bullet>trm" in exI)
   490 apply(perm_simp)
   491 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
   492 apply(rule_tac x="[(name,x)]\<bullet>[(coname1, c)]\<bullet>trm" in exI)
   493 apply(perm_simp)
   494 apply(simp add: abs_supp fin_supp abs_fresh fresh_left calc_atm fresh_prod)
   495 apply(drule sym)
   496 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   497 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   498 apply(simp add: eqvts calc_atm)
   499 done
   500 
   501 lemma crename_ImpR':
   502   assumes a: "R[a\<turnstile>c>b] = ImpR (x).<c>.N d" "c\<sharp>(R,a,b)" "x\<sharp>R" "d\<sharp>a"
   503   shows "(\<exists>N'. (R = ImpR (x).<c>.N' d) \<and> N'[a\<turnstile>c>b] = N) \<or>
   504          (\<exists>N'. (R = ImpR (x).<c>.N' a) \<and> b=d \<and> N'[a\<turnstile>c>b] = N)" 
   505 using a
   506 apply(nominal_induct R avoiding: x a b c d N rule: trm.strong_induct)
   507 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject abs_perm calc_atm)
   508 apply(rule_tac x="[(name,x)]\<bullet>[(coname1,c)]\<bullet>trm" in exI)
   509 apply(perm_simp)
   510 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod abs_supp fin_supp)
   511 apply(drule sym)
   512 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   513 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   514 apply(simp add: eqvts calc_atm)
   515 apply(rule_tac x="[(name,x)]\<bullet>[(coname1,c)]\<bullet>trm" in exI)
   516 apply(perm_simp)
   517 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod abs_supp fin_supp)
   518 apply(drule sym)
   519 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
   520 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
   521 apply(simp add: eqvts calc_atm)
   522 done
   523 
   524 lemma crename_ax2:
   525   assumes a: "N[a\<turnstile>c>b] = Ax x c"
   526   shows "\<exists>d. N = Ax x d"
   527 using a
   528 apply(nominal_induct N avoiding: a b rule: trm.strong_induct)
   529 apply(auto split: if_splits)
   530 apply(simp add: trm.inject)
   531 done
   532 
   533 lemma crename_interesting1:
   534   assumes a: "distinct [a,b,c]"
   535   shows "M[a\<turnstile>c>c][c\<turnstile>c>b] = M[c\<turnstile>c>b][a\<turnstile>c>b]"
   536 using a
   537 apply(nominal_induct M avoiding: a c b rule: trm.strong_induct)
   538 apply(auto simp add: rename_fresh simp add: trm.inject alpha)
   539 apply(blast)
   540 apply(rotate_tac 12)
   541 apply(drule_tac x="a" in meta_spec)
   542 apply(rotate_tac 15)
   543 apply(drule_tac x="c" in meta_spec)
   544 apply(rotate_tac 15)
   545 apply(drule_tac x="b" in meta_spec)
   546 apply(blast)
   547 apply(blast)
   548 apply(blast)
   549 done
   550 
   551 lemma crename_interesting2:
   552   assumes a: "a\<noteq>c" "a\<noteq>d" "a\<noteq>b" "c\<noteq>d" "b\<noteq>c"
   553   shows "M[a\<turnstile>c>b][c\<turnstile>c>d] = M[c\<turnstile>c>d][a\<turnstile>c>b]"
   554 using a
   555 apply(nominal_induct M avoiding: a c b d rule: trm.strong_induct)
   556 apply(auto simp add: rename_fresh simp add: trm.inject alpha)
   557 done
   558 
   559 lemma crename_interesting3:
   560   shows "M[a\<turnstile>c>c][x\<turnstile>n>y] = M[x\<turnstile>n>y][a\<turnstile>c>c]"
   561 apply(nominal_induct M avoiding: a c x y rule: trm.strong_induct)
   562 apply(auto simp add: rename_fresh simp add: trm.inject alpha)
   563 done
   564 
   565 lemma crename_credu:
   566   assumes a: "(M[a\<turnstile>c>b]) \<longrightarrow>\<^isub>c M'"
   567   shows "\<exists>M0. M0[a\<turnstile>c>b]=M' \<and> M \<longrightarrow>\<^isub>c M0"
   568 using a
   569 apply(nominal_induct M\<equiv>"M[a\<turnstile>c>b]" M' avoiding: M a b rule: c_redu.strong_induct)
   570 apply(drule sym)
   571 apply(drule crename_Cut)
   572 apply(simp)
   573 apply(simp)
   574 apply(auto)
   575 apply(rule_tac x="M'{a:=(x).N'}" in exI)
   576 apply(rule conjI)
   577 apply(simp add: fresh_atm abs_fresh subst_comm fresh_prod)
   578 apply(rule c_redu.intros)
   579 apply(auto dest: not_fic_crename)[1]
   580 apply(simp add: abs_fresh)
   581 apply(simp add: abs_fresh)
   582 apply(drule sym)
   583 apply(drule crename_Cut)
   584 apply(simp)
   585 apply(simp)
   586 apply(auto)
   587 apply(rule_tac x="N'{x:=<a>.M'}" in exI)
   588 apply(rule conjI)
   589 apply(simp add: fresh_atm abs_fresh subst_comm fresh_prod)
   590 apply(rule c_redu.intros)
   591 apply(auto dest: not_fin_crename)[1]
   592 apply(simp add: abs_fresh)
   593 apply(simp add: abs_fresh)
   594 done
   595 
   596 lemma crename_lredu:
   597   assumes a: "(M[a\<turnstile>c>b]) \<longrightarrow>\<^isub>l M'"
   598   shows "\<exists>M0. M0[a\<turnstile>c>b]=M' \<and> M \<longrightarrow>\<^isub>l M0"
   599 using a
   600 apply(nominal_induct M\<equiv>"M[a\<turnstile>c>b]" M' avoiding: M a b rule: l_redu.strong_induct)
   601 apply(drule sym)
   602 apply(drule crename_Cut)
   603 apply(simp add: fresh_prod fresh_atm)
   604 apply(simp)
   605 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   606 apply(case_tac "aa=ba")
   607 apply(simp add: crename_id)
   608 apply(rule l_redu.intros)
   609 apply(simp)
   610 apply(simp add: fresh_atm)
   611 apply(assumption)
   612 apply(frule crename_ax2)
   613 apply(auto)[1]
   614 apply(case_tac "d=aa")
   615 apply(simp add: trm.inject)
   616 apply(rule_tac x="M'[a\<turnstile>c>aa]" in exI)
   617 apply(rule conjI)
   618 apply(rule crename_interesting1)
   619 apply(simp)
   620 apply(rule l_redu.intros)
   621 apply(simp)
   622 apply(simp add: fresh_atm)
   623 apply(auto dest: fic_crename simp add: fresh_prod fresh_atm)[1]
   624 apply(simp add: trm.inject)
   625 apply(rule_tac x="M'[a\<turnstile>c>b]" in exI)
   626 apply(rule conjI)
   627 apply(rule crename_interesting2)
   628 apply(simp)
   629 apply(simp)
   630 apply(simp)
   631 apply(simp)
   632 apply(simp)
   633 apply(rule l_redu.intros)
   634 apply(simp)
   635 apply(simp add: fresh_atm)
   636 apply(auto dest: fic_crename simp add: fresh_prod fresh_atm)[1]
   637 apply(drule sym)
   638 apply(drule crename_Cut)
   639 apply(simp add: fresh_prod fresh_atm)
   640 apply(simp add: fresh_prod fresh_atm)
   641 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   642 apply(case_tac "aa=b")
   643 apply(simp add: crename_id)
   644 apply(rule l_redu.intros)
   645 apply(simp)
   646 apply(simp add: fresh_atm)
   647 apply(assumption)
   648 apply(frule crename_ax2)
   649 apply(auto)[1]
   650 apply(case_tac "d=aa")
   651 apply(simp add: trm.inject)
   652 apply(simp add: trm.inject)
   653 apply(rule_tac x="N'[x\<turnstile>n>y]" in exI)
   654 apply(rule conjI)
   655 apply(rule sym)
   656 apply(rule crename_interesting3)
   657 apply(rule l_redu.intros)
   658 apply(simp)
   659 apply(simp add: fresh_atm)
   660 apply(auto dest: fin_crename simp add: fresh_prod fresh_atm)[1]
   661 (* LNot *)
   662 apply(drule sym)
   663 apply(drule crename_Cut)
   664 apply(simp add: fresh_prod abs_fresh fresh_atm)
   665 apply(simp add: fresh_prod abs_fresh fresh_atm)
   666 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   667 apply(drule crename_NotR)
   668 apply(simp add: fresh_prod abs_fresh fresh_atm)
   669 apply(simp add: fresh_prod abs_fresh fresh_atm)
   670 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   671 apply(drule crename_NotL)
   672 apply(simp add: fresh_prod abs_fresh fresh_atm)
   673 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   674 apply(rule_tac x="Cut <b>.N'b (x).N'a" in exI)
   675 apply(simp add: fresh_atm)[1]
   676 apply(rule l_redu.intros)
   677 apply(auto simp add: fresh_prod intro: crename_fresh_interesting2)[1]
   678 apply(auto simp add: fresh_atm fresh_prod intro: crename_fresh_interesting2)[1]
   679 apply(auto simp add: fresh_atm fresh_prod intro: crename_fresh_interesting1)[1]
   680 apply(auto simp add: fresh_atm fresh_prod intro: crename_fresh_interesting1)[1]
   681 apply(simp add: fresh_atm)
   682 apply(simp add: fresh_atm)
   683 (* LAnd1 *)
   684 apply(auto dest: fin_crename simp add: fresh_prod fresh_atm)[1]
   685 apply(drule sym)
   686 apply(drule crename_Cut)
   687 apply(simp add: fresh_prod abs_fresh fresh_atm)
   688 apply(simp add: fresh_prod abs_fresh fresh_atm)
   689 apply(auto)[1]
   690 apply(drule crename_AndR)
   691 apply(simp add: fresh_prod abs_fresh fresh_atm)
   692 apply(simp add: fresh_prod abs_fresh fresh_atm)
   693 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   694 apply(drule crename_AndL1)
   695 apply(simp add: fresh_prod abs_fresh fresh_atm)
   696 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   697 apply(rule_tac x="Cut <a1>.M'a (x).N'a" in exI)
   698 apply(simp add: fresh_atm)[1]
   699 apply(rule l_redu.intros)
   700 apply(auto simp add: fresh_atm abs_fresh fresh_prod intro: crename_fresh_interesting1)[1]
   701 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: crename_fresh_interesting2)[1]
   702 apply(auto simp add: fresh_atm fresh_prod intro: crename_fresh_interesting1)[1]
   703 apply(auto simp add: fresh_atm fresh_prod intro: crename_fresh_interesting1)[1]
   704 apply(simp add: fresh_atm)
   705 apply(simp add: fresh_atm)
   706 (* LAnd2 *)
   707 apply(auto dest: fin_crename simp add: fresh_prod fresh_atm)[1]
   708 apply(drule sym)
   709 apply(drule crename_Cut)
   710 apply(simp add: fresh_prod abs_fresh fresh_atm)
   711 apply(simp add: fresh_prod abs_fresh fresh_atm)
   712 apply(auto)[1]
   713 apply(drule crename_AndR)
   714 apply(simp add: fresh_prod abs_fresh fresh_atm)
   715 apply(simp add: fresh_prod abs_fresh fresh_atm)
   716 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   717 apply(drule crename_AndL2)
   718 apply(simp add: fresh_prod abs_fresh fresh_atm)
   719 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   720 apply(rule_tac x="Cut <a2>.N'b (x).N'a" in exI)
   721 apply(simp add: fresh_atm)[1]
   722 apply(rule l_redu.intros)
   723 apply(auto simp add: fresh_atm abs_fresh fresh_prod intro: crename_fresh_interesting1)[1]
   724 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: crename_fresh_interesting2)[1]
   725 apply(auto simp add: fresh_atm fresh_prod intro: crename_fresh_interesting1)[1]
   726 apply(auto simp add: fresh_atm fresh_prod intro: crename_fresh_interesting1)[1]
   727 apply(simp add: fresh_atm)
   728 apply(simp add: fresh_atm)
   729 (* LOr1 *)
   730 apply(auto dest: fin_crename simp add: fresh_prod fresh_atm)[1]
   731 apply(drule sym)
   732 apply(drule crename_Cut)
   733 apply(simp add: fresh_prod abs_fresh fresh_atm)
   734 apply(simp add: fresh_prod abs_fresh fresh_atm)
   735 apply(auto)[1]
   736 apply(drule crename_OrL)
   737 apply(simp add: fresh_prod abs_fresh fresh_atm)
   738 apply(simp add: fresh_prod abs_fresh fresh_atm)
   739 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   740 apply(drule crename_OrR1)
   741 apply(simp add: fresh_prod abs_fresh fresh_atm)
   742 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   743 apply(auto)
   744 apply(rule_tac x="Cut <a>.N' (x1).M'a" in exI)
   745 apply(rule conjI)
   746 apply(simp add: abs_fresh fresh_atm)[1]
   747 apply(rule l_redu.intros)
   748 apply(auto simp add: fresh_atm abs_fresh fresh_prod intro: crename_fresh_interesting1)[1]
   749 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: crename_fresh_interesting2)[1]
   750 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: crename_fresh_interesting1)[1]
   751 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: crename_fresh_interesting1)[1]
   752 apply(simp add: fresh_atm)
   753 apply(simp add: fresh_atm)
   754 (* LOr2 *)
   755 apply(auto dest: fin_crename simp add: fresh_prod fresh_atm)[1]
   756 apply(drule sym)
   757 apply(drule crename_Cut)
   758 apply(simp add: fresh_prod abs_fresh fresh_atm)
   759 apply(simp add: fresh_prod abs_fresh fresh_atm)
   760 apply(auto)[1]
   761 apply(drule crename_OrL)
   762 apply(simp add: fresh_prod abs_fresh fresh_atm)
   763 apply(simp add: fresh_prod abs_fresh fresh_atm)
   764 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   765 apply(drule crename_OrR2)
   766 apply(simp add: fresh_prod abs_fresh fresh_atm)
   767 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   768 apply(auto)
   769 apply(rule_tac x="Cut <a>.N' (x2).N'a" in exI)
   770 apply(rule conjI)
   771 apply(simp add: abs_fresh fresh_atm)[1]
   772 apply(rule l_redu.intros)
   773 apply(auto simp add: fresh_atm abs_fresh fresh_prod intro: crename_fresh_interesting1)[1]
   774 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: crename_fresh_interesting2)[1]
   775 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: crename_fresh_interesting1)[1]
   776 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: crename_fresh_interesting1)[1]
   777 apply(simp add: fresh_atm)
   778 apply(simp add: fresh_atm)
   779 (* ImpL *)
   780 apply(auto dest: fin_crename simp add: fresh_prod fresh_atm)[1]
   781 apply(drule sym)
   782 apply(drule crename_Cut)
   783 apply(simp add: fresh_prod abs_fresh fresh_atm)
   784 apply(simp add: fresh_prod abs_fresh fresh_atm abs_supp fin_supp)
   785 apply(auto)[1]
   786 apply(drule crename_ImpL)
   787 apply(simp add: fresh_prod abs_fresh fresh_atm)
   788 apply(simp add: fresh_prod abs_fresh fresh_atm)
   789 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   790 apply(drule crename_ImpR)
   791 apply(simp add: fresh_prod abs_fresh fresh_atm)
   792 apply(simp add: fresh_prod abs_fresh fresh_atm)
   793 apply(simp)
   794 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
   795 apply(rule_tac x="Cut <a>.(Cut <c>.M'a (x).N') (y).N'a" in exI)
   796 apply(rule conjI)
   797 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   798 apply(rule l_redu.intros)
   799 apply(auto simp add: fresh_atm abs_fresh abs_supp fin_supp fresh_prod intro: crename_fresh_interesting2)[1]
   800 apply(auto simp add: abs_fresh fresh_atm abs_supp fin_supp fresh_prod intro: crename_fresh_interesting1)[1]
   801 apply(auto simp add: abs_fresh fresh_atm abs_supp fin_supp fresh_prod intro: crename_fresh_interesting2)[1]
   802 apply(auto simp add: abs_fresh fresh_atm abs_supp fin_supp fresh_prod intro: crename_fresh_interesting1)[1]
   803 apply(auto simp add: abs_fresh fresh_atm abs_supp fin_supp fresh_prod intro: crename_fresh_interesting1)[1]
   804 apply(auto simp add: abs_fresh fresh_atm abs_supp fin_supp fresh_prod intro: crename_fresh_interesting1)[1]
   805 done
   806 
   807 lemma crename_aredu:
   808   assumes a: "(M[a\<turnstile>c>b]) \<longrightarrow>\<^isub>a M'" "a\<noteq>b"
   809   shows "\<exists>M0. M0[a\<turnstile>c>b]=M' \<and> M \<longrightarrow>\<^isub>a M0"
   810 using a
   811 apply(nominal_induct "M[a\<turnstile>c>b]" M' avoiding: M a b rule: a_redu.strong_induct)
   812 apply(drule  crename_lredu)
   813 apply(blast)
   814 apply(drule  crename_credu)
   815 apply(blast)
   816 (* Cut *)
   817 apply(drule sym)
   818 apply(drule crename_Cut)
   819 apply(simp)
   820 apply(simp)
   821 apply(auto)[1]
   822 apply(drule_tac x="M'a" in meta_spec)
   823 apply(drule_tac x="aa" in meta_spec)
   824 apply(drule_tac x="b" in meta_spec)
   825 apply(auto)[1]
   826 apply(rule_tac x="Cut <a>.M0 (x).N'" in exI)
   827 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   828 apply(rule conjI)
   829 apply(rule trans)
   830 apply(rule crename.simps)
   831 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   832 apply(drule crename_fresh_interesting2)
   833 apply(simp add: fresh_a_redu)
   834 apply(simp)
   835 apply(auto)[1]
   836 apply(drule sym)
   837 apply(drule crename_Cut)
   838 apply(simp)
   839 apply(simp)
   840 apply(auto)[1]
   841 apply(drule_tac x="N'a" in meta_spec)
   842 apply(drule_tac x="aa" in meta_spec)
   843 apply(drule_tac x="b" in meta_spec)
   844 apply(auto)[1]
   845 apply(rule_tac x="Cut <a>.M' (x).M0" in exI)
   846 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   847 apply(rule conjI)
   848 apply(rule trans)
   849 apply(rule crename.simps)
   850 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm fresh_prod)[1]
   851 apply(drule crename_fresh_interesting1)
   852 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   853 apply(simp add: fresh_a_redu)
   854 apply(simp)
   855 apply(simp)
   856 apply(auto)[1]
   857 (* NotL *)
   858 apply(drule sym)
   859 apply(drule crename_NotL)
   860 apply(simp)
   861 apply(auto)[1]
   862 apply(drule_tac x="N'" in meta_spec)
   863 apply(drule_tac x="aa" in meta_spec)
   864 apply(drule_tac x="b" in meta_spec)
   865 apply(auto)[1]
   866 apply(rule_tac x="NotL <a>.M0 x" in exI)
   867 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   868 apply(auto)[1]
   869 (* NotR *)
   870 apply(drule sym)
   871 apply(frule crename_NotR_aux)
   872 apply(erule disjE)
   873 apply(auto)[1]
   874 apply(drule crename_NotR')
   875 apply(simp)
   876 apply(simp add: fresh_atm)
   877 apply(erule disjE)
   878 apply(auto)[1]
   879 apply(drule_tac x="N'" in meta_spec)
   880 apply(drule_tac x="aa" in meta_spec)
   881 apply(drule_tac x="b" in meta_spec)
   882 apply(auto)[1]
   883 apply(rule_tac x="NotR (x).M0 a" in exI)
   884 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   885 apply(auto)[1]
   886 apply(auto)[1]
   887 apply(drule_tac x="N'" in meta_spec)
   888 apply(drule_tac x="aa" in meta_spec)
   889 apply(drule_tac x="a" in meta_spec)
   890 apply(auto)[1]
   891 apply(rule_tac x="NotR (x).M0 aa" in exI)
   892 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   893 apply(auto)[1]
   894 (* AndR *)
   895 apply(drule sym)
   896 apply(frule crename_AndR_aux)
   897 apply(erule disjE)
   898 apply(auto)[1]
   899 apply(drule crename_AndR')
   900 apply(simp add: fresh_prod fresh_atm)
   901 apply(simp add: fresh_atm)
   902 apply(simp add: fresh_atm)
   903 apply(erule disjE)
   904 apply(auto)[1]
   905 apply(drule_tac x="M'a" in meta_spec)
   906 apply(drule_tac x="aa" in meta_spec)
   907 apply(drule_tac x="ba" in meta_spec)
   908 apply(auto)[1]
   909 apply(rule_tac x="AndR <a>.M0 <b>.N' c" in exI)
   910 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   911 apply(auto)[1]
   912 apply(rule trans)
   913 apply(rule crename.simps)
   914 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   915 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
   916 apply(auto intro: fresh_a_redu)[1]
   917 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
   918 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
   919 apply(auto)[1]
   920 apply(drule_tac x="M'a" in meta_spec)
   921 apply(drule_tac x="aa" in meta_spec)
   922 apply(drule_tac x="c" in meta_spec)
   923 apply(auto)[1]
   924 apply(rule_tac x="AndR <a>.M0 <b>.N' aa" in exI)
   925 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   926 apply(auto)[1]
   927 apply(rule trans)
   928 apply(rule crename.simps)
   929 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   930 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
   931 apply(auto intro: fresh_a_redu)[1]
   932 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
   933 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
   934 apply(drule sym)
   935 apply(frule crename_AndR_aux)
   936 apply(erule disjE)
   937 apply(auto)[1]
   938 apply(drule crename_AndR')
   939 apply(simp add: fresh_prod fresh_atm)
   940 apply(simp add: fresh_atm)
   941 apply(simp add: fresh_atm)
   942 apply(erule disjE)
   943 apply(auto)[1]
   944 apply(drule_tac x="N'a" in meta_spec)
   945 apply(drule_tac x="aa" in meta_spec)
   946 apply(drule_tac x="ba" in meta_spec)
   947 apply(auto)[1]
   948 apply(rule_tac x="AndR <a>.M' <b>.M0 c" in exI)
   949 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   950 apply(auto)[1]
   951 apply(rule trans)
   952 apply(rule crename.simps)
   953 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm fresh_prod)[1]
   954 apply(auto intro: fresh_a_redu)[1]
   955 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
   956 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
   957 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
   958 apply(auto)[1]
   959 apply(drule_tac x="N'a" in meta_spec)
   960 apply(drule_tac x="aa" in meta_spec)
   961 apply(drule_tac x="c" in meta_spec)
   962 apply(auto)[1]
   963 apply(rule_tac x="AndR <a>.M' <b>.M0 aa" in exI)
   964 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   965 apply(auto)[1]
   966 apply(rule trans)
   967 apply(rule crename.simps)
   968 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm fresh_prod)[1]
   969 apply(auto intro: fresh_a_redu)[1]
   970 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
   971 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
   972 apply(simp)
   973 (* AndL1 *)
   974 apply(drule sym)
   975 apply(drule crename_AndL1)
   976 apply(simp)
   977 apply(auto)[1]
   978 apply(drule_tac x="N'" in meta_spec)
   979 apply(drule_tac x="a" in meta_spec)
   980 apply(drule_tac x="b" in meta_spec)
   981 apply(auto)[1]
   982 apply(rule_tac x="AndL1 (x).M0 y" in exI)
   983 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   984 apply(auto)[1]
   985 (* AndL2 *)
   986 apply(drule sym)
   987 apply(drule crename_AndL2)
   988 apply(simp)
   989 apply(auto)[1]
   990 apply(drule_tac x="N'" in meta_spec)
   991 apply(drule_tac x="a" in meta_spec)
   992 apply(drule_tac x="b" in meta_spec)
   993 apply(auto)[1]
   994 apply(rule_tac x="AndL2 (x).M0 y" in exI)
   995 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
   996 apply(auto)[1]
   997 (* OrL *)
   998 apply(drule sym)
   999 apply(drule crename_OrL)
  1000 apply(simp)
  1001 apply(auto simp add: fresh_atm fresh_prod)[1]
  1002 apply(auto simp add: fresh_atm fresh_prod)[1]
  1003 apply(auto)[1]
  1004 apply(drule_tac x="M'a" in meta_spec)
  1005 apply(drule_tac x="a" in meta_spec)
  1006 apply(drule_tac x="b" in meta_spec)
  1007 apply(auto)[1]
  1008 apply(rule_tac x="OrL (x).M0 (y).N' z" in exI)
  1009 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1010 apply(auto)[1]
  1011 apply(rule trans)
  1012 apply(rule crename.simps)
  1013 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm fresh_prod)[1]
  1014 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  1015 apply(auto intro: fresh_a_redu)[1]
  1016 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  1017 apply(simp)
  1018 apply(drule sym)
  1019 apply(drule crename_OrL)
  1020 apply(simp)
  1021 apply(auto simp add: fresh_atm fresh_prod)[1]
  1022 apply(auto simp add: fresh_atm fresh_prod)[1]
  1023 apply(auto)[1]
  1024 apply(drule_tac x="N'a" in meta_spec)
  1025 apply(drule_tac x="a" in meta_spec)
  1026 apply(drule_tac x="b" in meta_spec)
  1027 apply(auto)[1]
  1028 apply(rule_tac x="OrL (x).M' (y).M0 z" in exI)
  1029 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1030 apply(auto)[1]
  1031 apply(rule trans)
  1032 apply(rule crename.simps)
  1033 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm fresh_prod)[1]
  1034 apply(auto intro: fresh_a_redu)[1]
  1035 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  1036 apply(simp)
  1037 apply(simp)
  1038 (* OrR1 *)
  1039 apply(drule sym)
  1040 apply(frule crename_OrR1_aux)
  1041 apply(erule disjE)
  1042 apply(auto)[1]
  1043 apply(drule crename_OrR1')
  1044 apply(simp)
  1045 apply(simp add: fresh_atm)
  1046 apply(erule disjE)
  1047 apply(auto)[1]
  1048 apply(drule_tac x="N'" in meta_spec)
  1049 apply(drule_tac x="aa" in meta_spec)
  1050 apply(drule_tac x="ba" in meta_spec)
  1051 apply(auto)[1]
  1052 apply(rule_tac x="OrR1 <a>.M0 b" in exI)
  1053 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1054 apply(auto)[1]
  1055 apply(auto)[1]
  1056 apply(drule_tac x="N'" in meta_spec)
  1057 apply(drule_tac x="aa" in meta_spec)
  1058 apply(drule_tac x="b" in meta_spec)
  1059 apply(auto)[1]
  1060 apply(rule_tac x="OrR1 <a>.M0 aa" in exI)
  1061 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1062 apply(auto)[1]
  1063 (* OrR2 *)
  1064 apply(drule sym)
  1065 apply(frule crename_OrR2_aux)
  1066 apply(erule disjE)
  1067 apply(auto)[1]
  1068 apply(drule crename_OrR2')
  1069 apply(simp)
  1070 apply(simp add: fresh_atm)
  1071 apply(erule disjE)
  1072 apply(auto)[1]
  1073 apply(drule_tac x="N'" in meta_spec)
  1074 apply(drule_tac x="aa" in meta_spec)
  1075 apply(drule_tac x="ba" in meta_spec)
  1076 apply(auto)[1]
  1077 apply(rule_tac x="OrR2 <a>.M0 b" in exI)
  1078 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1079 apply(auto)[1]
  1080 apply(auto)[1]
  1081 apply(drule_tac x="N'" in meta_spec)
  1082 apply(drule_tac x="aa" in meta_spec)
  1083 apply(drule_tac x="b" in meta_spec)
  1084 apply(auto)[1]
  1085 apply(rule_tac x="OrR2 <a>.M0 aa" in exI)
  1086 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1087 apply(auto)[1]
  1088 (* ImpL *)
  1089 apply(drule sym)
  1090 apply(drule crename_ImpL)
  1091 apply(simp)
  1092 apply(simp)
  1093 apply(auto)[1]
  1094 apply(drule_tac x="M'a" in meta_spec)
  1095 apply(drule_tac x="aa" in meta_spec)
  1096 apply(drule_tac x="b" in meta_spec)
  1097 apply(auto)[1]
  1098 apply(rule_tac x="ImpL <a>.M0 (x).N' y" in exI)
  1099 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1100 apply(auto)[1]
  1101 apply(rule trans)
  1102 apply(rule crename.simps)
  1103 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm fresh_prod)[1]
  1104 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  1105 apply(auto intro: fresh_a_redu)[1]
  1106 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  1107 apply(drule sym)
  1108 apply(drule crename_ImpL)
  1109 apply(simp)
  1110 apply(simp)
  1111 apply(auto)[1]
  1112 apply(drule_tac x="N'a" in meta_spec)
  1113 apply(drule_tac x="aa" in meta_spec)
  1114 apply(drule_tac x="b" in meta_spec)
  1115 apply(auto)[1]
  1116 apply(rule_tac x="ImpL <a>.M' (x).M0 y" in exI)
  1117 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1118 apply(auto)[1]
  1119 apply(rule trans)
  1120 apply(rule crename.simps)
  1121 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm fresh_prod)[1]
  1122 apply(auto intro: fresh_a_redu)[1]
  1123 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  1124 apply(simp)
  1125 (* ImpR *)
  1126 apply(drule sym)
  1127 apply(frule crename_ImpR_aux)
  1128 apply(erule disjE)
  1129 apply(auto)[1]
  1130 apply(drule crename_ImpR')
  1131 apply(simp)
  1132 apply(simp add: fresh_atm)
  1133 apply(simp add: fresh_atm)
  1134 apply(erule disjE)
  1135 apply(auto)[1]
  1136 apply(drule_tac x="N'" in meta_spec)
  1137 apply(drule_tac x="aa" in meta_spec)
  1138 apply(drule_tac x="ba" in meta_spec)
  1139 apply(auto)[1]
  1140 apply(rule_tac x="ImpR (x).<a>.M0 b" in exI)
  1141 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1142 apply(auto)[1]
  1143 apply(auto)[1]
  1144 apply(drule_tac x="N'" in meta_spec)
  1145 apply(drule_tac x="aa" in meta_spec)
  1146 apply(drule_tac x="b" in meta_spec)
  1147 apply(auto)[1]
  1148 apply(rule_tac x="ImpR (x).<a>.M0 aa" in exI)
  1149 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1150 apply(auto)[1]
  1151 done
  1152 
  1153 lemma SNa_preserved_renaming1:
  1154   assumes a: "SNa M"
  1155   shows "SNa (M[a\<turnstile>c>b])"
  1156 using a
  1157 apply(induct rule: SNa_induct)
  1158 apply(case_tac "a=b")
  1159 apply(simp add: crename_id)
  1160 apply(rule SNaI)
  1161 apply(drule crename_aredu)
  1162 apply(blast)+
  1163 done
  1164 
  1165 lemma nrename_interesting1:
  1166   assumes a: "distinct [x,y,z]"
  1167   shows "M[x\<turnstile>n>z][z\<turnstile>n>y] = M[z\<turnstile>n>y][x\<turnstile>n>y]"
  1168 using a
  1169 apply(nominal_induct M avoiding: x y z rule: trm.strong_induct)
  1170 apply(auto simp add: rename_fresh simp add: trm.inject alpha)
  1171 apply(blast)
  1172 apply(blast)
  1173 apply(rotate_tac 12)
  1174 apply(drule_tac x="x" in meta_spec)
  1175 apply(rotate_tac 15)
  1176 apply(drule_tac x="y" in meta_spec)
  1177 apply(rotate_tac 15)
  1178 apply(drule_tac x="z" in meta_spec)
  1179 apply(blast)
  1180 apply(rotate_tac 11)
  1181 apply(drule_tac x="x" in meta_spec)
  1182 apply(rotate_tac 14)
  1183 apply(drule_tac x="y" in meta_spec)
  1184 apply(rotate_tac 14)
  1185 apply(drule_tac x="z" in meta_spec)
  1186 apply(blast)
  1187 done
  1188 
  1189 lemma nrename_interesting2:
  1190   assumes a: "x\<noteq>z" "x\<noteq>u" "x\<noteq>y" "z\<noteq>u" "y\<noteq>z"
  1191   shows "M[x\<turnstile>n>y][z\<turnstile>n>u] = M[z\<turnstile>n>u][x\<turnstile>n>y]"
  1192 using a
  1193 apply(nominal_induct M avoiding: x y z u rule: trm.strong_induct)
  1194 apply(auto simp add: rename_fresh simp add: trm.inject alpha)
  1195 done
  1196 
  1197 lemma not_fic_nrename_aux:
  1198   assumes a: "fic M c" 
  1199   shows "fic (M[x\<turnstile>n>y]) c" 
  1200 using a
  1201 apply(nominal_induct M avoiding: c x y rule: trm.strong_induct)
  1202 apply(auto dest!: fic_elims intro!: fic.intros simp add: fresh_prod fresh_atm rename_fresh abs_fresh)
  1203 done
  1204 
  1205 lemma not_fic_nrename:
  1206   assumes a: "\<not>(fic (M[x\<turnstile>n>y]) c)" 
  1207   shows "\<not>(fic M c)" 
  1208 using a
  1209 apply(auto dest:  not_fic_nrename_aux)
  1210 done
  1211 
  1212 lemma fin_nrename:
  1213   assumes a: "fin M z" "z\<sharp>(x,y)"
  1214   shows "fin (M[x\<turnstile>n>y]) z" 
  1215 using a
  1216 apply(nominal_induct M avoiding: x y z rule: trm.strong_induct)
  1217 apply(auto dest!: fin_elims intro!: fin.intros simp add: fresh_prod fresh_atm rename_fresh abs_fresh
  1218            split: if_splits)
  1219 done
  1220 
  1221 lemma nrename_fresh_interesting1:
  1222   fixes z::"name"
  1223   assumes a: "z\<sharp>(M[x\<turnstile>n>y])" "z\<sharp>(x,y)"
  1224   shows "z\<sharp>M"
  1225 using a
  1226 apply(nominal_induct M avoiding: x y z rule: trm.strong_induct)
  1227 apply(auto split: if_splits simp add: abs_fresh abs_supp fin_supp)
  1228 done
  1229 
  1230 lemma nrename_fresh_interesting2:
  1231   fixes c::"coname"
  1232   assumes a: "c\<sharp>(M[x\<turnstile>n>y])" 
  1233   shows "c\<sharp>M"
  1234 using a
  1235 apply(nominal_induct M avoiding: x y c rule: trm.strong_induct)
  1236 apply(auto split: if_splits simp add: abs_fresh abs_supp fin_supp fresh_atm)
  1237 done
  1238 
  1239 lemma fin_nrename2:
  1240   assumes a: "fin (M[x\<turnstile>n>y]) z" "z\<sharp>(x,y)"
  1241   shows "fin M z" 
  1242 using a
  1243 apply(nominal_induct M avoiding: x y z rule: trm.strong_induct)
  1244 apply(auto dest!: fin_elims intro!: fin.intros simp add: fresh_prod fresh_atm rename_fresh abs_fresh
  1245            split: if_splits)
  1246 apply(auto dest: nrename_fresh_interesting1 simp add: fresh_atm fresh_prod)
  1247 done
  1248 
  1249 lemma nrename_Cut:
  1250   assumes a: "R[x\<turnstile>n>y] = Cut <c>.M (z).N" "c\<sharp>(N,R)" "z\<sharp>(x,y,M,R)"
  1251   shows "\<exists>M' N'. R = Cut <c>.M' (z).N' \<and> M'[x\<turnstile>n>y] = M \<and> N'[x\<turnstile>n>y] = N \<and> c\<sharp>N' \<and> z\<sharp>M'"
  1252 using a
  1253 apply(nominal_induct R avoiding: c y x z M N rule: trm.strong_induct)
  1254 apply(auto split: if_splits)
  1255 apply(simp add: trm.inject)
  1256 apply(auto simp add: alpha fresh_atm)
  1257 apply(rule_tac x="[(coname,c)]\<bullet>trm1" in exI)
  1258 apply(perm_simp)
  1259 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1260 apply(rule_tac x="[(name,z)]\<bullet>trm2" in exI)
  1261 apply(perm_simp)
  1262 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1263 apply(rule conjI)
  1264 apply(drule sym)
  1265 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
  1266 apply(simp add: eqvts calc_atm)
  1267 apply(auto simp add: fresh_atm)[1]
  1268 apply(drule sym)
  1269 apply(drule sym)
  1270 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1271 apply(simp add: eqvts calc_atm)
  1272 done
  1273 
  1274 lemma nrename_NotR:
  1275   assumes a: "R[x\<turnstile>n>y] = NotR (z).N c" "z\<sharp>(R,x,y)" 
  1276   shows "\<exists>N'. (R = NotR (z).N' c) \<and> N'[x\<turnstile>n>y] = N" 
  1277 using a
  1278 apply(nominal_induct R avoiding: x y c z N rule: trm.strong_induct)
  1279 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
  1280 apply(rule_tac x="[(name,z)]\<bullet>trm" in exI)
  1281 apply(perm_simp)
  1282 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1283 apply(drule sym)
  1284 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1285 apply(simp add: eqvts calc_atm)
  1286 done
  1287 
  1288 lemma nrename_NotL:
  1289   assumes a: "R[x\<turnstile>n>y] = NotL <c>.N z" "c\<sharp>R" "z\<sharp>(x,y)"
  1290   shows "\<exists>N'. (R = NotL <c>.N' z) \<and> N'[x\<turnstile>n>y] = N" 
  1291 using a
  1292 apply(nominal_induct R avoiding: x y c z N rule: trm.strong_induct)
  1293 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
  1294 apply(rule_tac x="[(coname,c)]\<bullet>trm" in exI)
  1295 apply(perm_simp)
  1296 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1297 apply(drule sym)
  1298 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
  1299 apply(simp add: eqvts calc_atm)
  1300 done
  1301 
  1302 lemma nrename_NotL':
  1303   assumes a: "R[x\<turnstile>n>y] = NotL <c>.N u" "c\<sharp>R" "x\<noteq>y" 
  1304   shows "(\<exists>N'. (R = NotL <c>.N' u) \<and> N'[x\<turnstile>n>y] = N) \<or> (\<exists>N'. (R = NotL <c>.N' x) \<and> y=u \<and> N'[x\<turnstile>n>y] = N)"
  1305 using a
  1306 apply(nominal_induct R avoiding: y u c x N rule: trm.strong_induct)
  1307 apply(auto split: if_splits simp add: fresh_prod fresh_atm abs_fresh alpha trm.inject)
  1308 apply(rule_tac x="[(coname,c)]\<bullet>trm" in exI)
  1309 apply(perm_simp)
  1310 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1311 apply(drule sym)
  1312 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
  1313 apply(simp add: eqvts calc_atm)
  1314 apply(rule_tac x="[(coname,c)]\<bullet>trm" in exI)
  1315 apply(perm_simp)
  1316 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1317 apply(drule sym)
  1318 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
  1319 apply(simp add: eqvts calc_atm)
  1320 done
  1321 
  1322 lemma nrename_NotL_aux:
  1323   assumes a: "R[x\<turnstile>n>y] = NotL <c>.N u" 
  1324   shows "(x=u \<and> x=y) \<or> (x\<noteq>u)" 
  1325 using a
  1326 apply(nominal_induct R avoiding: y u c x N rule: trm.strong_induct)
  1327 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
  1328 done
  1329 
  1330 lemma nrename_AndL1:
  1331   assumes a: "R[x\<turnstile>n>y] = AndL1 (z).N u" "z\<sharp>(R,x,y)" "u\<sharp>(x,y)"
  1332   shows "\<exists>N'. (R = AndL1 (z).N' u) \<and> N'[x\<turnstile>n>y] = N" 
  1333 using a
  1334 apply(nominal_induct R avoiding: z u x y N rule: trm.strong_induct)
  1335 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
  1336 apply(rule_tac x="[(name1,z)]\<bullet>trm" in exI)
  1337 apply(perm_simp)
  1338 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1339 apply(drule sym)
  1340 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1341 apply(simp add: eqvts calc_atm)
  1342 done
  1343 
  1344 lemma nrename_AndL1':
  1345   assumes a: "R[x\<turnstile>n>y] = AndL1 (v).N u" "v\<sharp>(R,u,x,y)" "x\<noteq>y" 
  1346   shows "(\<exists>N'. (R = AndL1 (v).N' u) \<and> N'[x\<turnstile>n>y] = N) \<or> (\<exists>N'. (R = AndL1 (v).N' x) \<and> y=u \<and> N'[x\<turnstile>n>y] = N)"
  1347 using a
  1348 apply(nominal_induct R avoiding: y u v x N rule: trm.strong_induct)
  1349 apply(auto split: if_splits simp add: fresh_prod fresh_atm abs_fresh alpha trm.inject)
  1350 apply(rule_tac x="[(name1,v)]\<bullet>trm" in exI)
  1351 apply(perm_simp)
  1352 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1353 apply(drule sym)
  1354 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1355 apply(simp add: eqvts calc_atm)
  1356 apply(rule_tac x="[(name1,v)]\<bullet>trm" in exI)
  1357 apply(perm_simp)
  1358 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1359 apply(drule sym)
  1360 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1361 apply(simp add: eqvts calc_atm)
  1362 done
  1363 
  1364 lemma nrename_AndL1_aux:
  1365   assumes a: "R[x\<turnstile>n>y] = AndL1 (v).N u" 
  1366   shows "(x=u \<and> x=y) \<or> (x\<noteq>u)" 
  1367 using a
  1368 apply(nominal_induct R avoiding: y u v x N rule: trm.strong_induct)
  1369 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
  1370 done
  1371 
  1372 lemma nrename_AndL2:
  1373   assumes a: "R[x\<turnstile>n>y] = AndL2 (z).N u" "z\<sharp>(R,x,y)" "u\<sharp>(x,y)"
  1374   shows "\<exists>N'. (R = AndL2 (z).N' u) \<and> N'[x\<turnstile>n>y] = N" 
  1375 using a
  1376 apply(nominal_induct R avoiding: z u x y N rule: trm.strong_induct)
  1377 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
  1378 apply(rule_tac x="[(name1,z)]\<bullet>trm" in exI)
  1379 apply(perm_simp)
  1380 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1381 apply(drule sym)
  1382 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1383 apply(simp add: eqvts calc_atm)
  1384 done
  1385 
  1386 lemma nrename_AndL2':
  1387   assumes a: "R[x\<turnstile>n>y] = AndL2 (v).N u" "v\<sharp>(R,u,x,y)" "x\<noteq>y" 
  1388   shows "(\<exists>N'. (R = AndL2 (v).N' u) \<and> N'[x\<turnstile>n>y] = N) \<or> (\<exists>N'. (R = AndL2 (v).N' x) \<and> y=u \<and> N'[x\<turnstile>n>y] = N)"
  1389 using a
  1390 apply(nominal_induct R avoiding: y u v x N rule: trm.strong_induct)
  1391 apply(auto split: if_splits simp add: fresh_prod fresh_atm abs_fresh alpha trm.inject)
  1392 apply(rule_tac x="[(name1,v)]\<bullet>trm" in exI)
  1393 apply(perm_simp)
  1394 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1395 apply(drule sym)
  1396 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1397 apply(simp add: eqvts calc_atm)
  1398 apply(rule_tac x="[(name1,v)]\<bullet>trm" in exI)
  1399 apply(perm_simp)
  1400 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1401 apply(drule sym)
  1402 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1403 apply(simp add: eqvts calc_atm)
  1404 done
  1405 
  1406 lemma nrename_AndL2_aux:
  1407   assumes a: "R[x\<turnstile>n>y] = AndL2 (v).N u" 
  1408   shows "(x=u \<and> x=y) \<or> (x\<noteq>u)" 
  1409 using a
  1410 apply(nominal_induct R avoiding: y u v x N rule: trm.strong_induct)
  1411 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
  1412 done
  1413 
  1414 lemma nrename_AndR:
  1415   assumes a: "R[x\<turnstile>n>y] = AndR <c>.M <d>.N e" "c\<sharp>(d,e,N,R)" "d\<sharp>(c,e,M,R)" 
  1416   shows "\<exists>M' N'. R = AndR <c>.M' <d>.N' e \<and> M'[x\<turnstile>n>y] = M \<and> N'[x\<turnstile>n>y] = N \<and> c\<sharp>N' \<and> d\<sharp>M'"
  1417 using a
  1418 apply(nominal_induct R avoiding: x y c d e M N rule: trm.strong_induct)
  1419 apply(auto split: if_splits simp add: trm.inject alpha)
  1420 apply(simp add: fresh_atm fresh_prod)
  1421 apply(rule_tac x="[(coname1,c)]\<bullet>trm1" in exI)
  1422 apply(perm_simp)
  1423 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
  1424 apply(rule_tac x="[(coname1,c)]\<bullet>trm1" in exI)
  1425 apply(perm_simp)
  1426 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
  1427 apply(rule_tac x="[(coname2,d)]\<bullet>trm2" in exI)
  1428 apply(perm_simp)
  1429 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
  1430 apply(drule sym)
  1431 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
  1432 apply(simp add: eqvts calc_atm)
  1433 apply(drule_tac s="trm2[x\<turnstile>n>y]" in  sym)
  1434 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
  1435 apply(simp add: eqvts calc_atm)
  1436 done
  1437 
  1438 lemma nrename_OrR1:
  1439   assumes a: "R[x\<turnstile>n>y] = OrR1 <c>.N d" "c\<sharp>(R,d)" 
  1440   shows "\<exists>N'. (R = OrR1 <c>.N' d) \<and> N'[x\<turnstile>n>y] = N" 
  1441 using a
  1442 apply(nominal_induct R avoiding: x y c d N rule: trm.strong_induct)
  1443 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
  1444 apply(rule_tac x="[(coname1,c)]\<bullet>trm" in exI)
  1445 apply(perm_simp)
  1446 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1447 apply(drule sym)
  1448 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
  1449 apply(simp add: eqvts calc_atm)
  1450 done
  1451 
  1452 lemma nrename_OrR2:
  1453   assumes a: "R[x\<turnstile>n>y] = OrR2 <c>.N d" "c\<sharp>(R,d)" 
  1454   shows "\<exists>N'. (R = OrR2 <c>.N' d) \<and> N'[x\<turnstile>n>y] = N" 
  1455 using a
  1456 apply(nominal_induct R avoiding: x y c d N rule: trm.strong_induct)
  1457 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
  1458 apply(rule_tac x="[(coname1,c)]\<bullet>trm" in exI)
  1459 apply(perm_simp)
  1460 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1461 apply(drule sym)
  1462 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
  1463 apply(simp add: eqvts calc_atm)
  1464 done
  1465 
  1466 lemma nrename_OrL:
  1467   assumes a: "R[u\<turnstile>n>v] = OrL (x).M (y).N z" "x\<sharp>(y,z,u,v,N,R)" "y\<sharp>(x,z,u,v,M,R)" "z\<sharp>(u,v)"
  1468   shows "\<exists>M' N'. R = OrL (x).M' (y).N' z \<and> M'[u\<turnstile>n>v] = M \<and> N'[u\<turnstile>n>v] = N \<and> x\<sharp>N' \<and> y\<sharp>M'"
  1469 using a
  1470 apply(nominal_induct R avoiding: u v x y z M N rule: trm.strong_induct)
  1471 apply(auto split: if_splits simp add: trm.inject alpha fresh_prod fresh_atm)
  1472 apply(rule_tac x="[(name1,x)]\<bullet>trm1" in exI)
  1473 apply(perm_simp)
  1474 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
  1475 apply(rule_tac x="[(name2,y)]\<bullet>trm2" in exI)
  1476 apply(perm_simp)
  1477 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
  1478 apply(drule sym)
  1479 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1480 apply(simp add: eqvts calc_atm)
  1481 apply(drule_tac s="trm2[u\<turnstile>n>v]" in  sym)
  1482 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1483 apply(simp add: eqvts calc_atm)
  1484 done
  1485 
  1486 lemma nrename_OrL':
  1487   assumes a: "R[x\<turnstile>n>y] = OrL (v).M (w).N u" "v\<sharp>(R,N,u,x,y)" "w\<sharp>(R,M,u,x,y)" "x\<noteq>y" 
  1488   shows "(\<exists>M' N'. (R = OrL (v).M' (w).N' u) \<and> M'[x\<turnstile>n>y] = M \<and> N'[x\<turnstile>n>y] = N) \<or> 
  1489          (\<exists>M' N'. (R = OrL (v).M' (w).N' x) \<and> y=u \<and> M'[x\<turnstile>n>y] = M \<and> N'[x\<turnstile>n>y] = N)"
  1490 using a
  1491 apply(nominal_induct R avoiding: y x u v w M N rule: trm.strong_induct)
  1492 apply(auto split: if_splits simp add: fresh_prod fresh_atm abs_fresh alpha trm.inject)
  1493 apply(rule_tac x="[(name1,v)]\<bullet>trm1" in exI)
  1494 apply(perm_simp)
  1495 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1496 apply(rule_tac x="[(name2,w)]\<bullet>trm2" in exI)
  1497 apply(perm_simp)
  1498 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1499 apply(rule conjI)
  1500 apply(drule sym)
  1501 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1502 apply(simp add: eqvts calc_atm)
  1503 apply(drule_tac s="trm2[x\<turnstile>n>u]" in sym)
  1504 apply(drule_tac pt_bij1[OF pt_name_inst,OF at_name_inst])
  1505 apply(simp add: eqvts calc_atm)
  1506 apply(rule_tac x="[(name1,v)]\<bullet>trm1" in exI)
  1507 apply(perm_simp)
  1508 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1509 apply(rule_tac x="[(name2,w)]\<bullet>trm2" in exI)
  1510 apply(perm_simp)
  1511 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1512 apply(rule conjI)
  1513 apply(drule sym)
  1514 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1515 apply(simp add: eqvts calc_atm)
  1516 apply(drule_tac s="trm2[x\<turnstile>n>y]" in sym)
  1517 apply(drule_tac pt_bij1[OF pt_name_inst,OF at_name_inst])
  1518 apply(simp add: eqvts calc_atm)
  1519 done
  1520 
  1521 lemma nrename_OrL_aux:
  1522   assumes a: "R[x\<turnstile>n>y] = OrL (v).M (w).N u" 
  1523   shows "(x=u \<and> x=y) \<or> (x\<noteq>u)" 
  1524 using a
  1525 apply(nominal_induct R avoiding: y x w u v M N rule: trm.strong_induct)
  1526 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
  1527 done
  1528 
  1529 lemma nrename_ImpL:
  1530   assumes a: "R[x\<turnstile>n>y] = ImpL <c>.M (u).N z" "c\<sharp>(N,R)" "u\<sharp>(y,x,z,M,R)" "z\<sharp>(x,y)"
  1531   shows "\<exists>M' N'. R = ImpL <c>.M' (u).N' z \<and> M'[x\<turnstile>n>y] = M \<and> N'[x\<turnstile>n>y] = N \<and> c\<sharp>N' \<and> u\<sharp>M'"
  1532 using a
  1533 apply(nominal_induct R avoiding: u x c y z M N rule: trm.strong_induct)
  1534 apply(auto split: if_splits simp add: trm.inject alpha fresh_prod fresh_atm)
  1535 apply(rule_tac x="[(coname,c)]\<bullet>trm1" in exI)
  1536 apply(perm_simp)
  1537 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
  1538 apply(rule_tac x="[(name1,u)]\<bullet>trm2" in exI)
  1539 apply(perm_simp)
  1540 apply(auto simp add: abs_fresh fresh_left calc_atm fresh_prod fresh_atm)[1]
  1541 apply(drule sym)
  1542 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
  1543 apply(simp add: eqvts calc_atm)
  1544 apply(drule_tac s="trm2[x\<turnstile>n>y]" in  sym)
  1545 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1546 apply(simp add: eqvts calc_atm fresh_prod fresh_atm)
  1547 done
  1548 
  1549 lemma nrename_ImpL':
  1550   assumes a: "R[x\<turnstile>n>y] = ImpL <c>.M (w).N u" "c\<sharp>(R,N)" "w\<sharp>(R,M,u,x,y)" "x\<noteq>y" 
  1551   shows "(\<exists>M' N'. (R = ImpL <c>.M' (w).N' u) \<and> M'[x\<turnstile>n>y] = M \<and> N'[x\<turnstile>n>y] = N) \<or> 
  1552          (\<exists>M' N'. (R = ImpL <c>.M' (w).N' x) \<and> y=u \<and> M'[x\<turnstile>n>y] = M \<and> N'[x\<turnstile>n>y] = N)"
  1553 using a
  1554 apply(nominal_induct R avoiding: y x u c w M N rule: trm.strong_induct)
  1555 apply(auto split: if_splits simp add: fresh_prod fresh_atm abs_fresh alpha trm.inject)
  1556 apply(rule_tac x="[(coname,c)]\<bullet>trm1" in exI)
  1557 apply(perm_simp)
  1558 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1559 apply(rule_tac x="[(name1,w)]\<bullet>trm2" in exI)
  1560 apply(perm_simp)
  1561 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1562 apply(rule conjI)
  1563 apply(drule sym)
  1564 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
  1565 apply(simp add: eqvts calc_atm)
  1566 apply(drule_tac s="trm2[x\<turnstile>n>u]" in sym)
  1567 apply(drule_tac pt_bij1[OF pt_name_inst,OF at_name_inst])
  1568 apply(simp add: eqvts calc_atm)
  1569 apply(rule_tac x="[(coname,c)]\<bullet>trm1" in exI)
  1570 apply(perm_simp)
  1571 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1572 apply(rule_tac x="[(name1,w)]\<bullet>trm2" in exI)
  1573 apply(perm_simp)
  1574 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1575 apply(rule conjI)
  1576 apply(drule sym)
  1577 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
  1578 apply(simp add: eqvts calc_atm)
  1579 apply(drule_tac s="trm2[x\<turnstile>n>y]" in sym)
  1580 apply(drule_tac pt_bij1[OF pt_name_inst,OF at_name_inst])
  1581 apply(simp add: eqvts calc_atm)
  1582 done
  1583 
  1584 lemma nrename_ImpL_aux:
  1585   assumes a: "R[x\<turnstile>n>y] = ImpL <c>.M (w).N u" 
  1586   shows "(x=u \<and> x=y) \<or> (x\<noteq>u)" 
  1587 using a
  1588 apply(nominal_induct R avoiding: y x w u c M N rule: trm.strong_induct)
  1589 apply(auto split: if_splits simp add: fresh_prod fresh_atm alpha abs_fresh trm.inject)
  1590 done
  1591 
  1592 lemma nrename_ImpR:
  1593   assumes a: "R[u\<turnstile>n>v] = ImpR (x).<c>.N d" "c\<sharp>(R,d)" "x\<sharp>(R,u,v)" 
  1594   shows "\<exists>N'. (R = ImpR (x).<c>.N' d) \<and> N'[u\<turnstile>n>v] = N" 
  1595 using a
  1596 apply(nominal_induct R avoiding: u v x c d N rule: trm.strong_induct)
  1597 apply(auto split: if_splits simp add: fresh_prod fresh_atm abs_perm alpha abs_fresh trm.inject)
  1598 apply(rule_tac x="[(name,x)]\<bullet>trm" in exI)
  1599 apply(perm_simp)
  1600 apply(simp add: abs_fresh fresh_left calc_atm fresh_prod)
  1601 apply(rule_tac x="[(name,x)]\<bullet>[(coname1, c)]\<bullet>trm" in exI)
  1602 apply(perm_simp)
  1603 apply(simp add: abs_supp fin_supp abs_fresh fresh_left calc_atm fresh_prod)
  1604 apply(drule sym)
  1605 apply(drule pt_bij1[OF pt_coname_inst,OF at_coname_inst])
  1606 apply(drule pt_bij1[OF pt_name_inst,OF at_name_inst])
  1607 apply(simp add: eqvts calc_atm)
  1608 done
  1609 
  1610 lemma nrename_credu:
  1611   assumes a: "(M[x\<turnstile>n>y]) \<longrightarrow>\<^isub>c M'"
  1612   shows "\<exists>M0. M0[x\<turnstile>n>y]=M' \<and> M \<longrightarrow>\<^isub>c M0"
  1613 using a
  1614 apply(nominal_induct M\<equiv>"M[x\<turnstile>n>y]" M' avoiding: M x y rule: c_redu.strong_induct)
  1615 apply(drule sym)
  1616 apply(drule nrename_Cut)
  1617 apply(simp)
  1618 apply(simp)
  1619 apply(auto)
  1620 apply(rule_tac x="M'{a:=(x).N'}" in exI)
  1621 apply(rule conjI)
  1622 apply(simp add: fresh_atm abs_fresh subst_comm fresh_prod)
  1623 apply(rule c_redu.intros)
  1624 apply(auto dest: not_fic_nrename)[1]
  1625 apply(simp add: abs_fresh)
  1626 apply(simp add: abs_fresh)
  1627 apply(drule sym)
  1628 apply(drule nrename_Cut)
  1629 apply(simp)
  1630 apply(simp)
  1631 apply(auto)
  1632 apply(rule_tac x="N'{x:=<a>.M'}" in exI)
  1633 apply(rule conjI)
  1634 apply(simp add: fresh_atm abs_fresh subst_comm fresh_prod)
  1635 apply(rule c_redu.intros)
  1636 apply(auto)
  1637 apply(drule_tac x="xa" and y="y" in fin_nrename)
  1638 apply(auto simp add: fresh_prod abs_fresh)
  1639 done
  1640 
  1641 lemma nrename_ax2:
  1642   assumes a: "N[x\<turnstile>n>y] = Ax z c"
  1643   shows "\<exists>z. N = Ax z c"
  1644 using a
  1645 apply(nominal_induct N avoiding: x y rule: trm.strong_induct)
  1646 apply(auto split: if_splits)
  1647 apply(simp add: trm.inject)
  1648 done
  1649 
  1650 lemma fic_nrename:
  1651   assumes a: "fic (M[x\<turnstile>n>y]) c" 
  1652   shows "fic M c" 
  1653 using a
  1654 apply(nominal_induct M avoiding: c x y rule: trm.strong_induct)
  1655 apply(auto dest!: fic_elims intro!: fic.intros simp add: fresh_prod fresh_atm rename_fresh abs_fresh
  1656            split: if_splits)
  1657 apply(auto dest: nrename_fresh_interesting2 simp add: fresh_prod fresh_atm)
  1658 done
  1659 
  1660 lemma nrename_lredu:
  1661   assumes a: "(M[x\<turnstile>n>y]) \<longrightarrow>\<^isub>l M'"
  1662   shows "\<exists>M0. M0[x\<turnstile>n>y]=M' \<and> M \<longrightarrow>\<^isub>l M0"
  1663 using a
  1664 apply(nominal_induct M\<equiv>"M[x\<turnstile>n>y]" M' avoiding: M x y rule: l_redu.strong_induct)
  1665 apply(drule sym)
  1666 apply(drule nrename_Cut)
  1667 apply(simp add: fresh_prod fresh_atm)
  1668 apply(simp)
  1669 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1670 apply(case_tac "xa=y")
  1671 apply(simp add: nrename_id)
  1672 apply(rule l_redu.intros)
  1673 apply(simp)
  1674 apply(simp add: fresh_atm)
  1675 apply(assumption)
  1676 apply(frule nrename_ax2)
  1677 apply(auto)[1]
  1678 apply(case_tac "z=xa")
  1679 apply(simp add: trm.inject)
  1680 apply(simp)
  1681 apply(rule_tac x="M'[a\<turnstile>c>b]" in exI)
  1682 apply(rule conjI)
  1683 apply(rule crename_interesting3)
  1684 apply(rule l_redu.intros)
  1685 apply(simp)
  1686 apply(simp add: fresh_atm)
  1687 apply(auto dest: fic_nrename simp add: fresh_prod fresh_atm)[1]
  1688 apply(drule sym)
  1689 apply(drule nrename_Cut)
  1690 apply(simp add: fresh_prod fresh_atm)
  1691 apply(simp add: fresh_prod fresh_atm)
  1692 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1693 apply(case_tac "xa=ya")
  1694 apply(simp add: nrename_id)
  1695 apply(rule l_redu.intros)
  1696 apply(simp)
  1697 apply(simp add: fresh_atm)
  1698 apply(assumption)
  1699 apply(frule nrename_ax2)
  1700 apply(auto)[1]
  1701 apply(case_tac "z=xa")
  1702 apply(simp add: trm.inject)
  1703 apply(rule_tac x="N'[x\<turnstile>n>xa]" in exI)
  1704 apply(rule conjI)
  1705 apply(rule nrename_interesting1)
  1706 apply(auto)[1]
  1707 apply(rule l_redu.intros)
  1708 apply(simp)
  1709 apply(simp add: fresh_atm)
  1710 apply(auto dest: fin_nrename2 simp add: fresh_prod fresh_atm)[1]
  1711 apply(simp add: trm.inject)
  1712 apply(rule_tac x="N'[x\<turnstile>n>y]" in exI)
  1713 apply(rule conjI)
  1714 apply(rule nrename_interesting2)
  1715 apply(simp_all)
  1716 apply(rule l_redu.intros)
  1717 apply(simp)
  1718 apply(simp add: fresh_atm)
  1719 apply(auto dest: fin_nrename2 simp add: fresh_prod fresh_atm)[1]
  1720 (* LNot *)
  1721 apply(drule sym)
  1722 apply(drule nrename_Cut)
  1723 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1724 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1725 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1726 apply(drule nrename_NotR)
  1727 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1728 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1729 apply(drule nrename_NotL)
  1730 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1731 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1732 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1733 apply(rule_tac x="Cut <b>.N'b (x).N'a" in exI)
  1734 apply(simp add: fresh_atm)[1]
  1735 apply(rule l_redu.intros)
  1736 apply(auto simp add: fresh_prod fresh_atm intro: nrename_fresh_interesting1)[1]
  1737 apply(auto simp add: fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1738 apply(auto simp add: fresh_atm fresh_prod intro: nrename_fresh_interesting2)[1]
  1739 apply(auto simp add: fresh_atm fresh_prod intro: nrename_fresh_interesting2)[1]
  1740 apply(simp add: fresh_atm)
  1741 apply(simp add: fresh_atm)
  1742 (* LAnd1 *)
  1743 apply(auto dest: fin_crename simp add: fresh_prod fresh_atm)[1]
  1744 apply(drule sym)
  1745 apply(drule nrename_Cut)
  1746 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1747 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1748 apply(auto)[1]
  1749 apply(drule nrename_AndR)
  1750 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1751 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1752 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1753 apply(drule nrename_AndL1)
  1754 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1755 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1756 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1757 apply(rule_tac x="Cut <a1>.M'a (x).N'b" in exI)
  1758 apply(simp add: fresh_atm)[1]
  1759 apply(rule l_redu.intros)
  1760 apply(auto simp add: fresh_atm abs_fresh fresh_prod intro: nrename_fresh_interesting2)[1]
  1761 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1762 apply(auto simp add: fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1763 apply(auto simp add: fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1764 apply(auto simp add: fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1765 apply(simp add: fresh_atm)
  1766 (* LAnd2 *)
  1767 apply(auto dest: fin_crename simp add: fresh_prod fresh_atm)[1]
  1768 apply(drule sym)
  1769 apply(drule nrename_Cut)
  1770 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1771 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1772 apply(auto)[1]
  1773 apply(drule nrename_AndR)
  1774 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1775 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1776 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1777 apply(drule nrename_AndL2)
  1778 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1779 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1780 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1781 apply(rule_tac x="Cut <a2>.N'a (x).N'b" in exI)
  1782 apply(simp add: fresh_atm)[1]
  1783 apply(rule l_redu.intros)
  1784 apply(auto simp add: fresh_atm abs_fresh fresh_prod intro: nrename_fresh_interesting2)[1]
  1785 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1786 apply(auto simp add: fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1787 apply(auto simp add: fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1788 apply(auto simp add: fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1789 apply(simp add: fresh_atm)
  1790 (* LOr1 *)
  1791 apply(auto dest: fin_crename simp add: fresh_prod fresh_atm)[1]
  1792 apply(drule sym)
  1793 apply(drule nrename_Cut)
  1794 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1795 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1796 apply(auto)[1]
  1797 apply(drule nrename_OrL)
  1798 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1799 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1800 apply(simp add: fresh_prod fresh_atm)
  1801 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1802 apply(drule nrename_OrR1)
  1803 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1804 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1805 apply(rule_tac x="Cut <a>.N' (x1).M'a" in exI)
  1806 apply(rule conjI)
  1807 apply(simp add: abs_fresh fresh_atm)[1]
  1808 apply(rule l_redu.intros)
  1809 apply(auto simp add: fresh_atm abs_fresh fresh_prod intro: nrename_fresh_interesting2)[1]
  1810 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1811 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1812 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1813 apply(simp add: fresh_atm)
  1814 apply(simp add: fresh_atm)
  1815 (* LOr2 *)
  1816 apply(auto dest: fin_crename simp add: fresh_prod fresh_atm)[1]
  1817 apply(drule sym)
  1818 apply(drule nrename_Cut)
  1819 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1820 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1821 apply(auto)[1]
  1822 apply(drule nrename_OrL)
  1823 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1824 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1825 apply(simp add: fresh_prod fresh_atm)
  1826 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1827 apply(drule nrename_OrR2)
  1828 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1829 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1830 apply(rule_tac x="Cut <a>.N' (x2).N'a" in exI)
  1831 apply(rule conjI)
  1832 apply(simp add: abs_fresh fresh_atm)[1]
  1833 apply(rule l_redu.intros)
  1834 apply(auto simp add: fresh_atm abs_fresh fresh_prod intro: nrename_fresh_interesting2)[1]
  1835 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1836 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1837 apply(auto simp add: abs_fresh fresh_atm fresh_prod intro: nrename_fresh_interesting1)[1]
  1838 apply(simp add: fresh_atm)
  1839 apply(simp add: fresh_atm)
  1840 (* ImpL *)
  1841 apply(auto dest: fin_crename simp add: fresh_prod fresh_atm)[1]
  1842 apply(drule sym) 
  1843 apply(drule nrename_Cut)
  1844 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1845 apply(simp add: fresh_prod abs_fresh fresh_atm abs_supp fin_supp)
  1846 apply(auto)[1]
  1847 apply(drule nrename_ImpL)
  1848 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1849 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1850 apply(simp add: fresh_prod fresh_atm)
  1851 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1852 apply(drule nrename_ImpR)
  1853 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1854 apply(simp add: fresh_prod abs_fresh fresh_atm)
  1855 apply(auto simp add: abs_fresh fresh_prod fresh_atm)[1]
  1856 apply(rule_tac x="Cut <a>.(Cut <c>.M'a (x).N') (y).N'a" in exI)
  1857 apply(rule conjI)
  1858 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1859 apply(rule l_redu.intros)
  1860 apply(auto simp add: fresh_atm abs_fresh abs_supp fin_supp fresh_prod intro: nrename_fresh_interesting1)[1]
  1861 apply(auto simp add: abs_fresh fresh_atm abs_supp fin_supp fresh_prod intro: nrename_fresh_interesting2)[1]
  1862 apply(auto simp add: abs_fresh fresh_atm abs_supp fin_supp fresh_prod intro: nrename_fresh_interesting1)[1]
  1863 apply(auto simp add: abs_fresh fresh_atm abs_supp fin_supp fresh_prod intro: nrename_fresh_interesting2)[1]
  1864 apply(auto simp add: abs_fresh fresh_atm abs_supp fin_supp fresh_prod intro: nrename_fresh_interesting2)[1]
  1865 apply(auto simp add: abs_fresh fresh_atm abs_supp fin_supp fresh_prod intro: nrename_fresh_interesting2)[1]
  1866 done
  1867 
  1868 lemma nrename_aredu:
  1869   assumes a: "(M[x\<turnstile>n>y]) \<longrightarrow>\<^isub>a M'" "x\<noteq>y"
  1870   shows "\<exists>M0. M0[x\<turnstile>n>y]=M' \<and> M \<longrightarrow>\<^isub>a M0"
  1871 using a
  1872 apply(nominal_induct "M[x\<turnstile>n>y]" M' avoiding: M x y rule: a_redu.strong_induct)
  1873 apply(drule  nrename_lredu)
  1874 apply(blast)
  1875 apply(drule  nrename_credu)
  1876 apply(blast)
  1877 (* Cut *)
  1878 apply(drule sym)
  1879 apply(drule nrename_Cut)
  1880 apply(simp)
  1881 apply(simp)
  1882 apply(auto)[1]
  1883 apply(drule_tac x="M'a" in meta_spec)
  1884 apply(drule_tac x="xa" in meta_spec)
  1885 apply(drule_tac x="y" in meta_spec)
  1886 apply(auto)[1]
  1887 apply(rule_tac x="Cut <a>.M0 (x).N'" in exI)
  1888 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1889 apply(rule conjI)
  1890 apply(rule trans)
  1891 apply(rule nrename.simps)
  1892 apply(drule nrename_fresh_interesting2)
  1893 apply(simp add: fresh_a_redu)
  1894 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  1895 apply(drule nrename_fresh_interesting1)
  1896 apply(simp add: fresh_prod fresh_atm)
  1897 apply(simp add: fresh_a_redu)
  1898 apply(simp)
  1899 apply(auto)[1]
  1900 apply(drule sym)
  1901 apply(drule nrename_Cut)
  1902 apply(simp)
  1903 apply(simp)
  1904 apply(auto)[1]
  1905 apply(drule_tac x="N'a" in meta_spec)
  1906 apply(drule_tac x="xa" in meta_spec)
  1907 apply(drule_tac x="y" in meta_spec)
  1908 apply(auto)[1]
  1909 apply(rule_tac x="Cut <a>.M' (x).M0" in exI)
  1910 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1911 apply(rule conjI)
  1912 apply(rule trans)
  1913 apply(rule nrename.simps)
  1914 apply(simp add: fresh_a_redu)
  1915 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm fresh_prod)[1]
  1916 apply(simp)
  1917 apply(auto)[1]
  1918 (* NotL *)
  1919 apply(drule sym)
  1920 apply(frule nrename_NotL_aux)
  1921 apply(erule disjE)
  1922 apply(auto)[1]
  1923 apply(drule nrename_NotL')
  1924 apply(simp)
  1925 apply(simp add: fresh_atm)
  1926 apply(erule disjE)
  1927 apply(auto)[1]
  1928 apply(drule_tac x="N'" in meta_spec)
  1929 apply(drule_tac x="xa" in meta_spec)
  1930 apply(drule_tac x="y" in meta_spec)
  1931 apply(auto)[1]
  1932 apply(rule_tac x="NotL <a>.M0 x" in exI)
  1933 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1934 apply(auto)[1]
  1935 apply(auto)[1]
  1936 apply(drule_tac x="N'" in meta_spec)
  1937 apply(drule_tac x="xa" in meta_spec)
  1938 apply(drule_tac x="x" in meta_spec)
  1939 apply(auto)[1]
  1940 apply(rule_tac x="NotL <a>.M0 xa" in exI)
  1941 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1942 apply(auto)[1]
  1943 (* NotR *)
  1944 apply(drule sym)
  1945 apply(drule nrename_NotR)
  1946 apply(simp)
  1947 apply(auto)[1]
  1948 apply(drule_tac x="N'" in meta_spec)
  1949 apply(drule_tac x="xa" in meta_spec)
  1950 apply(drule_tac x="y" in meta_spec)
  1951 apply(auto)[1]
  1952 apply(rule_tac x="NotR (x).M0 a" in exI)
  1953 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1954 apply(auto)[1]
  1955 (* AndR *)
  1956 apply(drule sym)
  1957 apply(drule nrename_AndR)
  1958 apply(simp)
  1959 apply(auto simp add: fresh_atm fresh_prod)[1]
  1960 apply(auto simp add: fresh_atm fresh_prod)[1]
  1961 apply(auto)[1]
  1962 apply(drule_tac x="M'a" in meta_spec)
  1963 apply(drule_tac x="x" in meta_spec)
  1964 apply(drule_tac x="y" in meta_spec)
  1965 apply(auto)[1]
  1966 apply(rule_tac x="AndR <a>.M0 <b>.N' c" in exI)
  1967 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1968 apply(auto)[1]
  1969 apply(rule trans)
  1970 apply(rule nrename.simps)
  1971 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm fresh_prod)[1]
  1972 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  1973 apply(auto intro: fresh_a_redu)[1]
  1974 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  1975 apply(simp)
  1976 apply(drule sym)
  1977 apply(drule nrename_AndR)
  1978 apply(simp)
  1979 apply(auto simp add: fresh_atm fresh_prod)[1]
  1980 apply(auto simp add: fresh_atm fresh_prod)[1]
  1981 apply(auto)[1]
  1982 apply(drule_tac x="N'a" in meta_spec)
  1983 apply(drule_tac x="x" in meta_spec)
  1984 apply(drule_tac x="y" in meta_spec)
  1985 apply(auto)[1]
  1986 apply(rule_tac x="AndR <a>.M' <b>.M0 c" in exI)
  1987 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  1988 apply(auto)[1]
  1989 apply(rule trans)
  1990 apply(rule nrename.simps)
  1991 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm fresh_prod)[1]
  1992 apply(auto intro: fresh_a_redu)[1]
  1993 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  1994 apply(simp)
  1995 apply(simp)
  1996 (* AndL1 *)
  1997 apply(drule sym)
  1998 apply(frule nrename_AndL1_aux)
  1999 apply(erule disjE)
  2000 apply(auto)[1]
  2001 apply(drule nrename_AndL1')
  2002 apply(simp)
  2003 apply(simp add: fresh_atm)
  2004 apply(erule disjE)
  2005 apply(auto)[1]
  2006 apply(drule_tac x="N'" in meta_spec)
  2007 apply(drule_tac x="xa" in meta_spec)
  2008 apply(drule_tac x="ya" in meta_spec)
  2009 apply(auto)[1]
  2010 apply(rule_tac x="AndL1 (x).M0 y" in exI)
  2011 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2012 apply(auto)[1]
  2013 apply(auto)[1]
  2014 apply(drule_tac x="N'" in meta_spec)
  2015 apply(drule_tac x="xa" in meta_spec)
  2016 apply(drule_tac x="y" in meta_spec)
  2017 apply(auto)[1]
  2018 apply(rule_tac x="AndL1 (x).M0 xa" in exI)
  2019 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2020 apply(auto)[1]
  2021 (* AndL2 *)
  2022 apply(drule sym)
  2023 apply(frule nrename_AndL2_aux)
  2024 apply(erule disjE)
  2025 apply(auto)[1]
  2026 apply(drule nrename_AndL2')
  2027 apply(simp)
  2028 apply(simp add: fresh_atm)
  2029 apply(erule disjE)
  2030 apply(auto)[1]
  2031 apply(drule_tac x="N'" in meta_spec)
  2032 apply(drule_tac x="xa" in meta_spec)
  2033 apply(drule_tac x="ya" in meta_spec)
  2034 apply(auto)[1]
  2035 apply(rule_tac x="AndL2 (x).M0 y" in exI)
  2036 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2037 apply(auto)[1]
  2038 apply(auto)[1]
  2039 apply(drule_tac x="N'" in meta_spec)
  2040 apply(drule_tac x="xa" in meta_spec)
  2041 apply(drule_tac x="y" in meta_spec)
  2042 apply(auto)[1]
  2043 apply(rule_tac x="AndL2 (x).M0 xa" in exI)
  2044 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2045 apply(auto)[1]
  2046 (* OrL *)
  2047 apply(drule sym)
  2048 apply(frule nrename_OrL_aux)
  2049 apply(erule disjE)
  2050 apply(auto)[1]
  2051 apply(drule nrename_OrL')
  2052 apply(simp add: fresh_prod fresh_atm)
  2053 apply(simp add: fresh_atm)
  2054 apply(simp add: fresh_atm)
  2055 apply(erule disjE)
  2056 apply(auto)[1]
  2057 apply(drule_tac x="M'a" in meta_spec)
  2058 apply(drule_tac x="xa" in meta_spec)
  2059 apply(drule_tac x="ya" in meta_spec)
  2060 apply(auto)[1]
  2061 apply(rule_tac x="OrL (x).M0 (y).N' z" in exI)
  2062 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2063 apply(auto)[1]
  2064 apply(rule trans)
  2065 apply(rule nrename.simps)
  2066 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2067 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2068 apply(auto intro: fresh_a_redu)[1]
  2069 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2070 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2071 apply(auto)[1]
  2072 apply(drule_tac x="M'a" in meta_spec)
  2073 apply(drule_tac x="xa" in meta_spec)
  2074 apply(drule_tac x="z" in meta_spec)
  2075 apply(auto)[1]
  2076 apply(rule_tac x="OrL (x).M0 (y).N' xa" in exI)
  2077 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2078 apply(auto)[1]
  2079 apply(rule trans)
  2080 apply(rule nrename.simps)
  2081 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2082 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2083 apply(auto intro: fresh_a_redu)[1]
  2084 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2085 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2086 apply(drule sym)
  2087 apply(frule nrename_OrL_aux)
  2088 apply(erule disjE)
  2089 apply(auto)[1]
  2090 apply(drule nrename_OrL')
  2091 apply(simp add: fresh_prod fresh_atm)
  2092 apply(simp add: fresh_atm)
  2093 apply(simp add: fresh_atm)
  2094 apply(erule disjE)
  2095 apply(auto)[1]
  2096 apply(drule_tac x="N'a" in meta_spec)
  2097 apply(drule_tac x="xa" in meta_spec)
  2098 apply(drule_tac x="ya" in meta_spec)
  2099 apply(auto)[1]
  2100 apply(rule_tac x="OrL (x).M' (y).M0 z" in exI)
  2101 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2102 apply(auto)[1]
  2103 apply(rule trans)
  2104 apply(rule nrename.simps)
  2105 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm fresh_prod)[1]
  2106 apply(auto intro: fresh_a_redu)[1]
  2107 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2108 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2109 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2110 apply(auto)[1]
  2111 apply(drule_tac x="N'a" in meta_spec)
  2112 apply(drule_tac x="xa" in meta_spec)
  2113 apply(drule_tac x="z" in meta_spec)
  2114 apply(auto)[1]
  2115 apply(rule_tac x="OrL (x).M' (y).M0 xa" in exI)
  2116 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2117 apply(auto)[1]
  2118 apply(rule trans)
  2119 apply(rule nrename.simps)
  2120 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm fresh_prod)[1]
  2121 apply(auto intro: fresh_a_redu)[1]
  2122 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2123 apply(simp)
  2124 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2125 (* OrR1 *)
  2126 apply(drule sym)
  2127 apply(drule nrename_OrR1)
  2128 apply(simp)
  2129 apply(auto)[1]
  2130 apply(drule_tac x="N'" in meta_spec)
  2131 apply(drule_tac x="x" in meta_spec)
  2132 apply(drule_tac x="y" in meta_spec)
  2133 apply(auto)[1]
  2134 apply(rule_tac x="OrR1 <a>.M0 b" in exI)
  2135 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2136 apply(auto)[1]
  2137 (* OrR2 *)
  2138 apply(drule sym)
  2139 apply(drule nrename_OrR2)
  2140 apply(simp)
  2141 apply(auto)[1]
  2142 apply(drule_tac x="N'" in meta_spec)
  2143 apply(drule_tac x="x" in meta_spec)
  2144 apply(drule_tac x="y" in meta_spec)
  2145 apply(auto)[1]
  2146 apply(rule_tac x="OrR2 <a>.M0 b" in exI)
  2147 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2148 apply(auto)[1]
  2149 (* ImpL *)
  2150 apply(drule sym)
  2151 apply(frule nrename_ImpL_aux)
  2152 apply(erule disjE)
  2153 apply(auto)[1]
  2154 apply(drule nrename_ImpL')
  2155 apply(simp add: fresh_prod fresh_atm)
  2156 apply(simp add: fresh_atm)
  2157 apply(simp add: fresh_atm)
  2158 apply(erule disjE)
  2159 apply(auto)[1]
  2160 apply(drule_tac x="M'a" in meta_spec)
  2161 apply(drule_tac x="xa" in meta_spec)
  2162 apply(drule_tac x="ya" in meta_spec)
  2163 apply(auto)[1]
  2164 apply(rule_tac x="ImpL <a>.M0 (x).N' y" in exI)
  2165 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2166 apply(auto)[1]
  2167 apply(rule trans)
  2168 apply(rule nrename.simps)
  2169 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2170 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2171 apply(auto intro: fresh_a_redu)[1]
  2172 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2173 apply(auto)[1]
  2174 apply(drule_tac x="M'a" in meta_spec)
  2175 apply(drule_tac x="xa" in meta_spec)
  2176 apply(drule_tac x="y" in meta_spec)
  2177 apply(auto)[1]
  2178 apply(rule_tac x="ImpL <a>.M0 (x).N' xa" in exI)
  2179 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2180 apply(auto)[1]
  2181 apply(rule trans)
  2182 apply(rule nrename.simps)
  2183 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2184 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2185 apply(auto intro: fresh_a_redu)[1]
  2186 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2187 apply(drule sym)
  2188 apply(frule nrename_ImpL_aux)
  2189 apply(erule disjE)
  2190 apply(auto)[1]
  2191 apply(drule nrename_ImpL')
  2192 apply(simp add: fresh_prod fresh_atm)
  2193 apply(simp add: fresh_atm)
  2194 apply(simp add: fresh_atm)
  2195 apply(erule disjE)
  2196 apply(auto)[1]
  2197 apply(drule_tac x="N'a" in meta_spec)
  2198 apply(drule_tac x="xa" in meta_spec)
  2199 apply(drule_tac x="ya" in meta_spec)
  2200 apply(auto)[1]
  2201 apply(rule_tac x="ImpL <a>.M' (x).M0 y" in exI)
  2202 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2203 apply(auto)[1]
  2204 apply(rule trans)
  2205 apply(rule nrename.simps)
  2206 apply(auto intro: fresh_a_redu)[1]
  2207 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2208 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2209 apply(auto)[1]
  2210 apply(drule_tac x="N'a" in meta_spec)
  2211 apply(drule_tac x="xa" in meta_spec)
  2212 apply(drule_tac x="y" in meta_spec)
  2213 apply(auto)[1]
  2214 apply(rule_tac x="ImpL <a>.M' (x).M0 xa" in exI)
  2215 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2216 apply(auto)[1]
  2217 apply(rule trans)
  2218 apply(rule nrename.simps)
  2219 apply(auto intro: fresh_a_redu)[1]
  2220 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2221 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp fresh_atm)[1]
  2222 (* ImpR *)
  2223 apply(drule sym)
  2224 apply(drule nrename_ImpR)
  2225 apply(simp)
  2226 apply(simp)
  2227 apply(auto)[1]
  2228 apply(drule_tac x="N'" in meta_spec)
  2229 apply(drule_tac x="xa" in meta_spec)
  2230 apply(drule_tac x="y" in meta_spec)
  2231 apply(auto)[1]
  2232 apply(rule_tac x="ImpR (x).<a>.M0 b" in exI)
  2233 apply(simp add: abs_fresh abs_supp fin_supp fresh_atm)[1]
  2234 apply(auto)[1]
  2235 done
  2236 
  2237 lemma SNa_preserved_renaming2:
  2238   assumes a: "SNa N"
  2239   shows "SNa (N[x\<turnstile>n>y])"
  2240 using a
  2241 apply(induct rule: SNa_induct)
  2242 apply(case_tac "x=y")
  2243 apply(simp add: nrename_id)
  2244 apply(rule SNaI)
  2245 apply(drule nrename_aredu)
  2246 apply(blast)+
  2247 done
  2248 
  2249 text {* helper-stuff to set up the induction *}
  2250 
  2251 abbreviation
  2252   SNa_set :: "trm set"
  2253 where
  2254   "SNa_set \<equiv> {M. SNa M}"
  2255 
  2256 abbreviation
  2257   A_Redu_set :: "(trm\<times>trm) set"
  2258 where
  2259  "A_Redu_set \<equiv> {(N,M)| M N. M \<longrightarrow>\<^isub>a N}"
  2260 
  2261 lemma SNa_elim:
  2262   assumes a: "SNa M"
  2263   shows "(\<forall>M. (\<forall>N. M \<longrightarrow>\<^isub>a N \<longrightarrow> P N)\<longrightarrow> P M) \<longrightarrow> P M"
  2264 using a
  2265 by (induct rule: SNa.induct) (blast)
  2266 
  2267 lemma wf_SNa_restricted:
  2268   shows "wf (A_Redu_set \<inter> (UNIV <*> SNa_set))"
  2269 apply(unfold wf_def)
  2270 apply(intro strip)
  2271 apply(case_tac "SNa x")
  2272 apply(simp (no_asm_use))
  2273 apply(drule_tac P="P" in SNa_elim)
  2274 apply(erule mp)
  2275 apply(blast)
  2276 (* other case *)
  2277 apply(drule_tac x="x" in spec)
  2278 apply(erule mp)
  2279 apply(fast)
  2280 done
  2281 
  2282 definition SNa_Redu :: "(trm \<times> trm) set" where
  2283   "SNa_Redu \<equiv> A_Redu_set \<inter> (UNIV <*> SNa_set)"
  2284 
  2285 lemma wf_SNa_Redu:
  2286   shows "wf SNa_Redu"
  2287 apply(unfold SNa_Redu_def)
  2288 apply(rule wf_SNa_restricted)
  2289 done
  2290 
  2291 lemma wf_measure_triple:
  2292 shows "wf ((measure size) <*lex*> SNa_Redu <*lex*> SNa_Redu)"
  2293 by (auto intro: wf_SNa_Redu)
  2294 
  2295 lemma my_wf_induct_triple: 
  2296  assumes a: " wf(r1 <*lex*> r2 <*lex*> r3)"           
  2297  and     b: "\<And>x. \<lbrakk>\<And>y. ((fst y,fst (snd y),snd (snd y)),(fst x,fst (snd x), snd (snd x))) 
  2298                                     \<in> (r1 <*lex*> r2 <*lex*> r3) \<longrightarrow> P y\<rbrakk> \<Longrightarrow> P x"  
  2299  shows "P x"
  2300 using a
  2301 apply(induct x rule: wf_induct_rule)
  2302 apply(rule b)
  2303 apply(simp)
  2304 done
  2305 
  2306 lemma my_wf_induct_triple': 
  2307  assumes a: " wf(r1 <*lex*> r2 <*lex*> r3)"           
  2308  and    b: "\<And>x1 x2 x3. \<lbrakk>\<And>y1 y2 y3. ((y1,y2,y3),(x1,x2,x3)) \<in> (r1 <*lex*> r2 <*lex*> r3) \<longrightarrow> P (y1,y2,y3)\<rbrakk> 
  2309              \<Longrightarrow> P (x1,x2,x3)"  
  2310  shows "P (x1,x2,x3)"
  2311 apply(rule_tac my_wf_induct_triple[OF a])
  2312 apply(case_tac x rule: prod.exhaust)
  2313 apply(simp)
  2314 apply(case_tac b)
  2315 apply(simp)
  2316 apply(rule b)
  2317 apply(blast)
  2318 done
  2319 
  2320 lemma my_wf_induct_triple'': 
  2321  assumes a: " wf(r1 <*lex*> r2 <*lex*> r3)"           
  2322  and     b: "\<And>x1 x2 x3. \<lbrakk>\<And>y1 y2 y3. ((y1,y2,y3),(x1,x2,x3)) \<in> (r1 <*lex*> r2 <*lex*> r3) \<longrightarrow> P y1 y2 y3\<rbrakk>
  2323                \<Longrightarrow> P x1 x2 x3"  
  2324  shows "P x1 x2 x3"
  2325 apply(rule_tac my_wf_induct_triple'[where P="\<lambda>(x1,x2,x3). P x1 x2 x3", simplified])
  2326 apply(rule a)
  2327 apply(rule b)
  2328 apply(auto)
  2329 done
  2330 
  2331 lemma excluded_m:
  2332   assumes a: "<a>:M \<in> (\<parallel><B>\<parallel>)" "(x):N \<in> (\<parallel>(B)\<parallel>)"
  2333   shows "(<a>:M \<in> BINDINGc B (\<parallel>(B)\<parallel>) \<or> (x):N \<in> BINDINGn B (\<parallel><B>\<parallel>))
  2334       \<or>\<not>(<a>:M \<in> BINDINGc B (\<parallel>(B)\<parallel>) \<or> (x):N \<in> BINDINGn B (\<parallel><B>\<parallel>))"
  2335 by (blast)
  2336 
  2337 lemma tricky_subst:
  2338   assumes a1: "b\<sharp>(c,N)"
  2339   and     a2: "z\<sharp>(x,P)"
  2340   and     a3: "M\<noteq>Ax z b"
  2341   shows "(Cut <c>.N (z).M){b:=(x).P} = Cut <c>.N (z).(M{b:=(x).P})"
  2342 using a1 a2 a3
  2343 apply -
  2344 apply(generate_fresh "coname")
  2345 apply(subgoal_tac "Cut <c>.N (z).M = Cut <ca>.([(ca,c)]\<bullet>N) (z).M")
  2346 apply(simp)
  2347 apply(rule trans)
  2348 apply(rule better_Cut_substc)
  2349 apply(simp)
  2350 apply(simp add: abs_fresh)
  2351 apply(simp)
  2352 apply(subgoal_tac "b\<sharp>([(ca,c)]\<bullet>N)")
  2353 apply(simp add: forget)
  2354 apply(simp add: trm.inject)
  2355 apply(simp add: fresh_left calc_atm fresh_prod fresh_atm)
  2356 apply(simp add: trm.inject)
  2357 apply(rule sym)
  2358 apply(simp add: alpha fresh_prod fresh_atm)
  2359 done
  2360 
  2361 text {* 3rd lemma *}
  2362 
  2363 lemma CUT_SNa_aux:
  2364   assumes a1: "<a>:M \<in> (\<parallel><B>\<parallel>)"
  2365   and     a2: "SNa M"
  2366   and     a3: "(x):N \<in> (\<parallel>(B)\<parallel>)"
  2367   and     a4: "SNa N"
  2368   shows   "SNa (Cut <a>.M (x).N)"
  2369 using a1 a2 a3 a4
  2370 apply(induct B M N arbitrary: a x rule: my_wf_induct_triple''[OF wf_measure_triple])
  2371 apply(rule SNaI)
  2372 apply(drule Cut_a_redu_elim)
  2373 apply(erule disjE)
  2374 (* left-inner reduction *)
  2375 apply(erule exE)
  2376 apply(erule conjE)+
  2377 apply(simp)
  2378 apply(drule_tac x="x1" in meta_spec)
  2379 apply(drule_tac x="M'a" in meta_spec)
  2380 apply(drule_tac x="x3" in meta_spec)
  2381 apply(drule conjunct2)
  2382 apply(drule mp)
  2383 apply(rule conjI)
  2384 apply(simp)
  2385 apply(rule disjI1)
  2386 apply(simp add: SNa_Redu_def)
  2387 apply(drule_tac x="a" in spec)
  2388 apply(drule mp)
  2389 apply(simp add: CANDs_preserved_single)
  2390 apply(drule mp)
  2391 apply(simp add: a_preserves_SNa)
  2392 apply(drule_tac x="x" in spec)
  2393 apply(simp)
  2394 apply(erule disjE)
  2395 (* right-inner reduction *)
  2396 apply(erule exE)
  2397 apply(erule conjE)+
  2398 apply(simp)
  2399 apply(drule_tac x="x1" in meta_spec)
  2400 apply(drule_tac x="x2" in meta_spec)
  2401 apply(drule_tac x="N'" in meta_spec)
  2402 apply(drule conjunct2)
  2403 apply(drule mp)
  2404 apply(rule conjI)
  2405 apply(simp)
  2406 apply(rule disjI2)
  2407 apply(simp add: SNa_Redu_def)
  2408 apply(drule_tac x="a" in spec)
  2409 apply(drule mp)
  2410 apply(simp add: CANDs_preserved_single)
  2411 apply(drule mp)
  2412 apply(assumption)
  2413 apply(drule_tac x="x" in spec)
  2414 apply(drule mp)
  2415 apply(simp add: CANDs_preserved_single)
  2416 apply(drule mp)
  2417 apply(simp add: a_preserves_SNa)
  2418 apply(assumption)
  2419 apply(erule disjE)
  2420 (******** c-reduction *********)
  2421 apply(drule Cut_c_redu_elim)
  2422 (* c-left reduction*)
  2423 apply(erule disjE)
  2424 apply(erule conjE)
  2425 apply(frule_tac B="x1" in fic_CANDS)
  2426 apply(simp)
  2427 apply(erule disjE)
  2428 (* in AXIOMSc *)
  2429 apply(simp add: AXIOMSc_def)
  2430 apply(erule exE)+
  2431 apply(simp add: ctrm.inject)
  2432 apply(simp add: alpha)
  2433 apply(erule disjE)
  2434 apply(simp)
  2435 apply(rule impI)
  2436 apply(simp)
  2437 apply(subgoal_tac "fic (Ax y b) b")(*A*)
  2438 apply(simp)
  2439 (*A*)
  2440 apply(auto)[1]
  2441 apply(simp)
  2442 apply(rule impI)
  2443 apply(simp)
  2444 apply(subgoal_tac "fic (Ax ([(a,aa)]\<bullet>y) a) a")(*B*)
  2445 apply(simp)
  2446 (*B*)
  2447 apply(auto)[1]
  2448 (* in BINDINGc *)
  2449 apply(simp)
  2450 apply(drule BINDINGc_elim)
  2451 apply(simp)
  2452 (* c-right reduction*)
  2453 apply(erule conjE)
  2454 apply(frule_tac B="x1" in fin_CANDS)
  2455 apply(simp)
  2456 apply(erule disjE)
  2457 (* in AXIOMSc *)
  2458 apply(simp add: AXIOMSn_def)
  2459 apply(erule exE)+
  2460 apply(simp add: ntrm.inject)
  2461 apply(simp add: alpha)
  2462 apply(erule disjE)
  2463 apply(simp)
  2464 apply(rule impI)
  2465 apply(simp)
  2466 apply(subgoal_tac "fin (Ax xa b) xa")(*A*)
  2467 apply(simp)
  2468 (*A*)
  2469 apply(auto)[1]
  2470 apply(simp)
  2471 apply(rule impI)
  2472 apply(simp)
  2473 apply(subgoal_tac "fin (Ax x ([(x,xa)]\<bullet>b)) x")(*B*)
  2474 apply(simp)
  2475 (*B*)
  2476 apply(auto)[1]
  2477 (* in BINDINGc *)
  2478 apply(simp)
  2479 apply(drule BINDINGn_elim)
  2480 apply(simp)
  2481 (*********** l-reductions ************)
  2482 apply(drule Cut_l_redu_elim)
  2483 apply(erule disjE)
  2484 (* ax1 *)
  2485 apply(erule exE)
  2486 apply(simp)
  2487 apply(simp add: SNa_preserved_renaming1)
  2488 apply(erule disjE)
  2489 (* ax2 *)
  2490 apply(erule exE)
  2491 apply(simp add: SNa_preserved_renaming2)
  2492 apply(erule disjE)
  2493 (* LNot *)
  2494 apply(erule exE)+
  2495 apply(auto)[1]
  2496 apply(frule_tac excluded_m)
  2497 apply(assumption)
  2498 apply(erule disjE)
  2499 (* one of them in BINDING *)
  2500 apply(erule disjE)
  2501 apply(drule fin_elims)
  2502 apply(drule fic_elims)
  2503 apply(simp)
  2504 apply(drule BINDINGc_elim)
  2505 apply(drule_tac x="x" in spec)
  2506 apply(drule_tac x="NotL <b>.N' x" in spec)
  2507 apply(simp)
  2508 apply(simp add: better_NotR_substc)
  2509 apply(generate_fresh "coname")
  2510 apply(subgoal_tac "fresh_fun (\<lambda>a'. Cut <a'>.NotR (y).M'a a' (x).NotL <b>.N' x) 
  2511                    =  Cut <c>.NotR (y).M'a c (x).NotL <b>.N' x")
  2512 apply(simp)
  2513 apply(subgoal_tac "Cut <c>.NotR (y).M'a c (x).NotL <b>.N' x \<longrightarrow>\<^isub>a Cut <b>.N' (y).M'a")
  2514 apply(simp only: a_preserves_SNa)
  2515 apply(rule al_redu)
  2516 apply(rule better_LNot_intro)
  2517 apply(simp)
  2518 apply(simp)
  2519 apply(fresh_fun_simp (no_asm))
  2520 apply(simp)
  2521 (* other case of in BINDING *)
  2522 apply(drule fin_elims)
  2523 apply(drule fic_elims)
  2524 apply(simp)
  2525 apply(drule BINDINGn_elim)
  2526 apply(drule_tac x="a" in spec)
  2527 apply(drule_tac x="NotR (y).M'a a" in spec)
  2528 apply(simp)
  2529 apply(simp add: better_NotL_substn)
  2530 apply(generate_fresh "name")
  2531 apply(subgoal_tac "fresh_fun (\<lambda>x'. Cut <a>.NotR (y).M'a a (x').NotL <b>.N' x') 
  2532                    = Cut <a>.NotR (y).M'a a (c).NotL <b>.N' c")
  2533 apply(simp)
  2534 apply(subgoal_tac "Cut <a>.NotR (y).M'a a (c).NotL <b>.N' c \<longrightarrow>\<^isub>a Cut <b>.N' (y).M'a")
  2535 apply(simp only: a_preserves_SNa)
  2536 apply(rule al_redu)
  2537 apply(rule better_LNot_intro)
  2538 apply(simp)
  2539 apply(simp)
  2540 apply(fresh_fun_simp (no_asm))
  2541 apply(simp)
  2542 (* none of them in BINDING *)
  2543 apply(simp)
  2544 apply(erule conjE)
  2545 apply(frule CAND_NotR_elim)
  2546 apply(assumption)
  2547 apply(erule exE)
  2548 apply(frule CAND_NotL_elim)
  2549 apply(assumption)
  2550 apply(erule exE)
  2551 apply(simp only: ty.inject)
  2552 apply(drule_tac x="B'" in meta_spec)
  2553 apply(drule_tac x="N'" in meta_spec)
  2554 apply(drule_tac x="M'a" in meta_spec)
  2555 apply(erule conjE)+
  2556 apply(drule mp)
  2557 apply(simp)
  2558 apply(drule_tac x="b" in spec)
  2559 apply(rotate_tac 13)
  2560 apply(drule mp)
  2561 apply(assumption)
  2562 apply(rotate_tac 13)
  2563 apply(drule mp)
  2564 apply(simp add: CANDs_imply_SNa)
  2565 apply(drule_tac x="y" in spec)
  2566 apply(rotate_tac 13)
  2567 apply(drule mp)
  2568 apply(assumption)
  2569 apply(rotate_tac 13)
  2570 apply(drule mp)
  2571 apply(simp add: CANDs_imply_SNa)
  2572 apply(assumption)
  2573 (* LAnd1 case *)
  2574 apply(erule disjE)
  2575 apply(erule exE)+
  2576 apply(auto)[1]
  2577 apply(frule_tac excluded_m)
  2578 apply(assumption)
  2579 apply(erule disjE)
  2580 (* one of them in BINDING *)
  2581 apply(erule disjE)
  2582 apply(drule fin_elims)
  2583 apply(drule fic_elims)
  2584 apply(simp)
  2585 apply(drule BINDINGc_elim)
  2586 apply(drule_tac x="x" in spec)
  2587 apply(drule_tac x="AndL1 (y).N' x" in spec)
  2588 apply(simp)
  2589 apply(simp add: better_AndR_substc)
  2590 apply(generate_fresh "coname")
  2591 apply(subgoal_tac "fresh_fun (\<lambda>a'. Cut <a'>.AndR <b>.M1 <c>.M2 a' (x).AndL1 (y).N' x) 
  2592                    = Cut <ca>.AndR <b>.M1 <c>.M2 ca (x).AndL1 (y).N' x")
  2593 apply(simp)
  2594 apply(subgoal_tac "Cut <ca>.AndR <b>.M1 <c>.M2 ca (x).AndL1 (y).N' x \<longrightarrow>\<^isub>a Cut <b>.M1 (y).N'")
  2595 apply(auto intro: a_preserves_SNa)[1]
  2596 apply(rule al_redu)
  2597 apply(rule better_LAnd1_intro)
  2598 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2599 apply(simp)
  2600 apply(fresh_fun_simp (no_asm))
  2601 apply(simp)
  2602 (* other case of in BINDING *)
  2603 apply(drule fin_elims)
  2604 apply(drule fic_elims)
  2605 apply(simp)
  2606 apply(drule BINDINGn_elim)
  2607 apply(drule_tac x="a" in spec)
  2608 apply(drule_tac x="AndR <b>.M1 <c>.M2 a" in spec)
  2609 apply(simp)
  2610 apply(simp add: better_AndL1_substn)
  2611 apply(generate_fresh "name")
  2612 apply(subgoal_tac "fresh_fun (\<lambda>z'. Cut <a>.AndR <b>.M1 <c>.M2 a (z').AndL1 (y).N' z') 
  2613                    = Cut <a>.AndR <b>.M1 <c>.M2 a (ca).AndL1 (y).N' ca")
  2614 apply(simp)
  2615 apply(subgoal_tac "Cut <a>.AndR <b>.M1 <c>.M2 a (ca).AndL1 (y).N' ca \<longrightarrow>\<^isub>a Cut <b>.M1 (y).N'")
  2616 apply(auto intro: a_preserves_SNa)[1]
  2617 apply(rule al_redu)
  2618 apply(rule better_LAnd1_intro)
  2619 apply(simp add: abs_fresh fresh_prod fresh_atm) 
  2620 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2621 apply(fresh_fun_simp (no_asm))
  2622 apply(simp)
  2623 (* none of them in BINDING *)
  2624 apply(simp)
  2625 apply(erule conjE)
  2626 apply(frule CAND_AndR_elim)
  2627 apply(assumption)
  2628 apply(erule exE)
  2629 apply(frule CAND_AndL1_elim)
  2630 apply(assumption)
  2631 apply(erule exE)+
  2632 apply(simp only: ty.inject)
  2633 apply(drule_tac x="B1" in meta_spec)
  2634 apply(drule_tac x="M1" in meta_spec)
  2635 apply(drule_tac x="N'" in meta_spec)
  2636 apply(erule conjE)+
  2637 apply(drule mp)
  2638 apply(simp)
  2639 apply(drule_tac x="b" in spec)
  2640 apply(rotate_tac 14)
  2641 apply(drule mp)
  2642 apply(assumption)
  2643 apply(rotate_tac 14)
  2644 apply(drule mp)
  2645 apply(simp add: CANDs_imply_SNa)
  2646 apply(drule_tac x="y" in spec)
  2647 apply(rotate_tac 15)
  2648 apply(drule mp)
  2649 apply(assumption)
  2650 apply(rotate_tac 15)
  2651 apply(drule mp)
  2652 apply(simp add: CANDs_imply_SNa)
  2653 apply(assumption)
  2654 (* LAnd2 case *)
  2655 apply(erule disjE)
  2656 apply(erule exE)+
  2657 apply(auto)[1]
  2658 apply(frule_tac excluded_m)
  2659 apply(assumption)
  2660 apply(erule disjE)
  2661 (* one of them in BINDING *)
  2662 apply(erule disjE)
  2663 apply(drule fin_elims)
  2664 apply(drule fic_elims)
  2665 apply(simp)
  2666 apply(drule BINDINGc_elim)
  2667 apply(drule_tac x="x" in spec)
  2668 apply(drule_tac x="AndL2 (y).N' x" in spec)
  2669 apply(simp)
  2670 apply(simp add: better_AndR_substc)
  2671 apply(generate_fresh "coname")
  2672 apply(subgoal_tac "fresh_fun (\<lambda>a'. Cut <a'>.AndR <b>.M1 <c>.M2 a' (x).AndL2 (y).N' x) 
  2673                    = Cut <ca>.AndR <b>.M1 <c>.M2 ca (x).AndL2 (y).N' x")
  2674 apply(simp)
  2675 apply(subgoal_tac "Cut <ca>.AndR <b>.M1 <c>.M2 ca (x).AndL2 (y).N' x \<longrightarrow>\<^isub>a Cut <c>.M2 (y).N'")
  2676 apply(auto intro: a_preserves_SNa)[1]
  2677 apply(rule al_redu)
  2678 apply(rule better_LAnd2_intro)
  2679 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2680 apply(simp)
  2681 apply(fresh_fun_simp (no_asm))
  2682 apply(simp)
  2683 (* other case of in BINDING *)
  2684 apply(drule fin_elims)
  2685 apply(drule fic_elims)
  2686 apply(simp)
  2687 apply(drule BINDINGn_elim)
  2688 apply(drule_tac x="a" in spec)
  2689 apply(drule_tac x="AndR <b>.M1 <c>.M2 a" in spec)
  2690 apply(simp)
  2691 apply(simp add: better_AndL2_substn)
  2692 apply(generate_fresh "name")
  2693 apply(subgoal_tac "fresh_fun (\<lambda>z'. Cut <a>.AndR <b>.M1 <c>.M2 a (z').AndL2 (y).N' z') 
  2694                    = Cut <a>.AndR <b>.M1 <c>.M2 a (ca).AndL2 (y).N' ca")
  2695 apply(simp)
  2696 apply(subgoal_tac "Cut <a>.AndR <b>.M1 <c>.M2 a (ca).AndL2 (y).N' ca \<longrightarrow>\<^isub>a Cut <c>.M2 (y).N'")
  2697 apply(auto intro: a_preserves_SNa)[1]
  2698 apply(rule al_redu)
  2699 apply(rule better_LAnd2_intro)
  2700 apply(simp add: abs_fresh fresh_prod fresh_atm) 
  2701 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2702 apply(fresh_fun_simp (no_asm))
  2703 apply(simp)
  2704 (* none of them in BINDING *)
  2705 apply(simp)
  2706 apply(erule conjE)
  2707 apply(frule CAND_AndR_elim)
  2708 apply(assumption)
  2709 apply(erule exE)
  2710 apply(frule CAND_AndL2_elim)
  2711 apply(assumption)
  2712 apply(erule exE)+
  2713 apply(simp only: ty.inject)
  2714 apply(drule_tac x="B2" in meta_spec)
  2715 apply(drule_tac x="M2" in meta_spec)
  2716 apply(drule_tac x="N'" in meta_spec)
  2717 apply(erule conjE)+
  2718 apply(drule mp)
  2719 apply(simp)
  2720 apply(drule_tac x="c" in spec)
  2721 apply(rotate_tac 14)
  2722 apply(drule mp)
  2723 apply(assumption)
  2724 apply(rotate_tac 14)
  2725 apply(drule mp)
  2726 apply(simp add: CANDs_imply_SNa)
  2727 apply(drule_tac x="y" in spec)
  2728 apply(rotate_tac 15)
  2729 apply(drule mp)
  2730 apply(assumption)
  2731 apply(rotate_tac 15)
  2732 apply(drule mp)
  2733 apply(simp add: CANDs_imply_SNa)
  2734 apply(assumption)
  2735 (* LOr1 case *)
  2736 apply(erule disjE)
  2737 apply(erule exE)+
  2738 apply(auto)[1]
  2739 apply(frule_tac excluded_m)
  2740 apply(assumption)
  2741 apply(erule disjE)
  2742 (* one of them in BINDING *)
  2743 apply(erule disjE)
  2744 apply(drule fin_elims)
  2745 apply(drule fic_elims)
  2746 apply(simp)
  2747 apply(drule BINDINGc_elim)
  2748 apply(drule_tac x="x" in spec)
  2749 apply(drule_tac x="OrL (z).M1 (y).M2 x" in spec)
  2750 apply(simp)
  2751 apply(simp add: better_OrR1_substc)
  2752 apply(generate_fresh "coname")
  2753 apply(subgoal_tac "fresh_fun (\<lambda>a'. Cut <a'>.OrR1 <b>.N' a' (x).OrL (z).M1 (y).M2 x) 
  2754                    = Cut <c>.OrR1 <b>.N' c (x).OrL (z).M1 (y).M2 x")
  2755 apply(simp)
  2756 apply(subgoal_tac "Cut <c>.OrR1 <b>.N' c (x).OrL (z).M1 (y).M2 x \<longrightarrow>\<^isub>a Cut <b>.N' (z).M1")
  2757 apply(auto intro: a_preserves_SNa)[1]
  2758 apply(rule al_redu)
  2759 apply(rule better_LOr1_intro)
  2760 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2761 apply(simp add: abs_fresh)
  2762 apply(fresh_fun_simp (no_asm))
  2763 apply(simp)
  2764 (* other case of in BINDING *)
  2765 apply(drule fin_elims)
  2766 apply(drule fic_elims)
  2767 apply(simp)
  2768 apply(drule BINDINGn_elim)
  2769 apply(drule_tac x="a" in spec)
  2770 apply(drule_tac x="OrR1 <b>.N' a" in spec)
  2771 apply(simp)
  2772 apply(simp add: better_OrL_substn)
  2773 apply(generate_fresh "name")
  2774 apply(subgoal_tac "fresh_fun (\<lambda>z'. Cut <a>.OrR1 <b>.N' a (z').OrL (z).M1 (y).M2 z') 
  2775                    = Cut <a>.OrR1 <b>.N' a (c).OrL (z).M1 (y).M2 c")
  2776 apply(simp)
  2777 apply(subgoal_tac "Cut <a>.OrR1 <b>.N' a (c).OrL (z).M1 (y).M2 c \<longrightarrow>\<^isub>a Cut <b>.N' (z).M1")
  2778 apply(auto intro: a_preserves_SNa)[1]
  2779 apply(rule al_redu)
  2780 apply(rule better_LOr1_intro)
  2781 apply(simp add: abs_fresh fresh_prod fresh_atm) 
  2782 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2783 apply(fresh_fun_simp (no_asm))
  2784 apply(simp)
  2785 (* none of them in BINDING *)
  2786 apply(simp)
  2787 apply(erule conjE)
  2788 apply(frule CAND_OrR1_elim)
  2789 apply(assumption)
  2790 apply(erule exE)+
  2791 apply(frule CAND_OrL_elim)
  2792 apply(assumption)
  2793 apply(erule exE)+
  2794 apply(simp only: ty.inject)
  2795 apply(drule_tac x="B1" in meta_spec)
  2796 apply(drule_tac x="N'" in meta_spec)
  2797 apply(drule_tac x="M1" in meta_spec)
  2798 apply(erule conjE)+
  2799 apply(drule mp)
  2800 apply(simp)
  2801 apply(drule_tac x="b" in spec)
  2802 apply(rotate_tac 15)
  2803 apply(drule mp)
  2804 apply(assumption)
  2805 apply(rotate_tac 15)
  2806 apply(drule mp)
  2807 apply(simp add: CANDs_imply_SNa)
  2808 apply(drule_tac x="z" in spec)
  2809 apply(rotate_tac 15)
  2810 apply(drule mp)
  2811 apply(assumption)
  2812 apply(rotate_tac 15)
  2813 apply(drule mp)
  2814 apply(simp add: CANDs_imply_SNa)
  2815 apply(assumption)
  2816 (* LOr2 case *)
  2817 apply(erule disjE)
  2818 apply(erule exE)+
  2819 apply(auto)[1]
  2820 apply(frule_tac excluded_m)
  2821 apply(assumption)
  2822 apply(erule disjE)
  2823 (* one of them in BINDING *)
  2824 apply(erule disjE)
  2825 apply(drule fin_elims)
  2826 apply(drule fic_elims)
  2827 apply(simp)
  2828 apply(drule BINDINGc_elim)
  2829 apply(drule_tac x="x" in spec)
  2830 apply(drule_tac x="OrL (z).M1 (y).M2 x" in spec)
  2831 apply(simp)
  2832 apply(simp add: better_OrR2_substc)
  2833 apply(generate_fresh "coname")
  2834 apply(subgoal_tac "fresh_fun (\<lambda>a'. Cut <a'>.OrR2 <b>.N' a' (x).OrL (z).M1 (y).M2 x) 
  2835                    = Cut <c>.OrR2 <b>.N' c (x).OrL (z).M1 (y).M2 x")
  2836 apply(simp)
  2837 apply(subgoal_tac "Cut <c>.OrR2 <b>.N' c (x).OrL (z).M1 (y).M2 x \<longrightarrow>\<^isub>a Cut <b>.N' (y).M2")
  2838 apply(auto intro: a_preserves_SNa)[1]
  2839 apply(rule al_redu)
  2840 apply(rule better_LOr2_intro)
  2841 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2842 apply(simp add: abs_fresh)
  2843 apply(fresh_fun_simp (no_asm))
  2844 apply(simp)
  2845 (* other case of in BINDING *)
  2846 apply(drule fin_elims)
  2847 apply(drule fic_elims)
  2848 apply(simp)
  2849 apply(drule BINDINGn_elim)
  2850 apply(drule_tac x="a" in spec)
  2851 apply(drule_tac x="OrR2 <b>.N' a" in spec)
  2852 apply(simp)
  2853 apply(simp add: better_OrL_substn)
  2854 apply(generate_fresh "name")
  2855 apply(subgoal_tac "fresh_fun (\<lambda>z'. Cut <a>.OrR2 <b>.N' a (z').OrL (z).M1 (y).M2 z') 
  2856                    = Cut <a>.OrR2 <b>.N' a (c).OrL (z).M1 (y).M2 c")
  2857 apply(simp)
  2858 apply(subgoal_tac "Cut <a>.OrR2 <b>.N' a (c).OrL (z).M1 (y).M2 c \<longrightarrow>\<^isub>a Cut <b>.N' (y).M2")
  2859 apply(auto intro: a_preserves_SNa)[1]
  2860 apply(rule al_redu)
  2861 apply(rule better_LOr2_intro)
  2862 apply(simp add: abs_fresh fresh_prod fresh_atm) 
  2863 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2864 apply(fresh_fun_simp (no_asm))
  2865 apply(simp)
  2866 (* none of them in BINDING *)
  2867 apply(simp)
  2868 apply(erule conjE)
  2869 apply(frule CAND_OrR2_elim)
  2870 apply(assumption)
  2871 apply(erule exE)+
  2872 apply(frule CAND_OrL_elim)
  2873 apply(assumption)
  2874 apply(erule exE)+
  2875 apply(simp only: ty.inject)
  2876 apply(drule_tac x="B2" in meta_spec)
  2877 apply(drule_tac x="N'" in meta_spec)
  2878 apply(drule_tac x="M2" in meta_spec)
  2879 apply(erule conjE)+
  2880 apply(drule mp)
  2881 apply(simp)
  2882 apply(drule_tac x="b" in spec)
  2883 apply(rotate_tac 15)
  2884 apply(drule mp)
  2885 apply(assumption)
  2886 apply(rotate_tac 15)
  2887 apply(drule mp)
  2888 apply(simp add: CANDs_imply_SNa)
  2889 apply(drule_tac x="y" in spec)
  2890 apply(rotate_tac 15)
  2891 apply(drule mp)
  2892 apply(assumption)
  2893 apply(rotate_tac 15)
  2894 apply(drule mp)
  2895 apply(simp add: CANDs_imply_SNa)
  2896 apply(assumption)
  2897 (* LImp case *)
  2898 apply(erule exE)+
  2899 apply(auto)[1]
  2900 apply(frule_tac excluded_m)
  2901 apply(assumption)
  2902 apply(erule disjE)
  2903 (* one of them in BINDING *)
  2904 apply(erule disjE)
  2905 apply(drule fin_elims)
  2906 apply(drule fic_elims)
  2907 apply(simp)
  2908 apply(drule BINDINGc_elim)
  2909 apply(drule_tac x="x" in spec)
  2910 apply(drule_tac x="ImpL <c>.N1 (y).N2 x" in spec)
  2911 apply(simp)
  2912 apply(simp add: better_ImpR_substc)
  2913 apply(generate_fresh "coname")
  2914 apply(subgoal_tac "fresh_fun (\<lambda>a'. Cut <a'>.ImpR (z).<b>.M'a a' (x).ImpL <c>.N1 (y).N2 x)
  2915                    = Cut <ca>.ImpR (z).<b>.M'a ca (x).ImpL <c>.N1 (y).N2 x")
  2916 apply(simp)
  2917 apply(subgoal_tac "Cut <ca>.ImpR (z).<b>.M'a ca (x).ImpL <c>.N1 (y).N2 x \<longrightarrow>\<^isub>a 
  2918                                                           Cut <b>.Cut <c>.N1 (z).M'a (y).N2")
  2919 apply(auto intro: a_preserves_SNa)[1]
  2920 apply(rule al_redu)
  2921 apply(rule better_LImp_intro)
  2922 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2923 apply(simp add: abs_fresh)
  2924 apply(simp)
  2925 apply(fresh_fun_simp (no_asm))
  2926 apply(simp)
  2927 (* other case of in BINDING *)
  2928 apply(drule fin_elims)
  2929 apply(drule fic_elims)
  2930 apply(simp)
  2931 apply(drule BINDINGn_elim)
  2932 apply(drule_tac x="a" in spec)
  2933 apply(drule_tac x="ImpR (z).<b>.M'a a" in spec)
  2934 apply(simp)
  2935 apply(simp add: better_ImpL_substn)
  2936 apply(generate_fresh "name")
  2937 apply(subgoal_tac "fresh_fun (\<lambda>z'. Cut <a>.ImpR (z).<b>.M'a a (z').ImpL <c>.N1 (y).N2 z')
  2938                    = Cut <a>.ImpR (z).<b>.M'a a (ca).ImpL <c>.N1 (y).N2 ca")
  2939 apply(simp)
  2940 apply(subgoal_tac "Cut <a>.ImpR (z).<b>.M'a a (ca).ImpL <c>.N1 (y).N2 ca \<longrightarrow>\<^isub>a 
  2941                                                           Cut <b>.Cut <c>.N1 (z).M'a (y).N2")
  2942 apply(auto intro: a_preserves_SNa)[1]
  2943 apply(rule al_redu)
  2944 apply(rule better_LImp_intro)
  2945 apply(simp add: abs_fresh fresh_prod fresh_atm) 
  2946 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2947 apply(simp)
  2948 apply(fresh_fun_simp (no_asm))
  2949 apply(simp add: abs_fresh abs_supp fin_supp)
  2950 apply(simp add: abs_fresh abs_supp fin_supp)
  2951 apply(simp)
  2952 (* none of them in BINDING *)
  2953 apply(erule conjE)
  2954 apply(frule CAND_ImpL_elim)
  2955 apply(assumption)
  2956 apply(erule exE)+
  2957 apply(frule CAND_ImpR_elim) (* check here *)
  2958 apply(assumption)
  2959 apply(erule exE)+
  2960 apply(erule conjE)+
  2961 apply(simp only: ty.inject)
  2962 apply(erule conjE)+
  2963 apply(case_tac "M'a=Ax z b")
  2964 (* case Ma = Ax z b *)
  2965 apply(rule_tac t="Cut <b>.(Cut <c>.N1 (z).M'a) (y).N2" and s="Cut <b>.(M'a{z:=<c>.N1}) (y).N2" in subst)
  2966 apply(simp)
  2967 apply(drule_tac x="c" in spec)
  2968 apply(drule_tac x="N1" in spec)
  2969 apply(drule mp)
  2970 apply(simp)
  2971 apply(drule_tac x="B2" in meta_spec)
  2972 apply(drule_tac x="M'a{z:=<c>.N1}" in meta_spec)
  2973 apply(drule_tac x="N2" in meta_spec)
  2974 apply(drule conjunct1)
  2975 apply(drule mp)
  2976 apply(simp)
  2977 apply(rotate_tac 17)
  2978 apply(drule_tac x="b" in spec)
  2979 apply(drule mp)
  2980 apply(assumption)
  2981 apply(drule mp)
  2982 apply(simp add: CANDs_imply_SNa)
  2983 apply(rotate_tac 17)
  2984 apply(drule_tac x="y" in spec)
  2985 apply(drule mp)
  2986 apply(assumption)
  2987 apply(drule mp)
  2988 apply(simp add: CANDs_imply_SNa)
  2989 apply(assumption)
  2990 (* case Ma \<noteq> Ax z b *)
  2991 apply(subgoal_tac "<b>:Cut <c>.N1 (z).M'a \<in> \<parallel><B2>\<parallel>") (* lemma *)
  2992 apply(frule_tac meta_spec)
  2993 apply(drule_tac x="B2" in meta_spec)
  2994 apply(drule_tac x="Cut <c>.N1 (z).M'a" in meta_spec)
  2995 apply(drule_tac x="N2" in meta_spec)
  2996 apply(erule conjE)+
  2997 apply(drule mp)
  2998 apply(simp)
  2999 apply(rotate_tac 20)
  3000 apply(drule_tac x="b" in spec)
  3001 apply(rotate_tac 20)
  3002 apply(drule mp)
  3003 apply(assumption)
  3004 apply(rotate_tac 20)
  3005 apply(drule mp)
  3006 apply(simp add: CANDs_imply_SNa)
  3007 apply(rotate_tac 20)
  3008 apply(drule_tac x="y" in spec)
  3009 apply(rotate_tac 20)
  3010 apply(drule mp)
  3011 apply(assumption)
  3012 apply(rotate_tac 20)
  3013 apply(drule mp)
  3014 apply(simp add: CANDs_imply_SNa)
  3015 apply(assumption)
  3016 (* lemma *)
  3017 apply(subgoal_tac "<b>:Cut <c>.N1 (z).M'a \<in> BINDINGc B2 (\<parallel>(B2)\<parallel>)") (* second lemma *)
  3018 apply(simp add: BINDING_implies_CAND)
  3019 (* second lemma *)
  3020 apply(simp (no_asm) add: BINDINGc_def)
  3021 apply(rule exI)+
  3022 apply(rule conjI)
  3023 apply(rule refl)
  3024 apply(rule allI)+
  3025 apply(rule impI)
  3026 apply(generate_fresh "name")
  3027 apply(rule_tac t="Cut <c>.N1 (z).M'a" and s="Cut <c>.N1 (ca).([(ca,z)]\<bullet>M'a)" in subst)
  3028 apply(simp add: trm.inject alpha fresh_prod fresh_atm)
  3029 apply(rule_tac t="(Cut <c>.N1 (ca).([(ca,z)]\<bullet>M'a)){b:=(xa).P}" 
  3030            and s="Cut <c>.N1 (ca).(([(ca,z)]\<bullet>M'a){b:=(xa).P})" in subst)
  3031 apply(rule sym)
  3032 apply(rule tricky_subst)
  3033 apply(simp)
  3034 apply(simp)
  3035 apply(clarify)
  3036 apply(drule pt_bij1[OF pt_name_inst, OF at_name_inst])
  3037 apply(simp add: calc_atm)
  3038 apply(drule_tac x="B1" in meta_spec)
  3039 apply(drule_tac x="N1" in meta_spec)
  3040 apply(drule_tac x="([(ca,z)]\<bullet>M'a){b:=(xa).P}" in meta_spec)
  3041 apply(drule conjunct1)
  3042 apply(drule mp)
  3043 apply(simp)
  3044 apply(rotate_tac 19)
  3045 apply(drule_tac x="c" in spec)
  3046 apply(drule mp)
  3047 apply(assumption)
  3048 apply(drule mp)
  3049 apply(simp add: CANDs_imply_SNa)
  3050 apply(rotate_tac 19)
  3051 apply(drule_tac x="ca" in spec)
  3052 apply(subgoal_tac "(ca):([(ca,z)]\<bullet>M'a){b:=(xa).P} \<in> \<parallel>(B1)\<parallel>")(*A*)
  3053 apply(drule mp)
  3054 apply(assumption)
  3055 apply(drule mp)
  3056 apply(simp add: CANDs_imply_SNa)
  3057 apply(assumption)
  3058 (*A*)
  3059 apply(drule_tac x="[(ca,z)]\<bullet>xa" in spec)
  3060 apply(drule_tac x="[(ca,z)]\<bullet>P" in spec)
  3061 apply(rotate_tac 19)
  3062 apply(simp add: fresh_prod fresh_left)
  3063 apply(drule mp)
  3064 apply(rule conjI)
  3065 apply(auto simp add: calc_atm)[1]
  3066 apply(rule conjI)
  3067 apply(auto simp add: calc_atm)[1]
  3068 apply(drule_tac pi="[(ca,z)]" and x="(xa):P" in pt_set_bij2[OF pt_name_inst, OF at_name_inst])
  3069 apply(simp add: CAND_eqvt_name)
  3070 apply(drule_tac pi="[(ca,z)]" and X="\<parallel>(B1)\<parallel>" in pt_set_bij2[OF pt_name_inst, OF at_name_inst])
  3071 apply(simp add: CAND_eqvt_name csubst_eqvt)
  3072 apply(perm_simp)
  3073 done
  3074 
  3075 
  3076 (* parallel substitution *)
  3077 
  3078 
  3079 lemma CUT_SNa:
  3080   assumes a1: "<a>:M \<in> (\<parallel><B>\<parallel>)"
  3081   and     a2: "(x):N \<in> (\<parallel>(B)\<parallel>)"
  3082   shows   "SNa (Cut <a>.M (x).N)"
  3083 using a1 a2
  3084 apply -
  3085 apply(rule CUT_SNa_aux[OF a1])
  3086 apply(simp_all add: CANDs_imply_SNa)
  3087 done 
  3088 
  3089 
  3090 fun 
  3091  findn :: "(name\<times>coname\<times>trm) list\<Rightarrow>name\<Rightarrow>(coname\<times>trm) option"
  3092 where
  3093   "findn [] x = None"
  3094 | "findn ((y,c,P)#\<theta>_n) x = (if y=x then Some (c,P) else findn \<theta>_n x)"
  3095 
  3096 lemma findn_eqvt[eqvt]:
  3097   fixes pi1::"name prm"
  3098   and   pi2::"coname prm"
  3099   shows "(pi1\<bullet>findn \<theta>_n x) = findn (pi1\<bullet>\<theta>_n) (pi1\<bullet>x)" 
  3100   and   "(pi2\<bullet>findn \<theta>_n x) = findn (pi2\<bullet>\<theta>_n) (pi2\<bullet>x)"
  3101 apply(induct \<theta>_n)
  3102 apply(auto simp add: perm_bij) 
  3103 done
  3104 
  3105 lemma findn_fresh:
  3106   assumes a: "x\<sharp>\<theta>_n"
  3107   shows "findn \<theta>_n x = None"
  3108 using a
  3109 apply(induct \<theta>_n)
  3110 apply(auto simp add: fresh_list_cons fresh_atm fresh_prod)
  3111 done
  3112 
  3113 fun 
  3114  findc :: "(coname\<times>name\<times>trm) list\<Rightarrow>coname\<Rightarrow>(name\<times>trm) option"
  3115 where
  3116   "findc [] x = None"
  3117 | "findc ((c,y,P)#\<theta>_c) a = (if a=c then Some (y,P) else findc \<theta>_c a)"
  3118 
  3119 lemma findc_eqvt[eqvt]:
  3120   fixes pi1::"name prm"
  3121   and   pi2::"coname prm"
  3122   shows "(pi1\<bullet>findc \<theta>_c a) = findc (pi1\<bullet>\<theta>_c) (pi1\<bullet>a)" 
  3123   and   "(pi2\<bullet>findc \<theta>_c a) = findc (pi2\<bullet>\<theta>_c) (pi2\<bullet>a)"
  3124 apply(induct \<theta>_c)
  3125 apply(auto simp add: perm_bij) 
  3126 done
  3127 
  3128 lemma findc_fresh:
  3129   assumes a: "a\<sharp>\<theta>_c"
  3130   shows "findc \<theta>_c a = None"
  3131 using a
  3132 apply(induct \<theta>_c)
  3133 apply(auto simp add: fresh_list_cons fresh_atm fresh_prod)
  3134 done
  3135 
  3136 abbreviation 
  3137  nmaps :: "(name\<times>coname\<times>trm) list \<Rightarrow> name \<Rightarrow> (coname\<times>trm) option \<Rightarrow> bool" ("_ nmaps _ to _" [55,55,55] 55) 
  3138 where
  3139  "\<theta>_n nmaps x to P \<equiv> (findn \<theta>_n x) = P"
  3140 
  3141 abbreviation 
  3142  cmaps :: "(coname\<times>name\<times>trm) list \<Rightarrow> coname \<Rightarrow> (name\<times>trm) option \<Rightarrow> bool" ("_ cmaps _ to _" [55,55,55] 55) 
  3143 where
  3144  "\<theta>_c cmaps a to P \<equiv> (findc \<theta>_c a) = P"
  3145 
  3146 lemma nmaps_fresh:
  3147   shows "\<theta>_n nmaps x to Some (c,P) \<Longrightarrow> a\<sharp>\<theta>_n \<Longrightarrow> a\<sharp>(c,P)"
  3148 apply(induct \<theta>_n)
  3149 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3150 apply(case_tac "aa=x")
  3151 apply(auto)
  3152 apply(case_tac "aa=x")
  3153 apply(auto)
  3154 done
  3155 
  3156 lemma cmaps_fresh:
  3157   shows "\<theta>_c cmaps a to Some (y,P) \<Longrightarrow> x\<sharp>\<theta>_c \<Longrightarrow> x\<sharp>(y,P)"
  3158 apply(induct \<theta>_c)
  3159 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3160 apply(case_tac "a=aa")
  3161 apply(auto)
  3162 apply(case_tac "a=aa")
  3163 apply(auto)
  3164 done
  3165 
  3166 lemma nmaps_false:
  3167   shows "\<theta>_n nmaps x to Some (c,P) \<Longrightarrow> x\<sharp>\<theta>_n \<Longrightarrow> False"
  3168 apply(induct \<theta>_n)
  3169 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3170 done
  3171 
  3172 lemma cmaps_false:
  3173   shows "\<theta>_c cmaps c to Some (x,P) \<Longrightarrow> c\<sharp>\<theta>_c \<Longrightarrow> False"
  3174 apply(induct \<theta>_c)
  3175 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3176 done
  3177 
  3178 fun 
  3179  lookupa :: "name\<Rightarrow>coname\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm"
  3180 where
  3181   "lookupa x a [] = Ax x a"
  3182 | "lookupa x a ((c,y,P)#\<theta>_c) = (if a=c then Cut <a>.Ax x a (y).P else lookupa x a \<theta>_c)"
  3183 
  3184 lemma lookupa_eqvt[eqvt]:
  3185   fixes pi1::"name prm"
  3186   and   pi2::"coname prm"
  3187   shows "(pi1\<bullet>(lookupa x a \<theta>_c)) = lookupa (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>_c)"
  3188   and   "(pi2\<bullet>(lookupa x a \<theta>_c)) = lookupa (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>_c)"
  3189 apply -
  3190 apply(induct \<theta>_c)
  3191 apply(auto simp add: eqvts)
  3192 apply(induct \<theta>_c)
  3193 apply(auto simp add: eqvts)
  3194 done
  3195 
  3196 lemma lookupa_fire:
  3197   assumes a: "\<theta>_c cmaps a to Some (y,P)"
  3198   shows "(lookupa x a \<theta>_c) = Cut <a>.Ax x a (y).P"
  3199 using a
  3200 apply(induct \<theta>_c arbitrary: x a y P)
  3201 apply(auto)
  3202 done
  3203 
  3204 fun 
  3205  lookupb :: "name\<Rightarrow>coname\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>coname\<Rightarrow>trm\<Rightarrow>trm"
  3206 where
  3207   "lookupb x a [] c P = Cut <c>.P (x).Ax x a"
  3208 | "lookupb x a ((d,y,N)#\<theta>_c) c P = (if a=d then Cut <c>.P (y).N  else lookupb x a \<theta>_c c P)"
  3209 
  3210 lemma lookupb_eqvt[eqvt]:
  3211   fixes pi1::"name prm"
  3212   and   pi2::"coname prm"
  3213   shows "(pi1\<bullet>(lookupb x a \<theta>_c c P)) = lookupb (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>_c) (pi1\<bullet>c) (pi1\<bullet>P)"
  3214   and   "(pi2\<bullet>(lookupb x a \<theta>_c c P)) = lookupb (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>_c) (pi2\<bullet>c) (pi2\<bullet>P)"
  3215 apply -
  3216 apply(induct \<theta>_c)
  3217 apply(auto simp add: eqvts)
  3218 apply(induct \<theta>_c)
  3219 apply(auto simp add: eqvts)
  3220 done
  3221 
  3222 fun 
  3223   lookup :: "name\<Rightarrow>coname\<Rightarrow>(name\<times>coname\<times>trm) list\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm"
  3224 where
  3225   "lookup x a [] \<theta>_c = lookupa x a \<theta>_c"
  3226 | "lookup x a ((y,c,P)#\<theta>_n) \<theta>_c = (if x=y then (lookupb x a \<theta>_c c P) else lookup x a \<theta>_n \<theta>_c)"
  3227 
  3228 lemma lookup_eqvt[eqvt]:
  3229   fixes pi1::"name prm"
  3230   and   pi2::"coname prm"
  3231   shows "(pi1\<bullet>(lookup x a \<theta>_n \<theta>_c)) = lookup (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>_n) (pi1\<bullet>\<theta>_c)"
  3232   and   "(pi2\<bullet>(lookup x a \<theta>_n \<theta>_c)) = lookup (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>_n) (pi2\<bullet>\<theta>_c)"
  3233 apply -
  3234 apply(induct \<theta>_n)
  3235 apply(auto simp add: eqvts)
  3236 apply(induct \<theta>_n)
  3237 apply(auto simp add: eqvts)
  3238 done
  3239 
  3240 fun 
  3241   lookupc :: "name\<Rightarrow>coname\<Rightarrow>(name\<times>coname\<times>trm) list\<Rightarrow>trm"
  3242 where
  3243   "lookupc x a [] = Ax x a"
  3244 | "lookupc x a ((y,c,P)#\<theta>_n) = (if x=y then P[c\<turnstile>c>a] else lookupc x a \<theta>_n)"
  3245 
  3246 lemma lookupc_eqvt[eqvt]:
  3247   fixes pi1::"name prm"
  3248   and   pi2::"coname prm"
  3249   shows "(pi1\<bullet>(lookupc x a \<theta>_n)) = lookupc (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>_n)"
  3250   and   "(pi2\<bullet>(lookupc x a \<theta>_n)) = lookupc (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>_n)"
  3251 apply -
  3252 apply(induct \<theta>_n)
  3253 apply(auto simp add: eqvts)
  3254 apply(induct \<theta>_n)
  3255 apply(auto simp add: eqvts)
  3256 done
  3257 
  3258 fun 
  3259   lookupd :: "name\<Rightarrow>coname\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm"
  3260 where
  3261   "lookupd x a [] = Ax x a"
  3262 | "lookupd x a ((c,y,P)#\<theta>_c) = (if a=c then P[y\<turnstile>n>x] else lookupd x a \<theta>_c)"
  3263 
  3264 lemma lookupd_eqvt[eqvt]:
  3265   fixes pi1::"name prm"
  3266   and   pi2::"coname prm"
  3267   shows "(pi1\<bullet>(lookupd x a \<theta>_n)) = lookupd (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>_n)"
  3268   and   "(pi2\<bullet>(lookupd x a \<theta>_n)) = lookupd (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>_n)"
  3269 apply -
  3270 apply(induct \<theta>_n)
  3271 apply(auto simp add: eqvts)
  3272 apply(induct \<theta>_n)
  3273 apply(auto simp add: eqvts)
  3274 done
  3275 
  3276 lemma lookupa_fresh:
  3277   assumes a: "a\<sharp>\<theta>_c"
  3278   shows "lookupa y a \<theta>_c = Ax y a"
  3279 using a
  3280 apply(induct \<theta>_c)
  3281 apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
  3282 done
  3283 
  3284 lemma lookupa_csubst:
  3285   assumes a: "a\<sharp>\<theta>_c"
  3286   shows "Cut <a>.Ax y a (x).P = (lookupa y a \<theta>_c){a:=(x).P}"
  3287 using a by (simp add: lookupa_fresh)
  3288 
  3289 lemma lookupa_freshness:
  3290   fixes a::"coname"
  3291   and   x::"name"
  3292   shows "a\<sharp>(\<theta>_c,c) \<Longrightarrow> a\<sharp>lookupa y c \<theta>_c"
  3293   and   "x\<sharp>(\<theta>_c,y) \<Longrightarrow> x\<sharp>lookupa y c \<theta>_c"
  3294 apply(induct \<theta>_c)
  3295 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3296 done
  3297 
  3298 lemma lookupa_unicity:
  3299   assumes a: "lookupa x a \<theta>_c= Ax y b" "b\<sharp>\<theta>_c" "y\<sharp>\<theta>_c"
  3300   shows "x=y \<and> a=b"
  3301 using a
  3302 apply(induct \<theta>_c)
  3303 apply(auto simp add: trm.inject fresh_list_cons fresh_prod fresh_atm)
  3304 apply(case_tac "a=aa")
  3305 apply(auto)
  3306 apply(case_tac "a=aa")
  3307 apply(auto)
  3308 done
  3309 
  3310 lemma lookupb_csubst:
  3311   assumes a: "a\<sharp>(\<theta>_c,c,N)"
  3312   shows "Cut <c>.N (x).P = (lookupb y a \<theta>_c c N){a:=(x).P}"
  3313 using a
  3314 apply(induct \<theta>_c)
  3315 apply(auto simp add: fresh_list_cons fresh_atm fresh_prod)
  3316 apply(rule sym)
  3317 apply(generate_fresh "name")
  3318 apply(generate_fresh "coname")
  3319 apply(subgoal_tac "Cut <c>.N (y).Ax y a = Cut <caa>.([(caa,c)]\<bullet>N) (ca).Ax ca a")
  3320 apply(simp)
  3321 apply(rule trans)
  3322 apply(rule better_Cut_substc)
  3323 apply(simp)
  3324 apply(simp add: abs_fresh)
  3325 apply(simp)
  3326 apply(subgoal_tac "a\<sharp>([(caa,c)]\<bullet>N)")
  3327 apply(simp add: forget)
  3328 apply(simp add: trm.inject)
  3329 apply(simp add: fresh_left calc_atm fresh_prod fresh_atm)
  3330 apply(simp add: trm.inject)
  3331 apply(rule conjI)
  3332 apply(rule sym)
  3333 apply(simp add: alpha fresh_prod fresh_atm)
  3334 apply(simp add: alpha calc_atm fresh_prod fresh_atm)
  3335 done
  3336 
  3337 lemma lookupb_freshness:
  3338   fixes a::"coname"
  3339   and   x::"name"
  3340   shows "a\<sharp>(\<theta>_c,c,b,P) \<Longrightarrow> a\<sharp>lookupb y c \<theta>_c b P"
  3341   and   "x\<sharp>(\<theta>_c,y,P) \<Longrightarrow> x\<sharp>lookupb y c \<theta>_c b P"
  3342 apply(induct \<theta>_c)
  3343 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3344 done
  3345 
  3346 lemma lookupb_unicity:
  3347   assumes a: "lookupb x a \<theta>_c c P = Ax y b" "b\<sharp>(\<theta>_c,c,P)" "y\<sharp>\<theta>_c"
  3348   shows "x=y \<and> a=b"
  3349 using a
  3350 apply(induct \<theta>_c)
  3351 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3352 apply(case_tac "a=aa")
  3353 apply(auto)
  3354 apply(case_tac "a=aa")
  3355 apply(auto)
  3356 done
  3357 
  3358 lemma lookupb_lookupa:
  3359   assumes a: "x\<sharp>\<theta>_c"
  3360   shows "lookupb x c \<theta>_c a P = (lookupa x c \<theta>_c){x:=<a>.P}"
  3361 using a
  3362 apply(induct \<theta>_c)
  3363 apply(auto simp add: fresh_list_cons fresh_prod)
  3364 apply(generate_fresh "coname")
  3365 apply(generate_fresh "name")
  3366 apply(subgoal_tac "Cut <c>.Ax x c (aa).b = Cut <ca>.Ax x ca (caa).([(caa,aa)]\<bullet>b)")
  3367 apply(simp)
  3368 apply(rule sym)
  3369 apply(rule trans)
  3370 apply(rule better_Cut_substn)
  3371 apply(simp add: abs_fresh)
  3372 apply(simp)
  3373 apply(simp)
  3374 apply(subgoal_tac "x\<sharp>([(caa,aa)]\<bullet>b)")
  3375 apply(simp add: forget)
  3376 apply(simp add: trm.inject)
  3377 apply(auto simp add: fresh_left calc_atm fresh_prod fresh_atm)[1]
  3378 apply(simp add: trm.inject)
  3379 apply(rule conjI)
  3380 apply(simp add: alpha calc_atm fresh_atm fresh_prod)
  3381 apply(rule sym)
  3382 apply(simp add: alpha calc_atm fresh_atm fresh_prod)
  3383 done
  3384 
  3385 lemma lookup_csubst:
  3386   assumes a: "a\<sharp>(\<theta>_n,\<theta>_c)"
  3387   shows "lookup y c \<theta>_n ((a,x,P)#\<theta>_c) = (lookup y c \<theta>_n \<theta>_c){a:=(x).P}"
  3388 using a
  3389 apply(induct \<theta>_n)
  3390 apply(auto simp add: fresh_prod fresh_list_cons)
  3391 apply(simp add: lookupa_csubst)
  3392 apply(simp add: lookupa_freshness forget fresh_atm fresh_prod)
  3393 apply(rule lookupb_csubst)
  3394 apply(simp)
  3395 apply(auto simp add: lookupb_freshness forget fresh_atm fresh_prod)
  3396 done
  3397 
  3398 lemma lookup_fresh:
  3399   assumes a: "x\<sharp>(\<theta>_n,\<theta>_c)"
  3400   shows "lookup x c \<theta>_n \<theta>_c = lookupa x c \<theta>_c"
  3401 using a
  3402 apply(induct \<theta>_n)
  3403 apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
  3404 done
  3405 
  3406 lemma lookup_unicity:
  3407   assumes a: "lookup x a \<theta>_n \<theta>_c= Ax y b" "b\<sharp>(\<theta>_c,\<theta>_n)" "y\<sharp>(\<theta>_c,\<theta>_n)"
  3408   shows "x=y \<and> a=b"
  3409 using a
  3410 apply(induct \<theta>_n)
  3411 apply(auto simp add: trm.inject fresh_list_cons fresh_prod fresh_atm)
  3412 apply(drule lookupa_unicity)
  3413 apply(simp)+
  3414 apply(drule lookupa_unicity)
  3415 apply(simp)+
  3416 apply(case_tac "x=aa")
  3417 apply(auto)
  3418 apply(drule lookupb_unicity)
  3419 apply(simp add: fresh_atm)
  3420 apply(simp)
  3421 apply(simp)
  3422 apply(case_tac "x=aa")
  3423 apply(auto)
  3424 apply(drule lookupb_unicity)
  3425 apply(simp add: fresh_atm)
  3426 apply(simp)
  3427 apply(simp)
  3428 done
  3429 
  3430 lemma lookup_freshness:
  3431   fixes a::"coname"
  3432   and   x::"name"
  3433   shows "a\<sharp>(c,\<theta>_c,\<theta>_n) \<Longrightarrow> a\<sharp>lookup y c \<theta>_n \<theta>_c"
  3434   and   "x\<sharp>(y,\<theta>_c,\<theta>_n) \<Longrightarrow> x\<sharp>lookup y c \<theta>_n \<theta>_c"   
  3435 apply(induct \<theta>_n)
  3436 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3437 apply(simp add: fresh_atm fresh_prod lookupa_freshness)
  3438 apply(simp add: fresh_atm fresh_prod lookupa_freshness)
  3439 apply(simp add: fresh_atm fresh_prod lookupb_freshness)
  3440 apply(simp add: fresh_atm fresh_prod lookupb_freshness)
  3441 done
  3442 
  3443 lemma lookupc_freshness:
  3444   fixes a::"coname"
  3445   and   x::"name"
  3446   shows "a\<sharp>(\<theta>_c,c) \<Longrightarrow> a\<sharp>lookupc y c \<theta>_c"
  3447   and   "x\<sharp>(\<theta>_c,y) \<Longrightarrow> x\<sharp>lookupc y c \<theta>_c"
  3448 apply(induct \<theta>_c)
  3449 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3450 apply(rule rename_fresh)
  3451 apply(simp add: fresh_atm)
  3452 apply(rule rename_fresh)
  3453 apply(simp add: fresh_atm)
  3454 done
  3455 
  3456 lemma lookupc_fresh:
  3457   assumes a: "y\<sharp>\<theta>_n"
  3458   shows "lookupc y a \<theta>_n = Ax y a"
  3459 using a
  3460 apply(induct \<theta>_n)
  3461 apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
  3462 done
  3463 
  3464 lemma lookupc_nmaps:
  3465   assumes a: "\<theta>_n nmaps x to Some (c,P)"
  3466   shows "lookupc x a \<theta>_n = P[c\<turnstile>c>a]"
  3467 using a
  3468 apply(induct \<theta>_n)
  3469 apply(auto)
  3470 done 
  3471 
  3472 lemma lookupc_unicity:
  3473   assumes a: "lookupc y a \<theta>_n = Ax x b" "x\<sharp>\<theta>_n"
  3474   shows "y=x"
  3475 using a
  3476 apply(induct \<theta>_n)
  3477 apply(auto simp add: trm.inject fresh_list_cons fresh_prod)
  3478 apply(case_tac "y=aa")
  3479 apply(auto)
  3480 apply(subgoal_tac "x\<sharp>(ba[aa\<turnstile>c>a])")
  3481 apply(simp add: fresh_atm)
  3482 apply(rule rename_fresh)
  3483 apply(simp)
  3484 done
  3485 
  3486 lemma lookupd_fresh:
  3487   assumes a: "a\<sharp>\<theta>_c"
  3488   shows "lookupd y a \<theta>_c = Ax y a"
  3489 using a
  3490 apply(induct \<theta>_c)
  3491 apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
  3492 done 
  3493 
  3494 lemma lookupd_unicity:
  3495   assumes a: "lookupd y a \<theta>_c = Ax y b" "b\<sharp>\<theta>_c"
  3496   shows "a=b"
  3497 using a
  3498 apply(induct \<theta>_c)
  3499 apply(auto simp add: trm.inject fresh_list_cons fresh_prod)
  3500 apply(case_tac "a=aa")
  3501 apply(auto)
  3502 apply(subgoal_tac "b\<sharp>(ba[aa\<turnstile>n>y])")
  3503 apply(simp add: fresh_atm)
  3504 apply(rule rename_fresh)
  3505 apply(simp)
  3506 done
  3507 
  3508 lemma lookupd_freshness:
  3509   fixes a::"coname"
  3510   and   x::"name"
  3511   shows "a\<sharp>(\<theta>_c,c) \<Longrightarrow> a\<sharp>lookupd y c \<theta>_c"
  3512   and   "x\<sharp>(\<theta>_c,y) \<Longrightarrow> x\<sharp>lookupd y c \<theta>_c"
  3513 apply(induct \<theta>_c)
  3514 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3515 apply(rule rename_fresh)
  3516 apply(simp add: fresh_atm)
  3517 apply(rule rename_fresh)
  3518 apply(simp add: fresh_atm)
  3519 done
  3520 
  3521 lemma lookupd_cmaps:
  3522   assumes a: "\<theta>_c cmaps a to Some (x,P)"
  3523   shows "lookupd y a \<theta>_c = P[x\<turnstile>n>y]"
  3524 using a
  3525 apply(induct \<theta>_c)
  3526 apply(auto)
  3527 done 
  3528 
  3529 nominal_primrec (freshness_context: "\<theta>_n::(name\<times>coname\<times>trm)")
  3530   stn :: "trm\<Rightarrow>(name\<times>coname\<times>trm) list\<Rightarrow>trm" 
  3531 where
  3532   "stn (Ax x a) \<theta>_n = lookupc x a \<theta>_n"
  3533 | "\<lbrakk>a\<sharp>(N,\<theta>_n);x\<sharp>(M,\<theta>_n)\<rbrakk> \<Longrightarrow> stn (Cut <a>.M (x).N) \<theta>_n = (Cut <a>.M (x).N)" 
  3534 | "x\<sharp>\<theta>_n \<Longrightarrow> stn (NotR (x).M a) \<theta>_n = (NotR (x).M a)"
  3535 | "a\<sharp>\<theta>_n \<Longrightarrow>stn (NotL <a>.M x) \<theta>_n = (NotL <a>.M x)"
  3536 | "\<lbrakk>a\<sharp>(N,d,b,\<theta>_n);b\<sharp>(M,d,a,\<theta>_n)\<rbrakk> \<Longrightarrow> stn (AndR <a>.M <b>.N d) \<theta>_n = (AndR <a>.M <b>.N d)"
  3537 | "x\<sharp>(z,\<theta>_n) \<Longrightarrow> stn (AndL1 (x).M z) \<theta>_n = (AndL1 (x).M z)"
  3538 | "x\<sharp>(z,\<theta>_n) \<Longrightarrow> stn (AndL2 (x).M z) \<theta>_n = (AndL2 (x).M z)"
  3539 | "a\<sharp>(b,\<theta>_n) \<Longrightarrow> stn (OrR1 <a>.M b) \<theta>_n = (OrR1 <a>.M b)"
  3540 | "a\<sharp>(b,\<theta>_n) \<Longrightarrow> stn (OrR2 <a>.M b) \<theta>_n = (OrR2 <a>.M b)"
  3541 | "\<lbrakk>x\<sharp>(N,z,u,\<theta>_n);u\<sharp>(M,z,x,\<theta>_n)\<rbrakk> \<Longrightarrow> stn (OrL (x).M (u).N z) \<theta>_n = (OrL (x).M (u).N z)"
  3542 | "\<lbrakk>a\<sharp>(b,\<theta>_n);x\<sharp>\<theta>_n\<rbrakk> \<Longrightarrow> stn (ImpR (x).<a>.M b) \<theta>_n = (ImpR (x).<a>.M b)"
  3543 | "\<lbrakk>a\<sharp>(N,\<theta>_n);x\<sharp>(M,z,\<theta>_n)\<rbrakk> \<Longrightarrow> stn (ImpL <a>.M (x).N z) \<theta>_n = (ImpL <a>.M (x).N z)"
  3544 apply(finite_guess)+
  3545 apply(rule TrueI)+
  3546 apply(simp add: abs_fresh abs_supp fin_supp)+
  3547 apply(fresh_guess)+
  3548 done
  3549 
  3550 nominal_primrec (freshness_context: "\<theta>_c::(coname\<times>name\<times>trm)")
  3551   stc :: "trm\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm" 
  3552 where
  3553   "stc (Ax x a) \<theta>_c = lookupd x a \<theta>_c"
  3554 | "\<lbrakk>a\<sharp>(N,\<theta>_c);x\<sharp>(M,\<theta>_c)\<rbrakk> \<Longrightarrow> stc (Cut <a>.M (x).N) \<theta>_c = (Cut <a>.M (x).N)" 
  3555 | "x\<sharp>\<theta>_c \<Longrightarrow> stc (NotR (x).M a) \<theta>_c = (NotR (x).M a)"
  3556 | "a\<sharp>\<theta>_c \<Longrightarrow> stc (NotL <a>.M x) \<theta>_c = (NotL <a>.M x)"
  3557 | "\<lbrakk>a\<sharp>(N,d,b,\<theta>_c);b\<sharp>(M,d,a,\<theta>_c)\<rbrakk> \<Longrightarrow> stc (AndR <a>.M <b>.N d) \<theta>_c = (AndR <a>.M <b>.N d)"
  3558 | "x\<sharp>(z,\<theta>_c) \<Longrightarrow> stc (AndL1 (x).M z) \<theta>_c = (AndL1 (x).M z)"
  3559 | "x\<sharp>(z,\<theta>_c) \<Longrightarrow> stc (AndL2 (x).M z) \<theta>_c = (AndL2 (x).M z)"
  3560 | "a\<sharp>(b,\<theta>_c) \<Longrightarrow> stc (OrR1 <a>.M b) \<theta>_c = (OrR1 <a>.M b)"
  3561 | "a\<sharp>(b,\<theta>_c) \<Longrightarrow> stc (OrR2 <a>.M b) \<theta>_c = (OrR2 <a>.M b)"
  3562 | "\<lbrakk>x\<sharp>(N,z,u,\<theta>_c);u\<sharp>(M,z,x,\<theta>_c)\<rbrakk> \<Longrightarrow> stc (OrL (x).M (u).N z) \<theta>_c = (OrL (x).M (u).N z)"
  3563 | "\<lbrakk>a\<sharp>(b,\<theta>_c);x\<sharp>\<theta>_c\<rbrakk> \<Longrightarrow> stc (ImpR (x).<a>.M b) \<theta>_c = (ImpR (x).<a>.M b)"
  3564 | "\<lbrakk>a\<sharp>(N,\<theta>_c);x\<sharp>(M,z,\<theta>_c)\<rbrakk> \<Longrightarrow> stc (ImpL <a>.M (x).N z) \<theta>_c = (ImpL <a>.M (x).N z)"
  3565 apply(finite_guess)+
  3566 apply(rule TrueI)+
  3567 apply(simp add: abs_fresh abs_supp fin_supp)+
  3568 apply(fresh_guess)+
  3569 done
  3570 
  3571 lemma stn_eqvt[eqvt]:
  3572   fixes pi1::"name prm"
  3573   and   pi2::"coname prm"
  3574   shows "(pi1\<bullet>(stn M \<theta>_n)) = stn (pi1\<bullet>M) (pi1\<bullet>\<theta>_n)"
  3575   and   "(pi2\<bullet>(stn M \<theta>_n)) = stn (pi2\<bullet>M) (pi2\<bullet>\<theta>_n)"
  3576 apply -
  3577 apply(nominal_induct M avoiding: \<theta>_n rule: trm.strong_induct)
  3578 apply(auto simp add: eqvts fresh_bij fresh_prod eq_bij fresh_atm)
  3579 apply(nominal_induct M avoiding: \<theta>_n rule: trm.strong_induct)
  3580 apply(auto simp add: eqvts fresh_bij fresh_prod eq_bij fresh_atm)
  3581 done
  3582 
  3583 lemma stc_eqvt[eqvt]:
  3584   fixes pi1::"name prm"
  3585   and   pi2::"coname prm"
  3586   shows "(pi1\<bullet>(stc M \<theta>_c)) = stc (pi1\<bullet>M) (pi1\<bullet>\<theta>_c)"
  3587   and   "(pi2\<bullet>(stc M \<theta>_c)) = stc (pi2\<bullet>M) (pi2\<bullet>\<theta>_c)"
  3588 apply -
  3589 apply(nominal_induct M avoiding: \<theta>_c rule: trm.strong_induct)
  3590 apply(auto simp add: eqvts fresh_bij fresh_prod eq_bij fresh_atm)
  3591 apply(nominal_induct M avoiding: \<theta>_c rule: trm.strong_induct)
  3592 apply(auto simp add: eqvts fresh_bij fresh_prod eq_bij fresh_atm)
  3593 done
  3594 
  3595 lemma stn_fresh:
  3596   fixes a::"coname"
  3597   and   x::"name"
  3598   shows "a\<sharp>(\<theta>_n,M) \<Longrightarrow> a\<sharp>stn M \<theta>_n"
  3599   and   "x\<sharp>(\<theta>_n,M) \<Longrightarrow> x\<sharp>stn M \<theta>_n"
  3600 apply(nominal_induct M avoiding: \<theta>_n a x rule: trm.strong_induct)
  3601 apply(auto simp add: abs_fresh fresh_prod fresh_atm)
  3602 apply(rule lookupc_freshness)
  3603 apply(simp add: fresh_atm)
  3604 apply(rule lookupc_freshness)
  3605 apply(simp add: fresh_atm)
  3606 done
  3607 
  3608 lemma stc_fresh:
  3609   fixes a::"coname"
  3610   and   x::"name"
  3611   shows "a\<sharp>(\<theta>_c,M) \<Longrightarrow> a\<sharp>stc M \<theta>_c"
  3612   and   "x\<sharp>(\<theta>_c,M) \<Longrightarrow> x\<sharp>stc M \<theta>_c"
  3613 apply(nominal_induct M avoiding: \<theta>_c a x rule: trm.strong_induct)
  3614 apply(auto simp add: abs_fresh fresh_prod fresh_atm)
  3615 apply(rule lookupd_freshness)
  3616 apply(simp add: fresh_atm)
  3617 apply(rule lookupd_freshness)
  3618 apply(simp add: fresh_atm)
  3619 done
  3620 
  3621 lemma option_case_eqvt1[eqvt_force]:
  3622   fixes pi1::"name prm"
  3623   and   pi2::"coname prm"
  3624   and   B::"(name\<times>trm) option"
  3625   and   r::"trm"
  3626   shows "(pi1\<bullet>(case B of Some (x,P) \<Rightarrow> s x P | None \<Rightarrow> r)) = 
  3627               (case (pi1\<bullet>B) of Some (x,P) \<Rightarrow> (pi1\<bullet>s) x P | None \<Rightarrow> (pi1\<bullet>r))"
  3628   and   "(pi2\<bullet>(case B of Some (x,P) \<Rightarrow> s x P| None \<Rightarrow> r)) = 
  3629               (case (pi2\<bullet>B) of Some (x,P) \<Rightarrow> (pi2\<bullet>s) x P | None \<Rightarrow> (pi2\<bullet>r))"
  3630 apply(cases "B")
  3631 apply(auto)
  3632 apply(perm_simp)
  3633 apply(cases "B")
  3634 apply(auto)
  3635 apply(perm_simp)
  3636 done
  3637 
  3638 lemma option_case_eqvt2[eqvt_force]:
  3639   fixes pi1::"name prm"
  3640   and   pi2::"coname prm"
  3641   and   B::"(coname\<times>trm) option"
  3642   and   r::"trm"
  3643   shows "(pi1\<bullet>(case B of Some (x,P) \<Rightarrow> s x P | None \<Rightarrow> r)) = 
  3644               (case (pi1\<bullet>B) of Some (x,P) \<Rightarrow> (pi1\<bullet>s) x P | None \<Rightarrow> (pi1\<bullet>r))"
  3645   and   "(pi2\<bullet>(case B of Some (x,P) \<Rightarrow> s x P| None \<Rightarrow> r)) = 
  3646               (case (pi2\<bullet>B) of Some (x,P) \<Rightarrow> (pi2\<bullet>s) x P | None \<Rightarrow> (pi2\<bullet>r))"
  3647 apply(cases "B")
  3648 apply(auto)
  3649 apply(perm_simp)
  3650 apply(cases "B")
  3651 apply(auto)
  3652 apply(perm_simp)
  3653 done
  3654 
  3655 nominal_primrec (freshness_context: "(\<theta>_n::(name\<times>coname\<times>trm) list,\<theta>_c::(coname\<times>name\<times>trm) list)")
  3656   psubst :: "(name\<times>coname\<times>trm) list\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm\<Rightarrow>trm" ("_,_<_>" [100,100,100] 100) 
  3657 where
  3658   "\<theta>_n,\<theta>_c<Ax x a> = lookup x a \<theta>_n \<theta>_c" 
  3659 | "\<lbrakk>a\<sharp>(N,\<theta>_n,\<theta>_c);x\<sharp>(M,\<theta>_n,\<theta>_c)\<rbrakk> \<Longrightarrow> \<theta>_n,\<theta>_c<Cut <a>.M (x).N> = 
  3660    Cut <a>.(if \<exists>x. M=Ax x a then stn M \<theta>_n else \<theta>_n,\<theta>_c<M>) 
  3661        (x).(if \<exists>a. N=Ax x a then stc N \<theta>_c else \<theta>_n,\<theta>_c<N>)" 
  3662 | "x\<sharp>(\<theta>_n,\<theta>_c) \<Longrightarrow> \<theta>_n,\<theta>_c<NotR (x).M a> = 
  3663   (case (findc \<theta>_c a) of 
  3664        Some (u,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.NotR (x).(\<theta>_n,\<theta>_c<M>) a' (u).P) 
  3665      | None \<Rightarrow> NotR (x).(\<theta>_n,\<theta>_c<M>) a)"
  3666 | "a\<sharp>(\<theta>_n,\<theta>_c) \<Longrightarrow> \<theta>_n,\<theta>_c<NotL <a>.M x> = 
  3667   (case (findn \<theta>_n x) of 
  3668        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>x'. Cut <c>.P (x').(NotL <a>.(\<theta>_n,\<theta>_c<M>) x')) 
  3669      | None \<Rightarrow> NotL <a>.(\<theta>_n,\<theta>_c<M>) x)"
  3670 | "\<lbrakk>a\<sharp>(N,c,\<theta>_n,\<theta>_c);b\<sharp>(M,c,\<theta>_n,\<theta>_c);b\<noteq>a\<rbrakk> \<Longrightarrow> (\<theta>_n,\<theta>_c<AndR <a>.M <b>.N c>) = 
  3671   (case (findc \<theta>_c c) of 
  3672        Some (x,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.(AndR <a>.(\<theta>_n,\<theta>_c<M>) <b>.(\<theta>_n,\<theta>_c<N>) a') (x).P)
  3673      | None \<Rightarrow> AndR <a>.(\<theta>_n,\<theta>_c<M>) <b>.(\<theta>_n,\<theta>_c<N>) c)"
  3674 | "x\<sharp>(z,\<theta>_n,\<theta>_c) \<Longrightarrow> (\<theta>_n,\<theta>_c<AndL1 (x).M z>) = 
  3675   (case (findn \<theta>_n z) of 
  3676        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>z'. Cut <c>.P (z').AndL1 (x).(\<theta>_n,\<theta>_c<M>) z') 
  3677      | None \<Rightarrow> AndL1 (x).(\<theta>_n,\<theta>_c<M>) z)"
  3678 | "x\<sharp>(z,\<theta>_n,\<theta>_c) \<Longrightarrow> (\<theta>_n,\<theta>_c<AndL2 (x).M z>) = 
  3679   (case (findn \<theta>_n z) of 
  3680        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>z'. Cut <c>.P (z').AndL2 (x).(\<theta>_n,\<theta>_c<M>) z') 
  3681      | None \<Rightarrow> AndL2 (x).(\<theta>_n,\<theta>_c<M>) z)"
  3682 | "\<lbrakk>x\<sharp>(N,z,\<theta>_n,\<theta>_c);u\<sharp>(M,z,\<theta>_n,\<theta>_c);x\<noteq>u\<rbrakk> \<Longrightarrow> (\<theta>_n,\<theta>_c<OrL (x).M (u).N z>) =
  3683   (case (findn \<theta>_n z) of  
  3684        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>z'. Cut <c>.P (z').OrL (x).(\<theta>_n,\<theta>_c<M>) (u).(\<theta>_n,\<theta>_c<N>) z') 
  3685      | None \<Rightarrow> OrL (x).(\<theta>_n,\<theta>_c<M>) (u).(\<theta>_n,\<theta>_c<N>) z)"
  3686 | "a\<sharp>(b,\<theta>_n,\<theta>_c) \<Longrightarrow> (\<theta>_n,\<theta>_c<OrR1 <a>.M b>) = 
  3687   (case (findc \<theta>_c b) of
  3688        Some (x,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.OrR1 <a>.(\<theta>_n,\<theta>_c<M>) a' (x).P) 
  3689      | None \<Rightarrow> OrR1 <a>.(\<theta>_n,\<theta>_c<M>) b)"
  3690 | "a\<sharp>(b,\<theta>_n,\<theta>_c) \<Longrightarrow> (\<theta>_n,\<theta>_c<OrR2 <a>.M b>) = 
  3691   (case (findc \<theta>_c b) of
  3692        Some (x,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.OrR2 <a>.(\<theta>_n,\<theta>_c<M>) a' (x).P) 
  3693      | None \<Rightarrow> OrR2 <a>.(\<theta>_n,\<theta>_c<M>) b)"
  3694 | "\<lbrakk>a\<sharp>(b,\<theta>_n,\<theta>_c); x\<sharp>(\<theta>_n,\<theta>_c)\<rbrakk> \<Longrightarrow> (\<theta>_n,\<theta>_c<ImpR (x).<a>.M b>) = 
  3695   (case (findc \<theta>_c b) of
  3696        Some (z,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.ImpR (x).<a>.(\<theta>_n,\<theta>_c<M>) a' (z).P)
  3697      | None \<Rightarrow> ImpR (x).<a>.(\<theta>_n,\<theta>_c<M>) b)"
  3698 | "\<lbrakk>a\<sharp>(N,\<theta>_n,\<theta>_c); x\<sharp>(z,M,\<theta>_n,\<theta>_c)\<rbrakk> \<Longrightarrow> (\<theta>_n,\<theta>_c<ImpL <a>.M (x).N z>) = 
  3699   (case (findn \<theta>_n z) of
  3700        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>z'. Cut <c>.P (z').ImpL <a>.(\<theta>_n,\<theta>_c<M>) (x).(\<theta>_n,\<theta>_c<N>) z') 
  3701      | None \<Rightarrow> ImpL <a>.(\<theta>_n,\<theta>_c<M>) (x).(\<theta>_n,\<theta>_c<N>) z)"
  3702 apply(finite_guess)+
  3703 apply(rule TrueI)+
  3704 apply(simp add: abs_fresh stc_fresh)
  3705 apply(simp add: abs_fresh stn_fresh)
  3706 apply(case_tac "findc \<theta>_c x3")
  3707 apply(simp add: abs_fresh)
  3708 apply(auto)[1]
  3709 apply(generate_fresh "coname")
  3710 apply(fresh_fun_simp (no_asm))
  3711 apply(drule cmaps_fresh)
  3712 apply(auto simp add: fresh_prod)[1]
  3713 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3714 apply(case_tac "findn \<theta>_n x3")
  3715 apply(simp add: abs_fresh)
  3716 apply(auto)[1]
  3717 apply(generate_fresh "name")
  3718 apply(fresh_fun_simp (no_asm))
  3719 apply(drule nmaps_fresh)
  3720 apply(auto simp add: fresh_prod)[1]
  3721 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3722 apply(case_tac "findc \<theta>_c x5")
  3723 apply(simp add: abs_fresh)
  3724 apply(auto)[1]
  3725 apply(generate_fresh "coname")
  3726 apply(fresh_fun_simp (no_asm))
  3727 apply(drule cmaps_fresh)
  3728 apply(auto simp add: fresh_prod)[1]
  3729 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3730 apply(case_tac "findc \<theta>_c x5")
  3731 apply(simp add: abs_fresh)
  3732 apply(auto)[1]
  3733 apply(generate_fresh "coname")
  3734 apply(fresh_fun_simp (no_asm))
  3735 apply(drule_tac x="x3" in cmaps_fresh)
  3736 apply(auto simp add: fresh_prod)[1]
  3737 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3738 apply(case_tac "findn \<theta>_n x3")
  3739 apply(simp add: abs_fresh)
  3740 apply(auto)[1]
  3741 apply(generate_fresh "name")
  3742 apply(fresh_fun_simp (no_asm))
  3743 apply(drule nmaps_fresh)
  3744 apply(auto simp add: fresh_prod)[1]
  3745 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3746 apply(case_tac "findn \<theta>_n x3")
  3747 apply(simp add: abs_fresh)
  3748 apply(auto)[1]
  3749 apply(generate_fresh "name")
  3750 apply(fresh_fun_simp (no_asm))
  3751 apply(drule nmaps_fresh)
  3752 apply(auto simp add: fresh_prod)[1]
  3753 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3754 apply(case_tac "findc \<theta>_c x3")
  3755 apply(simp add: abs_fresh)
  3756 apply(auto)[1]
  3757 apply(generate_fresh "coname")
  3758 apply(fresh_fun_simp (no_asm))
  3759 apply(drule cmaps_fresh)
  3760 apply(auto simp add: fresh_prod)[1]
  3761 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3762 apply(case_tac "findc \<theta>_c x3")
  3763 apply(simp add: abs_fresh)
  3764 apply(auto)[1]
  3765 apply(generate_fresh "coname")
  3766 apply(fresh_fun_simp (no_asm))
  3767 apply(drule cmaps_fresh)
  3768 apply(auto simp add: fresh_prod)[1]
  3769 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3770 apply(case_tac "findn \<theta>_n x5")
  3771 apply(simp add: abs_fresh)
  3772 apply(auto)[1]
  3773 apply(generate_fresh "name")
  3774 apply(fresh_fun_simp (no_asm))
  3775 apply(drule nmaps_fresh)
  3776 apply(auto simp add: fresh_prod)[1]
  3777 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3778 apply(case_tac "findn \<theta>_n x5")
  3779 apply(simp add: abs_fresh)
  3780 apply(auto)[1]
  3781 apply(generate_fresh "name")
  3782 apply(fresh_fun_simp (no_asm))
  3783 apply(drule_tac a="x3" in nmaps_fresh)
  3784 apply(auto simp add: fresh_prod)[1]
  3785 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3786 apply(case_tac "findc \<theta>_c x4")
  3787 apply(simp add: abs_fresh abs_supp fin_supp)
  3788 apply(auto)[1]
  3789 apply(generate_fresh "coname")
  3790 apply(fresh_fun_simp (no_asm))
  3791 apply(drule cmaps_fresh)
  3792 apply(auto simp add: fresh_prod)[1]
  3793 apply(simp add: abs_fresh fresh_prod fresh_atm abs_supp fin_supp)
  3794 apply(case_tac "findc \<theta>_c x4")
  3795 apply(simp add: abs_fresh abs_supp fin_supp)
  3796 apply(auto)[1]
  3797 apply(generate_fresh "coname")
  3798 apply(fresh_fun_simp (no_asm))
  3799 apply(drule_tac x="x2" in cmaps_fresh)
  3800 apply(auto simp add: fresh_prod)[1]
  3801 apply(simp add: abs_fresh fresh_prod fresh_atm abs_supp fin_supp)
  3802 apply(case_tac "findn \<theta>_n x5")
  3803 apply(simp add: abs_fresh)
  3804 apply(auto)[1]
  3805 apply(generate_fresh "name")
  3806 apply(fresh_fun_simp (no_asm))
  3807 apply(drule nmaps_fresh)
  3808 apply(auto simp add: fresh_prod)[1]
  3809 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3810 apply(case_tac "findn \<theta>_n x5")
  3811 apply(simp add: abs_fresh)
  3812 apply(auto)[1]
  3813 apply(generate_fresh "name")
  3814 apply(fresh_fun_simp (no_asm))
  3815 apply(drule_tac a="x3" in nmaps_fresh)
  3816 apply(auto simp add: fresh_prod)[1]
  3817 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3818 apply(fresh_guess)+
  3819 done
  3820 
  3821 lemma case_cong:
  3822   assumes a: "B1=B2" "x1=x2" "y1=y2"
  3823   shows "(case B1 of None \<Rightarrow> x1 | Some (x,P) \<Rightarrow> y1 x P) = (case B2 of None \<Rightarrow> x2 | Some (x,P) \<Rightarrow> y2 x P)"
  3824 using a
  3825 apply(auto)
  3826 done
  3827 
  3828 lemma find_maps:
  3829   shows "\<theta>_c cmaps a to (findc \<theta>_c a)"
  3830   and   "\<theta>_n nmaps x to (findn \<theta>_n x)"
  3831 apply(auto)
  3832 done
  3833 
  3834 lemma psubst_eqvt[eqvt]:
  3835   fixes pi1::"name prm"
  3836   and   pi2::"coname prm"
  3837   shows "pi1\<bullet>(\<theta>_n,\<theta>_c<M>) = (pi1\<bullet>\<theta>_n),(pi1\<bullet>\<theta>_c)<(pi1\<bullet>M)>"
  3838   and   "pi2\<bullet>(\<theta>_n,\<theta>_c<M>) = (pi2\<bullet>\<theta>_n),(pi2\<bullet>\<theta>_c)<(pi2\<bullet>M)>"
  3839 apply(nominal_induct M avoiding: \<theta>_n \<theta>_c rule: trm.strong_induct)
  3840 apply(auto simp add: eq_bij fresh_bij eqvts perm_pi_simp)
  3841 apply(rule case_cong)
  3842 apply(rule find_maps)
  3843 apply(simp)
  3844 apply(perm_simp add: eqvts)
  3845 apply(rule case_cong)
  3846 apply(rule find_maps)
  3847 apply(simp)
  3848 apply(perm_simp add: eqvts)
  3849 apply(rule case_cong)
  3850 apply(rule find_maps)
  3851 apply(simp)
  3852 apply(perm_simp add: eqvts)
  3853 apply(rule case_cong)
  3854 apply(rule find_maps)
  3855 apply(simp)
  3856 apply(perm_simp add: eqvts)
  3857 apply(rule case_cong)
  3858 apply(rule find_maps)
  3859 apply(simp)
  3860 apply(perm_simp add: eqvts)
  3861 apply(rule case_cong)
  3862 apply(rule find_maps)
  3863 apply(simp)
  3864 apply(perm_simp add: eqvts)
  3865 apply(rule case_cong)
  3866 apply(rule find_maps)
  3867 apply(simp)
  3868 apply(perm_simp add: eqvts)
  3869 apply(rule case_cong)
  3870 apply(rule find_maps)
  3871 apply(simp)
  3872 apply(perm_simp add: eqvts)
  3873 apply(rule case_cong)
  3874 apply(rule find_maps)
  3875 apply(simp)
  3876 apply(perm_simp add: eqvts)
  3877 apply(rule case_cong)
  3878 apply(rule find_maps)
  3879 apply(simp)
  3880 apply(perm_simp add: eqvts)
  3881 apply(rule case_cong)
  3882 apply(rule find_maps)
  3883 apply(simp)
  3884 apply(perm_simp add: eqvts)
  3885 apply(rule case_cong)
  3886 apply(rule find_maps)
  3887 apply(simp)
  3888 apply(perm_simp add: eqvts)
  3889 apply(rule case_cong)
  3890 apply(rule find_maps)
  3891 apply(simp)
  3892 apply(perm_simp add: eqvts)
  3893 apply(rule case_cong)
  3894 apply(rule find_maps)
  3895 apply(simp)
  3896 apply(perm_simp add: eqvts)
  3897 apply(rule case_cong)
  3898 apply(rule find_maps)
  3899 apply(simp)
  3900 apply(perm_simp add: eqvts)
  3901 apply(rule case_cong)
  3902 apply(rule find_maps)
  3903 apply(simp)
  3904 apply(perm_simp add: eqvts)
  3905 apply(rule case_cong)
  3906 apply(rule find_maps)
  3907 apply(simp)
  3908 apply(perm_simp add: eqvts)
  3909 apply(rule case_cong)
  3910 apply(rule find_maps)
  3911 apply(simp)
  3912 apply(perm_simp add: eqvts)
  3913 apply(rule case_cong)
  3914 apply(rule find_maps)
  3915 apply(simp)
  3916 apply(perm_simp add: eqvts)
  3917 apply(rule case_cong)
  3918 apply(rule find_maps)
  3919 apply(simp)
  3920 apply(perm_simp add: eqvts)
  3921 done
  3922 
  3923 lemma ax_psubst:
  3924   assumes a: "\<theta>_n,\<theta>_c<M> = Ax x a"
  3925   and     b: "a\<sharp>(\<theta>_n,\<theta>_c)" "x\<sharp>(\<theta>_n,\<theta>_c)"
  3926   shows "M = Ax x a"
  3927 using a b
  3928 apply(nominal_induct M avoiding: \<theta>_n \<theta>_c rule: trm.strong_induct)
  3929 apply(auto)
  3930 apply(drule lookup_unicity)
  3931 apply(simp)+
  3932 apply(case_tac "findc \<theta>_c coname")
  3933 apply(simp)
  3934 apply(auto)[1]
  3935 apply(generate_fresh "coname")
  3936 apply(fresh_fun_simp)
  3937 apply(simp)
  3938 apply(case_tac "findn \<theta>_n name")
  3939 apply(simp)
  3940 apply(auto)[1]
  3941 apply(generate_fresh "name")
  3942 apply(fresh_fun_simp)
  3943 apply(simp)
  3944 apply(case_tac "findc \<theta>_c coname3")
  3945 apply(simp)
  3946 apply(auto)[1]
  3947 apply(generate_fresh "coname")
  3948 apply(fresh_fun_simp)
  3949 apply(simp)
  3950 apply(case_tac "findn \<theta>_n name2")
  3951 apply(simp)
  3952 apply(auto)[1]
  3953 apply(generate_fresh "name")
  3954 apply(fresh_fun_simp)
  3955 apply(simp)
  3956 apply(case_tac "findn \<theta>_n name2")
  3957 apply(simp)
  3958 apply(auto)[1]
  3959 apply(generate_fresh "name")
  3960 apply(fresh_fun_simp)
  3961 apply(simp)
  3962 apply(case_tac "findc \<theta>_c coname2")
  3963 apply(simp)
  3964 apply(auto)[1]
  3965 apply(generate_fresh "coname")
  3966 apply(fresh_fun_simp)
  3967 apply(simp)
  3968 apply(case_tac "findc \<theta>_c coname2")
  3969 apply(simp)
  3970 apply(auto)[1]
  3971 apply(generate_fresh "coname")
  3972 apply(fresh_fun_simp)
  3973 apply(simp)
  3974 apply(case_tac "findn \<theta>_n name3")
  3975 apply(simp)
  3976 apply(auto)[1]
  3977 apply(generate_fresh "name")
  3978 apply(fresh_fun_simp)
  3979 apply(simp)
  3980 apply(case_tac "findc \<theta>_c coname2")
  3981 apply(simp)
  3982 apply(auto)[1]
  3983 apply(generate_fresh "coname")
  3984 apply(fresh_fun_simp)
  3985 apply(simp)
  3986 apply(case_tac "findn \<theta>_n name2")
  3987 apply(simp)
  3988 apply(auto)[1]
  3989 apply(generate_fresh "name")
  3990 apply(fresh_fun_simp)
  3991 apply(simp)
  3992 done
  3993 
  3994 lemma better_Cut_substc1:
  3995   assumes a: "a\<sharp>(P,b)" "b\<sharp>N" 
  3996   shows "(Cut <a>.M (x).N){b:=(y).P} = Cut <a>.(M{b:=(y).P}) (x).N"
  3997 using a
  3998 apply -
  3999 apply(generate_fresh "coname")
  4000 apply(generate_fresh "name")
  4001 apply(subgoal_tac "Cut <a>.M (x).N = Cut <c>.([(c,a)]\<bullet>M) (ca).([(ca,x)]\<bullet>N)")
  4002 apply(simp)
  4003 apply(rule trans)
  4004 apply(rule better_Cut_substc)
  4005 apply(simp)
  4006 apply(simp add: abs_fresh)
  4007 apply(auto)[1]
  4008 apply(drule pt_bij1[OF pt_name_inst, OF at_name_inst])
  4009 apply(simp add: calc_atm fresh_atm)
  4010 apply(subgoal_tac"b\<sharp>([(ca,x)]\<bullet>N)")
  4011 apply(simp add: forget)
  4012 apply(simp add: trm.inject)
  4013 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4014 apply(perm_simp)
  4015 apply(simp add: fresh_left calc_atm)
  4016 apply(simp add: trm.inject)
  4017 apply(rule conjI)
  4018 apply(rule sym)
  4019 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4020 apply(rule sym)
  4021 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4022 done
  4023 
  4024 lemma better_Cut_substc2:
  4025   assumes a: "x\<sharp>(y,P)" "b\<sharp>(a,M)" "N\<noteq>Ax x b"
  4026   shows "(Cut <a>.M (x).N){b:=(y).P} = Cut <a>.M (x).(N{b:=(y).P})"
  4027 using a
  4028 apply -
  4029 apply(generate_fresh "coname")
  4030 apply(generate_fresh "name")
  4031 apply(subgoal_tac "Cut <a>.M (x).N = Cut <c>.([(c,a)]\<bullet>M) (ca).([(ca,x)]\<bullet>N)")
  4032 apply(simp)
  4033 apply(rule trans)
  4034 apply(rule better_Cut_substc)
  4035 apply(simp)
  4036 apply(simp add: abs_fresh)
  4037 apply(auto)[1]
  4038 apply(drule pt_bij1[OF pt_name_inst, OF at_name_inst])
  4039 apply(simp add: calc_atm fresh_atm fresh_prod)
  4040 apply(subgoal_tac"b\<sharp>([(c,a)]\<bullet>M)")
  4041 apply(simp add: forget)
  4042 apply(simp add: trm.inject)
  4043 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4044 apply(perm_simp)
  4045 apply(auto simp add: fresh_left calc_atm fresh_prod fresh_atm)[1]
  4046 apply(simp add: trm.inject)
  4047 apply(rule conjI)
  4048 apply(rule sym)
  4049 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4050 apply(rule sym)
  4051 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4052 done
  4053 
  4054 lemma better_Cut_substn1:
  4055   assumes a: "y\<sharp>(x,N)" "a\<sharp>(b,P)" "M\<noteq>Ax y a"
  4056   shows "(Cut <a>.M (x).N){y:=<b>.P} = Cut <a>.(M{y:=<b>.P}) (x).N"
  4057 using a
  4058 apply -
  4059 apply(generate_fresh "coname")
  4060 apply(generate_fresh "name")
  4061 apply(subgoal_tac "Cut <a>.M (x).N = Cut <c>.([(c,a)]\<bullet>M) (ca).([(ca,x)]\<bullet>N)")
  4062 apply(simp)
  4063 apply(rule trans)
  4064 apply(rule better_Cut_substn)
  4065 apply(simp add: abs_fresh)
  4066 apply(simp add: abs_fresh)
  4067 apply(auto)[1]
  4068 apply(drule pt_bij1[OF pt_coname_inst, OF at_coname_inst])
  4069 apply(simp add: calc_atm fresh_atm fresh_prod)
  4070 apply(subgoal_tac"y\<sharp>([(ca,x)]\<bullet>N)")
  4071 apply(simp add: forget)
  4072 apply(simp add: trm.inject)
  4073 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4074 apply(perm_simp)
  4075 apply(auto simp add: fresh_left calc_atm fresh_prod fresh_atm)[1]
  4076 apply(simp add: trm.inject)
  4077 apply(rule conjI)
  4078 apply(rule sym)
  4079 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4080 apply(rule sym)
  4081 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4082 done
  4083 
  4084 lemma better_Cut_substn2:
  4085   assumes a: "x\<sharp>(P,y)" "y\<sharp>M" 
  4086   shows "(Cut <a>.M (x).N){y:=<b>.P} = Cut <a>.M (x).(N{y:=<b>.P})"
  4087 using a
  4088 apply -
  4089 apply(generate_fresh "coname")
  4090 apply(generate_fresh "name")
  4091 apply(subgoal_tac "Cut <a>.M (x).N = Cut <c>.([(c,a)]\<bullet>M) (ca).([(ca,x)]\<bullet>N)")
  4092 apply(simp)
  4093 apply(rule trans)
  4094 apply(rule better_Cut_substn)
  4095 apply(simp add: abs_fresh)
  4096 apply(simp add: abs_fresh)
  4097 apply(auto)[1]
  4098 apply(drule pt_bij1[OF pt_coname_inst, OF at_coname_inst])
  4099 apply(simp add: calc_atm fresh_atm)
  4100 apply(subgoal_tac"y\<sharp>([(c,a)]\<bullet>M)")
  4101 apply(simp add: forget)
  4102 apply(simp add: trm.inject)
  4103 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4104 apply(perm_simp)
  4105 apply(simp add: fresh_left calc_atm)
  4106 apply(simp add: trm.inject)
  4107 apply(rule conjI)
  4108 apply(rule sym)
  4109 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4110 apply(rule sym)
  4111 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4112 done
  4113 
  4114 lemma psubst_fresh_name:
  4115   fixes x::"name"
  4116   assumes a: "x\<sharp>\<theta>_n" "x\<sharp>\<theta>_c" "x\<sharp>M"
  4117   shows "x\<sharp>\<theta>_n,\<theta>_c<M>"
  4118 using a
  4119 apply(nominal_induct M avoiding: x \<theta>_n \<theta>_c rule: trm.strong_induct)
  4120 apply(simp add: lookup_freshness)
  4121 apply(auto simp add: abs_fresh)[1]
  4122 apply(simp add: lookupc_freshness)
  4123 apply(simp add: lookupc_freshness)
  4124 apply(simp add: lookupc_freshness)
  4125 apply(simp add: lookupd_freshness)
  4126 apply(simp add: lookupd_freshness)
  4127 apply(simp add: lookupc_freshness)
  4128 apply(simp)
  4129 apply(case_tac "findc \<theta>_c coname")
  4130 apply(auto simp add: abs_fresh)[1]
  4131 apply(auto)[1]
  4132 apply(generate_fresh "coname")
  4133 apply(fresh_fun_simp)
  4134 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4135 apply(simp)
  4136 apply(case_tac "findn \<theta>_n name")
  4137 apply(auto simp add: abs_fresh)[1]
  4138 apply(auto)[1]
  4139 apply(generate_fresh "name")
  4140 apply(fresh_fun_simp)
  4141 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4142 apply(simp)
  4143 apply(case_tac "findc \<theta>_c coname3")
  4144 apply(auto simp add: abs_fresh)[1]
  4145 apply(auto)[1]
  4146 apply(generate_fresh "coname")
  4147 apply(fresh_fun_simp)
  4148 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4149 apply(simp)
  4150 apply(case_tac "findn \<theta>_n name2")
  4151 apply(auto simp add: abs_fresh)[1]
  4152 apply(auto)[1]
  4153 apply(generate_fresh "name")
  4154 apply(fresh_fun_simp)
  4155 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4156 apply(simp)
  4157 apply(case_tac "findn \<theta>_n name2")
  4158 apply(auto simp add: abs_fresh)[1]
  4159 apply(auto)[1]
  4160 apply(generate_fresh "name")
  4161 apply(fresh_fun_simp)
  4162 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4163 apply(simp)
  4164 apply(case_tac "findc \<theta>_c coname2")
  4165 apply(auto simp add: abs_fresh)[1]
  4166 apply(auto)[1]
  4167 apply(generate_fresh "coname")
  4168 apply(fresh_fun_simp)
  4169 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4170 apply(simp)
  4171 apply(case_tac "findc \<theta>_c coname2")
  4172 apply(auto simp add: abs_fresh)[1]
  4173 apply(auto)[1]
  4174 apply(generate_fresh "coname")
  4175 apply(fresh_fun_simp)
  4176 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4177 apply(simp)
  4178 apply(case_tac "findn \<theta>_n name3")
  4179 apply(auto simp add: abs_fresh)[1]
  4180 apply(auto)[1]
  4181 apply(generate_fresh "name")
  4182 apply(fresh_fun_simp)
  4183 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4184 apply(simp)
  4185 apply(case_tac "findc \<theta>_c coname2")
  4186 apply(auto simp add: abs_fresh abs_supp fin_supp)[1]
  4187 apply(auto)[1]
  4188 apply(generate_fresh "coname")
  4189 apply(fresh_fun_simp)
  4190 apply(simp add: abs_fresh abs_supp fin_supp fresh_prod fresh_atm cmaps_fresh)
  4191 apply(simp)
  4192 apply(case_tac "findn \<theta>_n name2")
  4193 apply(auto simp add: abs_fresh)[1]
  4194 apply(auto)[1]
  4195 apply(generate_fresh "name")
  4196 apply(fresh_fun_simp)
  4197 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4198 done
  4199 
  4200 lemma psubst_fresh_coname:
  4201   fixes a::"coname"
  4202   assumes a: "a\<sharp>\<theta>_n" "a\<sharp>\<theta>_c" "a\<sharp>M"
  4203   shows "a\<sharp>\<theta>_n,\<theta>_c<M>"
  4204 using a
  4205 apply(nominal_induct M avoiding: a \<theta>_n \<theta>_c rule: trm.strong_induct)
  4206 apply(simp add: lookup_freshness)
  4207 apply(auto simp add: abs_fresh)[1]
  4208 apply(simp add: lookupd_freshness)
  4209 apply(simp add: lookupd_freshness)
  4210 apply(simp add: lookupc_freshness)
  4211 apply(simp add: lookupd_freshness)
  4212 apply(simp add: lookupc_freshness)
  4213 apply(simp add: lookupd_freshness)
  4214 apply(simp)
  4215 apply(case_tac "findc \<theta>_c coname")
  4216 apply(auto simp add: abs_fresh)[1]
  4217 apply(auto)[1]
  4218 apply(generate_fresh "coname")
  4219 apply(fresh_fun_simp)
  4220 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4221 apply(simp)
  4222 apply(case_tac "findn \<theta>_n name")
  4223 apply(auto simp add: abs_fresh)[1]
  4224 apply(auto)[1]
  4225 apply(generate_fresh "name")
  4226 apply(fresh_fun_simp)
  4227 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4228 apply(simp)
  4229 apply(case_tac "findc \<theta>_c coname3")
  4230 apply(auto simp add: abs_fresh)[1]
  4231 apply(auto)[1]
  4232 apply(generate_fresh "coname")
  4233 apply(fresh_fun_simp)
  4234 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4235 apply(simp)
  4236 apply(case_tac "findn \<theta>_n name2")
  4237 apply(auto simp add: abs_fresh)[1]
  4238 apply(auto)[1]
  4239 apply(generate_fresh "name")
  4240 apply(fresh_fun_simp)
  4241 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4242 apply(simp)
  4243 apply(case_tac "findn \<theta>_n name2")
  4244 apply(auto simp add: abs_fresh)[1]
  4245 apply(auto)[1]
  4246 apply(generate_fresh "name")
  4247 apply(fresh_fun_simp)
  4248 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4249 apply(simp)
  4250 apply(case_tac "findc \<theta>_c coname2")
  4251 apply(auto simp add: abs_fresh)[1]
  4252 apply(auto)[1]
  4253 apply(generate_fresh "coname")
  4254 apply(fresh_fun_simp)
  4255 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4256 apply(simp)
  4257 apply(case_tac "findc \<theta>_c coname2")
  4258 apply(auto simp add: abs_fresh)[1]
  4259 apply(auto)[1]
  4260 apply(generate_fresh "coname")
  4261 apply(fresh_fun_simp)
  4262 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4263 apply(simp)
  4264 apply(case_tac "findn \<theta>_n name3")
  4265 apply(auto simp add: abs_fresh)[1]
  4266 apply(auto)[1]
  4267 apply(generate_fresh "name")
  4268 apply(fresh_fun_simp)
  4269 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4270 apply(simp)
  4271 apply(case_tac "findc \<theta>_c coname2")
  4272 apply(auto simp add: abs_fresh abs_supp fin_supp)[1]
  4273 apply(auto)[1]
  4274 apply(generate_fresh "coname")
  4275 apply(fresh_fun_simp)
  4276 apply(simp add: abs_fresh abs_supp fin_supp fresh_prod fresh_atm cmaps_fresh)
  4277 apply(simp)
  4278 apply(case_tac "findn \<theta>_n name2")
  4279 apply(auto simp add: abs_fresh)[1]
  4280 apply(auto)[1]
  4281 apply(generate_fresh "name")
  4282 apply(fresh_fun_simp)
  4283 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4284 done
  4285 
  4286 lemma psubst_csubst:
  4287   assumes a: "a\<sharp>(\<theta>_n,\<theta>_c)"
  4288   shows "\<theta>_n,((a,x,P)#\<theta>_c)<M> = ((\<theta>_n,\<theta>_c<M>){a:=(x).P})"
  4289 using a
  4290 apply(nominal_induct M avoiding: a x \<theta>_n \<theta>_c P rule: trm.strong_induct)
  4291 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4292 apply(simp add: lookup_csubst)
  4293 apply(simp add: fresh_list_cons fresh_prod)
  4294 apply(auto)[1]
  4295 apply(rule sym)
  4296 apply(rule trans)
  4297 apply(rule better_Cut_substc)
  4298 apply(simp)
  4299 apply(simp add: abs_fresh fresh_atm)
  4300 apply(simp add: lookupd_fresh)
  4301 apply(subgoal_tac "a\<sharp>lookupc xa coname \<theta>_n")
  4302 apply(simp add: forget)
  4303 apply(simp add: trm.inject)
  4304 apply(rule sym)
  4305 apply(simp add: alpha nrename_swap fresh_atm)
  4306 apply(rule lookupc_freshness)
  4307 apply(simp add: fresh_atm)
  4308 apply(rule sym)
  4309 apply(rule trans)
  4310 apply(rule better_Cut_substc)
  4311 apply(simp)
  4312 apply(simp add: abs_fresh fresh_atm)
  4313 apply(simp)
  4314 apply(rule conjI)
  4315 apply(rule impI)
  4316 apply(simp add: lookupd_unicity)
  4317 apply(rule impI)
  4318 apply(subgoal_tac "a\<sharp>lookupc xa coname \<theta>_n")
  4319 apply(subgoal_tac "a\<sharp>lookupd name aa \<theta>_c")
  4320 apply(simp add: forget)
  4321 apply(rule lookupd_freshness)
  4322 apply(simp add: fresh_atm)
  4323 apply(rule lookupc_freshness)
  4324 apply(simp add: fresh_atm)
  4325 apply(rule sym)
  4326 apply(rule trans)
  4327 apply(rule better_Cut_substc)
  4328 apply(simp)
  4329 apply(simp add: abs_fresh fresh_atm)
  4330 apply(simp)
  4331 apply(rule conjI)
  4332 apply(rule impI)
  4333 apply(drule ax_psubst)
  4334 apply(simp)
  4335 apply(simp)
  4336 apply(blast)
  4337 apply(rule impI)
  4338 apply(subgoal_tac "a\<sharp>lookupc xa coname \<theta>_n")
  4339 apply(simp add: forget)
  4340 apply(rule lookupc_freshness)
  4341 apply(simp add: fresh_atm)
  4342 apply(rule sym)
  4343 apply(rule trans)
  4344 apply(rule better_Cut_substc)
  4345 apply(simp)
  4346 apply(simp add: abs_fresh fresh_atm)
  4347 apply(simp)
  4348 apply(rule conjI)
  4349 apply(rule impI)
  4350 apply(simp add: trm.inject)
  4351 apply(rule sym)
  4352 apply(simp add: alpha)
  4353 apply(simp add: alpha nrename_swap fresh_atm)
  4354 apply(simp add: lookupd_fresh)
  4355 apply(rule sym)
  4356 apply(rule trans)
  4357 apply(rule better_Cut_substc)
  4358 apply(simp)
  4359 apply(simp add: abs_fresh fresh_atm)
  4360 apply(simp)
  4361 apply(rule conjI)
  4362 apply(rule impI)
  4363 apply(simp add: lookupd_unicity)
  4364 apply(rule impI)
  4365 apply(subgoal_tac "a\<sharp>lookupd name aa \<theta>_c")
  4366 apply(simp add: forget)
  4367 apply(rule lookupd_freshness)
  4368 apply(simp add: fresh_atm)
  4369 apply(rule sym)
  4370 apply(rule trans)
  4371 apply(rule better_Cut_substc)
  4372 apply(simp)
  4373 apply(simp add: abs_fresh fresh_atm)
  4374 apply(simp)
  4375 apply(rule impI)
  4376 apply(drule ax_psubst)
  4377 apply(simp)
  4378 apply(simp)
  4379 apply(blast)
  4380 (* NotR *)
  4381 apply(simp)
  4382 apply(case_tac "findc \<theta>_c coname")
  4383 apply(simp)
  4384 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4385 apply(simp)
  4386 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4387 apply(drule cmaps_false)
  4388 apply(assumption)
  4389 apply(simp)
  4390 apply(generate_fresh "coname")
  4391 apply(fresh_fun_simp)
  4392 apply(fresh_fun_simp)
  4393 apply(rule sym)
  4394 apply(rule trans)
  4395 apply(rule better_Cut_substc1)
  4396 apply(simp)
  4397 apply(simp add: cmaps_fresh)
  4398 apply(auto simp add: fresh_prod fresh_atm)[1]
  4399 (* NotL *)
  4400 apply(simp)
  4401 apply(case_tac "findn \<theta>_n name")
  4402 apply(simp)
  4403 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4404 apply(simp)
  4405 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4406 apply(generate_fresh "name")
  4407 apply(fresh_fun_simp)
  4408 apply(fresh_fun_simp)
  4409 apply(drule_tac a="a" in nmaps_fresh)
  4410 apply(assumption)
  4411 apply(rule sym)
  4412 apply(rule trans)
  4413 apply(rule better_Cut_substc2)
  4414 apply(simp)
  4415 apply(simp)
  4416 apply(simp)
  4417 apply(simp)
  4418 (* AndR *)
  4419 apply(simp)
  4420 apply(case_tac "findc \<theta>_c coname3")
  4421 apply(simp)
  4422 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4423 apply(simp)
  4424 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4425 apply(drule cmaps_false)
  4426 apply(assumption)
  4427 apply(simp)
  4428 apply(generate_fresh "coname")
  4429 apply(fresh_fun_simp)
  4430 apply(fresh_fun_simp)
  4431 apply(rule sym)
  4432 apply(rule trans)
  4433 apply(rule better_Cut_substc1)
  4434 apply(simp)
  4435 apply(simp add: cmaps_fresh)
  4436 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4437 (* AndL1 *)
  4438 apply(simp)
  4439 apply(case_tac "findn \<theta>_n name2")
  4440 apply(simp)
  4441 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4442 apply(simp)
  4443 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4444 apply(generate_fresh "name")
  4445 apply(fresh_fun_simp)
  4446 apply(fresh_fun_simp)
  4447 apply(drule_tac a="a" in nmaps_fresh)
  4448 apply(assumption)
  4449 apply(rule sym)
  4450 apply(rule trans)
  4451 apply(rule better_Cut_substc2)
  4452 apply(simp)
  4453 apply(simp)
  4454 apply(simp)
  4455 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4456 (* AndL2 *)
  4457 apply(simp)
  4458 apply(case_tac "findn \<theta>_n name2")
  4459 apply(simp)
  4460 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4461 apply(simp)
  4462 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4463 apply(generate_fresh "name")
  4464 apply(fresh_fun_simp)
  4465 apply(fresh_fun_simp)
  4466 apply(drule_tac a="a" in nmaps_fresh)
  4467 apply(assumption)
  4468 apply(rule sym)
  4469 apply(rule trans)
  4470 apply(rule better_Cut_substc2)
  4471 apply(simp)
  4472 apply(simp)
  4473 apply(simp)
  4474 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4475 (* OrR1 *)
  4476 apply(simp)
  4477 apply(case_tac "findc \<theta>_c coname2")
  4478 apply(simp)
  4479 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4480 apply(simp)
  4481 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4482 apply(drule cmaps_false)
  4483 apply(assumption)
  4484 apply(simp)
  4485 apply(generate_fresh "coname")
  4486 apply(fresh_fun_simp)
  4487 apply(fresh_fun_simp)
  4488 apply(rule sym)
  4489 apply(rule trans)
  4490 apply(rule better_Cut_substc1)
  4491 apply(simp)
  4492 apply(simp add: cmaps_fresh)
  4493 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4494 (* OrR2 *)
  4495 apply(simp)
  4496 apply(case_tac "findc \<theta>_c coname2")
  4497 apply(simp)
  4498 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4499 apply(simp)
  4500 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4501 apply(drule cmaps_false)
  4502 apply(assumption)
  4503 apply(simp)
  4504 apply(generate_fresh "coname")
  4505 apply(fresh_fun_simp)
  4506 apply(fresh_fun_simp)
  4507 apply(rule sym)
  4508 apply(rule trans)
  4509 apply(rule better_Cut_substc1)
  4510 apply(simp)
  4511 apply(simp add: cmaps_fresh)
  4512 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4513 (* OrL *)
  4514 apply(simp)
  4515 apply(case_tac "findn \<theta>_n name3")
  4516 apply(simp)
  4517 apply(auto simp add: fresh_list_cons psubst_fresh_name fresh_atm fresh_prod)[1]
  4518 apply(simp)
  4519 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4520 apply(generate_fresh "name")
  4521 apply(fresh_fun_simp)
  4522 apply(fresh_fun_simp)
  4523 apply(drule_tac a="a" in nmaps_fresh)
  4524 apply(assumption)
  4525 apply(rule sym)
  4526 apply(rule trans)
  4527 apply(rule better_Cut_substc2)
  4528 apply(simp)
  4529 apply(simp)
  4530 apply(simp)
  4531 apply(auto simp add:  psubst_fresh_name fresh_prod fresh_atm)[1]
  4532 (* ImpR *)
  4533 apply(simp)
  4534 apply(case_tac "findc \<theta>_c coname2")
  4535 apply(simp)
  4536 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4537 apply(simp)
  4538 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4539 apply(drule cmaps_false)
  4540 apply(assumption)
  4541 apply(simp)
  4542 apply(generate_fresh "coname")
  4543 apply(fresh_fun_simp)
  4544 apply(fresh_fun_simp)
  4545 apply(rule sym)
  4546 apply(rule trans)
  4547 apply(rule better_Cut_substc1)
  4548 apply(simp)
  4549 apply(simp add: cmaps_fresh)
  4550 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4551 (* ImpL *)
  4552 apply(simp)
  4553 apply(case_tac "findn \<theta>_n name2")
  4554 apply(simp)
  4555 apply(auto simp add: fresh_list_cons psubst_fresh_coname psubst_fresh_name fresh_atm fresh_prod)[1]
  4556 apply(simp)
  4557 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4558 apply(generate_fresh "name")
  4559 apply(fresh_fun_simp)
  4560 apply(fresh_fun_simp)
  4561 apply(simp add: abs_fresh subst_fresh)
  4562 apply(drule_tac a="a" in nmaps_fresh)
  4563 apply(assumption)
  4564 apply(rule sym)
  4565 apply(rule trans)
  4566 apply(rule better_Cut_substc2)
  4567 apply(simp)
  4568 apply(simp)
  4569 apply(simp)
  4570 apply(auto simp add: psubst_fresh_coname psubst_fresh_name fresh_prod fresh_atm)[1]
  4571 done
  4572 
  4573 lemma psubst_nsubst:
  4574   assumes a: "x\<sharp>(\<theta>_n,\<theta>_c)"
  4575   shows "((x,a,P)#\<theta>_n),\<theta>_c<M> = ((\<theta>_n,\<theta>_c<M>){x:=<a>.P})"
  4576 using a
  4577 apply(nominal_induct M avoiding: a x \<theta>_n \<theta>_c P rule: trm.strong_induct)
  4578 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4579 apply(simp add: lookup_fresh)
  4580 apply(rule lookupb_lookupa)
  4581 apply(simp)
  4582 apply(rule sym)
  4583 apply(rule forget)
  4584 apply(rule lookup_freshness)
  4585 apply(simp add: fresh_atm)
  4586 apply(auto simp add: lookupc_freshness fresh_list_cons fresh_prod)[1]
  4587 apply(simp add: lookupc_fresh)
  4588 apply(rule sym)
  4589 apply(rule trans)
  4590 apply(rule better_Cut_substn)
  4591 apply(simp add: abs_fresh)
  4592 apply(simp add: abs_fresh fresh_atm)
  4593 apply(simp add: lookupd_fresh)
  4594 apply(subgoal_tac "x\<sharp>lookupd name aa \<theta>_c")
  4595 apply(simp add: forget)
  4596 apply(simp add: trm.inject)
  4597 apply(rule sym)
  4598 apply(simp add: alpha crename_swap fresh_atm)
  4599 apply(rule lookupd_freshness)
  4600 apply(simp add: fresh_atm)
  4601 apply(rule sym)
  4602 apply(rule trans)
  4603 apply(rule better_Cut_substn)
  4604 apply(simp add: abs_fresh) 
  4605 apply(simp add: abs_fresh fresh_atm)
  4606 apply(simp)
  4607 apply(rule conjI)
  4608 apply(rule impI)
  4609 apply(simp add: lookupc_unicity)
  4610 apply(rule impI)
  4611 apply(subgoal_tac "x\<sharp>lookupc xa coname \<theta>_n")
  4612 apply(subgoal_tac "x\<sharp>lookupd name aa \<theta>_c")
  4613 apply(simp add: forget)
  4614 apply(rule lookupd_freshness)
  4615 apply(simp add: fresh_atm)
  4616 apply(rule lookupc_freshness)
  4617 apply(simp add: fresh_atm)
  4618 apply(rule sym)
  4619 apply(rule trans)
  4620 apply(rule better_Cut_substn)
  4621 apply(simp add: abs_fresh)
  4622 apply(simp add: abs_fresh fresh_atm)
  4623 apply(simp)
  4624 apply(rule conjI)
  4625 apply(rule impI)
  4626 apply(simp add: trm.inject)
  4627 apply(rule sym)
  4628 apply(simp add: alpha crename_swap fresh_atm)
  4629 apply(rule impI)
  4630 apply(simp add: lookupc_fresh)
  4631 apply(rule sym)
  4632 apply(rule trans)
  4633 apply(rule better_Cut_substn)
  4634 apply(simp add: abs_fresh)
  4635 apply(simp add: abs_fresh fresh_atm)
  4636 apply(simp)
  4637 apply(rule conjI)
  4638 apply(rule impI)
  4639 apply(simp add: lookupc_unicity)
  4640 apply(rule impI)
  4641 apply(subgoal_tac "x\<sharp>lookupc xa coname \<theta>_n")
  4642 apply(simp add: forget)
  4643 apply(rule lookupc_freshness)
  4644 apply(simp add: fresh_prod fresh_atm)
  4645 apply(rule sym)
  4646 apply(rule trans)
  4647 apply(rule better_Cut_substn)
  4648 apply(simp add: abs_fresh)
  4649 apply(simp add: abs_fresh fresh_atm)
  4650 apply(simp)
  4651 apply(rule conjI)
  4652 apply(rule impI)
  4653 apply(drule ax_psubst)
  4654 apply(simp)
  4655 apply(simp)
  4656 apply(simp)
  4657 apply(blast)
  4658 apply(rule impI)
  4659 apply(subgoal_tac "x\<sharp>lookupd name aa \<theta>_c")
  4660 apply(simp add: forget)
  4661 apply(rule lookupd_freshness)
  4662 apply(simp add: fresh_atm)
  4663 apply(rule sym)
  4664 apply(rule trans)
  4665 apply(rule better_Cut_substn)
  4666 apply(simp add: abs_fresh)
  4667 apply(simp add: abs_fresh fresh_atm)
  4668 apply(simp)
  4669 apply(rule impI)
  4670 apply(drule ax_psubst)
  4671 apply(simp)
  4672 apply(simp)
  4673 apply(blast)
  4674 (* NotR *)
  4675 apply(simp)
  4676 apply(case_tac "findc \<theta>_c coname")
  4677 apply(simp)
  4678 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4679 apply(simp)
  4680 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4681 apply(generate_fresh "coname")
  4682 apply(fresh_fun_simp)
  4683 apply(fresh_fun_simp)
  4684 apply(rule sym)
  4685 apply(rule trans)
  4686 apply(rule better_Cut_substn1)
  4687 apply(simp add: cmaps_fresh)
  4688 apply(simp)
  4689 apply(simp)
  4690 apply(simp)
  4691 (* NotL *)
  4692 apply(simp)
  4693 apply(case_tac "findn \<theta>_n name")
  4694 apply(simp)
  4695 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4696 apply(simp)
  4697 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4698 apply(drule nmaps_false)
  4699 apply(simp)
  4700 apply(simp)
  4701 apply(generate_fresh "name")
  4702 apply(fresh_fun_simp)
  4703 apply(fresh_fun_simp)
  4704 apply(rule sym)
  4705 apply(rule trans)
  4706 apply(rule better_Cut_substn2)
  4707 apply(simp)
  4708 apply(simp add: nmaps_fresh)
  4709 apply(simp add: fresh_prod fresh_atm)
  4710 (* AndR *)
  4711 apply(simp)
  4712 apply(case_tac "findc \<theta>_c coname3")
  4713 apply(simp)
  4714 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4715 apply(simp)
  4716 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4717 apply(generate_fresh "coname")
  4718 apply(fresh_fun_simp)
  4719 apply(fresh_fun_simp)
  4720 apply(rule sym)
  4721 apply(rule trans)
  4722 apply(rule better_Cut_substn1)
  4723 apply(simp add: cmaps_fresh)
  4724 apply(simp)
  4725 apply(simp)
  4726 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4727 (* AndL1 *)
  4728 apply(simp)
  4729 apply(case_tac "findn \<theta>_n name2")
  4730 apply(simp)
  4731 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4732 apply(simp)
  4733 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4734 apply(drule nmaps_false)
  4735 apply(simp)
  4736 apply(simp)
  4737 apply(generate_fresh "name")
  4738 apply(fresh_fun_simp)
  4739 apply(fresh_fun_simp)
  4740 apply(rule sym)
  4741 apply(rule trans)
  4742 apply(rule better_Cut_substn2)
  4743 apply(simp)
  4744 apply(simp add: nmaps_fresh)
  4745 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4746 (* AndL2 *)
  4747 apply(simp)
  4748 apply(case_tac "findn \<theta>_n name2")
  4749 apply(simp)
  4750 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4751 apply(simp)
  4752 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4753 apply(drule nmaps_false)
  4754 apply(simp)
  4755 apply(simp)
  4756 apply(generate_fresh "name")
  4757 apply(fresh_fun_simp)
  4758 apply(fresh_fun_simp)
  4759 apply(rule sym)
  4760 apply(rule trans)
  4761 apply(rule better_Cut_substn2)
  4762 apply(simp)
  4763 apply(simp add: nmaps_fresh)
  4764 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4765 (* OrR1 *)
  4766 apply(simp)
  4767 apply(case_tac "findc \<theta>_c coname2")
  4768 apply(simp)
  4769 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4770 apply(simp)
  4771 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4772 apply(generate_fresh "coname")
  4773 apply(fresh_fun_simp)
  4774 apply(fresh_fun_simp)
  4775 apply(rule sym)
  4776 apply(rule trans)
  4777 apply(rule better_Cut_substn1)
  4778 apply(simp add: cmaps_fresh)
  4779 apply(simp)
  4780 apply(simp)
  4781 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4782 (* OrR2 *)
  4783 apply(simp)
  4784 apply(case_tac "findc \<theta>_c coname2")
  4785 apply(simp)
  4786 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4787 apply(simp)
  4788 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4789 apply(generate_fresh "coname")
  4790 apply(fresh_fun_simp)
  4791 apply(fresh_fun_simp)
  4792 apply(rule sym)
  4793 apply(rule trans)
  4794 apply(rule better_Cut_substn1)
  4795 apply(simp add: cmaps_fresh)
  4796 apply(simp)
  4797 apply(simp)
  4798 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4799 (* OrL *)
  4800 apply(simp)
  4801 apply(case_tac "findn \<theta>_n name3")
  4802 apply(simp)
  4803 apply(auto simp add: fresh_list_cons psubst_fresh_name fresh_atm fresh_prod)[1]
  4804 apply(simp)
  4805 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4806 apply(drule nmaps_false)
  4807 apply(simp)
  4808 apply(simp)
  4809 apply(generate_fresh "name")
  4810 apply(fresh_fun_simp)
  4811 apply(fresh_fun_simp)
  4812 apply(rule sym)
  4813 apply(rule trans)
  4814 apply(rule better_Cut_substn2)
  4815 apply(simp)
  4816 apply(simp add: nmaps_fresh)
  4817 apply(auto simp add:  psubst_fresh_name fresh_prod fresh_atm)[1]
  4818 (* ImpR *)
  4819 apply(simp)
  4820 apply(case_tac "findc \<theta>_c coname2")
  4821 apply(simp)
  4822 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4823 apply(simp)
  4824 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4825 apply(generate_fresh "coname")
  4826 apply(fresh_fun_simp)
  4827 apply(fresh_fun_simp)
  4828 apply(rule sym)
  4829 apply(rule trans)
  4830 apply(rule better_Cut_substn1)
  4831 apply(simp add: cmaps_fresh)
  4832 apply(simp)
  4833 apply(simp)
  4834 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4835 (* ImpL *)
  4836 apply(simp)
  4837 apply(case_tac "findn \<theta>_n name2")
  4838 apply(simp)
  4839 apply(auto simp add: fresh_list_cons psubst_fresh_coname psubst_fresh_name fresh_atm fresh_prod)[1]
  4840 apply(simp)
  4841 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4842 apply(drule nmaps_false)
  4843 apply(simp)
  4844 apply(simp)
  4845 apply(generate_fresh "name")
  4846 apply(fresh_fun_simp)
  4847 apply(fresh_fun_simp)
  4848 apply(rule sym)
  4849 apply(rule trans)
  4850 apply(rule better_Cut_substn2)
  4851 apply(simp)
  4852 apply(simp add: nmaps_fresh)
  4853 apply(auto simp add: psubst_fresh_coname psubst_fresh_name fresh_prod fresh_atm)[1]
  4854 done
  4855 
  4856 definition 
  4857   ncloses :: "(name\<times>coname\<times>trm) list\<Rightarrow>(name\<times>ty) list \<Rightarrow> bool" ("_ ncloses _" [55,55] 55) 
  4858 where
  4859   "\<theta>_n ncloses \<Gamma> \<equiv> \<forall>x B. ((x,B) \<in> set \<Gamma> \<longrightarrow> (\<exists>c P. \<theta>_n nmaps x to Some (c,P) \<and> <c>:P \<in> (\<parallel><B>\<parallel>)))"
  4860   
  4861 definition 
  4862   ccloses :: "(coname\<times>name\<times>trm) list\<Rightarrow>(coname\<times>ty) list \<Rightarrow> bool" ("_ ccloses _" [55,55] 55) 
  4863 where
  4864   "\<theta>_c ccloses \<Delta> \<equiv> \<forall>a B. ((a,B) \<in> set \<Delta> \<longrightarrow> (\<exists>x P. \<theta>_c cmaps a to Some (x,P) \<and> (x):P \<in> (\<parallel>(B)\<parallel>)))"
  4865 
  4866 lemma ncloses_elim:
  4867   assumes a: "(x,B) \<in> set \<Gamma>"
  4868   and     b: "\<theta>_n ncloses \<Gamma>"
  4869   shows "\<exists>c P. \<theta>_n nmaps x to Some (c,P) \<and> <c>:P \<in> (\<parallel><B>\<parallel>)"
  4870 using a b by (auto simp add: ncloses_def)
  4871 
  4872 lemma ccloses_elim:
  4873   assumes a: "(a,B) \<in> set \<Delta>"
  4874   and     b: "\<theta>_c ccloses \<Delta>"
  4875   shows "\<exists>x P. \<theta>_c cmaps a to Some (x,P) \<and> (x):P \<in> (\<parallel>(B)\<parallel>)"
  4876 using a b by (auto simp add: ccloses_def)
  4877 
  4878 lemma ncloses_subset:
  4879   assumes a: "\<theta>_n ncloses \<Gamma>"
  4880   and     b: "set \<Gamma>' \<subseteq> set \<Gamma>"
  4881   shows "\<theta>_n ncloses \<Gamma>'"
  4882 using a b by (auto  simp add: ncloses_def)
  4883 
  4884 lemma ccloses_subset:
  4885   assumes a: "\<theta>_c ccloses \<Delta>"
  4886   and     b: "set \<Delta>' \<subseteq> set \<Delta>"
  4887   shows "\<theta>_c ccloses \<Delta>'"
  4888 using a b by (auto  simp add: ccloses_def)
  4889 
  4890 lemma validc_fresh:
  4891   fixes a::"coname"
  4892   and   \<Delta>::"(coname\<times>ty) list"
  4893   assumes a: "a\<sharp>\<Delta>"
  4894   shows "\<not>(\<exists>B. (a,B)\<in>set \<Delta>)"
  4895 using a
  4896 apply(induct \<Delta>)
  4897 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  4898 done
  4899 
  4900 lemma validn_fresh:
  4901   fixes x::"name"
  4902   and   \<Gamma>::"(name\<times>ty) list"
  4903   assumes a: "x\<sharp>\<Gamma>"
  4904   shows "\<not>(\<exists>B. (x,B)\<in>set \<Gamma>)"
  4905 using a
  4906 apply(induct \<Gamma>)
  4907 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  4908 done
  4909 
  4910 lemma ccloses_extend:
  4911   assumes a: "\<theta>_c ccloses \<Delta>" "a\<sharp>\<Delta>" "a\<sharp>\<theta>_c" "(x):P\<in>\<parallel>(B)\<parallel>"
  4912   shows "(a,x,P)#\<theta>_c ccloses (a,B)#\<Delta>"
  4913 using a
  4914 apply(simp add: ccloses_def)
  4915 apply(drule validc_fresh)
  4916 apply(auto)
  4917 done
  4918 
  4919 lemma ncloses_extend:
  4920   assumes a: "\<theta>_n ncloses \<Gamma>" "x\<sharp>\<Gamma>" "x\<sharp>\<theta>_n" "<a>:P\<in>\<parallel><B>\<parallel>"
  4921   shows "(x,a,P)#\<theta>_n ncloses (x,B)#\<Gamma>"
  4922 using a
  4923 apply(simp add: ncloses_def)
  4924 apply(drule validn_fresh)
  4925 apply(auto)
  4926 done
  4927 
  4928 
  4929 text {* typing relation *}
  4930 
  4931 inductive
  4932    typing :: "ctxtn \<Rightarrow> trm \<Rightarrow> ctxtc \<Rightarrow> bool" ("_ \<turnstile> _ \<turnstile> _" [100,100,100] 100)
  4933 where
  4934   TAx:    "\<lbrakk>validn \<Gamma>;validc \<Delta>; (x,B)\<in>set \<Gamma>; (a,B)\<in>set \<Delta>\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> Ax x a \<turnstile> \<Delta>"
  4935 | TNotR:  "\<lbrakk>x\<sharp>\<Gamma>; ((x,B)#\<Gamma>) \<turnstile> M \<turnstile> \<Delta>; set \<Delta>' = {(a,NOT B)}\<union>set \<Delta>; validc \<Delta>'\<rbrakk> 
  4936            \<Longrightarrow> \<Gamma> \<turnstile> NotR (x).M a \<turnstile> \<Delta>'"
  4937 | TNotL:  "\<lbrakk>a\<sharp>\<Delta>; \<Gamma> \<turnstile> M \<turnstile> ((a,B)#\<Delta>); set \<Gamma>' = {(x,NOT B)} \<union> set \<Gamma>; validn \<Gamma>'\<rbrakk>  
  4938            \<Longrightarrow> \<Gamma>' \<turnstile> NotL <a>.M x \<turnstile> \<Delta>"
  4939 | TAndL1: "\<lbrakk>x\<sharp>(\<Gamma>,y); ((x,B1)#\<Gamma>) \<turnstile> M \<turnstile> \<Delta>; set \<Gamma>' = {(y,B1 AND B2)} \<union> set \<Gamma>; validn \<Gamma>'\<rbrakk> 
  4940            \<Longrightarrow> \<Gamma>' \<turnstile> AndL1 (x).M y \<turnstile> \<Delta>"
  4941 | TAndL2: "\<lbrakk>x\<sharp>(\<Gamma>,y); ((x,B2)#\<Gamma>) \<turnstile> M \<turnstile> \<Delta>; set \<Gamma>' = {(y,B1 AND B2)} \<union> set \<Gamma>; validn \<Gamma>'\<rbrakk> 
  4942            \<Longrightarrow> \<Gamma>' \<turnstile> AndL2 (x).M y \<turnstile> \<Delta>"
  4943 | TAndR:  "\<lbrakk>a\<sharp>(\<Delta>,N,c); b\<sharp>(\<Delta>,M,c); a\<noteq>b; \<Gamma> \<turnstile> M \<turnstile> ((a,B)#\<Delta>); \<Gamma> \<turnstile> N \<turnstile> ((b,C)#\<Delta>); 
  4944            set \<Delta>' = {(c,B AND C)}\<union>set \<Delta>; validc \<Delta>'\<rbrakk> 
  4945            \<Longrightarrow> \<Gamma> \<turnstile> AndR <a>.M <b>.N c \<turnstile> \<Delta>'"
  4946 | TOrL:   "\<lbrakk>x\<sharp>(\<Gamma>,N,z); y\<sharp>(\<Gamma>,M,z); x\<noteq>y; ((x,B)#\<Gamma>) \<turnstile> M \<turnstile> \<Delta>; ((y,C)#\<Gamma>) \<turnstile> N \<turnstile> \<Delta>;
  4947            set \<Gamma>' = {(z,B OR C)} \<union> set \<Gamma>; validn \<Gamma>'\<rbrakk> 
  4948            \<Longrightarrow> \<Gamma>' \<turnstile> OrL (x).M (y).N z \<turnstile> \<Delta>"
  4949 | TOrR1:  "\<lbrakk>a\<sharp>(\<Delta>,b); \<Gamma> \<turnstile> M \<turnstile> ((a,B1)#\<Delta>); set \<Delta>' = {(b,B1 OR B2)}\<union>set \<Delta>; validc \<Delta>'\<rbrakk> 
  4950            \<Longrightarrow> \<Gamma> \<turnstile> OrR1 <a>.M b \<turnstile> \<Delta>'"
  4951 | TOrR2:  "\<lbrakk>a\<sharp>(\<Delta>,b); \<Gamma> \<turnstile> M \<turnstile> ((a,B2)#\<Delta>); set \<Delta>' = {(b,B1 OR B2)}\<union>set \<Delta>; validc \<Delta>'\<rbrakk> 
  4952            \<Longrightarrow> \<Gamma> \<turnstile> OrR2 <a>.M b \<turnstile> \<Delta>'"
  4953 | TImpL:  "\<lbrakk>a\<sharp>(\<Delta>,N); x\<sharp>(\<Gamma>,M,y); \<Gamma> \<turnstile> M \<turnstile> ((a,B)#\<Delta>); ((x,C)#\<Gamma>) \<turnstile> N \<turnstile> \<Delta>;
  4954            set \<Gamma>' = {(y,B IMP C)} \<union> set \<Gamma>; validn \<Gamma>'\<rbrakk> 
  4955            \<Longrightarrow> \<Gamma>' \<turnstile> ImpL <a>.M (x).N y \<turnstile> \<Delta>"
  4956 | TImpR:  "\<lbrakk>a\<sharp>(\<Delta>,b); x\<sharp>\<Gamma>; ((x,B)#\<Gamma>) \<turnstile> M \<turnstile> ((a,C)#\<Delta>); set \<Delta>' = {(b,B IMP C)}\<union>set \<Delta>; validc \<Delta>'\<rbrakk> 
  4957            \<Longrightarrow> \<Gamma> \<turnstile> ImpR (x).<a>.M b \<turnstile> \<Delta>'"
  4958 | TCut:   "\<lbrakk>a\<sharp>(\<Delta>,N); x\<sharp>(\<Gamma>,M); \<Gamma> \<turnstile> M \<turnstile> ((a,B)#\<Delta>); ((x,B)#\<Gamma>) \<turnstile> N \<turnstile> \<Delta>\<rbrakk> 
  4959            \<Longrightarrow> \<Gamma> \<turnstile> Cut <a>.M (x).N \<turnstile> \<Delta>"
  4960 
  4961 equivariance typing
  4962 
  4963 lemma fresh_set_member:
  4964   fixes x::"name"
  4965   and   a::"coname"
  4966   shows "x\<sharp>L \<Longrightarrow> e\<in>set L \<Longrightarrow> x\<sharp>e"
  4967   and   "a\<sharp>L \<Longrightarrow> e\<in>set L \<Longrightarrow> a\<sharp>e"   
  4968 by (induct L) (auto simp add: fresh_list_cons) 
  4969 
  4970 lemma fresh_subset:
  4971   fixes x::"name"
  4972   and   a::"coname"
  4973   shows "x\<sharp>L \<Longrightarrow> set L' \<subseteq> set L \<Longrightarrow> x\<sharp>L'"
  4974   and   "a\<sharp>L \<Longrightarrow> set L' \<subseteq> set L \<Longrightarrow> a\<sharp>L'"   
  4975 apply(induct L' arbitrary: L) 
  4976 apply(auto simp add: fresh_list_cons fresh_list_nil intro: fresh_set_member)
  4977 done
  4978 
  4979 lemma fresh_subset_ext:
  4980   fixes x::"name"
  4981   and   a::"coname"
  4982   shows "x\<sharp>L \<Longrightarrow> x\<sharp>e \<Longrightarrow> set L' \<subseteq> set (e#L) \<Longrightarrow> x\<sharp>L'"
  4983   and   "a\<sharp>L \<Longrightarrow> a\<sharp>e \<Longrightarrow> set L' \<subseteq> set (e#L) \<Longrightarrow> a\<sharp>L'"   
  4984 apply(induct L' arbitrary: L) 
  4985 apply(auto simp add: fresh_list_cons fresh_list_nil intro: fresh_set_member)
  4986 done
  4987 
  4988 lemma fresh_under_insert:
  4989   fixes x::"name"
  4990   and   a::"coname"
  4991   and   \<Gamma>::"ctxtn"
  4992   and   \<Delta>::"ctxtc"
  4993   shows "x\<sharp>\<Gamma> \<Longrightarrow> x\<noteq>y \<Longrightarrow> set \<Gamma>' = insert (y,B) (set \<Gamma>) \<Longrightarrow> x\<sharp>\<Gamma>'"
  4994   and   "a\<sharp>\<Delta> \<Longrightarrow> a\<noteq>c \<Longrightarrow> set \<Delta>' = insert (c,B) (set \<Delta>) \<Longrightarrow> a\<sharp>\<Delta>'"   
  4995 apply(rule fresh_subset_ext(1))
  4996 apply(auto simp add: fresh_prod fresh_atm fresh_ty)
  4997 apply(rule fresh_subset_ext(2))
  4998 apply(auto simp add: fresh_prod fresh_atm fresh_ty)
  4999 done
  5000 
  5001 nominal_inductive typing
  5002   apply (simp_all add: abs_fresh fresh_atm fresh_list_cons fresh_prod fresh_ty fresh_ctxt 
  5003                        fresh_list_append abs_supp fin_supp)
  5004   apply(auto intro: fresh_under_insert)
  5005   done
  5006 
  5007 lemma validn_elim:
  5008   assumes a: "validn ((x,B)#\<Gamma>)"
  5009   shows "validn \<Gamma> \<and> x\<sharp>\<Gamma>"
  5010 using a
  5011 apply(erule_tac validn.cases)
  5012 apply(auto)
  5013 done
  5014 
  5015 lemma validc_elim:
  5016   assumes a: "validc ((a,B)#\<Delta>)"
  5017   shows "validc \<Delta> \<and> a\<sharp>\<Delta>"
  5018 using a
  5019 apply(erule_tac validc.cases)
  5020 apply(auto)
  5021 done
  5022 
  5023 lemma context_fresh:
  5024   fixes x::"name"
  5025   and   a::"coname"
  5026   shows "x\<sharp>\<Gamma> \<Longrightarrow> \<not>(\<exists>B. (x,B)\<in>set \<Gamma>)"
  5027   and   "a\<sharp>\<Delta> \<Longrightarrow> \<not>(\<exists>B. (a,B)\<in>set \<Delta>)"
  5028 apply -
  5029 apply(induct \<Gamma>)
  5030 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  5031 apply(induct \<Delta>)
  5032 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  5033 done
  5034 
  5035 lemma typing_implies_valid:
  5036   assumes a: "\<Gamma> \<turnstile> M \<turnstile> \<Delta>"
  5037   shows "validn \<Gamma> \<and> validc \<Delta>"
  5038 using a
  5039 apply(nominal_induct rule: typing.strong_induct)
  5040 apply(auto dest: validn_elim validc_elim)
  5041 done
  5042 
  5043 lemma ty_perm:
  5044   fixes pi1::"name prm"
  5045   and   pi2::"coname prm"
  5046   and   B::"ty"
  5047   shows "pi1\<bullet>B=B" and "pi2\<bullet>B=B"
  5048 apply(nominal_induct B rule: ty.strong_induct)
  5049 apply(auto simp add: perm_string)
  5050 done
  5051 
  5052 lemma ctxt_perm:
  5053   fixes pi1::"name prm"
  5054   and   pi2::"coname prm"
  5055   and   \<Gamma>::"ctxtn"
  5056   and   \<Delta>::"ctxtc"
  5057   shows "pi2\<bullet>\<Gamma>=\<Gamma>" and "pi1\<bullet>\<Delta>=\<Delta>"
  5058 apply -
  5059 apply(induct \<Gamma>)
  5060 apply(auto simp add: calc_atm ty_perm)
  5061 apply(induct \<Delta>)
  5062 apply(auto simp add: calc_atm ty_perm)
  5063 done
  5064 
  5065 lemma typing_Ax_elim1: 
  5066   assumes a: "\<Gamma> \<turnstile> Ax x a \<turnstile> ((a,B)#\<Delta>)"
  5067   shows "(x,B)\<in>set \<Gamma>"
  5068 using a
  5069 apply(erule_tac typing.cases)
  5070 apply(simp_all add: trm.inject)
  5071 apply(auto)
  5072 apply(auto dest: validc_elim context_fresh)
  5073 done
  5074 
  5075 lemma typing_Ax_elim2: 
  5076   assumes a: "((x,B)#\<Gamma>) \<turnstile> Ax x a \<turnstile> \<Delta>"
  5077   shows "(a,B)\<in>set \<Delta>"
  5078 using a
  5079 apply(erule_tac typing.cases)
  5080 apply(simp_all add: trm.inject)
  5081 apply(auto  dest!: validn_elim context_fresh)
  5082 done
  5083 
  5084 lemma psubst_Ax_aux: 
  5085   assumes a: "\<theta>_c cmaps a to Some (y,N)"
  5086   shows "lookupb x a \<theta>_c c P = Cut <c>.P (y).N"
  5087 using a
  5088 apply(induct \<theta>_c)
  5089 apply(auto)
  5090 done
  5091 
  5092 lemma psubst_Ax:
  5093   assumes a: "\<theta>_n nmaps x to Some (c,P)"
  5094   and     b: "\<theta>_c cmaps a to Some (y,N)"
  5095   shows "\<theta>_n,\<theta>_c<Ax x a> = Cut <c>.P (y).N"
  5096 using a b
  5097 apply(induct \<theta>_n)
  5098 apply(auto simp add: psubst_Ax_aux)
  5099 done
  5100 
  5101 lemma psubst_Cut:
  5102   assumes a: "\<forall>x. M\<noteq>Ax x c"
  5103   and     b: "\<forall>a. N\<noteq>Ax x a"
  5104   and     c: "c\<sharp>(\<theta>_n,\<theta>_c,N)" "x\<sharp>(\<theta>_n,\<theta>_c,M)"
  5105   shows "\<theta>_n,\<theta>_c<Cut <c>.M (x).N> = Cut <c>.(\<theta>_n,\<theta>_c<M>) (x).(\<theta>_n,\<theta>_c<N>)"
  5106 using a b c
  5107 apply(simp)
  5108 done
  5109 
  5110 lemma all_CAND: 
  5111   assumes a: "\<Gamma> \<turnstile> M \<turnstile> \<Delta>"
  5112   and     b: "\<theta>_n ncloses \<Gamma>"
  5113   and     c: "\<theta>_c ccloses \<Delta>"
  5114   shows "SNa (\<theta>_n,\<theta>_c<M>)"
  5115 using a b c
  5116 proof(nominal_induct avoiding: \<theta>_n \<theta>_c rule: typing.strong_induct)
  5117   case (TAx \<Gamma> \<Delta> x B a \<theta>_n \<theta>_c)
  5118   then show ?case
  5119     apply -
  5120     apply(drule ncloses_elim)
  5121     apply(assumption)
  5122     apply(drule ccloses_elim)
  5123     apply(assumption)
  5124     apply(erule exE)+
  5125     apply(erule conjE)+
  5126     apply(rule_tac s="Cut <c>.P (xa).Pa" and t="\<theta>_n,\<theta>_c<Ax x a>" in subst)
  5127     apply(rule sym)
  5128     apply(simp only: psubst_Ax)
  5129     apply(simp add: CUT_SNa)
  5130     done
  5131 next
  5132   case (TNotR x \<Gamma> B M \<Delta> \<Delta>' a \<theta>_n \<theta>_c) 
  5133   then show ?case 
  5134     apply(simp)
  5135     apply(subgoal_tac "(a,NOT B) \<in> set \<Delta>'")
  5136     apply(drule ccloses_elim)
  5137     apply(assumption)
  5138     apply(erule exE)+
  5139     apply(simp)
  5140     apply(generate_fresh "coname")
  5141     apply(fresh_fun_simp)
  5142     apply(rule_tac B="NOT B" in CUT_SNa)
  5143     apply(simp)
  5144     apply(rule disjI2)
  5145     apply(rule disjI2)
  5146     apply(rule_tac x="c" in exI)
  5147     apply(rule_tac x="x" in exI)
  5148     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5149     apply(simp)
  5150     apply(rule conjI)
  5151     apply(rule fic.intros)
  5152     apply(rule psubst_fresh_coname)
  5153     apply(simp)
  5154     apply(simp)
  5155     apply(simp)
  5156     apply(rule BINDING_implies_CAND)
  5157     apply(unfold BINDINGn_def)
  5158     apply(simp)
  5159     apply(rule_tac x="x" in exI)
  5160     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5161     apply(simp)
  5162     apply(rule allI)+
  5163     apply(rule impI)
  5164     apply(simp add: psubst_nsubst[symmetric])
  5165     apply(drule_tac x="(x,aa,Pa)#\<theta>_n" in meta_spec)
  5166     apply(drule_tac x="\<theta>_c" in meta_spec)
  5167     apply(drule meta_mp)
  5168     apply(rule ncloses_extend)
  5169     apply(assumption)
  5170     apply(assumption)
  5171     apply(assumption)
  5172     apply(assumption)
  5173     apply(drule meta_mp)
  5174     apply(rule ccloses_subset)
  5175     apply(assumption)
  5176     apply(blast)
  5177     apply(assumption)
  5178     apply(simp)
  5179     apply(blast)
  5180     done
  5181 next
  5182   case (TNotL a \<Delta> \<Gamma> M B \<Gamma>' x \<theta>_n \<theta>_c)
  5183   then show ?case
  5184     apply(simp)
  5185     apply(subgoal_tac "(x,NOT B) \<in> set \<Gamma>'")
  5186     apply(drule ncloses_elim)
  5187     apply(assumption)
  5188     apply(erule exE)+
  5189     apply(simp del: NEGc.simps)
  5190     apply(generate_fresh "name")
  5191     apply(fresh_fun_simp)
  5192     apply(rule_tac B="NOT B" in CUT_SNa)
  5193     apply(simp)
  5194     apply(rule NEG_intro)
  5195     apply(simp (no_asm))
  5196     apply(rule disjI2)
  5197     apply(rule disjI2)
  5198     apply(rule_tac x="a" in exI)
  5199     apply(rule_tac x="ca" in exI)
  5200     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5201     apply(simp del: NEGc.simps)
  5202     apply(rule conjI)
  5203     apply(rule fin.intros)
  5204     apply(rule psubst_fresh_name)
  5205     apply(simp)
  5206     apply(simp)
  5207     apply(simp)
  5208     apply(rule BINDING_implies_CAND)
  5209     apply(unfold BINDINGc_def)
  5210     apply(simp (no_asm))
  5211     apply(rule_tac x="a" in exI)
  5212     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5213     apply(simp (no_asm))
  5214     apply(rule allI)+
  5215     apply(rule impI)
  5216     apply(simp del: NEGc.simps add: psubst_csubst[symmetric])
  5217     apply(drule_tac x="\<theta>_n" in meta_spec)
  5218     apply(drule_tac x="(a,xa,Pa)#\<theta>_c" in meta_spec)
  5219     apply(drule meta_mp)
  5220     apply(rule ncloses_subset)
  5221     apply(assumption)
  5222     apply(blast)
  5223     apply(drule meta_mp)
  5224     apply(rule ccloses_extend)
  5225     apply(assumption)
  5226     apply(assumption)
  5227     apply(assumption)
  5228     apply(assumption)
  5229     apply(assumption)
  5230     apply(blast)
  5231     done
  5232 next
  5233   case (TAndL1 x \<Gamma> y B1 M \<Delta> \<Gamma>' B2 \<theta>_n \<theta>_c)
  5234   then show ?case     
  5235     apply(simp)
  5236     apply(subgoal_tac "(y,B1 AND B2) \<in> set \<Gamma>'")
  5237     apply(drule ncloses_elim)
  5238     apply(assumption)
  5239     apply(erule exE)+ 
  5240     apply(simp del: NEGc.simps)
  5241     apply(generate_fresh "name")
  5242     apply(fresh_fun_simp)
  5243     apply(rule_tac B="B1 AND B2" in CUT_SNa)
  5244     apply(simp)
  5245     apply(rule NEG_intro)
  5246     apply(simp (no_asm))
  5247     apply(rule disjI2)
  5248     apply(rule disjI2)
  5249     apply(rule disjI1)
  5250     apply(rule_tac x="x" in exI)
  5251     apply(rule_tac x="ca" in exI)
  5252     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5253     apply(simp del: NEGc.simps)
  5254     apply(rule conjI)
  5255     apply(rule fin.intros)
  5256     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5257     apply(rule psubst_fresh_name)
  5258     apply(simp)
  5259     apply(simp)
  5260     apply(simp)
  5261     apply(rule BINDING_implies_CAND)
  5262     apply(unfold BINDINGn_def)
  5263     apply(simp (no_asm))
  5264     apply(rule_tac x="x" in exI)
  5265     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5266     apply(simp (no_asm))
  5267     apply(rule allI)+
  5268     apply(rule impI)
  5269     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5270     apply(drule_tac x="(x,a,Pa)#\<theta>_n" in meta_spec)
  5271     apply(drule_tac x="\<theta>_c" in meta_spec)
  5272     apply(drule meta_mp)
  5273     apply(rule ncloses_extend)
  5274     apply(rule ncloses_subset)
  5275     apply(assumption)
  5276     apply(blast)
  5277     apply(simp)
  5278     apply(simp)
  5279     apply(simp)
  5280     apply(drule meta_mp)
  5281     apply(assumption)
  5282     apply(assumption)
  5283     apply(blast)
  5284     done
  5285 next
  5286   case (TAndL2 x \<Gamma> y B2 M \<Delta> \<Gamma>' B1 \<theta>_n \<theta>_c)
  5287   then show ?case 
  5288     apply(simp)
  5289     apply(subgoal_tac "(y,B1 AND B2) \<in> set \<Gamma>'")
  5290     apply(drule ncloses_elim)
  5291     apply(assumption)
  5292     apply(erule exE)+ 
  5293     apply(simp del: NEGc.simps)
  5294     apply(generate_fresh "name")
  5295     apply(fresh_fun_simp)
  5296     apply(rule_tac B="B1 AND B2" in CUT_SNa)
  5297     apply(simp)
  5298     apply(rule NEG_intro)
  5299     apply(simp (no_asm))
  5300     apply(rule disjI2)
  5301     apply(rule disjI2)
  5302     apply(rule disjI2)
  5303     apply(rule_tac x="x" in exI)
  5304     apply(rule_tac x="ca" in exI)
  5305     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5306     apply(simp del: NEGc.simps)
  5307     apply(rule conjI)
  5308     apply(rule fin.intros)
  5309     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5310     apply(rule psubst_fresh_name)
  5311     apply(simp)
  5312     apply(simp)
  5313     apply(simp)
  5314     apply(rule BINDING_implies_CAND)
  5315     apply(unfold BINDINGn_def)
  5316     apply(simp (no_asm))
  5317     apply(rule_tac x="x" in exI)
  5318     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5319     apply(simp (no_asm))
  5320     apply(rule allI)+
  5321     apply(rule impI)
  5322     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5323     apply(drule_tac x="(x,a,Pa)#\<theta>_n" in meta_spec)
  5324     apply(drule_tac x="\<theta>_c" in meta_spec)
  5325     apply(drule meta_mp)
  5326     apply(rule ncloses_extend)
  5327     apply(rule ncloses_subset)
  5328     apply(assumption)
  5329     apply(blast)
  5330     apply(simp)
  5331     apply(simp)
  5332     apply(simp)
  5333     apply(drule meta_mp)
  5334     apply(assumption)
  5335     apply(assumption)
  5336     apply(blast)
  5337     done
  5338 next
  5339   case (TAndR a \<Delta> N c b M \<Gamma> B C \<Delta>' \<theta>_n \<theta>_c)
  5340   then show ?case 
  5341     apply(simp)
  5342     apply(subgoal_tac "(c,B AND C) \<in> set \<Delta>'")
  5343     apply(drule ccloses_elim)
  5344     apply(assumption)
  5345     apply(erule exE)+
  5346     apply(simp)
  5347     apply(generate_fresh "coname")
  5348     apply(fresh_fun_simp)
  5349     apply(rule_tac B="B AND C" in CUT_SNa)
  5350     apply(simp)
  5351     apply(rule disjI2)
  5352     apply(rule disjI2)
  5353     apply(rule_tac x="ca" in exI)
  5354     apply(rule_tac x="a" in exI)
  5355     apply(rule_tac x="b" in exI)
  5356     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5357     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5358     apply(simp)
  5359     apply(rule conjI)
  5360     apply(rule fic.intros)
  5361     apply(simp add: abs_fresh fresh_prod fresh_atm)
  5362     apply(rule psubst_fresh_coname)
  5363     apply(simp)
  5364     apply(simp)
  5365     apply(simp)
  5366     apply(simp add: abs_fresh fresh_prod fresh_atm)
  5367     apply(rule psubst_fresh_coname)
  5368     apply(simp)
  5369     apply(simp)
  5370     apply(simp)
  5371     apply(rule conjI)
  5372     apply(rule BINDING_implies_CAND)
  5373     apply(unfold BINDINGc_def)
  5374     apply(simp)
  5375     apply(rule_tac x="a" in exI)
  5376     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5377     apply(simp)
  5378     apply(rule allI)+
  5379     apply(rule impI)
  5380     apply(simp add: psubst_csubst[symmetric])
  5381     apply(drule_tac x="\<theta>_n" in meta_spec)
  5382     apply(drule_tac x="(a,xa,Pa)#\<theta>_c" in meta_spec)
  5383     apply(drule meta_mp)
  5384     apply(assumption)
  5385     apply(drule meta_mp)
  5386     apply(rule ccloses_extend)
  5387     apply(rule ccloses_subset)
  5388     apply(assumption)
  5389     apply(blast)
  5390     apply(simp)
  5391     apply(simp)
  5392     apply(assumption)
  5393     apply(assumption)
  5394     apply(rule BINDING_implies_CAND)
  5395     apply(unfold BINDINGc_def)
  5396     apply(simp)
  5397     apply(rule_tac x="b" in exI)
  5398     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5399     apply(simp)
  5400     apply(rule allI)+
  5401     apply(rule impI)
  5402     apply(simp add: psubst_csubst[symmetric])
  5403     apply(rotate_tac 14)
  5404     apply(drule_tac x="\<theta>_n" in meta_spec)
  5405     apply(drule_tac x="(b,xa,Pa)#\<theta>_c" in meta_spec)
  5406     apply(drule meta_mp)
  5407     apply(assumption)
  5408     apply(drule meta_mp)
  5409     apply(rule ccloses_extend)
  5410     apply(rule ccloses_subset)
  5411     apply(assumption)
  5412     apply(blast)
  5413     apply(simp)
  5414     apply(simp)
  5415     apply(assumption)
  5416     apply(assumption)
  5417     apply(simp)
  5418     apply(blast)
  5419     done
  5420 next
  5421   case (TOrL x \<Gamma> N z y M B \<Delta> C \<Gamma>' \<theta>_n \<theta>_c)
  5422   then show ?case 
  5423     apply(simp)
  5424     apply(subgoal_tac "(z,B OR C) \<in> set \<Gamma>'")
  5425     apply(drule ncloses_elim)
  5426     apply(assumption)
  5427     apply(erule exE)+
  5428     apply(simp del: NEGc.simps)
  5429     apply(generate_fresh "name")
  5430     apply(fresh_fun_simp)
  5431     apply(rule_tac B="B OR C" in CUT_SNa)
  5432     apply(simp)
  5433     apply(rule NEG_intro)
  5434     apply(simp (no_asm))
  5435     apply(rule disjI2)
  5436     apply(rule disjI2)
  5437     apply(rule_tac x="x" in exI)
  5438     apply(rule_tac x="y" in exI)
  5439     apply(rule_tac x="ca" in exI)
  5440     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5441     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5442     apply(simp del: NEGc.simps)
  5443     apply(rule conjI)
  5444     apply(rule fin.intros)
  5445     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5446     apply(rule psubst_fresh_name)
  5447     apply(simp)
  5448     apply(simp)
  5449     apply(simp)
  5450     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5451     apply(rule psubst_fresh_name)
  5452     apply(simp)
  5453     apply(simp)
  5454     apply(simp)
  5455     apply(rule conjI)
  5456     apply(rule BINDING_implies_CAND)
  5457     apply(unfold BINDINGn_def)
  5458     apply(simp del: NEGc.simps)
  5459     apply(rule_tac x="x" in exI)
  5460     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5461     apply(simp del: NEGc.simps)
  5462     apply(rule allI)+
  5463     apply(rule impI)
  5464     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5465     apply(drule_tac x="(x,a,Pa)#\<theta>_n" in meta_spec)
  5466     apply(drule_tac x="\<theta>_c" in meta_spec)
  5467     apply(drule meta_mp)
  5468     apply(rule ncloses_extend)
  5469     apply(rule ncloses_subset)
  5470     apply(assumption)
  5471     apply(blast)
  5472     apply(simp)
  5473     apply(simp)
  5474     apply(assumption)
  5475     apply(drule meta_mp)
  5476     apply(assumption)
  5477     apply(assumption)
  5478     apply(rule BINDING_implies_CAND)
  5479     apply(unfold BINDINGn_def)
  5480     apply(simp del: NEGc.simps)
  5481     apply(rule_tac x="y" in exI)
  5482     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5483     apply(simp del: NEGc.simps)
  5484     apply(rule allI)+
  5485     apply(rule impI)
  5486     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5487     apply(rotate_tac 14)
  5488     apply(drule_tac x="(y,a,Pa)#\<theta>_n" in meta_spec)
  5489     apply(drule_tac x="\<theta>_c" in meta_spec)
  5490     apply(drule meta_mp)
  5491     apply(rule ncloses_extend)
  5492     apply(rule ncloses_subset)
  5493     apply(assumption)
  5494     apply(blast)
  5495     apply(simp)
  5496     apply(simp)
  5497     apply(assumption)
  5498     apply(drule meta_mp)
  5499     apply(assumption)
  5500     apply(assumption)
  5501     apply(blast)
  5502     done
  5503 next
  5504   case (TOrR1 a \<Delta> b \<Gamma> M B1 \<Delta>' B2 \<theta>_n \<theta>_c)
  5505   then show ?case
  5506     apply(simp)
  5507     apply(subgoal_tac "(b,B1 OR B2) \<in> set \<Delta>'")
  5508     apply(drule ccloses_elim)
  5509     apply(assumption)
  5510     apply(erule exE)+ 
  5511     apply(simp del: NEGc.simps)
  5512     apply(generate_fresh "coname")
  5513     apply(fresh_fun_simp)
  5514     apply(rule_tac B="B1 OR B2" in CUT_SNa)
  5515     apply(simp)
  5516     apply(rule disjI2)
  5517     apply(rule disjI2)
  5518     apply(rule disjI1)
  5519     apply(rule_tac x="a" in exI)
  5520     apply(rule_tac x="c" in exI)
  5521     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5522     apply(simp)
  5523     apply(rule conjI)
  5524     apply(rule fic.intros)
  5525     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5526     apply(rule psubst_fresh_coname)
  5527     apply(simp)
  5528     apply(simp)
  5529     apply(simp)
  5530     apply(rule BINDING_implies_CAND)
  5531     apply(unfold BINDINGc_def)
  5532     apply(simp (no_asm))
  5533     apply(rule_tac x="a" in exI)
  5534     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5535     apply(simp (no_asm))
  5536     apply(rule allI)+
  5537     apply(rule impI)    
  5538     apply(simp del: NEGc.simps add: psubst_csubst[symmetric])
  5539     apply(drule_tac x="\<theta>_n" in meta_spec)
  5540     apply(drule_tac x="(a,xa,Pa)#\<theta>_c" in meta_spec)
  5541     apply(drule meta_mp)
  5542     apply(assumption)
  5543     apply(drule meta_mp)
  5544     apply(rule ccloses_extend)
  5545     apply(rule ccloses_subset)
  5546     apply(assumption)
  5547     apply(blast)
  5548     apply(simp)
  5549     apply(simp)
  5550     apply(simp)
  5551     apply(assumption)
  5552     apply(simp)
  5553     apply(blast)
  5554     done
  5555 next
  5556   case (TOrR2 a \<Delta> b \<Gamma> M B2 \<Delta>' B1 \<theta>_n \<theta>_c)
  5557   then show ?case 
  5558     apply(simp)
  5559     apply(subgoal_tac "(b,B1 OR B2) \<in> set \<Delta>'")
  5560     apply(drule ccloses_elim)
  5561     apply(assumption)
  5562     apply(erule exE)+ 
  5563     apply(simp del: NEGc.simps)
  5564     apply(generate_fresh "coname")
  5565     apply(fresh_fun_simp)
  5566     apply(rule_tac B="B1 OR B2" in CUT_SNa)
  5567     apply(simp)
  5568     apply(rule disjI2)
  5569     apply(rule disjI2)
  5570     apply(rule disjI2)
  5571     apply(rule_tac x="a" in exI)
  5572     apply(rule_tac x="c" in exI)
  5573     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5574     apply(simp)
  5575     apply(rule conjI)
  5576     apply(rule fic.intros)
  5577     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5578     apply(rule psubst_fresh_coname)
  5579     apply(simp)
  5580     apply(simp)
  5581     apply(simp)
  5582     apply(rule BINDING_implies_CAND)
  5583     apply(unfold BINDINGc_def)
  5584     apply(simp (no_asm))
  5585     apply(rule_tac x="a" in exI)
  5586     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5587     apply(simp (no_asm))
  5588     apply(rule allI)+
  5589     apply(rule impI)    
  5590     apply(simp del: NEGc.simps add: psubst_csubst[symmetric])
  5591     apply(drule_tac x="\<theta>_n" in meta_spec)
  5592     apply(drule_tac x="(a,xa,Pa)#\<theta>_c" in meta_spec)
  5593     apply(drule meta_mp)
  5594     apply(assumption)
  5595     apply(drule meta_mp)
  5596     apply(rule ccloses_extend)
  5597     apply(rule ccloses_subset)
  5598     apply(assumption)
  5599     apply(blast)
  5600     apply(simp)
  5601     apply(simp)
  5602     apply(simp)
  5603     apply(assumption)
  5604     apply(simp)
  5605     apply(blast)
  5606     done
  5607 next
  5608   case (TImpL a \<Delta> N x \<Gamma> M y B C \<Gamma>' \<theta>_n \<theta>_c)
  5609   then show ?case
  5610     apply(simp)
  5611     apply(subgoal_tac "(y,B IMP C) \<in> set \<Gamma>'")
  5612     apply(drule ncloses_elim)
  5613     apply(assumption)
  5614     apply(erule exE)+
  5615     apply(simp del: NEGc.simps)
  5616     apply(generate_fresh "name")
  5617     apply(fresh_fun_simp)
  5618     apply(rule_tac B="B IMP C" in CUT_SNa)
  5619     apply(simp)
  5620     apply(rule NEG_intro)
  5621     apply(simp (no_asm))
  5622     apply(rule disjI2)
  5623     apply(rule disjI2)
  5624     apply(rule_tac x="x" in exI)
  5625     apply(rule_tac x="a" in exI)
  5626     apply(rule_tac x="ca" in exI)
  5627     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5628     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5629     apply(simp del: NEGc.simps)
  5630     apply(rule conjI)
  5631     apply(rule fin.intros)
  5632     apply(rule psubst_fresh_name)
  5633     apply(simp)
  5634     apply(simp)
  5635     apply(simp)
  5636     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5637     apply(rule psubst_fresh_name)
  5638     apply(simp)
  5639     apply(simp)
  5640     apply(simp)
  5641     apply(rule conjI)
  5642     apply(rule BINDING_implies_CAND)
  5643     apply(unfold BINDINGc_def)
  5644     apply(simp del: NEGc.simps)
  5645     apply(rule_tac x="a" in exI)
  5646     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5647     apply(simp del: NEGc.simps)
  5648     apply(rule allI)+
  5649     apply(rule impI)
  5650     apply(simp del: NEGc.simps add: psubst_csubst[symmetric])
  5651     apply(drule_tac x="\<theta>_n" in meta_spec)
  5652     apply(drule_tac x="(a,xa,Pa)#\<theta>_c" in meta_spec)
  5653     apply(drule meta_mp)
  5654     apply(rule ncloses_subset)
  5655     apply(assumption)
  5656     apply(blast)
  5657     apply(drule meta_mp)
  5658     apply(rule ccloses_extend)
  5659     apply(assumption)
  5660     apply(simp)
  5661     apply(simp)
  5662     apply(assumption)
  5663     apply(assumption)
  5664     apply(rule BINDING_implies_CAND)
  5665     apply(unfold BINDINGn_def)
  5666     apply(simp del: NEGc.simps)
  5667     apply(rule_tac x="x" in exI)
  5668     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5669     apply(simp del: NEGc.simps)
  5670     apply(rule allI)+
  5671     apply(rule impI)
  5672     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5673     apply(rotate_tac 12)
  5674     apply(drule_tac x="(x,aa,Pa)#\<theta>_n" in meta_spec)
  5675     apply(drule_tac x="\<theta>_c" in meta_spec)
  5676     apply(drule meta_mp)
  5677     apply(rule ncloses_extend)
  5678     apply(rule ncloses_subset)
  5679     apply(assumption)
  5680     apply(blast)
  5681     apply(simp)
  5682     apply(simp)
  5683     apply(assumption)
  5684     apply(drule meta_mp)
  5685     apply(assumption)
  5686     apply(assumption)
  5687     apply(blast)
  5688     done
  5689 next
  5690   case (TImpR a \<Delta> b x \<Gamma> B M C \<Delta>' \<theta>_n \<theta>_c)
  5691   then show ?case
  5692     apply(simp)
  5693     apply(subgoal_tac "(b,B IMP C) \<in> set \<Delta>'")
  5694     apply(drule ccloses_elim)
  5695     apply(assumption)
  5696     apply(erule exE)+
  5697     apply(simp)
  5698     apply(generate_fresh "coname")
  5699     apply(fresh_fun_simp)
  5700     apply(rule_tac B="B IMP C" in CUT_SNa)
  5701     apply(simp)
  5702     apply(rule disjI2)
  5703     apply(rule disjI2)
  5704     apply(rule_tac x="x" in exI)
  5705     apply(rule_tac x="a" in exI)
  5706     apply(rule_tac x="c" in exI)
  5707     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5708     apply(simp)
  5709     apply(rule conjI)
  5710     apply(rule fic.intros)
  5711     apply(simp add: abs_fresh fresh_prod fresh_atm)
  5712     apply(rule psubst_fresh_coname)
  5713     apply(simp)
  5714     apply(simp)
  5715     apply(simp)
  5716     apply(rule conjI)
  5717     apply(rule allI)+
  5718     apply(rule impI)
  5719     apply(simp add: psubst_csubst[symmetric])
  5720     apply(rule BINDING_implies_CAND)
  5721     apply(unfold BINDINGn_def)
  5722     apply(simp)
  5723     apply(rule_tac x="x" in exI)
  5724     apply(rule_tac x="\<theta>_n,((a,z,Pa)#\<theta>_c)<M>" in exI)
  5725     apply(simp)
  5726     apply(rule allI)+
  5727     apply(rule impI)
  5728     apply(rule_tac t="\<theta>_n,((a,z,Pa)#\<theta>_c)<M>{x:=<aa>.Pb}" and 
  5729                    s="((x,aa,Pb)#\<theta>_n),((a,z,Pa)#\<theta>_c)<M>" in subst)
  5730     apply(rule psubst_nsubst)
  5731     apply(simp add: fresh_prod fresh_atm fresh_list_cons)
  5732     apply(drule_tac x="(x,aa,Pb)#\<theta>_n" in meta_spec)
  5733     apply(drule_tac x="(a,z,Pa)#\<theta>_c" in meta_spec)
  5734     apply(drule meta_mp)
  5735     apply(rule ncloses_extend)
  5736     apply(assumption)
  5737     apply(simp)
  5738     apply(simp)
  5739     apply(simp)
  5740     apply(drule meta_mp)
  5741     apply(rule ccloses_extend)
  5742     apply(rule ccloses_subset)
  5743     apply(assumption)
  5744     apply(blast)
  5745     apply(auto intro: fresh_subset simp del: NEGc.simps)[1]
  5746     apply(simp)
  5747     apply(simp)
  5748     apply(assumption)
  5749     apply(rule allI)+
  5750     apply(rule impI)
  5751     apply(simp add: psubst_nsubst[symmetric])
  5752     apply(rule BINDING_implies_CAND)
  5753     apply(unfold BINDINGc_def)
  5754     apply(simp)
  5755     apply(rule_tac x="a" in exI)
  5756     apply(rule_tac x="((x,ca,Q)#\<theta>_n),\<theta>_c<M>" in exI)
  5757     apply(simp)
  5758     apply(rule allI)+
  5759     apply(rule impI)
  5760     apply(rule_tac t="((x,ca,Q)#\<theta>_n),\<theta>_c<M>{a:=(xaa).Pa}" and 
  5761                    s="((x,ca,Q)#\<theta>_n),((a,xaa,Pa)#\<theta>_c)<M>" in subst)
  5762     apply(rule psubst_csubst)
  5763     apply(simp add: fresh_prod fresh_atm fresh_list_cons)
  5764     apply(drule_tac x="(x,ca,Q)#\<theta>_n" in meta_spec)
  5765     apply(drule_tac x="(a,xaa,Pa)#\<theta>_c" in meta_spec)
  5766     apply(drule meta_mp)
  5767     apply(rule ncloses_extend)
  5768     apply(assumption)
  5769     apply(simp)
  5770     apply(simp)
  5771     apply(simp)
  5772     apply(drule meta_mp)
  5773     apply(rule ccloses_extend)
  5774     apply(rule ccloses_subset)
  5775     apply(assumption)
  5776     apply(blast)
  5777     apply(auto intro: fresh_subset simp del: NEGc.simps)[1]
  5778     apply(simp)
  5779     apply(simp)
  5780     apply(assumption)
  5781     apply(simp)
  5782     apply(blast)
  5783     done
  5784 next
  5785   case (TCut a \<Delta> N x \<Gamma> M B \<theta>_n \<theta>_c)
  5786   then show ?case 
  5787     apply -
  5788     apply(case_tac "\<forall>y. M\<noteq>Ax y a")
  5789     apply(case_tac "\<forall>c. N\<noteq>Ax x c")
  5790     apply(simp)
  5791     apply(rule_tac B="B" in CUT_SNa)
  5792     apply(rule BINDING_implies_CAND)
  5793     apply(unfold BINDINGc_def)
  5794     apply(simp)
  5795     apply(rule_tac x="a" in exI)
  5796     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5797     apply(simp)
  5798     apply(rule allI)
  5799     apply(rule allI)
  5800     apply(rule impI)
  5801     apply(simp add: psubst_csubst[symmetric]) (*?*)
  5802     apply(drule_tac x="\<theta>_n" in meta_spec)
  5803     apply(drule_tac x="(a,xa,P)#\<theta>_c" in meta_spec)
  5804     apply(drule meta_mp)
  5805     apply(assumption)
  5806     apply(drule meta_mp)
  5807     apply(rule ccloses_extend) 
  5808     apply(assumption)
  5809     apply(assumption)
  5810     apply(assumption)
  5811     apply(assumption)
  5812     apply(assumption)
  5813     apply(rule BINDING_implies_CAND)
  5814     apply(unfold BINDINGn_def)
  5815     apply(simp)
  5816     apply(rule_tac x="x" in exI)
  5817     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5818     apply(simp)
  5819     apply(rule allI)
  5820     apply(rule allI)
  5821     apply(rule impI)
  5822     apply(simp add: psubst_nsubst[symmetric]) (*?*)
  5823     apply(rotate_tac 11)
  5824     apply(drule_tac x="(x,aa,P)#\<theta>_n" in meta_spec)
  5825     apply(drule_tac x="\<theta>_c" in meta_spec)
  5826     apply(drule meta_mp)
  5827     apply(rule ncloses_extend)
  5828     apply(assumption)
  5829     apply(assumption)
  5830     apply(assumption)
  5831     apply(assumption)
  5832     apply(drule_tac meta_mp)
  5833     apply(assumption)
  5834     apply(assumption)
  5835     (* cases at least one axiom *)
  5836     apply(simp (no_asm_use))
  5837     apply(erule exE)
  5838     apply(simp del: psubst.simps)
  5839     apply(drule typing_Ax_elim2)
  5840     apply(auto simp add: trm.inject)[1]
  5841     apply(rule_tac B="B" in CUT_SNa)
  5842     (* left term *)
  5843     apply(rule BINDING_implies_CAND)
  5844     apply(unfold BINDINGc_def)
  5845     apply(simp)
  5846     apply(rule_tac x="a" in exI)
  5847     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5848     apply(simp)
  5849     apply(rule allI)+
  5850     apply(rule impI)
  5851     apply(drule_tac x="\<theta>_n" in meta_spec)
  5852     apply(drule_tac x="(a,xa,P)#\<theta>_c" in meta_spec)
  5853     apply(drule meta_mp)
  5854     apply(assumption)
  5855     apply(drule meta_mp)
  5856     apply(rule ccloses_extend) 
  5857     apply(assumption)
  5858     apply(assumption)
  5859     apply(assumption)
  5860     apply(assumption)
  5861     apply(simp add: psubst_csubst[symmetric]) (*?*)
  5862     (* right term -axiom *)
  5863     apply(drule ccloses_elim)
  5864     apply(assumption)
  5865     apply(erule exE)+
  5866     apply(erule conjE)
  5867     apply(frule_tac y="x" in lookupd_cmaps)
  5868     apply(drule cmaps_fresh)
  5869     apply(assumption)
  5870     apply(simp)
  5871     apply(subgoal_tac "(x):P[xa\<turnstile>n>x] = (xa):P")
  5872     apply(simp)
  5873     apply(simp add: ntrm.inject)
  5874     apply(simp add: alpha fresh_prod fresh_atm)
  5875     apply(rule sym)
  5876     apply(rule nrename_swap)
  5877     apply(simp)
  5878     (* M is axiom *)
  5879     apply(simp)
  5880     apply(auto)[1]
  5881     (* both are axioms *)
  5882     apply(rule_tac B="B" in CUT_SNa)
  5883     apply(drule typing_Ax_elim1)
  5884     apply(drule ncloses_elim)
  5885     apply(assumption)
  5886     apply(erule exE)+
  5887     apply(erule conjE)
  5888     apply(frule_tac a="a" in lookupc_nmaps)
  5889     apply(drule_tac a="a" in nmaps_fresh)
  5890     apply(assumption)
  5891     apply(simp)
  5892     apply(subgoal_tac "<a>:P[c\<turnstile>c>a] = <c>:P")
  5893     apply(simp)
  5894     apply(simp add: ctrm.inject)
  5895     apply(simp add: alpha fresh_prod fresh_atm)
  5896     apply(rule sym)
  5897     apply(rule crename_swap)
  5898     apply(simp)
  5899     apply(drule typing_Ax_elim2)
  5900     apply(drule ccloses_elim)
  5901     apply(assumption)
  5902     apply(erule exE)+
  5903     apply(erule conjE)
  5904     apply(frule_tac y="x" in lookupd_cmaps)
  5905     apply(drule cmaps_fresh)
  5906     apply(assumption)
  5907     apply(simp)
  5908     apply(subgoal_tac "(x):P[xa\<turnstile>n>x] = (xa):P")
  5909     apply(simp)
  5910     apply(simp add: ntrm.inject)
  5911     apply(simp add: alpha fresh_prod fresh_atm)
  5912     apply(rule sym)
  5913     apply(rule nrename_swap)
  5914     apply(simp)
  5915     (* N is not axioms *)
  5916     apply(rule_tac B="B" in CUT_SNa)
  5917     (* left term *)
  5918     apply(drule typing_Ax_elim1)
  5919     apply(drule ncloses_elim)
  5920     apply(assumption)
  5921     apply(erule exE)+
  5922     apply(erule conjE)
  5923     apply(frule_tac a="a" in lookupc_nmaps)
  5924     apply(drule_tac a="a" in nmaps_fresh)
  5925     apply(assumption)
  5926     apply(simp)
  5927     apply(subgoal_tac "<a>:P[c\<turnstile>c>a] = <c>:P")
  5928     apply(simp)
  5929     apply(simp add: ctrm.inject)
  5930     apply(simp add: alpha fresh_prod fresh_atm)
  5931     apply(rule sym)
  5932     apply(rule crename_swap)
  5933     apply(simp)
  5934     apply(rule BINDING_implies_CAND)
  5935     apply(unfold BINDINGn_def)
  5936     apply(simp)
  5937     apply(rule_tac x="x" in exI)
  5938     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5939     apply(simp)
  5940     apply(rule allI)
  5941     apply(rule allI)
  5942     apply(rule impI)
  5943     apply(simp add: psubst_nsubst[symmetric]) (*?*)
  5944     apply(rotate_tac 10)
  5945     apply(drule_tac x="(x,aa,P)#\<theta>_n" in meta_spec)
  5946     apply(drule_tac x="\<theta>_c" in meta_spec)
  5947     apply(drule meta_mp)
  5948     apply(rule ncloses_extend)
  5949     apply(assumption)
  5950     apply(assumption)
  5951     apply(assumption)
  5952     apply(assumption)
  5953     apply(drule_tac meta_mp)
  5954     apply(assumption)
  5955     apply(assumption)
  5956     done
  5957 qed
  5958 
  5959 primrec "idn" :: "(name\<times>ty) list\<Rightarrow>coname\<Rightarrow>(name\<times>coname\<times>trm) list" where
  5960   "idn [] a   = []"
  5961 | "idn (p#\<Gamma>) a = ((fst p),a,Ax (fst p) a)#(idn \<Gamma> a)"
  5962 
  5963 primrec "idc" :: "(coname\<times>ty) list\<Rightarrow>name\<Rightarrow>(coname\<times>name\<times>trm) list" where
  5964   "idc [] x    = []"
  5965 | "idc (p#\<Delta>) x = ((fst p),x,Ax x (fst p))#(idc \<Delta> x)"
  5966 
  5967 lemma idn_eqvt[eqvt]:
  5968   fixes pi1::"name prm"
  5969   and   pi2::"coname prm"
  5970   shows "(pi1\<bullet>(idn \<Gamma> a)) = idn (pi1\<bullet>\<Gamma>) (pi1\<bullet>a)"
  5971   and   "(pi2\<bullet>(idn \<Gamma> a)) = idn (pi2\<bullet>\<Gamma>) (pi2\<bullet>a)"
  5972 apply(induct \<Gamma>)
  5973 apply(auto)
  5974 done
  5975 
  5976 lemma idc_eqvt[eqvt]:
  5977   fixes pi1::"name prm"
  5978   and   pi2::"coname prm"
  5979   shows "(pi1\<bullet>(idc \<Delta> x)) = idc (pi1\<bullet>\<Delta>) (pi1\<bullet>x)"
  5980   and   "(pi2\<bullet>(idc \<Delta> x)) = idc (pi2\<bullet>\<Delta>) (pi2\<bullet>x)"
  5981 apply(induct \<Delta>)
  5982 apply(auto)
  5983 done
  5984 
  5985 lemma ccloses_id:
  5986   shows "(idc \<Delta> x) ccloses \<Delta>"
  5987 apply(induct \<Delta>)
  5988 apply(auto simp add: ccloses_def)
  5989 apply(rule Ax_in_CANDs)
  5990 apply(rule Ax_in_CANDs)
  5991 done
  5992 
  5993 lemma ncloses_id:
  5994   shows "(idn \<Gamma> a) ncloses \<Gamma>"
  5995 apply(induct \<Gamma>)
  5996 apply(auto simp add: ncloses_def)
  5997 apply(rule Ax_in_CANDs)
  5998 apply(rule Ax_in_CANDs)
  5999 done
  6000 
  6001 lemma fresh_idn:
  6002   fixes x::"name"
  6003   and   a::"coname"
  6004   shows "x\<sharp>\<Gamma> \<Longrightarrow> x\<sharp>idn \<Gamma> a"
  6005   and   "a\<sharp>(\<Gamma>,b) \<Longrightarrow> a\<sharp>idn \<Gamma> b"
  6006 apply(induct \<Gamma>)
  6007 apply(auto simp add: fresh_list_cons fresh_list_nil fresh_atm fresh_prod)
  6008 done
  6009 
  6010 lemma fresh_idc:
  6011   fixes x::"name"
  6012   and   a::"coname"
  6013   shows "x\<sharp>(\<Delta>,y) \<Longrightarrow> x\<sharp>idc \<Delta> y"
  6014   and   "a\<sharp>\<Delta>  \<Longrightarrow> a\<sharp>idc \<Delta> y"
  6015 apply(induct \<Delta>)
  6016 apply(auto simp add: fresh_list_cons fresh_list_nil fresh_atm fresh_prod)
  6017 done
  6018 
  6019 lemma idc_cmaps:
  6020   assumes a: "idc \<Delta> y cmaps b to Some (x,M)"
  6021   shows "M=Ax x b"
  6022 using a
  6023 apply(induct \<Delta>)
  6024 apply(auto)
  6025 apply(case_tac "b=a")
  6026 apply(auto)
  6027 done
  6028 
  6029 lemma idn_nmaps:
  6030   assumes a: "idn \<Gamma> a nmaps x to Some (b,M)"
  6031   shows "M=Ax x b"
  6032 using a
  6033 apply(induct \<Gamma>)
  6034 apply(auto)
  6035 apply(case_tac "aa=x")
  6036 apply(auto)
  6037 done
  6038 
  6039 lemma lookup1:
  6040   assumes a: "x\<sharp>(idn \<Gamma> b)"
  6041   shows "lookup x a (idn \<Gamma> b) \<theta>_c = lookupa x a \<theta>_c"
  6042 using a
  6043 apply(induct \<Gamma>)
  6044 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  6045 done
  6046 
  6047 lemma lookup2:
  6048   assumes a: "\<not>(x\<sharp>(idn \<Gamma> b))"
  6049   shows "lookup x a (idn \<Gamma> b) \<theta>_c = lookupb x a \<theta>_c b (Ax x b)"
  6050 using a
  6051 apply(induct \<Gamma>)
  6052 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm fresh_list_nil)
  6053 done
  6054 
  6055 lemma lookup3:
  6056   assumes a: "a\<sharp>(idc \<Delta> y)"
  6057   shows "lookupa x a (idc \<Delta> y) = Ax x a"
  6058 using a
  6059 apply(induct \<Delta>)
  6060 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  6061 done
  6062 
  6063 lemma lookup4:
  6064   assumes a: "\<not>(a\<sharp>(idc \<Delta> y))"
  6065   shows "lookupa x a (idc \<Delta> y) = Cut <a>.(Ax x a) (y).Ax y a"
  6066 using a
  6067 apply(induct \<Delta>)
  6068 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm fresh_list_nil)
  6069 done
  6070 
  6071 lemma lookup5:
  6072   assumes a: "a\<sharp>(idc \<Delta> y)"
  6073   shows "lookupb x a (idc \<Delta> y) c P = Cut <c>.P (x).Ax x a"
  6074 using a
  6075 apply(induct \<Delta>)
  6076 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm fresh_list_nil)
  6077 done
  6078 
  6079 lemma lookup6:
  6080   assumes a: "\<not>(a\<sharp>(idc \<Delta> y))"
  6081   shows "lookupb x a (idc \<Delta> y) c P = Cut <c>.P (y).Ax y a"
  6082 using a
  6083 apply(induct \<Delta>)
  6084 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm fresh_list_nil)
  6085 done
  6086 
  6087 lemma lookup7:
  6088   shows "lookupc x a (idn \<Gamma> b) = Ax x a"
  6089 apply(induct \<Gamma>)
  6090 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm fresh_list_nil)
  6091 done
  6092 
  6093 lemma lookup8:
  6094   shows "lookupd x a (idc \<Delta> y) = Ax x a"
  6095 apply(induct \<Delta>)
  6096 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm fresh_list_nil)
  6097 done
  6098 
  6099 lemma id_redu:
  6100   shows "(idn \<Gamma> x),(idc \<Delta> a)<M> \<longrightarrow>\<^isub>a* M"
  6101 apply(nominal_induct M avoiding: \<Gamma> \<Delta> x a rule: trm.strong_induct)
  6102 apply(auto)
  6103 (* Ax *)
  6104 apply(case_tac "name\<sharp>(idn \<Gamma> x)")
  6105 apply(simp add: lookup1)
  6106 apply(case_tac "coname\<sharp>(idc \<Delta> a)")
  6107 apply(simp add: lookup3)
  6108 apply(simp add: lookup4)
  6109 apply(rule a_star_trans)
  6110 apply(rule a_starI)
  6111 apply(rule al_redu)
  6112 apply(rule better_LAxR_intro)
  6113 apply(rule fic.intros)
  6114 apply(simp)
  6115 apply(simp add: lookup2)
  6116 apply(case_tac "coname\<sharp>(idc \<Delta> a)")
  6117 apply(simp add: lookup5)
  6118 apply(rule a_star_trans)
  6119 apply(rule a_starI)
  6120 apply(rule al_redu)
  6121 apply(rule better_LAxR_intro)
  6122 apply(rule fic.intros)
  6123 apply(simp)
  6124 apply(simp add: lookup6)
  6125 apply(rule a_star_trans)
  6126 apply(rule a_starI)
  6127 apply(rule al_redu)
  6128 apply(rule better_LAxR_intro)
  6129 apply(rule fic.intros)
  6130 apply(simp)
  6131 (* Cut *)
  6132 apply(auto simp add: fresh_idn fresh_idc psubst_fresh_name psubst_fresh_coname fresh_atm fresh_prod )[1]
  6133 apply(simp add: lookup7 lookup8)
  6134 apply(simp add: lookup7 lookup8)
  6135 apply(simp add: a_star_Cut)
  6136 apply(simp add: lookup7 lookup8)
  6137 apply(simp add: a_star_Cut)
  6138 apply(simp add: a_star_Cut)
  6139 (* NotR *)
  6140 apply(simp add: fresh_idn fresh_idc)
  6141 apply(case_tac "findc (idc \<Delta> a) coname")
  6142 apply(simp)
  6143 apply(simp add: a_star_NotR)
  6144 apply(auto)[1]
  6145 apply(generate_fresh "coname")
  6146 apply(fresh_fun_simp)
  6147 apply(drule idc_cmaps)
  6148 apply(simp)
  6149 apply(subgoal_tac "c\<sharp>idn \<Gamma> x,idc \<Delta> a<trm>")
  6150 apply(rule a_star_trans)
  6151 apply(rule a_starI)
  6152 apply(rule al_redu)
  6153 apply(rule better_LAxR_intro)
  6154 apply(rule fic.intros)
  6155 apply(assumption)
  6156 apply(simp add: crename_fresh)
  6157 apply(simp add: a_star_NotR)
  6158 apply(rule psubst_fresh_coname)
  6159 apply(rule fresh_idn)
  6160 apply(simp)
  6161 apply(rule fresh_idc)
  6162 apply(simp)
  6163 apply(simp)
  6164 (* NotL *)
  6165 apply(simp add: fresh_idn fresh_idc)
  6166 apply(case_tac "findn (idn \<Gamma> x) name")
  6167 apply(simp)
  6168 apply(simp add: a_star_NotL)
  6169 apply(auto)[1]
  6170 apply(generate_fresh "name")
  6171 apply(fresh_fun_simp)
  6172 apply(drule idn_nmaps)
  6173 apply(simp)
  6174 apply(subgoal_tac "c\<sharp>idn \<Gamma> x,idc \<Delta> a<trm>")
  6175 apply(rule a_star_trans)
  6176 apply(rule a_starI)
  6177 apply(rule al_redu)
  6178 apply(rule better_LAxL_intro)
  6179 apply(rule fin.intros)
  6180 apply(assumption)
  6181 apply(simp add: nrename_fresh)
  6182 apply(simp add: a_star_NotL)
  6183 apply(rule psubst_fresh_name)
  6184 apply(rule fresh_idn)
  6185 apply(simp)
  6186 apply(rule fresh_idc)
  6187 apply(simp)
  6188 apply(simp)
  6189 (* AndR *)
  6190 apply(simp add: fresh_idn fresh_idc)
  6191 apply(case_tac "findc (idc \<Delta> a) coname3")
  6192 apply(simp)
  6193 apply(simp add: a_star_AndR)
  6194 apply(auto)[1]
  6195 apply(generate_fresh "coname")
  6196 apply(fresh_fun_simp)
  6197 apply(drule idc_cmaps)
  6198 apply(simp)
  6199 apply(subgoal_tac "c\<sharp>idn \<Gamma> x,idc \<Delta> a<trm1>")
  6200 apply(subgoal_tac "c\<sharp>idn \<Gamma> x,idc \<Delta> a<trm2>")
  6201 apply(rule a_star_trans)
  6202 apply(rule a_starI)
  6203 apply(rule al_redu)
  6204 apply(rule better_LAxR_intro)
  6205 apply(rule fic.intros)
  6206 apply(simp add: abs_fresh)
  6207 apply(simp add: abs_fresh)
  6208 apply(auto simp add: fresh_idn fresh_idc psubst_fresh_name crename_fresh fresh_atm fresh_prod )[1]
  6209 apply(rule aux3)
  6210 apply(rule crename.simps)
  6211 apply(auto simp add: fresh_prod fresh_atm)[1]
  6212 apply(rule psubst_fresh_coname)
  6213 apply(rule fresh_idn)
  6214 apply(simp add: fresh_prod fresh_atm)
  6215 apply(rule fresh_idc)
  6216 apply(simp)
  6217 apply(simp)
  6218 apply(auto simp add: fresh_prod fresh_atm)[1]
  6219 apply(rule psubst_fresh_coname)
  6220 apply(rule fresh_idn)
  6221 apply(simp add: fresh_prod fresh_atm)
  6222 apply(rule fresh_idc)
  6223 apply(simp)
  6224 apply(simp)
  6225 apply(simp)
  6226 apply(simp)
  6227 apply(simp add: crename_fresh)
  6228 apply(simp add: a_star_AndR)
  6229 apply(rule psubst_fresh_coname)
  6230 apply(rule fresh_idn)
  6231 apply(simp)
  6232 apply(rule fresh_idc)
  6233 apply(simp)
  6234 apply(simp)
  6235 apply(rule psubst_fresh_coname)
  6236 apply(rule fresh_idn)
  6237 apply(simp)
  6238 apply(rule fresh_idc)
  6239 apply(simp)
  6240 apply(simp)
  6241 (* AndL1 *)
  6242 apply(simp add: fresh_idn fresh_idc)
  6243 apply(case_tac "findn (idn \<Gamma> x) name2")
  6244 apply(simp)
  6245 apply(simp add: a_star_AndL1)
  6246 apply(auto)[1]
  6247 apply(generate_fresh "name")
  6248 apply(fresh_fun_simp)
  6249 apply(drule idn_nmaps)
  6250 apply(simp)
  6251 apply(subgoal_tac "c\<sharp>idn \<Gamma> x,idc \<Delta> a<trm>")
  6252 apply(rule a_star_trans)
  6253 apply(rule a_starI)
  6254 apply(rule al_redu)
  6255 apply(rule better_LAxL_intro)
  6256 apply(rule fin.intros)
  6257 apply(simp add: abs_fresh)
  6258 apply(rule aux3)
  6259 apply(rule nrename.simps)
  6260 apply(auto simp add: fresh_prod fresh_atm)[1]
  6261 apply(simp)
  6262 apply(simp add: nrename_fresh)
  6263 apply(simp add: a_star_AndL1)
  6264 apply(rule psubst_fresh_name)
  6265 apply(rule fresh_idn)
  6266 apply(simp)
  6267 apply(rule fresh_idc)
  6268 apply(simp)
  6269 apply(simp)
  6270 (* AndL2 *)
  6271 apply(simp add: fresh_idn fresh_idc)
  6272 apply(case_tac "findn (idn \<Gamma> x) name2")
  6273 apply(simp)
  6274 apply(simp add: a_star_AndL2)
  6275 apply(auto)[1]
  6276 apply(generate_fresh "name")
  6277 apply(fresh_fun_simp)
  6278 apply(drule idn_nmaps)
  6279 apply(simp)
  6280 apply(subgoal_tac "c\<sharp>idn \<Gamma> x,idc \<Delta> a<trm>")
  6281 apply(rule a_star_trans)
  6282 apply(rule a_starI)
  6283 apply(rule al_redu)
  6284 apply(rule better_LAxL_intro)
  6285 apply(rule fin.intros)
  6286 apply(simp add: abs_fresh)
  6287 apply(rule aux3)
  6288 apply(rule nrename.simps)
  6289 apply(auto simp add: fresh_prod fresh_atm)[1]
  6290 apply(simp)
  6291 apply(simp add: nrename_fresh)
  6292 apply(simp add: a_star_AndL2)
  6293 apply(rule psubst_fresh_name)
  6294 apply(rule fresh_idn)
  6295 apply(simp)
  6296 apply(rule fresh_idc)
  6297 apply(simp)
  6298 apply(simp)
  6299 (* OrR1 *)
  6300 apply(simp add: fresh_idn fresh_idc)
  6301 apply(case_tac "findc (idc \<Delta> a) coname2")
  6302 apply(simp)
  6303 apply(simp add: a_star_OrR1)
  6304 apply(auto)[1]
  6305 apply(generate_fresh "coname")
  6306 apply(fresh_fun_simp)
  6307 apply(drule idc_cmaps)
  6308 apply(simp)
  6309 apply(subgoal_tac "c\<sharp>idn \<Gamma> x,idc \<Delta> a<trm>")
  6310 apply(rule a_star_trans)
  6311 apply(rule a_starI)
  6312 apply(rule al_redu)
  6313 apply(rule better_LAxR_intro)
  6314 apply(rule fic.intros)
  6315 apply(simp add: abs_fresh)
  6316 apply(rule aux3)
  6317 apply(rule crename.simps)
  6318 apply(auto simp add: fresh_prod fresh_atm)[1]
  6319 apply(simp)
  6320 apply(simp add: crename_fresh)
  6321 apply(simp add: a_star_OrR1)
  6322 apply(rule psubst_fresh_coname)
  6323 apply(rule fresh_idn)
  6324 apply(simp)
  6325 apply(rule fresh_idc)
  6326 apply(simp)
  6327 apply(simp)
  6328 (* OrR2 *)
  6329 apply(simp add: fresh_idn fresh_idc)
  6330 apply(case_tac "findc (idc \<Delta> a) coname2")
  6331 apply(simp)
  6332 apply(simp add: a_star_OrR2)
  6333 apply(auto)[1]
  6334 apply(generate_fresh "coname")
  6335 apply(fresh_fun_simp)
  6336 apply(drule idc_cmaps)
  6337 apply(simp)
  6338 apply(subgoal_tac "c\<sharp>idn \<Gamma> x,idc \<Delta> a<trm>")
  6339 apply(rule a_star_trans)
  6340 apply(rule a_starI)
  6341 apply(rule al_redu)
  6342 apply(rule better_LAxR_intro)
  6343 apply(rule fic.intros)
  6344 apply(simp add: abs_fresh)
  6345 apply(rule aux3)
  6346 apply(rule crename.simps)
  6347 apply(auto simp add: fresh_prod fresh_atm)[1]
  6348 apply(simp)
  6349 apply(simp add: crename_fresh)
  6350 apply(simp add: a_star_OrR2)
  6351 apply(rule psubst_fresh_coname)
  6352 apply(rule fresh_idn)
  6353 apply(simp)
  6354 apply(rule fresh_idc)
  6355 apply(simp)
  6356 apply(simp)
  6357 (* OrL *)
  6358 apply(simp add: fresh_idn fresh_idc)
  6359 apply(case_tac "findn (idn \<Gamma> x) name3")
  6360 apply(simp)
  6361 apply(simp add: a_star_OrL)
  6362 apply(auto)[1]
  6363 apply(generate_fresh "name")
  6364 apply(fresh_fun_simp)
  6365 apply(drule idn_nmaps)
  6366 apply(simp)
  6367 apply(subgoal_tac "c\<sharp>idn \<Gamma> x,idc \<Delta> a<trm1>")
  6368 apply(subgoal_tac "c\<sharp>idn \<Gamma> x,idc \<Delta> a<trm2>")
  6369 apply(rule a_star_trans)
  6370 apply(rule a_starI)
  6371 apply(rule al_redu)
  6372 apply(rule better_LAxL_intro)
  6373 apply(rule fin.intros)
  6374 apply(simp add: abs_fresh)
  6375 apply(simp add: abs_fresh)
  6376 apply(rule aux3)
  6377 apply(rule nrename.simps)
  6378 apply(auto simp add: fresh_prod fresh_atm)[1]
  6379 apply(rule psubst_fresh_name)
  6380 apply(rule fresh_idn)
  6381 apply(simp)
  6382 apply(rule fresh_idc)
  6383 apply(simp add: fresh_prod fresh_atm)
  6384 apply(simp)
  6385 apply(auto simp add: fresh_prod fresh_atm)[1]
  6386 apply(rule psubst_fresh_name)
  6387 apply(rule fresh_idn)
  6388 apply(simp)
  6389 apply(rule fresh_idc)
  6390 apply(simp add: fresh_prod fresh_atm)
  6391 apply(simp)
  6392 apply(simp)
  6393 apply(simp)
  6394 apply(simp add: nrename_fresh)
  6395 apply(simp add: a_star_OrL)
  6396 apply(rule psubst_fresh_name)
  6397 apply(rule fresh_idn)
  6398 apply(simp)
  6399 apply(rule fresh_idc)
  6400 apply(simp)
  6401 apply(simp)
  6402 apply(rule psu