src/HOL/Library/Eval_Witness.thy
changeset 39471 55e0ff582fa4
parent 39403 aad9f3cfa1d9
child 40316 665862241968
equal deleted inserted replaced
39436:4a7d09da2b9c 39471:55e0ff582fa4
    42 
    42 
    43 instance nat :: ml_equiv .. (* Attention: This conflicts with the "EfficientNat" theory *)
    43 instance nat :: ml_equiv .. (* Attention: This conflicts with the "EfficientNat" theory *)
    44 instance bool :: ml_equiv ..
    44 instance bool :: ml_equiv ..
    45 instance list :: (ml_equiv) ml_equiv ..
    45 instance list :: (ml_equiv) ml_equiv ..
    46 
    46 
       
    47 ML {*
       
    48 structure Eval_Method = Proof_Data (
       
    49   type T = unit -> bool
       
    50   fun init _ () = error "Eval_Method"
       
    51 )
       
    52 *}
       
    53 
    47 oracle eval_witness_oracle = {* fn (cgoal, ws) =>
    54 oracle eval_witness_oracle = {* fn (cgoal, ws) =>
    48 let
    55 let
    49   val thy = Thm.theory_of_cterm cgoal;
    56   val thy = Thm.theory_of_cterm cgoal;
    50   val goal = Thm.term_of cgoal;
    57   val goal = Thm.term_of cgoal;
    51   fun check_type T = 
    58   fun check_type T = 
    57     | dest_exs n (Const (@{const_name Ex}, _) $ Abs (v,T,b)) = 
    64     | dest_exs n (Const (@{const_name Ex}, _) $ Abs (v,T,b)) = 
    58       Abs (v, check_type T, dest_exs (n - 1) b)
    65       Abs (v, check_type T, dest_exs (n - 1) b)
    59     | dest_exs _ _ = sys_error "dest_exs";
    66     | dest_exs _ _ = sys_error "dest_exs";
    60   val t = dest_exs (length ws) (HOLogic.dest_Trueprop goal);
    67   val t = dest_exs (length ws) (HOLogic.dest_Trueprop goal);
    61 in
    68 in
    62   if Code_Runtime.value NONE (Eval_Method.get, Eval_Method.put, "Eval_Method.put") (K I) thy t ws
    69   if Code_Runtime.dynamic_value_strict (Eval_Method.get, Eval_Method.put, "Eval_Method.put") thy NONE (K I) t ws
    63   then Thm.cterm_of thy goal
    70   then Thm.cterm_of thy goal
    64   else @{cprop True} (*dummy*)
    71   else @{cprop True} (*dummy*)
    65 end
    72 end
    66 *}
    73 *}
    67 
    74