如何在 Isabelle 中简化选项表达式?
How to let option expressions simplfy in Isabelle?
我正在尝试理解 Isabelle (2020) 中的选项,但无法理解为什么一些简单的选项表达式没有按预期计算或简化。
例如,我希望
value "some (1::nat)"
应该 return 一个 "nat option"
类型,然而,它 return 是一个未指定的类型:
"some 1"
:: "'a
此外,从类型签名来看,我希望 the
函数 return 选项“内部”的值,以便“(some (1::nat) )" 只是 (1::nat)
.
然而,
value "the (some (1::nat))"
returns个貌似不是很好用的类型:
"the (some 1)"
:: "'a"
,这不是 nat
。那么结果不是很有用,例如
value "the (some (1::nat)) + 2"
returns
"the (some 1) + (1 + 1)"
:: "'a"
(我预计结果是 "3::nat"
)
这是设计使然还是我遗漏了一些关于 the
的内容,或者伊莎贝尔的选项 simplify/compute 是怎样的?
(我对 Isabelle 选项一无所知,我只是假设它类似于 Haskell 的 Maybe。)
C 键单击显示定义为:
datatype 'a option =
None
| Some (the: 'a)
是Some,不是Some
提示未定义some
:颜色与the
中的颜色不同。
我正在尝试理解 Isabelle (2020) 中的选项,但无法理解为什么一些简单的选项表达式没有按预期计算或简化。
例如,我希望
value "some (1::nat)"
应该 return 一个 "nat option"
类型,然而,它 return 是一个未指定的类型:
"some 1"
:: "'a
此外,从类型签名来看,我希望 the
函数 return 选项“内部”的值,以便“(some (1::nat) )" 只是 (1::nat)
.
然而,
value "the (some (1::nat))"
returns个貌似不是很好用的类型:
"the (some 1)"
:: "'a"
,这不是 nat
。那么结果不是很有用,例如
value "the (some (1::nat)) + 2"
returns
"the (some 1) + (1 + 1)"
:: "'a"
(我预计结果是 "3::nat"
)
这是设计使然还是我遗漏了一些关于 the
的内容,或者伊莎贝尔的选项 simplify/compute 是怎样的?
(我对 Isabelle 选项一无所知,我只是假设它类似于 Haskell 的 Maybe。)
C 键单击显示定义为:
datatype 'a option =
None
| Some (the: 'a)
是Some,不是Some
提示未定义some
:颜色与the
中的颜色不同。