added further inlining of boolean constants to the predicate compiler
authorbulwahn
Wed, 21 Apr 2010 12:10:52 +0200
changeset 36253 6e969ce3dfcc
parent 36252 beba03215d8f
child 36254 95ef0a3cf31c
added further inlining of boolean constants to the predicate compiler
src/HOL/Library/Predicate_Compile_Alternative_Defs.thy
src/HOL/Predicate_Compile_Examples/Predicate_Compile_Examples.thy
--- a/src/HOL/Library/Predicate_Compile_Alternative_Defs.thy	Wed Apr 21 12:10:52 2010 +0200
+++ b/src/HOL/Library/Predicate_Compile_Alternative_Defs.thy	Wed Apr 21 12:10:52 2010 +0200
@@ -6,6 +6,14 @@
 
 declare HOL.if_bool_eq_disj[code_pred_inline]
 
+declare bool_diff_def[code_pred_inline]
+declare inf_bool_eq_raw[code_pred_inline]
+declare less_bool_def_raw[code_pred_inline]
+declare le_bool_def_raw[code_pred_inline]
+
+lemma min_bool_eq [code_pred_inline]: "(min :: bool => bool => bool) == (op &)"
+by (rule eq_reflection) (auto simp add: expand_fun_eq min_def le_bool_def)
+
 setup {* Predicate_Compile_Data.ignore_consts [@{const_name Let}] *}
 
 section {* Pairs *}
@@ -35,6 +43,10 @@
   "(A - B) = (%x. A x \<and> \<not> B x)"
 by (auto simp add: mem_def)
 
+lemma subset_eq[code_pred_inline]:
+  "(P :: 'a => bool) < (Q :: 'a => bool) == ((\<exists>x. Q x \<and> (\<not> P x)) \<and> (\<forall> x. P x --> Q x))"
+by (rule eq_reflection) (fastsimp simp add: mem_def)
+
 lemma set_equality[code_pred_inline]:
   "(A = B) = ((\<forall>x. A x \<longrightarrow> B x) \<and> (\<forall>x. B x \<longrightarrow> A x))"
 by (fastsimp simp add: mem_def)
--- a/src/HOL/Predicate_Compile_Examples/Predicate_Compile_Examples.thy	Wed Apr 21 12:10:52 2010 +0200
+++ b/src/HOL/Predicate_Compile_Examples/Predicate_Compile_Examples.thy	Wed Apr 21 12:10:52 2010 +0200
@@ -1392,6 +1392,20 @@
 values [expected "{9::int}"] "{a. minus_int_test a 4 5}"
 values [expected "{- 1::int}"] "{b. minus_int_test 4 b 5}"
 
+subsection {* minus on bool *}
+
+inductive All :: "nat => bool"
+where
+  "All x"
+
+inductive None :: "nat => bool"
+
+definition "test_minus_bool x = (None x - All x)"
+
+code_pred [inductify] test_minus_bool .
+thm test_minus_bool.equation
+
+values "{x. test_minus_bool x}"