src/Tools/Code/code_runtime.ML
changeset 59633 a372513af1e2
parent 59621 291934bac95e
child 59936 b8ffc3dc9e24
equal deleted inserted replaced
59632:5980e75a204e 59633:a372513af1e2
   170 
   170 
   171 val reject_vars = fn ctxt => tap (reject_vars ctxt o Thm.term_of);
   171 val reject_vars = fn ctxt => tap (reject_vars ctxt o Thm.term_of);
   172 
   172 
   173 fun check_holds ctxt evaluator vs_t ct =
   173 fun check_holds ctxt evaluator vs_t ct =
   174   let
   174   let
   175     val thy = Proof_Context.theory_of ctxt;
       
   176     val t = Thm.term_of ct;
   175     val t = Thm.term_of ct;
   177     val _ = if fastype_of t <> propT
   176     val _ = if fastype_of t <> propT
   178       then error ("Not a proposition: " ^ Syntax.string_of_term_global thy t)
   177       then error ("Not a proposition: " ^ Syntax.string_of_term ctxt t)
   179       else ();
   178       else ();
   180     val iff = Thm.global_cterm_of thy (Term.Const (@{const_name Pure.eq}, propT --> propT --> propT));
   179     val iff = Thm.cterm_of ctxt (Term.Const (@{const_name Pure.eq}, propT --> propT --> propT));
   181     val result = case partiality_as_none (evaluation truth_cookie ctxt evaluator vs_t [])
   180     val result = case partiality_as_none (evaluation truth_cookie ctxt evaluator vs_t [])
   182      of SOME Holds => true
   181      of SOME Holds => true
   183       | _ => false;
   182       | _ => false;
   184   in
   183   in
   185     Thm.mk_binop iff ct (if result then @{cprop "PROP Code_Generator.holds"} else ct)
   184     Thm.mk_binop iff ct (if result then @{cprop "PROP Code_Generator.holds"} else ct)