src/HOL/Nominal/Examples/Class1.thy
changeset 80609 4b5d3d0abb69
parent 80595 1effd04264cc
child 80611 fbc859ccdaf3
equal deleted inserted replaced
80595:1effd04264cc 80609:4b5d3d0abb69
    48 
    48 
    49 text \<open>terms\<close>                               
    49 text \<open>terms\<close>                               
    50 
    50 
    51 nominal_datatype trm = 
    51 nominal_datatype trm = 
    52     Ax   "name" "coname"
    52     Ax   "name" "coname"
    53   | Cut  "\<guillemotleft>coname\<guillemotright>trm" "\<guillemotleft>name\<guillemotright>trm"            ("Cut <_>._ (_)._" [0,100,1000,100] 101)
    53   | Cut  "\<guillemotleft>coname\<guillemotright>trm" "\<guillemotleft>name\<guillemotright>trm"            ("Cut <_>._ ('(_'))._" [0,0,0,100] 101)
    54   | NotR "\<guillemotleft>name\<guillemotright>trm" "coname"                 ("NotR (_)._ _" [100,100,100] 101)
    54   | NotR "\<guillemotleft>name\<guillemotright>trm" "coname"                 ("NotR (_)._ _" [100,100,100] 101)
    55   | NotL "\<guillemotleft>coname\<guillemotright>trm" "name"                 ("NotL <_>._ _" [0,100,100] 101)
    55   | NotL "\<guillemotleft>coname\<guillemotright>trm" "name"                 ("NotL <_>._ _" [0,100,100] 101)
    56   | AndR "\<guillemotleft>coname\<guillemotright>trm" "\<guillemotleft>coname\<guillemotright>trm" "coname" ("AndR <_>._ <_>._ _" [0,100,0,100,100] 101)
    56   | AndR "\<guillemotleft>coname\<guillemotright>trm" "\<guillemotleft>coname\<guillemotright>trm" "coname" ("AndR <_>._ <_>._ _" [0,100,0,100,100] 101)
    57   | AndL1 "\<guillemotleft>name\<guillemotright>trm" "name"                  ("AndL1 (_)._ _" [100,100,100] 101)
    57   | AndL1 "\<guillemotleft>name\<guillemotright>trm" "name"                  ("AndL1 (_)._ _" [100,100,100] 101)
    58   | AndL2 "\<guillemotleft>name\<guillemotright>trm" "name"                  ("AndL2 (_)._ _" [100,100,100] 101)
    58   | AndL2 "\<guillemotleft>name\<guillemotright>trm" "name"                  ("AndL2 (_)._ _" [100,100,100] 101)
   671 apply (meson exists_fresh(1) fs_name1)
   671 apply (meson exists_fresh(1) fs_name1)
   672 apply(fresh_guess)+
   672 apply(fresh_guess)+
   673 done
   673 done
   674 
   674 
   675 nominal_primrec (freshness_context: "(d::name,z::coname,P::trm)")
   675 nominal_primrec (freshness_context: "(d::name,z::coname,P::trm)")
   676   substc :: "trm \<Rightarrow> coname \<Rightarrow> name   \<Rightarrow> trm \<Rightarrow> trm" ("_{_:=(_)._}" [100,100,100,100] 100)
   676   substc :: "trm \<Rightarrow> coname \<Rightarrow> name   \<Rightarrow> trm \<Rightarrow> trm" ("_{_:=('(_'))._}" [100,0,0,100] 100)
   677 where
   677 where
   678   "(Ax x a){d:=(z).P} = (if d=a then Cut <a>.(Ax x a) (z).P else Ax x a)" 
   678   "(Ax x a){d:=(z).P} = (if d=a then Cut <a>.(Ax x a) (z).P else Ax x a)" 
   679 | "\<lbrakk>a\<sharp>(d,P,N);x\<sharp>(z,P,M)\<rbrakk> \<Longrightarrow> (Cut <a>.M (x).N){d:=(z).P} = 
   679 | "\<lbrakk>a\<sharp>(d,P,N);x\<sharp>(z,P,M)\<rbrakk> \<Longrightarrow> (Cut <a>.M (x).N){d:=(z).P} = 
   680   (if N=Ax x d then Cut <a>.(M{d:=(z).P}) (z).P else Cut <a>.(M{d:=(z).P}) (x).(N{d:=(z).P}))" 
   680   (if N=Ax x d then Cut <a>.(M{d:=(z).P}) (z).P else Cut <a>.(M{d:=(z).P}) (x).(N{d:=(z).P}))" 
   681 | "x\<sharp>(z,P) \<Longrightarrow> (NotR (x).M a){d:=(z).P} = 
   681 | "x\<sharp>(z,P) \<Longrightarrow> (NotR (x).M a){d:=(z).P} = 
  2327   with ImpR fic_rest_elims show ?case
  2327   with ImpR fic_rest_elims show ?case
  2328     apply (clarsimp simp: fresh_prod fresh_fun_simp_ImpR)
  2328     apply (clarsimp simp: fresh_prod fresh_fun_simp_ImpR)
  2329     by (metis abs_fresh(2) fic.intros(6) fic_ImpR_elim freshc_after_substc)
  2329     by (metis abs_fresh(2) fic.intros(6) fic_ImpR_elim freshc_after_substc)
  2330 qed (use fic_rest_elims in auto)
  2330 qed (use fic_rest_elims in auto)
  2331 
  2331 
  2332 
       
  2333 lemma fic_subst1:
  2332 lemma fic_subst1:
  2334   assumes a: "fic M a" "a\<noteq>b" "a\<sharp>P"
  2333   assumes "fic M a" "a\<noteq>b" "a\<sharp>P"
  2335   shows "fic (M{b:=(x).P}) a"
  2334   shows "fic (M{b:=(x).P}) a"
  2336 using a
  2335 using assms
  2337 apply(nominal_induct M avoiding: x b a P rule: trm.strong_induct)
  2336 proof (nominal_induct M avoiding: x b a P rule: trm.strong_induct)
  2338 apply(drule fic_elims)
  2337   case (Ax name coname)
  2339 apply(simp add: fic.intros)
  2338   then show ?case
  2340 apply(drule fic_elims, simp)
  2339     using fic_Ax_elim by force
  2341 apply(drule fic_elims, simp)
  2340 next
  2342 apply(rule fic.intros)
  2341   case (NotR name trm coname)
  2343 apply(rule subst_fresh)
  2342   with fic_NotR_elim show ?case
  2344 apply(simp)
  2343     by (fastforce simp add: fresh_prod subst_fresh)
  2345 apply(drule fic_elims, simp)
  2344 next
  2346 apply(drule fic_elims, simp)
  2345   case (AndR coname1 trm1 coname2 trm2 coname3)
  2347 apply(rule fic.intros)
  2346   with fic_AndR_elim show ?case
  2348 apply(simp add: abs_fresh fresh_atm)
  2347     by (fastforce simp add: abs_fresh fresh_prod subst_fresh)
  2349 apply(rule subst_fresh)
  2348 next
  2350 apply(auto)[1]
  2349   case (OrR1 coname1 trm coname2)
  2351 apply(simp add: abs_fresh fresh_atm)
  2350   with fic_OrR1_elim show ?case
  2352 apply(rule subst_fresh)
  2351     by (fastforce simp add: abs_fresh fresh_prod subst_fresh)
  2353 apply(auto)[1]
  2352 next
  2354 apply(drule fic_elims, simp)
  2353   case (OrR2 coname1 trm coname2)
  2355 apply(drule fic_elims, simp)
  2354   with fic_OrR2_elim show ?case
  2356 apply(drule fic_elims, simp)
  2355     by (fastforce simp add: abs_fresh fresh_prod subst_fresh)
  2357 apply(rule fic.intros)
  2356 next
  2358 apply(simp add: abs_fresh fresh_atm)
  2357   case (ImpR name coname1 trm coname2)
  2359 apply(rule subst_fresh)
  2358   with fic_ImpR_elim show ?case
  2360 apply(auto)[1]
  2359     by (fastforce simp add: abs_fresh fresh_prod subst_fresh)
  2361 apply(drule fic_elims, simp)
  2360 qed (use fic_rest_elims in force)+
  2362 apply(rule fic.intros)
       
  2363 apply(simp add: abs_fresh fresh_atm)
       
  2364 apply(rule subst_fresh)
       
  2365 apply(auto)[1]
       
  2366 apply(drule fic_elims, simp)
       
  2367 apply(drule fic_elims, simp)
       
  2368 apply(rule fic.intros)
       
  2369 apply(simp add: abs_fresh fresh_atm)
       
  2370 apply(rule subst_fresh)
       
  2371 apply(auto)[1]
       
  2372 apply(drule fic_elims, simp)
       
  2373 done
       
  2374 
  2361 
  2375 lemma fic_subst2:
  2362 lemma fic_subst2:
  2376   assumes a: "fic M a" "c\<noteq>a" "a\<sharp>P" "M\<noteq>Ax x a" 
  2363   assumes "fic M a" "c\<noteq>a" "a\<sharp>P" "M\<noteq>Ax x a" 
  2377   shows "fic (M{x:=<c>.P}) a"
  2364   shows "fic (M{x:=<c>.P}) a"
  2378 using a
  2365 using assms
  2379 apply(nominal_induct M avoiding: x a c P rule: trm.strong_induct)
  2366 proof (nominal_induct M avoiding: x a c P rule: trm.strong_induct)
  2380 apply(drule fic_elims)
  2367   case (Ax name coname)
  2381 apply(simp add: trm.inject)
  2368   then show ?case
  2382 apply(rule fic.intros)
  2369     using fic_Ax_elim by force
  2383 apply(drule fic_elims, simp)
  2370 next
  2384 apply(drule fic_elims, simp)
  2371   case (NotR name trm coname)
  2385 apply(rule fic.intros)
  2372   with fic_NotR_elim show ?case
  2386 apply(rule subst_fresh)
  2373     by (fastforce simp add: fresh_prod subst_fresh)
  2387 apply(simp)
  2374 next
  2388 apply(drule fic_elims, simp)
  2375   case (AndR coname1 trm1 coname2 trm2 coname3)
  2389 apply(drule fic_elims, simp)
  2376   with fic_AndR_elim show ?case
  2390 apply(rule fic.intros)
  2377     by simp (metis abs_fresh(2) crename_cfresh crename_fresh fic.intros(3) fresh_atm(2) substn_crename_comm')
  2391 apply(simp add: abs_fresh fresh_atm)
  2378 next
  2392 apply(rule subst_fresh)
  2379   case (OrR1 coname1 trm coname2)
  2393 apply(auto)[1]
  2380   with fic_OrR1_elim show ?case
  2394 apply(simp add: abs_fresh fresh_atm)
  2381     by (fastforce simp add: abs_fresh fresh_prod subst_fresh)
  2395 apply(rule subst_fresh)
  2382 next
  2396 apply(auto)[1]
  2383   case (OrR2 coname1 trm coname2)
  2397 apply(drule fic_elims, simp)
  2384   with fic_OrR2_elim show ?case
  2398 apply(drule fic_elims, simp)
  2385     by (fastforce simp add: abs_fresh fresh_prod subst_fresh)
  2399 apply(drule fic_elims, simp)
  2386 next
  2400 apply(rule fic.intros)
  2387   case (ImpR name coname1 trm coname2)
  2401 apply(simp add: abs_fresh fresh_atm)
  2388   with fic_ImpR_elim show ?case
  2402 apply(rule subst_fresh)
  2389     by (fastforce simp add: abs_fresh fresh_prod subst_fresh)
  2403 apply(auto)[1]
  2390 qed (use fic_rest_elims in force)+
  2404 apply(drule fic_elims, simp)
       
  2405 apply(rule fic.intros)
       
  2406 apply(simp add: abs_fresh fresh_atm)
       
  2407 apply(rule subst_fresh)
       
  2408 apply(auto)[1]
       
  2409 apply(drule fic_elims, simp)
       
  2410 apply(drule fic_elims, simp)
       
  2411 apply(rule fic.intros)
       
  2412 apply(simp add: abs_fresh fresh_atm)
       
  2413 apply(rule subst_fresh)
       
  2414 apply(auto)[1]
       
  2415 apply(drule fic_elims, simp)
       
  2416 done
       
  2417 
  2391 
  2418 lemma fic_substc_crename:
  2392 lemma fic_substc_crename:
  2419   assumes a: "fic M a" "a\<noteq>b" "a\<sharp>P"
  2393   assumes "fic M a" "a\<noteq>b" "a\<sharp>P"
  2420   shows "M[a\<turnstile>c>b]{b:=(y).P} = Cut <a>.(M{b:=(y).P}) (y).P"
  2394   shows "M[a\<turnstile>c>b]{b:=(y).P} = Cut <a>.(M{b:=(y).P}) (y).P"
  2421 using a
  2395 using assms
  2422 apply(nominal_induct M avoiding: a b  y P rule: trm.strong_induct)
  2396 proof (nominal_induct M avoiding: a b  y P rule: trm.strong_induct)
  2423 apply(drule fic_Ax_elim)
  2397   case (Ax name coname)
  2424 apply(simp)
  2398   with fic_Ax_elim show ?case
  2425 apply(simp add: trm.inject)
  2399     by(force simp add: trm.inject alpha(2) fresh_atm(2,4) swap_simps(4,8))
  2426 apply(simp add: alpha calc_atm fresh_atm trm.inject)
  2400 next
  2427 apply(simp)
  2401   case (Cut coname trm1 name trm2)
  2428 apply(drule fic_rest_elims)
  2402   with fic_rest_elims show ?case by force
  2429 apply(simp)
  2403 next
  2430 apply(drule fic_NotR_elim)
  2404   case (NotR name trm coname)
  2431 apply(simp)
  2405   with fic_NotR_elim[OF NotR.prems(1)] show ?case
  2432 apply(generate_fresh "coname")
  2406     by (simp add: trm.inject crename_fresh fresh_fun_simp_NotR subst_fresh(6))
  2433 apply(fresh_fun_simp)
  2407 next
  2434 apply(simp add: trm.inject alpha fresh_atm fresh_prod fresh_atm calc_atm abs_fresh)
  2408   case (AndR coname1 trm1 coname2 trm2 coname3)
  2435 apply(rule conjI)
  2409   with AndR fic_AndR_elim[OF AndR.prems(1)] show ?case
  2436 apply(simp add: csubst_eqvt calc_atm)
  2410     by (simp add: abs_fresh rename_fresh fresh_fun_simp_AndR fresh_atm(2) subst_fresh(6))
  2437 apply(simp add: perm_fresh_fresh)
  2411 next
  2438 apply(simp add: crename_fresh)
  2412   case (OrR1 coname1 trm coname2)
  2439 apply(rule subst_fresh)
  2413   with fic_OrR1_elim[OF OrR1.prems(1)] show ?case
  2440 apply(simp)
  2414     by (simp add: abs_fresh rename_fresh fresh_fun_simp_OrR1 fresh_atm(2) subst_fresh(6))
  2441 apply(drule fic_rest_elims)
  2415 next
  2442 apply(simp)
  2416   case (OrR2 coname1 trm coname2)
  2443 apply(drule fic_AndR_elim)
  2417   with fic_OrR2_elim[OF OrR2.prems(1)] show ?case
  2444 apply(simp add: abs_fresh fresh_atm subst_fresh rename_fresh)
  2418     by (simp add: abs_fresh rename_fresh fresh_fun_simp_OrR2 fresh_atm(2) subst_fresh(6))
  2445 apply(generate_fresh "coname")
  2419 next
  2446 apply(fresh_fun_simp)
  2420   case (ImpR name coname1 trm coname2)
  2447 apply(simp add: trm.inject alpha fresh_atm calc_atm abs_fresh fresh_prod)
  2421   with fic_ImpR_elim[OF ImpR.prems(1)] crename_fresh show ?case
  2448 apply(rule conjI)
  2422     by (force simp add: abs_fresh fresh_fun_simp_ImpR fresh_atm(2) subst_fresh(6))
  2449 apply(simp add: csubst_eqvt calc_atm)
  2423 qed (use fic_rest_elims in force)+
  2450 apply(simp add: perm_fresh_fresh)
       
  2451 apply(simp add: csubst_eqvt calc_atm)
       
  2452 apply(simp add: perm_fresh_fresh)
       
  2453 apply(simp add: subst_fresh)
       
  2454 apply(drule fic_rest_elims)
       
  2455 apply(simp)
       
  2456 apply(drule fic_rest_elims)
       
  2457 apply(simp)
       
  2458 apply(drule fic_OrR1_elim)
       
  2459 apply(simp)
       
  2460 apply(generate_fresh "coname")
       
  2461 apply(fresh_fun_simp)
       
  2462 apply(simp add: trm.inject alpha fresh_atm calc_atm abs_fresh fresh_prod)
       
  2463 apply(simp add: csubst_eqvt calc_atm)
       
  2464 apply(simp add: perm_fresh_fresh)
       
  2465 apply(simp add: subst_fresh rename_fresh)
       
  2466 apply(drule fic_OrR2_elim)
       
  2467 apply(simp add: abs_fresh fresh_atm)
       
  2468 apply(generate_fresh "coname")
       
  2469 apply(fresh_fun_simp)
       
  2470 apply(simp add: trm.inject alpha fresh_atm calc_atm abs_fresh fresh_prod)
       
  2471 apply(simp add: csubst_eqvt calc_atm)
       
  2472 apply(simp add: perm_fresh_fresh)
       
  2473 apply(simp add: subst_fresh rename_fresh)
       
  2474 apply(drule fic_rest_elims)
       
  2475 apply(simp)
       
  2476 apply(drule fic_ImpR_elim)
       
  2477 apply(simp add: abs_fresh fresh_atm)
       
  2478 apply(generate_fresh "coname")
       
  2479 apply(fresh_fun_simp)
       
  2480 apply(simp add: trm.inject alpha fresh_atm calc_atm abs_fresh fresh_prod)
       
  2481 apply(simp add: csubst_eqvt calc_atm)
       
  2482 apply(simp add: perm_fresh_fresh)
       
  2483 apply(simp add: subst_fresh rename_fresh)
       
  2484 apply(drule fic_rest_elims)
       
  2485 apply(simp)
       
  2486 done
       
  2487 
  2424 
  2488 inductive
  2425 inductive
  2489   l_redu :: "trm \<Rightarrow> trm \<Rightarrow> bool" ("_ \<longrightarrow>\<^sub>l _" [100,100] 100)
  2426   l_redu :: "trm \<Rightarrow> trm \<Rightarrow> bool" ("_ \<longrightarrow>\<^sub>l _" [100,100] 100)
  2490 where
  2427 where
  2491   LAxR:  "\<lbrakk>x\<sharp>M; a\<sharp>b; fic M a\<rbrakk> \<Longrightarrow> Cut <a>.M (x).(Ax x b) \<longrightarrow>\<^sub>l M[a\<turnstile>c>b]"
  2428   LAxR:  "\<lbrakk>x\<sharp>M; a\<sharp>b; fic M a\<rbrakk> \<Longrightarrow> Cut <a>.M (x).(Ax x b) \<longrightarrow>\<^sub>l M[a\<turnstile>c>b]"
  2509 lemma l_redu_eqvt':
  2446 lemma l_redu_eqvt':
  2510   fixes pi1::"name prm"
  2447   fixes pi1::"name prm"
  2511   and   pi2::"coname prm"
  2448   and   pi2::"coname prm"
  2512   shows "(pi1\<bullet>M) \<longrightarrow>\<^sub>l (pi1\<bullet>M') \<Longrightarrow> M \<longrightarrow>\<^sub>l M'"
  2449   shows "(pi1\<bullet>M) \<longrightarrow>\<^sub>l (pi1\<bullet>M') \<Longrightarrow> M \<longrightarrow>\<^sub>l M'"
  2513   and   "(pi2\<bullet>M) \<longrightarrow>\<^sub>l (pi2\<bullet>M') \<Longrightarrow> M \<longrightarrow>\<^sub>l M'"
  2450   and   "(pi2\<bullet>M) \<longrightarrow>\<^sub>l (pi2\<bullet>M') \<Longrightarrow> M \<longrightarrow>\<^sub>l M'"
  2514 apply -
  2451   using l_redu.eqvt perm_pi_simp by metis+
  2515 apply(drule_tac pi="rev pi1" in l_redu.eqvt(1))
       
  2516 apply(perm_simp)
       
  2517 apply(drule_tac pi="rev pi2" in l_redu.eqvt(2))
       
  2518 apply(perm_simp)
       
  2519 done
       
  2520 
  2452 
  2521 nominal_inductive l_redu
  2453 nominal_inductive l_redu
  2522   apply(simp_all add: abs_fresh fresh_atm rename_fresh fresh_prod abs_supp fin_supp)
  2454   by (force simp add: abs_fresh fresh_atm rename_fresh fresh_prod abs_supp fin_supp)+
  2523   apply(force)+
  2455 
  2524   done
  2456 
  2525 
  2457 lemma fresh_l_redu_x:
  2526 lemma fresh_l_redu:
  2458   fixes z::"name"
  2527   fixes x::"name"
  2459   shows "M \<longrightarrow>\<^sub>l M' \<Longrightarrow> z\<sharp>M \<Longrightarrow> z\<sharp>M'"
  2528   and   a::"coname"
  2460 proof (induct rule: l_redu.induct)
  2529   shows "M \<longrightarrow>\<^sub>l M' \<Longrightarrow> x\<sharp>M \<Longrightarrow> x\<sharp>M'"
  2461   case (LAxL a M x y)
  2530   and   "M \<longrightarrow>\<^sub>l M' \<Longrightarrow> a\<sharp>M \<Longrightarrow> a\<sharp>M'"
  2462   then show ?case
  2531 apply -
  2463     by (metis abs_fresh(1,5) nrename_nfresh nrename_rename trm.fresh(1,3))
  2532 apply(induct rule: l_redu.induct)
  2464 next
  2533 apply(auto simp: abs_fresh rename_fresh)
  2465   case (LImp z N y P x M b a c)
  2534 apply(case_tac "xa=x")
  2466   then show ?case
  2535 apply(simp add: rename_fresh)
  2467     apply (simp add: abs_fresh fresh_prod)
  2536 apply(simp add: rename_fresh fresh_atm)
  2468     by (metis abs_fresh(3,5) abs_supp(5) fs_name1)
  2537 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp)+
  2469 qed (auto simp add: abs_fresh fresh_prod crename_nfresh)
  2538 apply(induct rule: l_redu.induct)
  2470 
  2539 apply(auto simp: abs_fresh rename_fresh)
  2471 lemma fresh_l_redu_a:
  2540 apply(case_tac "aa=a")
  2472   fixes c::"coname"
  2541 apply(simp add: rename_fresh)
  2473   shows "M \<longrightarrow>\<^sub>l M' \<Longrightarrow> c\<sharp>M \<Longrightarrow> c\<sharp>M'"
  2542 apply(simp add: rename_fresh fresh_atm)
  2474 proof (induct rule: l_redu.induct)
  2543 apply(simp add: fresh_prod abs_fresh abs_supp fin_supp)+
  2475   case (LAxR x M a b)
  2544 done
  2476   then show ?case
       
  2477     apply (simp add: abs_fresh)
       
  2478     by (metis crename_cfresh crename_rename)
       
  2479 next
       
  2480   case (LAxL a M x y)
       
  2481   with nrename_cfresh show ?case
       
  2482     by (simp add: abs_fresh)
       
  2483 qed (auto simp add: abs_fresh fresh_prod crename_nfresh)
       
  2484 
       
  2485 
       
  2486 lemmas fresh_l_redu = fresh_l_redu_x fresh_l_redu_a
  2545 
  2487 
  2546 lemma better_LAxR_intro[intro]:
  2488 lemma better_LAxR_intro[intro]:
  2547   shows "fic M a \<Longrightarrow> Cut <a>.M (x).(Ax x b) \<longrightarrow>\<^sub>l M[a\<turnstile>c>b]"
  2489   shows "fic M a \<Longrightarrow> Cut <a>.M (x).(Ax x b) \<longrightarrow>\<^sub>l M[a\<turnstile>c>b]"
  2548 proof -
  2490 proof -
  2549   assume fin: "fic M a"
  2491   assume fin: "fic M a"
  2735 lemma better_LImp_intro[intro]:
  2677 lemma better_LImp_intro[intro]:
  2736   shows "\<lbrakk>z\<sharp>(N,[y].P); b\<sharp>[a].M; a\<sharp>N\<rbrakk> 
  2678   shows "\<lbrakk>z\<sharp>(N,[y].P); b\<sharp>[a].M; a\<sharp>N\<rbrakk> 
  2737          \<Longrightarrow> Cut <b>.(ImpR (x).<a>.M b) (z).(ImpL <c>.N (y).P z) \<longrightarrow>\<^sub>l Cut <a>.(Cut <c>.N (x).M) (y).P"
  2679          \<Longrightarrow> Cut <b>.(ImpR (x).<a>.M b) (z).(ImpL <c>.N (y).P z) \<longrightarrow>\<^sub>l Cut <a>.(Cut <c>.N (x).M) (y).P"
  2738 proof -
  2680 proof -
  2739   assume fs: "z\<sharp>(N,[y].P)" "b\<sharp>[a].M" "a\<sharp>N"
  2681   assume fs: "z\<sharp>(N,[y].P)" "b\<sharp>[a].M" "a\<sharp>N"
  2740   obtain y'::"name" where f1: "y'\<sharp>(y,M,N,P,z,x)" by (rule exists_fresh(1), rule fin_supp, blast)
  2682   obtain y'::"name" and x'::"name" and z'::"name" 
  2741   obtain x'::"name" where f2: "x'\<sharp>(y,M,N,P,z,x,y')" by (rule exists_fresh(1), rule fin_supp, blast)
  2683     where f1: "y'\<sharp>(y,M,N,P,z,x)" and f2: "x'\<sharp>(y,M,N,P,z,x,y')" and f3: "z'\<sharp>(y,M,N,P,z,x,y',x')"
  2742   obtain z'::"name" where f3: "z'\<sharp>(y,M,N,P,z,x,y',x')" by (rule exists_fresh(1), rule fin_supp, blast)
  2684     by (meson exists_fresh(1) fs_name1)
  2743   obtain a'::"coname" where f4: "a'\<sharp>(a,N,P,M,b)" by (rule exists_fresh(2), rule fin_supp, blast)
  2685   obtain a'::"coname" and b'::"coname" and c'::"coname" 
  2744   obtain b'::"coname" where f5: "b'\<sharp>(a,N,P,M,b,c,a')" by (rule exists_fresh(2),rule fin_supp, blast)
  2686     where f4: "a'\<sharp>(a,N,P,M,b)" and f5: "b'\<sharp>(a,N,P,M,b,c,a')" and f6: "c'\<sharp>(a,N,P,M,b,c,a',b')"
  2745   obtain c'::"coname" where f6: "c'\<sharp>(a,N,P,M,b,c,a',b')" by (rule exists_fresh(2),rule fin_supp, blast)
  2687     by (meson exists_fresh(2) fs_coname1)
  2746   have " Cut <b>.(ImpR (x).<a>.M b) (z).(ImpL <c>.N (y).P z)
  2688   have "Cut <b>.(ImpR (x).<a>.M b) (z).(ImpL <c>.N (y).P z)
  2747                       =  Cut <b'>.(ImpR (x).<a>.M b') (z').(ImpL <c>.N (y).P z')"
  2689                       =  Cut <b'>.(ImpR (x).<a>.M b') (z').(ImpL <c>.N (y).P z')"
  2748     using f1 f2 f3 f4 f5 fs
  2690     using f1 f2 f3 f4 f5 fs
  2749     apply(rule_tac sym)
  2691     apply(rule_tac sym)
  2750     apply(perm_simp add: trm.inject alpha calc_atm fresh_prod fresh_left fresh_atm abs_fresh)
  2692     apply(perm_simp add: trm.inject alpha calc_atm fresh_prod fresh_left fresh_atm abs_fresh)
  2751     apply(auto simp: perm_fresh_fresh)
  2693     apply(auto simp: perm_fresh_fresh)
  2752     done
  2694     done
  2753   also have "\<dots> = Cut <b'>.(ImpR (x').<a'>.([(a',a)]\<bullet>([(x',x)]\<bullet>M)) b') 
  2695   also have "\<dots> = Cut <b'>.(ImpR (x').<a'>.([(a',a)]\<bullet>([(x',x)]\<bullet>M)) b') 
  2754                            (z').(ImpL <c'>.([(c',c)]\<bullet>N) (y').([(y',y)]\<bullet>P) z')"
  2696                            (z').(ImpL <c'>.([(c',c)]\<bullet>N) (y').([(y',y)]\<bullet>P) z')"
  2755     using f1 f2 f3 f4 f5 f6 fs 
  2697     using f1 f2 f3 f4 f5 f6 fs 
  2756     apply(rule_tac sym)
  2698     apply(rule_tac sym)
  2757     apply(simp add: trm.inject)
  2699     apply(simp add: trm.inject alpha fresh_prod fresh_atm abs_perm calc_atm fresh_left abs_fresh)
  2758     apply(simp add: alpha)
       
  2759     apply(rule conjI)
       
  2760     apply(simp add: trm.inject)
       
  2761     apply(simp add: alpha fresh_prod fresh_atm abs_perm calc_atm fresh_left abs_fresh)
       
  2762     apply(simp add: trm.inject)
       
  2763     apply(simp add: alpha)
       
  2764     apply(rule conjI)
       
  2765     apply(simp add: alpha fresh_prod fresh_atm abs_perm calc_atm fresh_left abs_fresh)
       
  2766     apply(simp add: alpha fresh_prod fresh_atm abs_perm calc_atm fresh_left abs_fresh)
       
  2767     done
  2700     done
  2768   also have "\<dots> \<longrightarrow>\<^sub>l Cut <a'>.(Cut <c'>.([(c',c)]\<bullet>N) (x').([(a',a)]\<bullet>[(x',x)]\<bullet>M)) (y').([(y',y)]\<bullet>P)"
  2701   also have "\<dots> \<longrightarrow>\<^sub>l Cut <a'>.(Cut <c'>.([(c',c)]\<bullet>N) (x').([(a',a)]\<bullet>[(x',x)]\<bullet>M)) (y').([(y',y)]\<bullet>P)"
  2769     using f1 f2 f3 f4 f5 f6 fs
  2702     using f1 f2 f3 f4 f5 f6 fs
  2770     apply -
  2703     apply -
  2771     apply(rule l_redu.intros)
  2704     apply(rule l_redu.intros)
  2772     apply(auto simp: abs_fresh fresh_prod fresh_left calc_atm fresh_atm)
  2705     apply(auto simp: abs_fresh fresh_prod fresh_left calc_atm fresh_atm)
  2773     done
  2706     done
  2774   also have "\<dots> = Cut <a>.(Cut <c>.N (x).M) (y).P"
  2707   also have "\<dots> = Cut <a>.(Cut <c>.N (x).M) (y).P"
  2775     using f1 f2 f3 f4 f5 f6 fs 
  2708     using f1 f2 f3 f4 f5 f6 fs 
  2776     apply(simp add: trm.inject)
  2709     apply(simp add: trm.inject)
  2777     apply(rule conjI)
       
  2778     apply(simp add: alpha)
       
  2779     apply(rule disjI2)
       
  2780     apply(simp add: trm.inject)
       
  2781     apply(rule conjI)
       
  2782     apply(simp add: fresh_prod fresh_atm)
       
  2783     apply(rule conjI)
       
  2784     apply(perm_simp add: calc_atm)
       
  2785     apply(auto simp: fresh_prod fresh_atm)[1]
       
  2786     apply(perm_simp add: alpha)
       
  2787     apply(perm_simp add: alpha)
       
  2788     apply(perm_simp add: alpha)
       
  2789     apply(rule conjI)
       
  2790     apply(perm_simp add: calc_atm)
       
  2791     apply(rule_tac pi="[(a',a)]" in pt_bij4[OF pt_coname_inst, OF at_coname_inst])
       
  2792     apply(perm_simp add: abs_perm calc_atm)
       
  2793     apply(perm_simp add: alpha fresh_prod fresh_atm)
  2710     apply(perm_simp add: alpha fresh_prod fresh_atm)
  2794     apply(simp add: abs_fresh)
  2711     apply(simp add: trm.inject abs_fresh alpha(1) fresh_perm_app(4) perm_compose(4) perm_dj(4))
  2795     apply(perm_simp add: alpha fresh_prod fresh_atm)
  2712     apply (metis alpha'(2) crename_fresh crename_swap swap_simps(2,4,6))
  2796     done
  2713     done
  2797   finally show ?thesis by simp
  2714   finally show ?thesis by simp
  2798 qed 
  2715 qed 
  2799 
  2716 
  2800 lemma alpha_coname:
  2717 lemma alpha_coname:
  2801   fixes M::"trm"
  2718   fixes M::"trm"
  2802   and   a::"coname"
  2719     and   a::"coname"
  2803   assumes a: "[a].M = [b].N" "c\<sharp>(a,b,M,N)"
  2720   assumes "[a].M = [b].N" "c\<sharp>(a,b,M,N)"
  2804   shows "M = [(a,c)]\<bullet>[(b,c)]\<bullet>N"
  2721   shows "M = [(a,c)]\<bullet>[(b,c)]\<bullet>N"
  2805 using a
  2722   by (metis alpha_fresh'(2) assms fresh_atm(2) fresh_prod)
  2806 apply(auto simp: alpha_fresh fresh_prod fresh_atm)
       
  2807 apply(drule sym)
       
  2808 apply(perm_simp)
       
  2809 done 
       
  2810 
  2723 
  2811 lemma alpha_name:
  2724 lemma alpha_name:
  2812   fixes M::"trm"
  2725   fixes M::"trm"
  2813   and   x::"name"
  2726     and   x::"name"
  2814   assumes a: "[x].M = [y].N" "z\<sharp>(x,y,M,N)"
  2727   assumes "[x].M = [y].N" "z\<sharp>(x,y,M,N)"
  2815   shows "M = [(x,z)]\<bullet>[(y,z)]\<bullet>N"
  2728   shows "M = [(x,z)]\<bullet>[(y,z)]\<bullet>N"
  2816 using a
  2729   by (metis alpha_fresh'(1) assms fresh_atm(1) fresh_prod)
  2817 apply(auto simp: alpha_fresh fresh_prod fresh_atm)
       
  2818 apply(drule sym)
       
  2819 apply(perm_simp)
       
  2820 done 
       
  2821 
  2730 
  2822 lemma alpha_name_coname:
  2731 lemma alpha_name_coname:
  2823   fixes M::"trm"
  2732   fixes M::"trm"
  2824   and   x::"name"
  2733   and   x::"name"
  2825   and   a::"coname"
  2734   and   a::"coname"
  2826   assumes a: "[x].[b].M = [y].[c].N" "z\<sharp>(x,y,M,N)" "a\<sharp>(b,c,M,N)"
  2735 assumes "[x].[b].M = [y].[c].N" "z\<sharp>(x,y,M,N)" "a\<sharp>(b,c,M,N)"
  2827   shows "M = [(x,z)]\<bullet>[(b,a)]\<bullet>[(c,a)]\<bullet>[(y,z)]\<bullet>N"
  2736   shows "M = [(x,z)]\<bullet>[(b,a)]\<bullet>[(c,a)]\<bullet>[(y,z)]\<bullet>N"
  2828 using a
  2737   using assms
  2829 apply(auto simp: alpha_fresh fresh_prod fresh_atm 
  2738   apply(clarsimp simp: alpha_fresh fresh_prod fresh_atm 
  2830                      abs_supp fin_supp abs_fresh abs_perm fresh_left calc_atm)
  2739       abs_supp fin_supp abs_fresh abs_perm fresh_left calc_atm)
  2831 apply(drule sym)
  2740   by (metis perm_swap(1,2))
  2832 apply(simp)
  2741 
  2833 apply(perm_simp)
       
  2834 done 
       
  2835 
  2742 
  2836 lemma Cut_l_redu_elim:
  2743 lemma Cut_l_redu_elim:
  2837   assumes a: "Cut <a>.M (x).N \<longrightarrow>\<^sub>l R"
  2744   assumes "Cut <a>.M (x).N \<longrightarrow>\<^sub>l R"
  2838   shows "(\<exists>b. R = M[a\<turnstile>c>b]) \<or> (\<exists>y. R = N[x\<turnstile>n>y]) \<or>
  2745   shows "(\<exists>b. R = M[a\<turnstile>c>b]) \<or> (\<exists>y. R = N[x\<turnstile>n>y]) \<or>
  2839   (\<exists>y M' b N'. M = NotR (y).M' a \<and> N = NotL <b>.N' x \<and> R = Cut <b>.N' (y).M' \<and> fic M a \<and> fin N x) \<or>
  2746   (\<exists>y M' b N'. M = NotR (y).M' a \<and> N = NotL <b>.N' x \<and> R = Cut <b>.N' (y).M' \<and> fic M a \<and> fin N x) \<or>
  2840   (\<exists>b M1 c M2 y N'. M = AndR <b>.M1 <c>.M2 a \<and> N = AndL1 (y).N' x \<and> R = Cut <b>.M1 (y).N' 
  2747   (\<exists>b M1 c M2 y N'. M = AndR <b>.M1 <c>.M2 a \<and> N = AndL1 (y).N' x \<and> R = Cut <b>.M1 (y).N' 
  2841                                                                             \<and> fic M a \<and> fin N x) \<or>
  2748                                                                             \<and> fic M a \<and> fin N x) \<or>
  2842   (\<exists>b M1 c M2 y N'. M = AndR <b>.M1 <c>.M2 a \<and> N = AndL2 (y).N' x \<and> R = Cut <c>.M2 (y).N' 
  2749   (\<exists>b M1 c M2 y N'. M = AndR <b>.M1 <c>.M2 a \<and> N = AndL2 (y).N' x \<and> R = Cut <c>.M2 (y).N' 
  2845                                                                             \<and> fic M a \<and> fin N x) \<or>
  2752                                                                             \<and> fic M a \<and> fin N x) \<or>
  2846   (\<exists>b N' z M1 y M2. M = OrR2 <b>.N' a \<and> N = OrL (z).M1 (y).M2 x \<and> R = Cut <b>.N' (y).M2 
  2753   (\<exists>b N' z M1 y M2. M = OrR2 <b>.N' a \<and> N = OrL (z).M1 (y).M2 x \<and> R = Cut <b>.N' (y).M2 
  2847                                                                             \<and> fic M a \<and> fin N x) \<or>
  2754                                                                             \<and> fic M a \<and> fin N x) \<or>
  2848   (\<exists>z b M' c N1 y N2. M = ImpR (z).<b>.M' a \<and> N = ImpL <c>.N1 (y).N2 x \<and> 
  2755   (\<exists>z b M' c N1 y N2. M = ImpR (z).<b>.M' a \<and> N = ImpL <c>.N1 (y).N2 x \<and> 
  2849             R = Cut <b>.(Cut <c>.N1 (z).M') (y).N2 \<and> b\<sharp>(c,N1) \<and> fic M a \<and> fin N x)"
  2756             R = Cut <b>.(Cut <c>.N1 (z).M') (y).N2 \<and> b\<sharp>(c,N1) \<and> fic M a \<and> fin N x)"
  2850 using a
  2757 using assms
  2851 apply(erule_tac l_redu.cases)
  2758 proof (cases rule: l_redu.cases)
  2852 apply(rule disjI1)
  2759   case (LAxR x M a b)
  2853 (* ax case *)
  2760   then show ?thesis
  2854 apply(simp add: trm.inject)
  2761     apply(simp add: trm.inject)
  2855 apply(rule_tac x="b" in exI)
  2762     by (metis alpha(2) crename_rename)
  2856 apply(erule conjE)
  2763 next
  2857 apply(simp add: alpha)
  2764   case (LAxL a M x y)
  2858 apply(erule disjE)
  2765   then show ?thesis
  2859 apply(simp)
  2766     apply(simp add: trm.inject)
  2860 apply(simp)
  2767     by (metis alpha(1) nrename_rename)
  2861 apply(simp add: rename_fresh)
  2768 next
  2862 apply(rule disjI2)
  2769   case (LNot y M N x a b)
  2863 apply(rule disjI1)
  2770   then show ?thesis
  2864 (* ax case *)
  2771     apply(simp add: trm.inject)
  2865 apply(simp add: trm.inject)
  2772     apply(rule disjI2)
  2866 apply(rule_tac x="y" in exI)
  2773     apply(rule disjI2)
  2867 apply(erule conjE)
  2774     apply(rule disjI1)
  2868 apply(thin_tac "[a].M = [aa].Ax y aa")
  2775     apply(erule conjE)+
  2869 apply(simp add: alpha)
  2776     apply(generate_fresh "coname")
  2870 apply(erule disjE)
  2777     apply(simp add: abs_fresh fresh_prod fresh_atm)
  2871 apply(simp)
  2778     apply(auto)[1]
  2872 apply(simp)
  2779     apply(drule_tac c="c" in  alpha_coname)
  2873 apply(simp add: rename_fresh)
  2780      apply(simp add: fresh_prod fresh_atm abs_fresh)
  2874 apply(rule disjI2)
  2781     apply(simp add: calc_atm)
  2875 apply(rule disjI2)
  2782     apply(rule exI)+
  2876 apply(rule disjI1)
  2783     apply(rule conjI)
  2877 (* not case *)
  2784      apply(rule refl)
  2878 apply(simp add: trm.inject)
  2785     apply(generate_fresh "name")
  2879 apply(erule conjE)+
  2786     apply(simp add: calc_atm abs_fresh fresh_prod fresh_atm fresh_left)
  2880 apply(generate_fresh "coname")
  2787     apply(auto)[1]
  2881 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2788     apply(drule_tac z="ca" in  alpha_name)
  2882 apply(auto)[1]
  2789      apply(simp add: fresh_prod fresh_atm abs_fresh)
  2883 apply(drule_tac c="c" in  alpha_coname)
  2790     apply(simp add: calc_atm)
  2884 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2791     apply(rule exI)+
  2885 apply(simp add: calc_atm)
  2792     apply(rule conjI)
  2886 apply(rule exI)+
  2793      apply(rule refl)
  2887 apply(rule conjI)
  2794     apply(auto simp: calc_atm abs_fresh fresh_left)[1]
  2888 apply(rule refl)
  2795     using nrename_fresh nrename_swap apply presburger
  2889 apply(generate_fresh "name")
  2796     using crename_fresh crename_swap by presburger
  2890 apply(simp add: calc_atm abs_fresh fresh_prod fresh_atm fresh_left)
  2797 next
  2891 apply(auto)[1]
  2798   case (LAnd1 b a1 M1 a2 M2 N y x)
  2892 apply(drule_tac z="ca" in  alpha_name)
  2799   then show ?thesis
  2893 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2800     apply -
  2894 apply(simp add: calc_atm)
  2801     apply(rule disjI2)
  2895 apply(rule exI)+
  2802     apply(rule disjI2)
  2896 apply(rule conjI)
  2803     apply(rule disjI2)
  2897 apply(rule refl)
  2804     apply(rule disjI1)
  2898 apply(auto simp: calc_atm abs_fresh fresh_left)[1]
  2805     apply(clarsimp simp add: trm.inject)
  2899 apply(case_tac "y=x")
  2806     apply(generate_fresh "coname")
  2900 apply(perm_simp)
  2807     apply(clarsimp simp add: abs_fresh fresh_prod fresh_atm)
  2901 apply(perm_simp)
  2808     apply(drule_tac c="c" in  alpha_coname)
  2902 apply(case_tac "aa=a")
  2809      apply(simp add: fresh_prod fresh_atm abs_fresh)
  2903 apply(perm_simp)
  2810     apply(simp)
  2904 apply(perm_simp)
  2811     apply(rule exI)+
  2905 (* and1 case *)
  2812     apply(rule conjI)
  2906 apply(rule disjI2)
  2813      apply(rule exI)+
  2907 apply(rule disjI2)
  2814      apply(rule_tac s="a" and t="[(a,c)]\<bullet>[(b,c)]\<bullet>b" in subst)
  2908 apply(rule disjI2)
  2815       apply(simp add: calc_atm)
  2909 apply(rule disjI1)
  2816      apply(rule refl)
  2910 apply(simp add: trm.inject)
  2817     apply(generate_fresh "name")
  2911 apply(erule conjE)+
  2818     apply(simp add: abs_fresh fresh_prod fresh_atm)
  2912 apply(generate_fresh "coname")
  2819     apply(auto)[1]
  2913 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2820        apply(drule_tac z="ca" in  alpha_name)
  2914 apply(auto)[1]
  2821         apply(simp add: fresh_prod fresh_atm abs_fresh)
  2915 apply(drule_tac c="c" in  alpha_coname)
  2822        apply(simp)
  2916 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2823        apply (metis swap_simps(6))
  2917 apply(simp)
  2824       apply(generate_fresh "name")
  2918 apply(rule exI)+
  2825       apply(simp add: abs_fresh fresh_prod fresh_atm)
  2919 apply(rule conjI)
  2826       apply(auto)[1]
  2920 apply(rule exI)+
  2827       apply(drule_tac z="cb" in  alpha_name)
  2921 apply(rule_tac s="a" and t="[(a,c)]\<bullet>[(b,c)]\<bullet>b" in subst)
  2828        apply(simp add: fresh_prod fresh_atm abs_fresh)
  2922 apply(simp add: calc_atm)
  2829       apply(simp)
  2923 apply(rule refl)
  2830       apply(perm_simp)
  2924 apply(generate_fresh "name")
  2831       apply (smt (verit, del_insts) abs_fresh(1,2) abs_perm(1,2) fic.intros(3) fin.intros(3) fresh_bij(1) perm_fresh_fresh(1,2) swap_simps(1,6))
  2925 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2832      apply(perm_simp)+
  2926 apply(auto)[1]
  2833      apply(generate_fresh "name")
  2927 apply(drule_tac z="ca" in  alpha_name)
  2834      apply(simp add: abs_fresh fresh_prod fresh_atm)
  2928 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2835      apply(auto)[1]
  2929 apply(simp)
  2836      apply(drule_tac z="cb" in  alpha_name)
  2930 apply(rule exI)+
  2837       apply(simp add: fresh_prod fresh_atm abs_fresh)
  2931 apply(rule conjI)
  2838      apply(perm_simp)
  2932 apply(rule_tac s="x" and t="[(x,ca)]\<bullet>[(y,ca)]\<bullet>y" in subst)
  2839      apply (smt (verit) abs_fresh(1,2) abs_perm(1,2) fic.intros(3) fin.intros(3) perm_fresh_fresh(1,2) perm_swap(3) swap_simps(1,6))
  2933 apply(simp add: calc_atm)
  2840     apply(perm_simp)+
  2934 apply(rule refl)
  2841     apply(generate_fresh "name")
  2935 apply(auto simp: fresh_left calc_atm abs_fresh split: if_splits)[1]
  2842     apply(simp add: abs_fresh fresh_prod fresh_atm)
  2936 apply(generate_fresh "name")
  2843     apply(auto)[1]
  2937 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2844     apply(drule_tac z="cb" in  alpha_name)
  2938 apply(auto)[1]
  2845      apply(simp add: fresh_prod fresh_atm abs_fresh cong: conj_cong)
  2939 apply(drule_tac z="cb" in  alpha_name)
  2846     apply(perm_simp)
  2940 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2847     by (smt (verit, best) abs_fresh(1,2) abs_perm(1) alpha(2) fic.intros(3) fin.intros(3) fresh_bij(1,2) perm_fresh_fresh(1,2) swap_simps(2,3))
  2941 apply(simp)
  2848 next
  2942 apply(rule exI)+
  2849   case (LAnd2 b a1 M1 a2 M2 N y x)
  2943 apply(rule conjI)
  2850   then show ?thesis
  2944 apply(rule_tac s="x" and t="[(x,cb)]\<bullet>[(y,cb)]\<bullet>y" in subst)
  2851     apply -
  2945 apply(simp add: calc_atm)
  2852     apply(rule disjI2)
  2946 apply(rule refl)
  2853     apply(rule disjI2)
  2947 apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  2854     apply(rule disjI2)
  2948 apply(perm_simp)+
  2855     apply(rule disjI2)
  2949 apply(generate_fresh "name")
  2856     apply(rule disjI1)
  2950 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2857     apply(clarsimp simp add: trm.inject)
  2951 apply(auto)[1]
  2858     apply(generate_fresh "coname")
  2952 apply(drule_tac z="cb" in  alpha_name)
  2859     apply(clarsimp simp add: abs_fresh fresh_prod fresh_atm)
  2953 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2860     apply(drule_tac c="c" in  alpha_coname)
  2954 apply(simp)
  2861      apply(simp add: fresh_prod fresh_atm abs_fresh)
  2955 apply(rule exI)+
  2862     apply(simp)
  2956 apply(rule conjI)
  2863     apply(rule exI)+
  2957 apply(rule_tac s="x" and t="[(x,cb)]\<bullet>[(y,cb)]\<bullet>y" in subst)
  2864     apply(rule conjI)
  2958 apply(simp add: calc_atm)
  2865      apply(rule_tac s="a" and t="[(a,c)]\<bullet>[(b,c)]\<bullet>b" in subst)
  2959 apply(rule refl)
  2866       apply(simp add: calc_atm)
  2960 apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  2867      apply(rule refl)
  2961 apply(perm_simp)+
  2868     apply(generate_fresh "name")
  2962 apply(generate_fresh "name")
  2869     apply(auto simp add: abs_fresh fresh_prod fresh_atm)
  2963 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2870        apply(drule_tac z="ca" in  alpha_name)
  2964 apply(auto)[1]
  2871         apply(simp add: fresh_prod fresh_atm abs_fresh)
  2965 apply(drule_tac z="cb" in  alpha_name)
  2872        apply (metis swap_simps(6))
  2966 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2873       apply(generate_fresh "name")
  2967 apply(simp)
  2874       apply(simp add: abs_fresh fresh_prod fresh_atm)
  2968 apply(rule exI)+
  2875       apply(auto)[1]
  2969 apply(rule conjI)
  2876       apply(drule_tac z="cb" in  alpha_name)
  2970 apply(rule_tac s="x" and t="[(x,cb)]\<bullet>[(y,cb)]\<bullet>y" in subst)
  2877        apply(simp add: fresh_prod fresh_atm abs_fresh)
  2971 apply(simp add: calc_atm)
  2878       apply(perm_simp)
  2972 apply(rule refl)
  2879       apply (smt (verit, ccfv_threshold) abs_fresh(1,2) abs_perm(1) fic.intros(3) fin.intros(4) fresh_bij(1,2) perm_fresh_fresh(1,2) swap_simps(1,4,6))
  2973 apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  2880      apply(generate_fresh "name")
  2974 apply(perm_simp)+
  2881      apply(simp add: abs_fresh fresh_prod fresh_atm)
  2975 (* and2 case *)
  2882      apply(auto)[1]
  2976 apply(rule disjI2)
  2883      apply(drule_tac z="cb" in  alpha_name)
  2977 apply(rule disjI2)
  2884       apply(simp add: fresh_prod fresh_atm abs_fresh)
  2978 apply(rule disjI2)
  2885      apply(simp)
  2979 apply(rule disjI2)
  2886      apply(perm_simp)
  2980 apply(rule disjI1)
  2887      apply (smt (verit) abs_fresh(1,2) abs_perm(1,2) fic.intros(3) fin.intros(4) fresh_bij(1) perm_fresh_fresh(1,2) swap_simps(1,6))
  2981 apply(simp add: trm.inject)
  2888     apply(generate_fresh "name")
  2982 apply(erule conjE)+
  2889     apply(clarsimp simp add: abs_fresh fresh_prod fresh_atm)
  2983 apply(generate_fresh "coname")
  2890     apply(drule_tac z="cb" in  alpha_name)
  2984 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2891      apply(simp add: fresh_prod fresh_atm abs_fresh)
  2985 apply(auto)[1]
  2892     apply(perm_simp)
  2986 apply(drule_tac c="c" in  alpha_coname)
  2893     by (smt (verit, ccfv_SIG) abs_fresh(1,2) abs_perm(1) alpha(2) fic.intros(3) fin.intros(4) fresh_bij(1,2) perm_fresh_fresh(1,2) swap_simps(2,3))
  2987 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2894 next
  2988 apply(simp)
  2895   case (LOr1 b a M N1 N2 y x1 x2)
  2989 apply(rule exI)+
  2896   then show ?thesis
  2990 apply(rule conjI)
  2897     apply -
  2991 apply(rule_tac s="a" and t="[(a,c)]\<bullet>[(b,c)]\<bullet>b" in subst)
  2898     apply(rule disjI2)
  2992 apply(simp add: calc_atm)
  2899     apply(rule disjI2)
  2993 apply(rule refl)
  2900     apply(rule disjI2)
  2994 apply(generate_fresh "name")
  2901     apply(rule disjI2)
  2995 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2902     apply(rule disjI2)
  2996 apply(auto)[1]
  2903     apply(rule disjI1)
  2997 apply(drule_tac z="ca" in  alpha_name)
  2904     apply(clarsimp simp add: trm.inject)
  2998 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2905     apply(generate_fresh "coname")
  2999 apply(simp)
  2906     apply(simp add: abs_fresh fresh_prod fresh_atm)
  3000 apply(rule exI)+
  2907     apply(auto)[1]
  3001 apply(rule conjI)
  2908     apply(drule_tac c="c" in  alpha_coname)
  3002 apply(rule_tac s="x" and t="[(x,ca)]\<bullet>[(y,ca)]\<bullet>y" in subst)
  2909      apply(simp add: fresh_prod fresh_atm abs_fresh)
  3003 apply(simp add: calc_atm)
  2910     apply(simp)
  3004 apply(rule refl)
  2911     apply(perm_simp)
  3005 apply(auto simp: fresh_left calc_atm abs_fresh split: if_splits)[1]
  2912     apply(rule exI)+
  3006 apply(generate_fresh "name")
  2913     apply(rule conjI)
  3007 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2914      apply(rule_tac s="a" and t="[(a,c)]\<bullet>[(b,c)]\<bullet>b" in subst)
  3008 apply(auto)[1]
  2915       apply(simp add: calc_atm)
  3009 apply(drule_tac z="cb" in  alpha_name)
  2916      apply(rule refl)
  3010 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2917     apply(generate_fresh "name")
  3011 apply(simp)
  2918     apply(simp add: abs_fresh fresh_prod fresh_atm)
  3012 apply(rule exI)+
  2919     apply(auto)[1]
  3013 apply(rule conjI)
  2920      apply(drule_tac z="ca" in  alpha_name)
  3014 apply(rule_tac s="x" and t="[(x,cb)]\<bullet>[(y,cb)]\<bullet>y" in subst)
  2921       apply(simp add: fresh_prod fresh_atm abs_fresh)
  3015 apply(simp add: calc_atm)
  2922      apply(simp)
  3016 apply(rule refl)
  2923      apply(rule exI)+
  3017 apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  2924      apply(rule conjI)
  3018 apply(perm_simp)+
  2925       apply(rule exI)+
  3019 apply(generate_fresh "name")
  2926       apply(rule_tac s="x" and t="[(x,ca)]\<bullet>[(y,ca)]\<bullet>y" in subst)
  3020 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2927        apply(simp add: calc_atm)
  3021 apply(auto)[1]
  2928       apply(rule refl)
  3022 apply(drule_tac z="cb" in  alpha_name)
  2929      apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  3023 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2930         apply(perm_simp)+
  3024 apply(simp)
  2931     apply(generate_fresh "name")
  3025 apply(rule exI)+
  2932     apply(simp add: abs_fresh fresh_prod fresh_atm)
  3026 apply(rule conjI)
  2933     apply(auto)[1]
  3027 apply(rule_tac s="x" and t="[(x,cb)]\<bullet>[(y,cb)]\<bullet>y" in subst)
  2934     apply(drule_tac z="cb" in  alpha_name)
  3028 apply(simp add: calc_atm)
  2935      apply(simp add: fresh_prod fresh_atm abs_fresh)
  3029 apply(rule refl)
  2936     apply(simp)
  3030 apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  2937     apply(rule exI)+
  3031 apply(perm_simp)+
  2938     apply(rule conjI)
  3032 apply(generate_fresh "name")
  2939      apply(rule exI)+
  3033 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2940      apply(rule_tac s="x" and t="[(x,cb)]\<bullet>[(y,cb)]\<bullet>y" in subst)
  3034 apply(auto)[1]
  2941       apply(simp add: calc_atm)
  3035 apply(drule_tac z="cb" in  alpha_name)
  2942      apply(rule refl)
  3036 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2943     apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  3037 apply(simp)
  2944      apply(perm_simp)+
  3038 apply(rule exI)+
  2945     done
  3039 apply(rule conjI)
  2946 next
  3040 apply(rule_tac s="x" and t="[(x,cb)]\<bullet>[(y,cb)]\<bullet>y" in subst)
  2947   case (LOr2 b a M N1 N2 y x1 x2)
  3041 apply(simp add: calc_atm)
  2948   then show ?thesis
  3042 apply(rule refl)
  2949     apply -
  3043 apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  2950     apply(rule disjI2)
  3044 apply(perm_simp)+
  2951     apply(rule disjI2)
  3045 (* or1 case *)
  2952     apply(rule disjI2)
  3046 apply(rule disjI2)
  2953     apply(rule disjI2)
  3047 apply(rule disjI2)
  2954     apply(rule disjI2)
  3048 apply(rule disjI2)
  2955     apply(rule disjI2)
  3049 apply(rule disjI2)
  2956     apply(rule disjI1)
  3050 apply(rule disjI2)
  2957     apply(simp add: trm.inject)
  3051 apply(rule disjI1)
  2958     apply(erule conjE)+
  3052 apply(simp add: trm.inject)
  2959     apply(generate_fresh "coname")
  3053 apply(erule conjE)+
  2960     apply(simp add: abs_fresh fresh_prod fresh_atm)
  3054 apply(generate_fresh "coname")
  2961     apply(auto)[1]
  3055 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2962     apply(drule_tac c="c" in  alpha_coname)
  3056 apply(auto)[1]
  2963      apply(simp add: fresh_prod fresh_atm abs_fresh)
  3057 apply(drule_tac c="c" in  alpha_coname)
  2964     apply(simp)
  3058 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2965      apply(perm_simp)
  3059 apply(simp)
  2966     apply(rule exI)+
  3060 apply(rule exI)+
  2967     apply(rule conjI)
  3061 apply(rule conjI)
  2968      apply(rule_tac s="a" and t="[(a,c)]\<bullet>[(b,c)]\<bullet>b" in subst)
  3062 apply(rule_tac s="a" and t="[(a,c)]\<bullet>[(b,c)]\<bullet>b" in subst)
  2969       apply(simp add: calc_atm)
  3063 apply(simp add: calc_atm)
  2970      apply(rule refl)
  3064 apply(rule refl)
  2971      apply(generate_fresh "name")
  3065 apply(generate_fresh "name")
  2972      apply(simp add: abs_fresh fresh_prod fresh_atm)
  3066 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2973      apply(auto)[1]
  3067 apply(auto)[1]
  2974       apply(drule_tac z="ca" in  alpha_name)
  3068 apply(drule_tac z="ca" in  alpha_name)
  2975        apply(simp add: fresh_prod fresh_atm abs_fresh)
  3069 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2976       apply(simp)
  3070 apply(simp)
  2977       apply(rule exI)+
  3071 apply(rule exI)+
  2978       apply(rule conjI)
  3072 apply(rule conjI)
  2979       apply(rule_tac s="x" and t="[(x,ca)]\<bullet>[(y,ca)]\<bullet>y" in subst)
  3073 apply(rule exI)+
  2980        apply(simp add: calc_atm)
  3074 apply(rule_tac s="x" and t="[(x,ca)]\<bullet>[(y,ca)]\<bullet>y" in subst)
  2981       apply(rule refl)
  3075 apply(simp add: calc_atm)
  2982       apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  3076 apply(rule refl)
  2983      apply(perm_simp)+
  3077 apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  2984      apply(generate_fresh "name")
  3078 apply(perm_simp)+
  2985      apply(simp add: abs_fresh fresh_prod fresh_atm)
  3079 apply(generate_fresh "name")
  2986      apply(auto)[1]
  3080 apply(simp add: abs_fresh fresh_prod fresh_atm)
  2987      apply(drule_tac z="cb" in  alpha_name)
  3081 apply(auto)[1]
  2988       apply(simp add: fresh_prod fresh_atm abs_fresh)
  3082 apply(drule_tac z="cb" in  alpha_name)
  2989      apply(simp)
  3083 apply(simp add: fresh_prod fresh_atm abs_fresh)
  2990      apply(rule exI)+
  3084 apply(simp)
  2991      apply(rule conjI)
  3085 apply(rule exI)+
  2992      apply(rule_tac s="x" and t="[(x,cb)]\<bullet>[(y,cb)]\<bullet>y" in subst)
  3086 apply(rule conjI)
  2993       apply(simp add: calc_atm)
  3087 apply(rule exI)+
  2994      apply(rule refl)
  3088 apply(rule_tac s="x" and t="[(x,cb)]\<bullet>[(y,cb)]\<bullet>y" in subst)
  2995      apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  3089 apply(simp add: calc_atm)
  2996        apply(perm_simp)+
  3090 apply(rule refl)
  2997     done
  3091 apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  2998 next
  3092 apply(perm_simp)+
  2999   case (LImp z N y P x M b a c)
  3093 (* or2 case *)
  3000   then show ?thesis
  3094 apply(rule disjI2)
  3001     apply(intro disjI2)
  3095 apply(rule disjI2)
  3002     apply(clarsimp simp add: trm.inject)
  3096 apply(rule disjI2)
  3003     apply(generate_fresh "coname")
  3097 apply(rule disjI2)
  3004     apply(clarsimp simp add: abs_fresh fresh_prod fresh_atm)
  3098 apply(rule disjI2)
  3005     apply(drule_tac c="ca" in  alpha_coname)
  3099 apply(rule disjI2)
  3006      apply(simp add: fresh_prod fresh_atm abs_fresh)
  3100 apply(rule disjI1)
  3007     apply(simp)
  3101 apply(simp add: trm.inject)
  3008     apply(perm_simp)
  3102 apply(erule conjE)+
  3009     apply(rule exI)+
  3103 apply(generate_fresh "coname")
  3010     apply(rule conjI)
  3104 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3011      apply(rule_tac s="a" and t="[(a,ca)]\<bullet>[(b,ca)]\<bullet>b" in subst)
  3105 apply(auto)[1]
  3012       apply(simp add: calc_atm)
  3106 apply(drule_tac c="c" in  alpha_coname)
  3013      apply(rule refl)
  3107 apply(simp add: fresh_prod fresh_atm abs_fresh)
  3014     apply(generate_fresh "name")
  3108 apply(simp)
  3015     apply(simp add: abs_fresh fresh_prod fresh_atm)
  3109 apply(rule exI)+
  3016     apply(auto)[1]
  3110 apply(rule conjI)
  3017      apply(drule_tac z="caa" in  alpha_name)
  3111 apply(rule_tac s="a" and t="[(a,c)]\<bullet>[(b,c)]\<bullet>b" in subst)
  3018       apply(simp add: fresh_prod fresh_atm abs_fresh)
  3112 apply(simp add: calc_atm)
  3019      apply(simp)
  3113 apply(rule refl)
  3020      apply(perm_simp)
  3114 apply(generate_fresh "name")
  3021      apply(rule exI)+
  3115 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3022      apply(rule conjI)
  3116 apply(auto)[1]
  3023       apply(rule_tac s="x" and t="[(x,caa)]\<bullet>[(z,caa)]\<bullet>z" in subst)
  3117 apply(drule_tac z="ca" in  alpha_name)
  3024        apply(simp add: calc_atm)
  3118 apply(simp add: fresh_prod fresh_atm abs_fresh)
  3025       apply(rule refl)
  3119 apply(simp)
  3026      apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  3120 apply(rule exI)+
  3027        apply(perm_simp)+
  3121 apply(rule conjI)
  3028     apply(generate_fresh "name")
  3122 apply(rule_tac s="x" and t="[(x,ca)]\<bullet>[(y,ca)]\<bullet>y" in subst)
  3029     apply(simp add: abs_fresh fresh_prod fresh_atm)
  3123 apply(simp add: calc_atm)
  3030     apply(auto)[1]
  3124 apply(rule refl)
  3031     apply(drule_tac z="cb" in  alpha_name)
  3125 apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  3032      apply(simp add: fresh_prod fresh_atm abs_fresh)
  3126 apply(perm_simp)+
  3033     apply(simp)
  3127 apply(generate_fresh "name")
  3034     apply(perm_simp)
  3128 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3035     apply(rule exI)+
  3129 apply(auto)[1]
  3036     apply(rule conjI)
  3130 apply(drule_tac z="cb" in  alpha_name)
  3037      apply(rule_tac s="x" and t="[(x,cb)]\<bullet>[(z,cb)]\<bullet>z" in subst)
  3131 apply(simp add: fresh_prod fresh_atm abs_fresh)
  3038       apply(simp add: calc_atm)
  3132 apply(simp)
  3039      apply(rule refl)
  3133 apply(rule exI)+
  3040     apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
  3134 apply(rule conjI)
  3041      apply(perm_simp)+
  3135 apply(rule_tac s="x" and t="[(x,cb)]\<bullet>[(y,cb)]\<bullet>y" in subst)
  3042     done
  3136 apply(simp add: calc_atm)
  3043 qed
  3137 apply(rule refl)
  3044 
  3138 apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
       
  3139 apply(perm_simp)+
       
  3140 (* imp-case *)
       
  3141 apply(rule disjI2)
       
  3142 apply(rule disjI2)
       
  3143 apply(rule disjI2)
       
  3144 apply(rule disjI2)
       
  3145 apply(rule disjI2)
       
  3146 apply(rule disjI2)
       
  3147 apply(rule disjI2)
       
  3148 apply(simp add: trm.inject)
       
  3149 apply(erule conjE)+
       
  3150 apply(generate_fresh "coname")
       
  3151 apply(simp add: abs_fresh fresh_prod fresh_atm)
       
  3152 apply(auto)[1]
       
  3153 apply(drule_tac c="ca" in  alpha_coname)
       
  3154 apply(simp add: fresh_prod fresh_atm abs_fresh)
       
  3155 apply(simp)
       
  3156 apply(rule exI)+
       
  3157 apply(rule conjI)
       
  3158 apply(rule_tac s="a" and t="[(a,ca)]\<bullet>[(b,ca)]\<bullet>b" in subst)
       
  3159 apply(simp add: calc_atm)
       
  3160 apply(rule refl)
       
  3161 apply(generate_fresh "name")
       
  3162 apply(simp add: abs_fresh fresh_prod fresh_atm)
       
  3163 apply(auto)[1]
       
  3164 apply(drule_tac z="cb" in  alpha_name)
       
  3165 apply(simp add: fresh_prod fresh_atm abs_fresh)
       
  3166 apply(simp)
       
  3167 apply(rule exI)+
       
  3168 apply(rule conjI)
       
  3169 apply(rule_tac s="x" and t="[(x,cb)]\<bullet>[(z,cb)]\<bullet>z" in subst)
       
  3170 apply(simp add: calc_atm)
       
  3171 apply(rule refl)
       
  3172 apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
       
  3173 apply(perm_simp)+
       
  3174 apply(generate_fresh "name")
       
  3175 apply(simp add: abs_fresh fresh_prod fresh_atm)
       
  3176 apply(auto)[1]
       
  3177 apply(drule_tac z="cc" in  alpha_name)
       
  3178 apply(simp add: fresh_prod fresh_atm abs_fresh)
       
  3179 apply(simp)
       
  3180 apply(rule exI)+
       
  3181 apply(rule conjI)
       
  3182 apply(rule_tac s="x" and t="[(x,cc)]\<bullet>[(z,cc)]\<bullet>z" in subst)
       
  3183 apply(simp add: calc_atm)
       
  3184 apply(rule refl)
       
  3185 apply(auto simp: fresh_left calc_atm abs_fresh alpha perm_fresh_fresh split: if_splits)[1]
       
  3186 apply(perm_simp)+
       
  3187 done
       
  3188 
  3045 
  3189 inductive
  3046 inductive
  3190   c_redu :: "trm \<Rightarrow> trm \<Rightarrow> bool" ("_ \<longrightarrow>\<^sub>c _" [100,100] 100)
  3047   c_redu :: "trm \<Rightarrow> trm \<Rightarrow> bool" ("_ \<longrightarrow>\<^sub>c _" [100,100] 100)
  3191 where
  3048 where
  3192   left[intro]:  "\<lbrakk>\<not>fic M a; a\<sharp>N; x\<sharp>M\<rbrakk> \<Longrightarrow> Cut <a>.M (x).N \<longrightarrow>\<^sub>c M{a:=(x).N}"
  3049   left[intro]:  "\<lbrakk>\<not>fic M a; a\<sharp>N; x\<sharp>M\<rbrakk> \<Longrightarrow> Cut <a>.M (x).N \<longrightarrow>\<^sub>c M{a:=(x).N}"
  3635 done
  3492 done
  3636 
  3493 
  3637 lemma a_redu_AndL1_elim:
  3494 lemma a_redu_AndL1_elim:
  3638   assumes a: "AndL1 (x).M y \<longrightarrow>\<^sub>a R"
  3495   assumes a: "AndL1 (x).M y \<longrightarrow>\<^sub>a R"
  3639   shows "\<exists>M'. R = AndL1 (x).M' y \<and> M\<longrightarrow>\<^sub>aM'"
  3496   shows "\<exists>M'. R = AndL1 (x).M' y \<and> M\<longrightarrow>\<^sub>aM'"
  3640 using a [[simproc del: defined_all]]
  3497   using a
  3641 apply(erule_tac a_redu.cases, simp_all add: trm.inject)
  3498   apply(erule_tac a_redu.cases, simp_all add: trm.inject)
  3642 apply(erule_tac l_redu.cases, simp_all add: trm.inject)
  3499     apply(erule_tac l_redu.cases, simp_all add: trm.inject)
  3643 apply(erule_tac c_redu.cases, simp_all add: trm.inject)
  3500    apply(erule_tac c_redu.cases, simp_all add: trm.inject)
  3644 apply(auto)
  3501   by (metis a_NotR a_redu_NotR_elim trm.inject(3))
  3645 apply(rotate_tac 3)
       
  3646 apply(erule_tac a_redu.cases, simp_all add: trm.inject)
       
  3647 apply(erule_tac l_redu.cases, simp_all add: trm.inject)
       
  3648 apply(erule_tac c_redu.cases, simp_all add: trm.inject)
       
  3649 apply(auto simp: alpha a_redu.eqvt)
       
  3650 apply(rule_tac x="([(x,xa)]\<bullet>M'a)" in exI)
       
  3651 apply(auto simp: fresh_left alpha a_redu.eqvt calc_atm fresh_a_redu)
       
  3652 apply(simp add: perm_swap)
       
  3653 apply(rule_tac x="([(x,xaa)]\<bullet>M'a)" in exI)
       
  3654 apply(auto simp: fresh_left alpha a_redu.eqvt calc_atm fresh_a_redu)
       
  3655 apply(simp add: perm_swap)
       
  3656 done
       
  3657 
  3502 
  3658 lemma a_redu_AndL2_elim:
  3503 lemma a_redu_AndL2_elim:
  3659   assumes a: "AndL2 (x).M y \<longrightarrow>\<^sub>a R"
  3504   assumes a: "AndL2 (x).M y \<longrightarrow>\<^sub>a R"
  3660   shows "\<exists>M'. R = AndL2 (x).M' y \<and> M\<longrightarrow>\<^sub>aM'"
  3505   shows "\<exists>M'. R = AndL2 (x).M' y \<and> M\<longrightarrow>\<^sub>aM'"
  3661 using a [[simproc del: defined_all]]
  3506   using a
  3662 apply(erule_tac a_redu.cases, simp_all add: trm.inject)
  3507   apply(erule_tac a_redu.cases, simp_all add: trm.inject)
  3663 apply(erule_tac l_redu.cases, simp_all add: trm.inject)
  3508     apply(erule_tac l_redu.cases, simp_all add: trm.inject)
  3664 apply(erule_tac c_redu.cases, simp_all add: trm.inject)
  3509    apply(erule_tac c_redu.cases, simp_all add: trm.inject)
  3665 apply(auto)
  3510   by (metis a_NotR a_redu_NotR_elim trm.inject(3))
  3666 apply(rotate_tac 3)
       
  3667 apply(erule_tac a_redu.cases, simp_all add: trm.inject)
       
  3668 apply(erule_tac l_redu.cases, simp_all add: trm.inject)
       
  3669 apply(erule_tac c_redu.cases, simp_all add: trm.inject)
       
  3670 apply(auto simp: alpha a_redu.eqvt)
       
  3671 apply(rule_tac x="([(x,xa)]\<bullet>M'a)" in exI)
       
  3672 apply(auto simp: fresh_left alpha a_redu.eqvt calc_atm fresh_a_redu)
       
  3673 apply(simp add: perm_swap)
       
  3674 apply(rule_tac x="([(x,xaa)]\<bullet>M'a)" in exI)
       
  3675 apply(auto simp: fresh_left alpha a_redu.eqvt calc_atm fresh_a_redu)
       
  3676 apply(simp add: perm_swap)
       
  3677 done
       
  3678 
  3511 
  3679 lemma a_redu_OrL_elim:
  3512 lemma a_redu_OrL_elim:
  3680   assumes a: "OrL (x).M (y).N z\<longrightarrow>\<^sub>a R"
  3513   assumes a: "OrL (x).M (y).N z\<longrightarrow>\<^sub>a R"
  3681   shows "(\<exists>M'. R = OrL (x).M' (y).N z \<and> M\<longrightarrow>\<^sub>aM') \<or> (\<exists>N'. R = OrL (x).M (y).N' z \<and> N\<longrightarrow>\<^sub>aN')"
  3514   shows "(\<exists>M'. R = OrL (x).M' (y).N z \<and> M\<longrightarrow>\<^sub>aM') \<or> (\<exists>N'. R = OrL (x).M (y).N' z \<and> N\<longrightarrow>\<^sub>aN')"
  3682 using a [[simproc del: defined_all]]
  3515 using a [[simproc del: defined_all]]
  3956 abbreviation
  3789 abbreviation
  3957  a_star_redu :: "trm \<Rightarrow> trm \<Rightarrow> bool" ("_ \<longrightarrow>\<^sub>a* _" [100,100] 100)
  3790  a_star_redu :: "trm \<Rightarrow> trm \<Rightarrow> bool" ("_ \<longrightarrow>\<^sub>a* _" [100,100] 100)
  3958 where
  3791 where
  3959   "M \<longrightarrow>\<^sub>a* M' \<equiv> (a_redu)\<^sup>*\<^sup>* M M'"
  3792   "M \<longrightarrow>\<^sub>a* M' \<equiv> (a_redu)\<^sup>*\<^sup>* M M'"
  3960 
  3793 
  3961 lemma a_starI:
  3794 lemmas a_starI = r_into_rtranclp
  3962   assumes a: "M \<longrightarrow>\<^sub>a M'"
       
  3963   shows "M \<longrightarrow>\<^sub>a* M'"
       
  3964 using a by blast
       
  3965 
  3795 
  3966 lemma a_starE:
  3796 lemma a_starE:
  3967   assumes a: "M \<longrightarrow>\<^sub>a* M'"
  3797   assumes a: "M \<longrightarrow>\<^sub>a* M'"
  3968   shows "M = M' \<or> (\<exists>N. M \<longrightarrow>\<^sub>a N \<and> N \<longrightarrow>\<^sub>a* M')"
  3798   shows "M = M' \<or> (\<exists>N. M \<longrightarrow>\<^sub>a N \<and> N \<longrightarrow>\<^sub>a* M')"
  3969 using a 
  3799   using a  by (induct) (auto)
  3970 by (induct) (auto)
       
  3971 
  3800 
  3972 lemma a_star_refl:
  3801 lemma a_star_refl:
  3973   shows "M \<longrightarrow>\<^sub>a* M"
  3802   shows "M \<longrightarrow>\<^sub>a* M"
  3974   by blast
  3803   by blast
  3975 
  3804 
  3976 lemma a_star_trans[trans]:
  3805 declare rtranclp_trans [trans]
  3977   assumes a1: "M1\<longrightarrow>\<^sub>a* M2"
       
  3978   and     a2: "M2\<longrightarrow>\<^sub>a* M3"
       
  3979   shows "M1 \<longrightarrow>\<^sub>a* M3"
       
  3980 using a2 a1
       
  3981 by (induct) (auto)
       
  3982 
  3806 
  3983 text \<open>congruence rules for \<open>\<longrightarrow>\<^sub>a*\<close>\<close>
  3807 text \<open>congruence rules for \<open>\<longrightarrow>\<^sub>a*\<close>\<close>
  3984 
  3808 
  3985 lemma ax_do_not_a_star_reduce:
  3809 lemma ax_do_not_a_star_reduce:
  3986   shows "Ax x a \<longrightarrow>\<^sub>a* M \<Longrightarrow> M = Ax x a"
  3810   shows "Ax x a \<longrightarrow>\<^sub>a* M \<Longrightarrow> M = Ax x a"
  3987 apply(induct set: rtranclp)
  3811   using a_starE ax_do_not_a_reduce by blast
  3988 apply(auto)
       
  3989 apply(drule  ax_do_not_a_reduce)
       
  3990 apply(simp)
       
  3991 done
       
  3992 
  3812 
  3993 
  3813 
  3994 lemma a_star_CutL:
  3814 lemma a_star_CutL:
  3995     "M \<longrightarrow>\<^sub>a* M' \<Longrightarrow> Cut <a>.M (x).N \<longrightarrow>\<^sub>a* Cut <a>.M' (x).N"
  3815     "M \<longrightarrow>\<^sub>a* M' \<Longrightarrow> Cut <a>.M (x).N \<longrightarrow>\<^sub>a* Cut <a>.M' (x).N"
  3996 by (induct set: rtranclp) (blast intro: rtranclp.rtrancl_into_rtrancl)+
  3816 by (induct set: rtranclp) (blast intro: rtranclp.rtrancl_into_rtrancl)+