# HG changeset patch # User Lars Hupel # Date 1452494660 -3600 # Node ID eed7ca453573b773e83997e59e62d987952623bc # Parent c8a93680b80d7494785e446adf326f52a1cf4781# Parent 13f0fa687aa760fd8b71f9c579d4f6af502398f0 merged diff -r 13f0fa687aa7 -r eed7ca453573 src/HOL/Predicate_Compile_Examples/Predicate_Compile_Tests.thy --- a/src/HOL/Predicate_Compile_Examples/Predicate_Compile_Tests.thy Sun Jan 10 20:29:12 2016 -0800 +++ b/src/HOL/Predicate_Compile_Examples/Predicate_Compile_Tests.thy Mon Jan 11 07:44:20 2016 +0100 @@ -85,10 +85,47 @@ inductive Fact :: "'a \ 'a \ bool" where -"Fact a' a'" + "Fact a' a'" code_pred (expected_modes: o => o => bool, i => o => bool, o => i => bool, i => i => bool) Fact . +text {* + The following example was derived from an predicate in the CakeML formalisation provided by Lars Hupel. +*} +inductive predicate_where_argument_is_condition :: "bool \ bool" +where + "ck \ predicate_where_argument_is_condition ck" + +code_pred predicate_where_argument_is_condition . + +text {* Other similar examples of this kind: *} + +inductive predicate_where_argument_is_in_equation :: "bool \ bool" +where + "ck = True \ predicate_where_argument_is_in_equation ck" + +code_pred predicate_where_argument_is_in_equation . + +inductive predicate_where_argument_is_condition_and_value :: "bool \ bool" +where + "predicate_where_argument_is_condition_and_value ck \ ck + \ predicate_where_argument_is_condition_and_value ck" + +code_pred predicate_where_argument_is_condition_and_value . + +inductive predicate_where_argument_is_neg_condition :: "bool \ bool" +where + "\ ck \ predicate_where_argument_is_neg_condition ck" + +code_pred predicate_where_argument_is_neg_condition . + +inductive predicate_where_argument_is_neg_condition_and_in_equation :: "bool \ bool" +where + "\ ck \ ck = False \ predicate_where_argument_is_neg_condition_and_in_equation ck" + +code_pred predicate_where_argument_is_neg_condition_and_in_equation . + + inductive zerozero :: "nat * nat => bool" where "zerozero (0, 0)" diff -r 13f0fa687aa7 -r eed7ca453573 src/HOL/Tools/Predicate_Compile/predicate_compile_proof.ML --- a/src/HOL/Tools/Predicate_Compile/predicate_compile_proof.ML Sun Jan 10 20:29:12 2016 -0800 +++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_proof.ML Mon Jan 11 07:44:20 2016 +0100 @@ -195,6 +195,7 @@ (fn {context = ctxt', prems, ...} => let val prems' = maps dest_conjunct_prem (take nargs prems) + |> filter is_equationlike in rewrite_goal_tac ctxt' (map (fn th => th RS @{thm sym} RS @{thm eq_reflection}) prems') 1 end) ctxt 1