在 Coq 中构建集合
Construct Sets in Coq
如何构造如下集合的元素(假设A:集合)?
A -> A + A
我的回答如下:
Definition set : A -> A + A :=
fun a => match a with
| inl l => a
| inr r => a
end.
它returns:
Error: In environment
P, Q, R : Prop
A, B, C : Set
a : A
The term "a" has type "A" while it is expected to have type "?T + ?T0".
我不知道我是否正确理解你的问题,但这里有一个解决方案。
Definition mkset {A : Set}: A -> A + A.
intro a.
left.
assumption.
Defined.
想法是使用策略构建A -> A + A
类型的函数。策略intro
对应参数a
的抽象。策略 left
允许我们选择只证明 A + A
的左边。最后,assumption
在假设中搜索符合当前目标的命题并完成它,如果这样的假设存在于上下文中。
如何构造如下集合的元素(假设A:集合)?
A -> A + A
我的回答如下:
Definition set : A -> A + A :=
fun a => match a with
| inl l => a
| inr r => a
end.
它returns:
Error: In environment
P, Q, R : Prop
A, B, C : Set
a : A
The term "a" has type "A" while it is expected to have type "?T + ?T0".
我不知道我是否正确理解你的问题,但这里有一个解决方案。
Definition mkset {A : Set}: A -> A + A.
intro a.
left.
assumption.
Defined.
想法是使用策略构建A -> A + A
类型的函数。策略intro
对应参数a
的抽象。策略 left
允许我们选择只证明 A + A
的左边。最后,assumption
在假设中搜索符合当前目标的命题并完成它,如果这样的假设存在于上下文中。