需要关于证明一些直觉逻辑陈述的提示
Need hints about proving some intuitionistic logic statements
我是 Agda 的新手,一般来说我也是依赖类型编程和证明助手的新手。我决定开始使用我在 Programming Language Foundations in Agda 中找到的定义来构建简单的直觉逻辑证明,并且我取得了一些成功。然而,当我试图写出以下证明时,我感到困惑:
∨-identity-indirect : {A B : Set} → (¬ A) ∧ (A ∨ B) → B
在纸上证明这一点相当简单:展开 ¬ A
,我们有 A → ⊥
。所以这个语句就等价于(⊥ ∨ B) → B
,这显然是正确的。
我能够成功证明后半部分,即(⊥ ∨ B) → B
:
∨-identity : {A : Set} → (⊥ ∨ A) → A
∨-identity (∨-left ())
∨-identity (∨-right A) = A
然后,我能够写:
∨-identity-indirect ⟨ ¬A , A∨B ⟩ = ∨-identity ?
建议我通过 ¬A
和 A ∨ B
生成 ⊥ ∨ B
。我想以某种方式将 A ∨ B
中的 A
替换为 ¬A A
,但我认为没有办法这样做。
当尝试将 ∨-identity
案例分析模式应用于 ∨-identity-indirect
时,我收到一条错误消息,指出 A 应该为空,但这对我来说并不明显 - 我假设我需要通过使用 ¬A
.
以某种方式让 Agda 明白这一点
我是在正确的轨道上,还是完全错了?我应该如何编写这个 ∨-identity-indirect
函数?
Suggesting me that I need to produce ⊥ ∨ B
by having ¬A
and A ∨ B
. I'd like to somehow replace A
in A ∨ B
with ¬A A
, but I don't think there's a way of doing so.
When trying to apply the ∨-identity
case analysis pattern to ∨-identity-indirect
, I get an error message that A should be empty, but that's not obvious to me - I assume I need to somehow make this obvious to Agda, by making use of ¬A
.
您可能正在尝试对 ¬ A
类型的值与 ()
进行模式匹配,但这不起作用,因为 ¬ A
扩展为 A -> ⊥
,也就是说,这是一个函数,在你给它一些 A
之后,它只会 return 你 ⊥
。以下是您的操作方法:
replace-A : {A B : Set} → (¬ A) → (A ∨ B) → ⊥ ∨ B
replace-A f (v-left x) = v-left (f x)
replace-A _ (v-right y) = v-right y
有了这个,∨-identity-indirect
就简单了:
∨-identity-indirect : {A B : Set} → (¬ A) ∧ (A ∨ B) → B
∨-identity-indirect ⟨ ¬A , A∨B ⟩ = ∨-identity (replace-A ¬A A∨B)
我是 Agda 的新手,一般来说我也是依赖类型编程和证明助手的新手。我决定开始使用我在 Programming Language Foundations in Agda 中找到的定义来构建简单的直觉逻辑证明,并且我取得了一些成功。然而,当我试图写出以下证明时,我感到困惑:
∨-identity-indirect : {A B : Set} → (¬ A) ∧ (A ∨ B) → B
在纸上证明这一点相当简单:展开 ¬ A
,我们有 A → ⊥
。所以这个语句就等价于(⊥ ∨ B) → B
,这显然是正确的。
我能够成功证明后半部分,即(⊥ ∨ B) → B
:
∨-identity : {A : Set} → (⊥ ∨ A) → A
∨-identity (∨-left ())
∨-identity (∨-right A) = A
然后,我能够写:
∨-identity-indirect ⟨ ¬A , A∨B ⟩ = ∨-identity ?
建议我通过 ¬A
和 A ∨ B
生成 ⊥ ∨ B
。我想以某种方式将 A ∨ B
中的 A
替换为 ¬A A
,但我认为没有办法这样做。
当尝试将 ∨-identity
案例分析模式应用于 ∨-identity-indirect
时,我收到一条错误消息,指出 A 应该为空,但这对我来说并不明显 - 我假设我需要通过使用 ¬A
.
我是在正确的轨道上,还是完全错了?我应该如何编写这个 ∨-identity-indirect
函数?
Suggesting me that I need to produce
⊥ ∨ B
by having¬A
andA ∨ B
. I'd like to somehow replaceA
inA ∨ B
with¬A A
, but I don't think there's a way of doing so. When trying to apply the∨-identity
case analysis pattern to∨-identity-indirect
, I get an error message that A should be empty, but that's not obvious to me - I assume I need to somehow make this obvious to Agda, by making use of¬A
.
您可能正在尝试对 ¬ A
类型的值与 ()
进行模式匹配,但这不起作用,因为 ¬ A
扩展为 A -> ⊥
,也就是说,这是一个函数,在你给它一些 A
之后,它只会 return 你 ⊥
。以下是您的操作方法:
replace-A : {A B : Set} → (¬ A) → (A ∨ B) → ⊥ ∨ B
replace-A f (v-left x) = v-left (f x)
replace-A _ (v-right y) = v-right y
有了这个,∨-identity-indirect
就简单了:
∨-identity-indirect : {A B : Set} → (¬ A) ∧ (A ∨ B) → B
∨-identity-indirect ⟨ ¬A , A∨B ⟩ = ∨-identity (replace-A ¬A A∨B)