src/HOL/Product_Type.thy
changeset 24844 98c006a30218
parent 24699 c6674504103f
child 25511 54db9b5080b8
equal deleted inserted replaced
24843:0fc73c4003ac 24844:98c006a30218
   805   by (simp add: expand_fun_eq)
   805   by (simp add: expand_fun_eq)
   806 
   806 
   807 declare prod_caseI2' [intro!] prod_caseI2 [intro!] prod_caseI [intro!]
   807 declare prod_caseI2' [intro!] prod_caseI2 [intro!] prod_caseI [intro!]
   808 declare prod_caseE' [elim!] prod_caseE [elim!]
   808 declare prod_caseE' [elim!] prod_caseE [elim!]
   809 
   809 
   810 lemma prod_case_split [code post]:
   810 lemma prod_case_split:
   811   "prod_case = split"
   811   "prod_case = split"
   812   by (auto simp add: expand_fun_eq)
   812   by (auto simp add: expand_fun_eq)
   813 
       
   814 lemmas [code inline] = prod_case_split [symmetric]
       
   815 
   813 
   816 
   814 
   817 subsection {* Further cases/induct rules for tuples *}
   815 subsection {* Further cases/induct rules for tuples *}
   818 
   816 
   819 lemma prod_cases3 [cases type]:
   817 lemma prod_cases3 [cases type]:
   899 
   897 
   900 instance * :: (eq, eq) eq ..
   898 instance * :: (eq, eq) eq ..
   901 
   899 
   902 lemma [code func]:
   900 lemma [code func]:
   903   "(x1\<Colon>'a\<Colon>eq, y1\<Colon>'b\<Colon>eq) = (x2, y2) \<longleftrightarrow> x1 = x2 \<and> y1 = y2" by auto
   901   "(x1\<Colon>'a\<Colon>eq, y1\<Colon>'b\<Colon>eq) = (x2, y2) \<longleftrightarrow> x1 = x2 \<and> y1 = y2" by auto
       
   902 
       
   903 lemma split_case_cert:
       
   904   assumes "CASE \<equiv> split f"
       
   905   shows "CASE (a, b) \<equiv> f a b"
       
   906   using assms by simp
       
   907 
       
   908 setup {*
       
   909   Code.add_case @{thm split_case_cert}
       
   910 *}
   904 
   911 
   905 code_type *
   912 code_type *
   906   (SML infix 2 "*")
   913   (SML infix 2 "*")
   907   (OCaml infix 2 "*")
   914   (OCaml infix 2 "*")
   908   (Haskell "!((_),/ (_))")
   915   (Haskell "!((_),/ (_))")