src/HOL/Tools/BNF/bnf_lfp_countable.ML
changeset 64705 7596b0736ab9
parent 64627 8d7cb22482e3
child 69593 3dda49e08b9d
equal deleted inserted replaced
64704:08c2d80428ff 64705:7596b0736ab9
    25 
    25 
    26 fun nchotomy_tac ctxt nchotomy =
    26 fun nchotomy_tac ctxt nchotomy =
    27   HEADGOAL (resolve_tac ctxt [nchotomy RS @{thm all_reg[rotated]}] THEN'
    27   HEADGOAL (resolve_tac ctxt [nchotomy RS @{thm all_reg[rotated]}] THEN'
    28     REPEAT_ALL_NEW (resolve_tac ctxt [allI, impI] ORELSE' eresolve_tac ctxt [exE, disjE]));
    28     REPEAT_ALL_NEW (resolve_tac ctxt [allI, impI] ORELSE' eresolve_tac ctxt [exE, disjE]));
    29 
    29 
    30 fun meta_spec_mp_tac ctxt 0 = K all_tac
    30 fun meta_spec_mp_tac _ 0 = K all_tac
    31   | meta_spec_mp_tac ctxt depth =
    31   | meta_spec_mp_tac ctxt depth =
    32     dtac ctxt meta_spec THEN' meta_spec_mp_tac ctxt (depth - 1) THEN'
    32     dtac ctxt meta_spec THEN' meta_spec_mp_tac ctxt (depth - 1) THEN'
    33     dtac ctxt meta_mp THEN' assume_tac ctxt;
    33     dtac ctxt meta_mp THEN' assume_tac ctxt;
    34 
    34 
    35 fun use_induction_hypothesis_tac ctxt =
    35 fun use_induction_hypothesis_tac ctxt =
   125   end;
   125   end;
   126 
   126 
   127 fun derive_encode_injectives_thms _ [] = []
   127 fun derive_encode_injectives_thms _ [] = []
   128   | derive_encode_injectives_thms ctxt fpT_names0 =
   128   | derive_encode_injectives_thms ctxt fpT_names0 =
   129     let
   129     let
   130       fun not_datatype s = error (quote s ^ " is not a datatype");
   130       fun not_datatype_name s =
       
   131         error (quote s ^ " is not a datatype");
   131       fun not_mutually_recursive ss = error (commas ss ^ " are not mutually recursive datatypes");
   132       fun not_mutually_recursive ss = error (commas ss ^ " are not mutually recursive datatypes");
   132 
   133 
   133       fun lfp_sugar_of s =
   134       fun lfp_sugar_of s =
   134         (case fp_sugar_of ctxt s of
   135         (case fp_sugar_of ctxt s of
   135           SOME (fp_sugar as {fp = Least_FP, fp_co_induct_sugar = SOME _, ...}) => fp_sugar
   136           SOME (fp_sugar as {fp = Least_FP, fp_co_induct_sugar = SOME _, ...}) => fp_sugar
   136         | _ => not_datatype s);
   137         | _ => not_datatype_name s);
   137 
   138 
   138       val fpTs0 as Type (_, var_As) :: _ =
   139       val fpTs0 as Type (_, var_As) :: _ =
   139         map (#T o lfp_sugar_of o fst o dest_Type) (#Ts (#fp_res (lfp_sugar_of (hd fpT_names0))));
   140         map (#T o lfp_sugar_of o fst o dest_Type) (#Ts (#fp_res (lfp_sugar_of (hd fpT_names0))));
   140       val fpT_names = map (fst o dest_Type) fpTs0;
   141       val fpT_names = map (fst o dest_Type) fpTs0;
   141 
   142