src/HOL/Tools/Predicate_Compile/predicate_compile_pred.ML
changeset 50056 72efd6b4038d
parent 46909 3c73a121a387
child 51552 c713c9505f68
equal deleted inserted replaced
50055:94041d602ecb 50056:72efd6b4038d
    17 structure Predicate_Compile_Pred : PREDICATE_COMPILE_PRED =
    17 structure Predicate_Compile_Pred : PREDICATE_COMPILE_PRED =
    18 struct
    18 struct
    19 
    19 
    20 open Predicate_Compile_Aux
    20 open Predicate_Compile_Aux
    21 
    21 
    22 fun is_compound ((Const (@{const_name Not}, _)) $ t) =
    22 fun is_compound ((Const (@{const_name Not}, _)) $ _) =
    23     error "is_compound: Negation should not occur; preprocessing is defect"
    23     error "is_compound: Negation should not occur; preprocessing is defect"
    24   | is_compound ((Const (@{const_name Ex}, _)) $ _) = true
    24   | is_compound ((Const (@{const_name Ex}, _)) $ _) = true
    25   | is_compound ((Const (@{const_name HOL.disj}, _)) $ _ $ _) = true
    25   | is_compound ((Const (@{const_name HOL.disj}, _)) $ _ $ _) = true
    26   | is_compound ((Const (@{const_name HOL.conj}, _)) $ _ $ _) =
    26   | is_compound ((Const (@{const_name HOL.conj}, _)) $ _ $ _) =
    27     error "is_compound: Conjunction should not occur; preprocessing is defect"
    27     error "is_compound: Conjunction should not occur; preprocessing is defect"
    35       val split_thm = prepare_split_thm (Proof_Context.init_global thy) raw_split_thm
    35       val split_thm = prepare_split_thm (Proof_Context.init_global thy) raw_split_thm
    36       (* TODO: contextify things - this line is to unvarify the split_thm *)
    36       (* TODO: contextify things - this line is to unvarify the split_thm *)
    37       (*val ((_, [isplit_thm]), _) =
    37       (*val ((_, [isplit_thm]), _) =
    38         Variable.import true [split_thm] (Proof_Context.init_global thy)*)
    38         Variable.import true [split_thm] (Proof_Context.init_global thy)*)
    39       val (assms, concl) = Logic.strip_horn (prop_of split_thm)
    39       val (assms, concl) = Logic.strip_horn (prop_of split_thm)
    40       val (P, [split_t]) = strip_comb (HOLogic.dest_Trueprop concl) 
    40       val (_, [split_t]) = strip_comb (HOLogic.dest_Trueprop concl) 
    41       val atom' = case_betapply thy atom
    41       val atom' = case_betapply thy atom
    42       val subst = Pattern.match thy (split_t, atom') (Vartab.empty, Vartab.empty)
    42       val subst = Pattern.match thy (split_t, atom') (Vartab.empty, Vartab.empty)
    43       val names' = Term.add_free_names atom' names
    43       val names' = Term.add_free_names atom' names
    44       fun mk_subst_rhs assm =
    44       fun mk_subst_rhs assm =
    45         let
    45         let
   154         val frees = Term.add_free_names rhs []
   154         val frees = Term.add_free_names rhs []
   155         val disjuncts = HOLogic.dest_disj rhs
   155         val disjuncts = HOLogic.dest_disj rhs
   156         val nctxt = Name.make_context frees
   156         val nctxt = Name.make_context frees
   157         fun mk_introrule t =
   157         fun mk_introrule t =
   158           let
   158           let
   159             val ((ps, t'), nctxt') = focus_ex t nctxt
   159             val ((ps, t'), _) = focus_ex t nctxt
   160             val prems = map HOLogic.mk_Trueprop (HOLogic.dest_conj t')
   160             val prems = map HOLogic.mk_Trueprop (HOLogic.dest_conj t')
   161           in
   161           in
   162             (ps, Logic.list_implies (prems, HOLogic.mk_Trueprop lhs))
   162             (ps, Logic.list_implies (prems, HOLogic.mk_Trueprop lhs))
   163           end
   163           end
   164         val x = ((cterm_of thy) o the_single o snd o strip_comb o HOLogic.dest_Trueprop o fst o
   164         val x = ((cterm_of thy) o the_single o snd o strip_comb o HOLogic.dest_Trueprop o fst o
   221       val full_spec = (constname, intros') :: flat intross
   221       val full_spec = (constname, intros') :: flat intross
   222       (*val thy''' = Predicate_Compile_Data.store_processed_specs (constname, full_spec) thy''*)
   222       (*val thy''' = Predicate_Compile_Data.store_processed_specs (constname, full_spec) thy''*)
   223     in
   223     in
   224       (full_spec, thy'')
   224       (full_spec, thy'')
   225     end;
   225     end;
   226 
       
   227 fun preprocess_term t thy = error "preprocess_pred_term: to implement" 
       
   228 
       
   229 fun is_Abs (Abs _) = true
       
   230   | is_Abs _       = false
       
   231 
   226 
   232 fun flat_higher_order_arguments (intross, thy) =
   227 fun flat_higher_order_arguments (intross, thy) =
   233   let
   228   let
   234     fun process constname atom (new_defs, thy) =
   229     fun process constname atom (new_defs, thy) =
   235       let
   230       let