src/HOL/Product_Type.thy
changeset 58306 117ba6cbe414
parent 58292 e7320cceda9c
child 58389 ee1f45ca0d73
equal deleted inserted replaced
58305:57752a91eec4 58306:117ba6cbe414
    13 subsection {* @{typ bool} is a datatype *}
    13 subsection {* @{typ bool} is a datatype *}
    14 
    14 
    15 free_constructors case_bool for True | False
    15 free_constructors case_bool for True | False
    16   by auto
    16   by auto
    17 
    17 
    18 text {* Avoid name clashes by prefixing the output of @{text rep_datatype} with @{text old}. *}
    18 text {* Avoid name clashes by prefixing the output of @{text old_rep_datatype} with @{text old}. *}
    19 
    19 
    20 setup {* Sign.mandatory_path "old" *}
    20 setup {* Sign.mandatory_path "old" *}
    21 
    21 
    22 rep_datatype True False by (auto intro: bool_induct)
    22 old_rep_datatype True False by (auto intro: bool_induct)
    23 
    23 
    24 setup {* Sign.parent_path *}
    24 setup {* Sign.parent_path *}
    25 
    25 
    26 text {* But erase the prefix for properties that are not generated by @{text free_constructors}. *}
    26 text {* But erase the prefix for properties that are not generated by @{text free_constructors}. *}
    27 
    27 
    82 *}
    82 *}
    83 
    83 
    84 free_constructors case_unit for "()"
    84 free_constructors case_unit for "()"
    85   by auto
    85   by auto
    86 
    86 
    87 text {* Avoid name clashes by prefixing the output of @{text rep_datatype} with @{text old}. *}
    87 text {* Avoid name clashes by prefixing the output of @{text old_rep_datatype} with @{text old}. *}
    88 
    88 
    89 setup {* Sign.mandatory_path "old" *}
    89 setup {* Sign.mandatory_path "old" *}
    90 
    90 
    91 rep_datatype "()" by simp
    91 old_rep_datatype "()" by simp
    92 
    92 
    93 setup {* Sign.parent_path *}
    93 setup {* Sign.parent_path *}
    94 
    94 
    95 text {* But erase the prefix for properties that are not generated by @{text free_constructors}. *}
    95 text {* But erase the prefix for properties that are not generated by @{text free_constructors}. *}
    96 
    96 
   255     by (auto simp add: prod_def)
   255     by (auto simp add: prod_def)
   256   ultimately show "Pair a b = Pair c d \<longleftrightarrow> a = c \<and> b = d"
   256   ultimately show "Pair a b = Pair c d \<longleftrightarrow> a = c \<and> b = d"
   257     by (simp add: Pair_def Abs_prod_inject)
   257     by (simp add: Pair_def Abs_prod_inject)
   258 qed
   258 qed
   259 
   259 
   260 text {* Avoid name clashes by prefixing the output of @{text rep_datatype} with @{text old}. *}
   260 text {* Avoid name clashes by prefixing the output of @{text old_rep_datatype} with @{text old}. *}
   261 
   261 
   262 setup {* Sign.mandatory_path "old" *}
   262 setup {* Sign.mandatory_path "old" *}
   263 
   263 
   264 rep_datatype Pair
   264 old_rep_datatype Pair
   265 by (erule prod_cases) (rule prod.inject)
   265 by (erule prod_cases) (rule prod.inject)
   266 
   266 
   267 setup {* Sign.parent_path *}
   267 setup {* Sign.parent_path *}
   268 
   268 
   269 text {* But erase the prefix for properties that are not generated by @{text free_constructors}. *}
   269 text {* But erase the prefix for properties that are not generated by @{text free_constructors}. *}