install case certificate for If after code_datatype declaration for bool
authorhaftmann
Sat, 02 Jul 2011 22:55:58 +0200
changeset 445123f1a44c2d645
parent 44511 905f17258bca
child 44513 5742b288bb86
install case certificate for If after code_datatype declaration for bool
src/HOL/HOL.thy
src/HOL/Product_Type.thy
     1.1 --- a/src/HOL/HOL.thy	Sat Jul 02 22:14:47 2011 +0200
     1.2 +++ b/src/HOL/HOL.thy	Sat Jul 02 22:55:58 2011 +0200
     1.3 @@ -1892,14 +1892,8 @@
     1.4    shows "CASE x \<equiv> f x"
     1.5    using assms by simp_all
     1.6  
     1.7 -lemma If_case_cert:
     1.8 -  assumes "CASE \<equiv> (\<lambda>b. If b f g)"
     1.9 -  shows "(CASE True \<equiv> f) &&& (CASE False \<equiv> g)"
    1.10 -  using assms by simp_all
    1.11 -
    1.12  setup {*
    1.13    Code.add_case @{thm Let_case_cert}
    1.14 -  #> Code.add_case @{thm If_case_cert}
    1.15    #> Code.add_undefined @{const_name undefined}
    1.16  *}
    1.17  
     2.1 --- a/src/HOL/Product_Type.thy	Sat Jul 02 22:14:47 2011 +0200
     2.2 +++ b/src/HOL/Product_Type.thy	Sat Jul 02 22:55:58 2011 +0200
     2.3 @@ -28,6 +28,15 @@
     2.4      and [code nbe]: "HOL.equal P P \<longleftrightarrow> True"
     2.5    by (simp_all add: equal)
     2.6  
     2.7 +lemma If_case_cert:
     2.8 +  assumes "CASE \<equiv> (\<lambda>b. If b f g)"
     2.9 +  shows "(CASE True \<equiv> f) &&& (CASE False \<equiv> g)"
    2.10 +  using assms by simp_all
    2.11 +
    2.12 +setup {*
    2.13 +  Code.add_case @{thm If_case_cert}
    2.14 +*}
    2.15 +
    2.16  code_const "HOL.equal \<Colon> bool \<Rightarrow> bool \<Rightarrow> bool"
    2.17    (Haskell infix 4 "==")
    2.18