src/HOL/Tools/Predicate_Compile/predicate_compile_aux.ML
changeset 38549 d0385f2764d8
parent 37678 0040bafffdef
child 38552 6c8806696bed
equal deleted inserted replaced
38548:dea0d2cca822 38549:d0385f2764d8
   403   | map_indprem f (Generator (v, T)) = Generator (dest_Free (f (Free (v, T))))
   403   | map_indprem f (Generator (v, T)) = Generator (dest_Free (f (Free (v, T))))
   404 
   404 
   405 (* general syntactic functions *)
   405 (* general syntactic functions *)
   406 
   406 
   407 (*Like dest_conj, but flattens conjunctions however nested*)
   407 (*Like dest_conj, but flattens conjunctions however nested*)
   408 fun conjuncts_aux (Const ("op &", _) $ t $ t') conjs = conjuncts_aux t (conjuncts_aux t' conjs)
   408 fun conjuncts_aux (Const (@{const_name "op &"}, _) $ t $ t') conjs = conjuncts_aux t (conjuncts_aux t' conjs)
   409   | conjuncts_aux t conjs = t::conjs;
   409   | conjuncts_aux t conjs = t::conjs;
   410 
   410 
   411 fun conjuncts t = conjuncts_aux t [];
   411 fun conjuncts t = conjuncts_aux t [];
   412 
   412 
   413 fun is_equationlike_term (Const ("==", _) $ _ $ _) = true
   413 fun is_equationlike_term (Const ("==", _) $ _ $ _) = true
   414   | is_equationlike_term (Const ("Trueprop", _) $ (Const ("op =", _) $ _ $ _)) = true
   414   | is_equationlike_term (Const (@{const_name "Trueprop"}, _) $ (Const (@{const_name "op ="}, _) $ _ $ _)) = true
   415   | is_equationlike_term _ = false
   415   | is_equationlike_term _ = false
   416   
   416   
   417 val is_equationlike = is_equationlike_term o prop_of 
   417 val is_equationlike = is_equationlike_term o prop_of 
   418 
   418 
   419 fun is_pred_equation_term (Const ("==", _) $ u $ v) =
   419 fun is_pred_equation_term (Const ("==", _) $ u $ v) =
   480 
   480 
   481 val is_constr = Code.is_constr o ProofContext.theory_of;
   481 val is_constr = Code.is_constr o ProofContext.theory_of;
   482 
   482 
   483 fun strip_all t = (Term.strip_all_vars t, Term.strip_all_body t)
   483 fun strip_all t = (Term.strip_all_vars t, Term.strip_all_body t)
   484 
   484 
   485 fun strip_ex (Const ("Ex", _) $ Abs (x, T, t)) =
   485 fun strip_ex (Const (@{const_name "Ex"}, _) $ Abs (x, T, t)) =
   486   let
   486   let
   487     val (xTs, t') = strip_ex t
   487     val (xTs, t') = strip_ex t
   488   in
   488   in
   489     ((x, T) :: xTs, t')
   489     ((x, T) :: xTs, t')
   490   end
   490   end