src/Tools/isac/Specify/pre-conditions.sml
author wneuper <Walther.Neuper@jku.at>
Mon, 07 Nov 2022 17:37:20 +0100
changeset 60586 007ef64dbb08
parent 60559 aba19e46dd84
child 60590 35846e25713e
permissions -rw-r--r--
rename fields in Method_Def.T
     1 (* Title:  Specify/where_-conds.sml
     2    Author: Walther Neuper 110226
     3    (c) due to copyright terms
     4 
     5 Operations on models.
     6 *)
     7 
     8 signature PRE_CONDITIONS =
     9 sig
    10   type T
    11   type input
    12   val to_string : T -> string
    13 
    14   val check: Rule_Set.T -> term list -> I_Model.T -> 'a -> bool * (bool * term) list (**)
    15 \<^isac_test>\<open>
    16   val eval: Rule_Set.T -> bool * term -> bool * term
    17 \<close>
    18 end
    19 
    20 (**)
    21 structure Pre_Conds(**) : PRE_CONDITIONS(**) =
    22 struct
    23 (**)
    24 
    25 (*type unchecked = term list*)
    26 (*type checked = Pre_Conds_Def.T;*)
    27 type T = Pre_Conds_Def.T;  (*= (bool * term) list;*)
    28 type input = string list;
    29 
    30 fun to_str (b, t) = pair2str (bool2str b, UnparseC.term t);
    31 fun to_string pres = strs2str' (map (linefeed o to_str) pres);
    32 
    33 fun eval _ (false, where_) = (false, where_) (*NOT ALL Free's have been substituted*)
    34   | eval where_rls (true, where_) =
    35     if Rewrite.eval_true (Proof_Context.init_global (ThyC.Isac "")) [where_] where_rls
    36     then (true , where_)
    37     else (false , where_);
    38 
    39 fun check _ [] _ _ = (true, [])
    40   | check where_rls pres pbl (_ (* FIXME.WN0308 re-introduce I_Model.variants *)) =
    41     let
    42       val env = I_Model.environment pbl;
    43       val pres' = map (TermC.subst_atomic_all env) pres;
    44       val evals = map (eval where_rls) pres';
    45     in (foldl and_ (true, map fst evals), evals) end;
    46 
    47 (**)end(**)