src/Tools/Code/code_simp.ML
changeset 39486 e992bcc4440e
parent 39475 9cc1ba3c5706
child 39601 922634ecdda4
equal deleted inserted replaced
39485:f7270a5e2550 39486:e992bcc4440e
    64   (add_program program (simpset_default thy some_ss));
    64   (add_program program (simpset_default thy some_ss));
    65 
    65 
    66 fun conclude_tac thy some_ss = Simplifier.full_simp_tac (simpset_default thy some_ss);
    66 fun conclude_tac thy some_ss = Simplifier.full_simp_tac (simpset_default thy some_ss);
    67 
    67 
    68 
    68 
    69 (* evaluation with current code context *)
    69 (* evaluation with dynamic code context *)
    70 
    70 
    71 fun dynamic_eval_conv thy = no_frees_conv (Code_Thingol.dynamic_eval_conv thy
    71 fun dynamic_eval_conv thy = no_frees_conv (Code_Thingol.dynamic_eval_conv thy
    72   (fn naming => fn program => fn t => fn deps => rewrite_modulo thy NONE program));
    72   (fn naming => fn program => fn t => fn deps => rewrite_modulo thy NONE program));
    73 
    73 
    74 fun dynamic_eval_tac thy = CONVERSION (dynamic_eval_conv thy) THEN' conclude_tac thy NONE;
    74 fun dynamic_eval_tac thy = CONVERSION (dynamic_eval_conv thy) THEN' conclude_tac thy NONE;
    79   (Scan.succeed (SIMPLE_METHOD' o (CHANGED_PROP oo dynamic_eval_tac o ProofContext.theory_of)))
    79   (Scan.succeed (SIMPLE_METHOD' o (CHANGED_PROP oo dynamic_eval_tac o ProofContext.theory_of)))
    80   "simplification with code equations"
    80   "simplification with code equations"
    81   #> Value.add_evaluator ("simp", dynamic_eval_value o ProofContext.theory_of);
    81   #> Value.add_evaluator ("simp", dynamic_eval_value o ProofContext.theory_of);
    82 
    82 
    83 
    83 
    84 (* evaluation with freezed code context *)
    84 (* evaluation with static code context *)
    85 
    85 
    86 fun static_eval_conv thy some_ss consts = no_frees_conv
    86 fun static_eval_conv thy some_ss consts = no_frees_conv
    87   (Code_Thingol.static_eval_conv_simple thy consts
    87   (Code_Thingol.static_eval_conv_simple thy consts
    88     (fn program => fn thy => rewrite_modulo thy some_ss program));
    88     (fn program => fn thy => fn _ => fn _ => rewrite_modulo thy some_ss program));
    89 
    89 
    90 fun static_eval_tac thy some_ss consts = CONVERSION (static_eval_conv thy some_ss consts)
    90 fun static_eval_tac thy some_ss consts = CONVERSION (static_eval_conv thy some_ss consts)
    91   THEN' conclude_tac thy some_ss;
    91   THEN' conclude_tac thy some_ss;
    92 
    92 
    93 end;
    93 end;