src/Tools/Code/code_simp.ML
changeset 55147 bce3dbc11f95
parent 54929 f1ded3cea58d
child 55757 9fc71814b8c1
equal deleted inserted replaced
55146:525309c2e4ee 55147:bce3dbc11f95
    50   end;
    50   end;
    51 
    51 
    52 
    52 
    53 (* build simpset and conversion from program *)
    53 (* build simpset and conversion from program *)
    54 
    54 
    55 fun add_stmt (Code_Thingol.Fun (_, ((_, eqs), some_cong))) ss =
    55 fun add_stmt (Code_Thingol.Fun ((_, eqs), some_cong)) ss =
    56       ss
    56       ss
    57       |> fold Simplifier.add_simp ((map_filter (fst o snd)) eqs)
    57       |> fold Simplifier.add_simp ((map_filter (fst o snd)) eqs)
    58       |> fold Simplifier.add_cong (the_list some_cong)
    58       |> fold Simplifier.add_cong (the_list some_cong)
    59   | add_stmt (Code_Thingol.Classinst { inst_params, ... }) ss =
    59   | add_stmt (Code_Thingol.Classinst { inst_params, ... }) ss =
    60       ss
    60       ss
    61       |> fold Simplifier.add_simp (map (fst o snd) inst_params)
    61       |> fold Simplifier.add_simp (map (fst o snd) inst_params)
    62   | add_stmt _ ss = ss;
    62   | add_stmt _ ss = ss;
    63 
    63 
    64 val add_program = Graph.fold (add_stmt o fst o snd);
    64 val add_program = Code_Symbol.Graph.fold (add_stmt o fst o snd);
    65 
    65 
    66 fun simp_ctxt_program thy some_ss program =
    66 fun simp_ctxt_program thy some_ss program =
    67   simp_ctxt_default thy some_ss
    67   simp_ctxt_default thy some_ss
    68   |> add_program program;
    68   |> add_program program;
    69 
    69 
    75 
    75 
    76 
    76 
    77 (* evaluation with dynamic code context *)
    77 (* evaluation with dynamic code context *)
    78 
    78 
    79 fun dynamic_conv thy = Code_Thingol.dynamic_conv thy
    79 fun dynamic_conv thy = Code_Thingol.dynamic_conv thy
    80   (fn _ => fn program => fn _ => fn _ => rewrite_modulo thy NONE program);
    80   (fn program => fn _ => fn _ => rewrite_modulo thy NONE program);
    81 
    81 
    82 fun dynamic_tac thy = CONVERSION (dynamic_conv thy) THEN' conclude_tac thy NONE (Proof_Context.init_global thy);
    82 fun dynamic_tac thy = CONVERSION (dynamic_conv thy) THEN' conclude_tac thy NONE (Proof_Context.init_global thy);
    83 
    83 
    84 fun dynamic_value thy = snd o Logic.dest_equals o Thm.prop_of o dynamic_conv thy o Thm.cterm_of thy;
    84 fun dynamic_value thy = snd o Logic.dest_equals o Thm.prop_of o dynamic_conv thy o Thm.cterm_of thy;
    85 
    85