src/HOL/Lambda/Eta.ML
changeset 5146 1ea751ae62b2
parent 5117 7b5efef2ca74
child 5184 9b8547a9496a
equal deleted inserted replaced
5145:963aff0818c2 5146:1ea751ae62b2
    12 open Eta;
    12 open Eta;
    13 
    13 
    14 Addsimps eta.intrs;
    14 Addsimps eta.intrs;
    15 
    15 
    16 val eta_cases = map (eta.mk_cases dB.simps)
    16 val eta_cases = map (eta.mk_cases dB.simps)
    17     ["Abs s -e> z","s @ t -e> u","Var i -e> t"];
    17     ["Abs s -e> z","s $ t -e> u","Var i -e> t"];
    18 
    18 
    19 val beta_cases = map (beta.mk_cases dB.simps)
    19 val beta_cases = map (beta.mk_cases dB.simps)
    20     ["s @ t -> u","Var i -> t"];
    20     ["s $ t -> u","Var i -> t"];
    21 
    21 
    22 AddIs eta.intrs;
    22 AddIs eta.intrs;
    23 AddSEs (beta_cases@eta_cases);
    23 AddSEs (beta_cases@eta_cases);
    24 
    24 
    25 section "eta, subst and free";
    25 section "eta, subst and free";
    92 Goal "s -e>> s' ==> Abs s -e>> Abs s'";
    92 Goal "s -e>> s' ==> Abs s -e>> Abs s'";
    93 by (etac rtrancl_induct 1);
    93 by (etac rtrancl_induct 1);
    94 by (ALLGOALS(blast_tac (claset() addIs [rtrancl_refl,rtrancl_into_rtrancl])));
    94 by (ALLGOALS(blast_tac (claset() addIs [rtrancl_refl,rtrancl_into_rtrancl])));
    95 qed "rtrancl_eta_Abs";
    95 qed "rtrancl_eta_Abs";
    96 
    96 
    97 Goal "s -e>> s' ==> s @ t -e>> s' @ t";
    97 Goal "s -e>> s' ==> s $ t -e>> s' $ t";
    98 by (etac rtrancl_induct 1);
    98 by (etac rtrancl_induct 1);
    99 by (ALLGOALS(blast_tac (claset() addIs [rtrancl_refl,rtrancl_into_rtrancl])));
    99 by (ALLGOALS(blast_tac (claset() addIs [rtrancl_refl,rtrancl_into_rtrancl])));
   100 qed "rtrancl_eta_AppL";
   100 qed "rtrancl_eta_AppL";
   101 
   101 
   102 Goal "t -e>> t' ==> s @ t -e>> s @ t'";
   102 Goal "t -e>> t' ==> s $ t -e>> s $ t'";
   103 by (etac rtrancl_induct 1);
   103 by (etac rtrancl_induct 1);
   104 by (ALLGOALS(blast_tac (claset() addIs [rtrancl_refl,rtrancl_into_rtrancl])));
   104 by (ALLGOALS(blast_tac (claset() addIs [rtrancl_refl,rtrancl_into_rtrancl])));
   105 qed "rtrancl_eta_AppR";
   105 qed "rtrancl_eta_AppR";
   106 
   106 
   107 Goal "[| s -e>> s'; t -e>> t' |] ==> s @ t -e>> s' @ t'";
   107 Goal "[| s -e>> s'; t -e>> t' |] ==> s $ t -e>> s' $ t'";
   108 by (blast_tac (claset() addSIs [rtrancl_eta_AppL, rtrancl_eta_AppR]
   108 by (blast_tac (claset() addSIs [rtrancl_eta_AppL, rtrancl_eta_AppR]
   109                        addIs [rtrancl_trans]) 1);
   109                        addIs [rtrancl_trans]) 1);
   110 qed "rtrancl_eta_App";
   110 qed "rtrancl_eta_App";
   111 
   111 
   112 section "Commutation of -> and -e>";
   112 section "Commutation of -> and -e>";
   161 Goal "confluent(beta Un eta)";
   161 Goal "confluent(beta Un eta)";
   162 by (REPEAT(ares_tac [square_rtrancl_reflcl_commute,confluent_Un,
   162 by (REPEAT(ares_tac [square_rtrancl_reflcl_commute,confluent_Un,
   163                     beta_confluent,eta_confluent,square_beta_eta] 1));
   163                     beta_confluent,eta_confluent,square_beta_eta] 1));
   164 qed "confluent_beta_eta";
   164 qed "confluent_beta_eta";
   165 
   165 
   166 section "Implicit definition of -e>: Abs(lift s 0 @ Var 0) -e> s";
   166 section "Implicit definition of -e>: Abs(lift s 0 $ Var 0) -e> s";
   167 
   167 
   168 Goal "!i. (~free s i) = (? t. s = lift t i)";
   168 Goal "!i. (~free s i) = (? t. s = lift t i)";
   169 by (dB.induct_tac "s" 1);
   169 by (dB.induct_tac "s" 1);
   170   by (Simp_tac 1);
   170   by (Simp_tac 1);
   171   by (SELECT_GOAL(safe_tac HOL_cs)1);
   171   by (SELECT_GOAL(safe_tac HOL_cs)1);
   187  by (etac thin_rl 1);
   187  by (etac thin_rl 1);
   188  by (rtac allI 1);
   188  by (rtac allI 1);
   189  by (rtac iffI 1);
   189  by (rtac iffI 1);
   190   by (REPEAT(eresolve_tac [conjE,exE] 1));
   190   by (REPEAT(eresolve_tac [conjE,exE] 1));
   191   by (rename_tac "u1 u2" 1);
   191   by (rename_tac "u1 u2" 1);
   192   by (res_inst_tac [("x","u1@u2")] exI 1);
   192   by (res_inst_tac [("x","u1$u2")] exI 1);
   193   by (Asm_simp_tac 1);
   193   by (Asm_simp_tac 1);
   194  by (etac exE 1);
   194  by (etac exE 1);
   195  by (etac rev_mp 1);
   195  by (etac rev_mp 1);
   196  by (res_inst_tac [("dB","t")] dB_case_distinction 1);
   196  by (res_inst_tac [("dB","t")] dB_case_distinction 1);
   197    by (Simp_tac 1);
   197    by (Simp_tac 1);
   212  by (Simp_tac 1);
   212  by (Simp_tac 1);
   213 by (Simp_tac 1);
   213 by (Simp_tac 1);
   214 by (Blast_tac 1);
   214 by (Blast_tac 1);
   215 qed_spec_mp "not_free_iff_lifted";
   215 qed_spec_mp "not_free_iff_lifted";
   216 
   216 
   217 Goal "(!s u. (~free s 0) --> R(Abs(s @ Var 0))(s[u/0])) = \
   217 Goal "(!s u. (~free s 0) --> R(Abs(s $ Var 0))(s[u/0])) = \
   218 \     (!s. R(Abs(lift s 0 @ Var 0))(s))";
   218 \     (!s. R(Abs(lift s 0 $ Var 0))(s))";
   219 by (fast_tac (HOL_cs addss (simpset() addsimps [not_free_iff_lifted])) 1);
   219 by (fast_tac (HOL_cs addss (simpset() addsimps [not_free_iff_lifted])) 1);
   220 qed "explicit_is_implicit";
   220 qed "explicit_is_implicit";