src/ZF/Tools/inductive_package.ML
changeset 16855 7563d0eb3414
parent 16457 e0f22edf38a5
child 17057 0934ac31985f
equal deleted inserted replaced
16854:fdd362b7e980 16855:7563d0eb3414
    46 functor Add_inductive_def_Fun
    46 functor Add_inductive_def_Fun
    47     (structure Fp: FP and Pr : PR and CP: CARTPROD and Su : SU val coind: bool)
    47     (structure Fp: FP and Pr : PR and CP: CARTPROD and Su : SU val coind: bool)
    48  : INDUCTIVE_PACKAGE =
    48  : INDUCTIVE_PACKAGE =
    49 struct
    49 struct
    50 
    50 
    51 open Logic Ind_Syntax;
    51 open Ind_Syntax;
    52 
    52 
    53 val co_prefix = if coind then "co" else "";
    53 val co_prefix = if coind then "co" else "";
    54 
    54 
    55 
    55 
    56 (* utils *)
    56 (* utils *)
   110     | dest_tprop Q = error ("Ill-formed premise of introduction rule: " ^
   110     | dest_tprop Q = error ("Ill-formed premise of introduction rule: " ^
   111                             Sign.string_of_term sign Q);
   111                             Sign.string_of_term sign Q);
   112 
   112 
   113   (*Makes a disjunct from an introduction rule*)
   113   (*Makes a disjunct from an introduction rule*)
   114   fun fp_part intr = (*quantify over rule's free vars except parameters*)
   114   fun fp_part intr = (*quantify over rule's free vars except parameters*)
   115     let val prems = map dest_tprop (strip_imp_prems intr)
   115     let val prems = map dest_tprop (Logic.strip_imp_prems intr)
   116         val dummy = List.app (fn rec_hd => List.app (chk_prem rec_hd) prems) rec_hds
   116         val dummy = List.app (fn rec_hd => List.app (chk_prem rec_hd) prems) rec_hds
   117         val exfrees = term_frees intr \\ rec_params
   117         val exfrees = term_frees intr \\ rec_params
   118         val zeq = FOLogic.mk_eq (Free(z',iT), #1 (rule_concl intr))
   118         val zeq = FOLogic.mk_eq (Free(z',iT), #1 (rule_concl intr))
   119     in foldr FOLogic.mk_exists
   119     in foldr FOLogic.mk_exists
   120              (fold_bal FOLogic.mk_conj (zeq::prems)) exfrees
   120              (fold_bal FOLogic.mk_conj (zeq::prems)) exfrees
   136                    mk_Collect(z', dom_sum,
   136                    mk_Collect(z', dom_sum,
   137                               fold_bal FOLogic.mk_disj part_intrs));
   137                               fold_bal FOLogic.mk_disj part_intrs));
   138 
   138 
   139   val fp_rhs = Fp.oper $ dom_sum $ fp_abs
   139   val fp_rhs = Fp.oper $ dom_sum $ fp_abs
   140 
   140 
   141   val dummy = List.app (fn rec_hd => deny (rec_hd occs fp_rhs)
   141   val dummy = List.app (fn rec_hd => deny (Logic.occs (rec_hd, fp_rhs))
   142                              "Illegal occurrence of recursion operator")
   142                              "Illegal occurrence of recursion operator")
   143            rec_hds;
   143            rec_hds;
   144 
   144 
   145   (*** Make the new theory ***)
   145   (*** Make the new theory ***)
   146 
   146