ebool = bool ⪠{â¥} )以及类型的一组操作(连词等)。
ebool = bool ⪠{â¥}
理论是这样的:
theory EboolTest imports Main "~~/src/HOL/Library/Adhoc_Overloading" begin notation bot ("â¥") declare [[coercion_enabled]] typedef ebool = "UNIV :: bool option set" .. definition ebool :: "bool â ebool" where "ebool b = Abs_ebool (Some b)" declare [[coercion "ebool :: bool â ebool"]] instantiation ebool :: bot begin definition "⥠⡠Abs_ebool None" instance .. end free_constructors case_ebool for ebool | "⥠:: ebool" apply (metis Rep_ebool_inverse bot_ebool_def ebool_def not_Some_eq) apply (smt Abs_ebool_inverse ebool_def iso_tuple_UNIV_I option.inject) by (simp add: Abs_ebool_inject bot_ebool_def ebool_def) lemmas ebool2_cases = ebool.exhaust[case_product ebool.exhaust] lemmas ebool3_cases = ebool.exhaust[case_product ebool.exhaust ebool.exhaust] fun ebool_and :: "ebool â ebool â ebool" (infixr "â§" 35) where "ebool_and a b = ebool (HOL.conj a b)" | "ebool_and False _ = False" | "ebool_and _ False = False" | "ebool_and ⥠_ = â¥" | "ebool_and _ ⥠= â¥" no_notation HOL.conj (infixr "â§" 35) consts "(â§)" :: "'a â 'a â 'a" adhoc_overloading "(â§)" HOL.conj adhoc_overloading "(â§)" ebool_and end
以下工作正常:
value "True â§ (False::ebool)" value "True â§ â¥"
ebool ,但我希望看到 bool :
ebool
bool
value "True â§ False"
首先,我有点惊讶的是:
consts "(â§)" :: "'a â 'a â 'a"
(...) 符号是为系统保留的(公平地说,它确实打印了一个警告,除非你确切知道自己在做什么,否则忽略它们是不明智的。)
(...)
adhoc_overloading 重载将由提供的语法 Main .
adhoc_overloading
Main
还有其他选择。例如,可以使用粗体版本。这用于 this theory .
或者你可以用另一个符号,比如 && .
&&