src/ZF/intr_elim.ML
changeset 726 d703d1a1a2af
parent 652 ff4d4d7fcb7f
child 909 5de21942d046
equal deleted inserted replaced
725:d9c629fbacc6 726:d703d1a1a2af
    17 
    17 
    18 (*internal items*)
    18 (*internal items*)
    19 signature INDUCTIVE_I =
    19 signature INDUCTIVE_I =
    20   sig
    20   sig
    21   val rec_tms    : term list		(*the recursive sets*)
    21   val rec_tms    : term list		(*the recursive sets*)
    22   val domts      : term list		(*their domains*)
    22   val dom_sum    : term			(*their common domain*)
    23   val intr_tms   : term list		(*terms for the introduction rules*)
    23   val intr_tms   : term list		(*terms for the introduction rules*)
    24   end;
    24   end;
    25 
    25 
    26 signature INTR_ELIM =
    26 signature INTR_ELIM =
    27   sig
    27   sig
    73        [rtac (Collect_subset RS bnd_monoI) 1,
    73        [rtac (Collect_subset RS bnd_monoI) 1,
    74 	REPEAT (ares_tac (basic_monos @ monos) 1)]);
    74 	REPEAT (ares_tac (basic_monos @ monos) 1)]);
    75 
    75 
    76 val dom_subset = standard (big_rec_def RS Fp.subs);
    76 val dom_subset = standard (big_rec_def RS Fp.subs);
    77 
    77 
    78 val unfold = standard (bnd_mono RS (big_rec_def RS Fp.Tarski));
    78 val unfold = standard ([big_rec_def, bnd_mono] MRS Fp.Tarski);
    79 
    79 
    80 (********)
    80 (********)
    81 val _ = writeln "  Proving the introduction rules...";
    81 val _ = writeln "  Proving the introduction rules...";
    82 
    82 
    83 (*Mutual recursion: Needs subset rules for the individual sets???*)
    83 (*Mutual recursion?  Helps to derive subset rules for the individual sets.*)
    84 val rec_typechecks = [dom_subset] RL (asm_rl::monos) RL [subsetD];
    84 val Part_trans =
       
    85     case rec_names of
       
    86          [_] => asm_rl
       
    87        | _   => standard (Part_subset RS subset_trans);
       
    88 
       
    89 (*To type-check recursive occurrences of the inductive sets, possibly
       
    90   enclosed in some monotonic operator M.*)
       
    91 val rec_typechecks = 
       
    92    [dom_subset] RL (asm_rl :: ([Part_trans] RL monos)) RL [subsetD];
    85 
    93 
    86 (*Type-checking is hardest aspect of proof;
    94 (*Type-checking is hardest aspect of proof;
    87   disjIn selects the correct disjunct after unfolding*)
    95   disjIn selects the correct disjunct after unfolding*)
    88 fun intro_tacsf disjIn prems = 
    96 fun intro_tacsf disjIn prems = 
    89   [(*insert prems and underlying sets*)
    97   [(*insert prems and underlying sets*)
    90    cut_facts_tac prems 1,
    98    cut_facts_tac prems 1,
    91    rtac (unfold RS ssubst) 1,
    99    DETERM (rtac (unfold RS ssubst) 1),
    92    REPEAT (resolve_tac [Part_eqI,CollectI] 1),
   100    REPEAT (resolve_tac [Part_eqI,CollectI] 1),
    93    (*Now 2-3 subgoals: typechecking, the disjunction, perhaps equality.*)
   101    (*Now 2-3 subgoals: typechecking, the disjunction, perhaps equality.*)
    94    rtac disjIn 2,
   102    rtac disjIn 2,
    95    (*Not ares_tac, since refl must be tried before any equality assumptions;
   103    (*Not ares_tac, since refl must be tried before any equality assumptions;
    96      backtracking may occur if the premises have extra variables!*)
   104      backtracking may occur if the premises have extra variables!*)
   132 
   140 
   133 (*Breaks down logical connectives in the monotonic function*)
   141 (*Breaks down logical connectives in the monotonic function*)
   134 val basic_elim_tac =
   142 val basic_elim_tac =
   135     REPEAT (SOMEGOAL (eresolve_tac (elim_rls@sumprod_free_SEs)
   143     REPEAT (SOMEGOAL (eresolve_tac (elim_rls@sumprod_free_SEs)
   136 	      ORELSE' bound_hyp_subst_tac))
   144 	      ORELSE' bound_hyp_subst_tac))
   137     THEN prune_params_tac;
   145     THEN prune_params_tac
       
   146         (*Mutual recursion: collapse references to Part(D,h)*)
       
   147     THEN fold_tac part_rec_defs;
   138 
   148 
   139 val elim = rule_by_tactic basic_elim_tac (unfold RS equals_CollectD);
   149 val elim = rule_by_tactic basic_elim_tac (unfold RS equals_CollectD);
   140 
   150 
   141 (*Applies freeness of the given constructors, which *must* be unfolded by
   151 (*Applies freeness of the given constructors, which *must* be unfolded by
   142   the given defs.  Cannot simply use the local con_defs because con_defs=[] 
   152   the given defs.  Cannot simply use the local con_defs because con_defs=[] 
   147 (*String s should have the form t:Si where Si is an inductive set*)
   157 (*String s should have the form t:Si where Si is an inductive set*)
   148 fun mk_cases defs s = 
   158 fun mk_cases defs s = 
   149     rule_by_tactic (con_elim_tac defs)
   159     rule_by_tactic (con_elim_tac defs)
   150       (assume_read thy s  RS  elim);
   160       (assume_read thy s  RS  elim);
   151 
   161 
   152 val defs = big_rec_def::part_rec_defs;
   162 val defs = big_rec_def :: part_rec_defs;
   153 
   163 
   154 val raw_induct = standard ([big_rec_def, bnd_mono] MRS Fp.induct);
   164 val raw_induct = standard ([big_rec_def, bnd_mono] MRS Fp.induct);
   155 end;
   165 end;
   156 
   166