src/HOL/Tools/Predicate_Compile/predicate_compile_core.ML
changeset 35021 c839a4c670c6
parent 34974 18b41bba42b5
child 35267 8dfd816713c6
equal deleted inserted replaced
35020:862a20ffa8e2 35021:c839a4c670c6
   575         val pre_elim = nth (#elims result) index
   575         val pre_elim = nth (#elims result) index
   576         val pred = nth (#preds result) index
   576         val pred = nth (#preds result) index
   577         (*val elim = singleton (Inductive_Set.codegen_preproc thy) (preprocess_elim thy nparams 
   577         (*val elim = singleton (Inductive_Set.codegen_preproc thy) (preprocess_elim thy nparams 
   578           (expand_tuples_elim pre_elim))*)
   578           (expand_tuples_elim pre_elim))*)
   579         val elim =
   579         val elim =
   580           (Drule.standard o Skip_Proof.make_thm thy)
   580           (Drule.export_without_context o Skip_Proof.make_thm thy)
   581           (mk_casesrule (ProofContext.init thy) pred intros)
   581           (mk_casesrule (ProofContext.init thy) pred intros)
   582       in
   582       in
   583         mk_pred_data ((intros, SOME elim), no_compilation)
   583         mk_pred_data ((intros, SOME elim), no_compilation)
   584       end
   584       end
   585   | NONE => error ("No such predicate: " ^ quote name)
   585   | NONE => error ("No such predicate: " ^ quote name)
   639         "expected rules for " ^ constname ^ ", but received rules for " ^
   639         "expected rules for " ^ constname ^ ", but received rules for " ^
   640           commas (map constname_of_intro pre_intros))
   640           commas (map constname_of_intro pre_intros))
   641       else ()
   641       else ()
   642     val pred = Const (constname, T)
   642     val pred = Const (constname, T)
   643     val pre_elim = 
   643     val pre_elim = 
   644       (Drule.standard o Skip_Proof.make_thm thy)
   644       (Drule.export_without_context o Skip_Proof.make_thm thy)
   645       (mk_casesrule (ProofContext.init thy) pred pre_intros)
   645       (mk_casesrule (ProofContext.init thy) pred pre_intros)
   646   in register_predicate (constname, pre_intros, pre_elim) thy end
   646   in register_predicate (constname, pre_intros, pre_elim) thy end
   647 
   647 
   648 fun defined_function_of compilation pred =
   648 fun defined_function_of compilation pred =
   649   let
   649   let
  2176 fun prove options thy clauses preds modes moded_clauses compiled_terms =
  2176 fun prove options thy clauses preds modes moded_clauses compiled_terms =
  2177   map_preds_modes (prove_pred options thy clauses preds modes)
  2177   map_preds_modes (prove_pred options thy clauses preds modes)
  2178     (join_preds_modes moded_clauses compiled_terms)
  2178     (join_preds_modes moded_clauses compiled_terms)
  2179 
  2179 
  2180 fun prove_by_skip options thy _ _ _ _ compiled_terms =
  2180 fun prove_by_skip options thy _ _ _ _ compiled_terms =
  2181   map_preds_modes (fn pred => fn mode => fn t => Drule.standard (Skip_Proof.make_thm thy t))
  2181   map_preds_modes
       
  2182     (fn pred => fn mode => fn t => Drule.export_without_context (Skip_Proof.make_thm thy t))
  2182     compiled_terms
  2183     compiled_terms
  2183 
  2184 
  2184 (* preparation of introduction rules into special datastructures *)
  2185 (* preparation of introduction rules into special datastructures *)
  2185 
  2186 
  2186 fun dest_prem thy params t =
  2187 fun dest_prem thy params t =
  2267       let
  2268       let
  2268         val intros = intros_of thy predname
  2269         val intros = intros_of thy predname
  2269         val elim = the_elim_of thy predname
  2270         val elim = the_elim_of thy predname
  2270         val nparams = nparams_of thy predname
  2271         val nparams = nparams_of thy predname
  2271         val elim' =
  2272         val elim' =
  2272           (Drule.standard o (Skip_Proof.make_thm thy))
  2273           (Drule.export_without_context o Skip_Proof.make_thm thy)
  2273           (mk_casesrule (ProofContext.init thy) nparams intros)
  2274           (mk_casesrule (ProofContext.init thy) nparams intros)
  2274       in
  2275       in
  2275         if not (Thm.equiv_thm (elim, elim')) then
  2276         if not (Thm.equiv_thm (elim, elim')) then
  2276           error "Introduction and elimination rules do not match!"
  2277           error "Introduction and elimination rules do not match!"
  2277         else true
  2278         else true