我如何找到比边界条件更多的约束?
How do I find further constraints than boundary conditions?
在下面的 Agda 代码中,我有一个洞有一些潜在的填充; las,填充不会进行类型检查。它似乎满足了 Agda 显示的所有约束,所以我想知道在哪里可以找到其他不可见的约束。
{-# OPTIONS --cubical #-}
module _ where
open import Cubical.Core.Everything
open import Cubical.Foundations.Everything
open import Cubical.Data.Nat
module UntypedNominalTerms
(A : Type)
where
data Term : Type where
var : ℕ → (x : A) → Term
rename : ∀ n m x → var n x ≡ var m x
trunc : isSet Term
module _ (P : Term → Type) (PIsProp : ∀ x → isProp (P x))
(P₀ : ∀ n X → P (var n X)) where
elimIntoProp : ∀ t → P t
elimIntoProp (var n X) = P₀ n X
elimIntoProp (rename n m x i) = {!transport-filler Pt≡Ps Pt i!}
where
t s : Term
t = var n x
s = var m x
q : t ≡ s
q = rename n m x
Pt : P t
Pt = P₀ n x
Ps : P s
Ps = P₀ m x
Pt≡Ps : P t ≡ P s
Pt≡Ps = λ j → P (q j)
elimIntoProp (trunc t s p q i j) = r (elimIntoProp t) (elimIntoProp s) (cong elimIntoProp p) (cong elimIntoProp q) (trunc t s p q) i j
where
r : isOfHLevelDep 2 P
r = isOfHLevel→isOfHLevelDep (suc (suc zero)) λ t → isOfHLevelSuc 1 (PIsProp t)
所以在 elimIntoProp (rename n m x i)
子句右侧的孔中,如果我要求 Agda 向我展示目标和类型,它会向我展示一个匹配类型并向我展示边界条件transport-filler
应满足:
Goal: P (rename n m x i)
Have: P (rename n m x i)
———— Boundary ——————————————————————————————————————————————
i = i0 ⊢ P₀ n x
i = i1 ⊢ P₀ m x
在 i = i0
,我们有 transport-filler Pt≡Ps Pt i0
,它应该 Pt
定义为 P₀ n x
,在 i = i1
,我们有 Ps
,它定义为 P₀ m x
。这么看来我们还是不错的。
然而,当我尝试用它的内容替换这个洞时,我得到了一个类型错误:
P₁ m x != transp (λ i → Pt≡Ps n m x i1 i) i0 (Pt n m x i1)
of type P₂ (rename n m x i1)
when checking the definition of elimIntoProp
此约束从何而来?如何在编辑期间在 goal-and-context
window 中显示此约束(以及类似约束)?
transport-filler Pt≡Ps Pt i1
虽然不是 Ps
,但您可以通过询问正常形式来查看它:
transp (λ i₁ → P (rename n m x i₁)) i0 (P₀ n x)
所以被违反的约束确实是来自边界的约束。
(其他相关约束可能会出现在上下文下方,但在这种情况下它们又只是边界。)
在下面的 Agda 代码中,我有一个洞有一些潜在的填充; las,填充不会进行类型检查。它似乎满足了 Agda 显示的所有约束,所以我想知道在哪里可以找到其他不可见的约束。
{-# OPTIONS --cubical #-}
module _ where
open import Cubical.Core.Everything
open import Cubical.Foundations.Everything
open import Cubical.Data.Nat
module UntypedNominalTerms
(A : Type)
where
data Term : Type where
var : ℕ → (x : A) → Term
rename : ∀ n m x → var n x ≡ var m x
trunc : isSet Term
module _ (P : Term → Type) (PIsProp : ∀ x → isProp (P x))
(P₀ : ∀ n X → P (var n X)) where
elimIntoProp : ∀ t → P t
elimIntoProp (var n X) = P₀ n X
elimIntoProp (rename n m x i) = {!transport-filler Pt≡Ps Pt i!}
where
t s : Term
t = var n x
s = var m x
q : t ≡ s
q = rename n m x
Pt : P t
Pt = P₀ n x
Ps : P s
Ps = P₀ m x
Pt≡Ps : P t ≡ P s
Pt≡Ps = λ j → P (q j)
elimIntoProp (trunc t s p q i j) = r (elimIntoProp t) (elimIntoProp s) (cong elimIntoProp p) (cong elimIntoProp q) (trunc t s p q) i j
where
r : isOfHLevelDep 2 P
r = isOfHLevel→isOfHLevelDep (suc (suc zero)) λ t → isOfHLevelSuc 1 (PIsProp t)
所以在 elimIntoProp (rename n m x i)
子句右侧的孔中,如果我要求 Agda 向我展示目标和类型,它会向我展示一个匹配类型并向我展示边界条件transport-filler
应满足:
Goal: P (rename n m x i)
Have: P (rename n m x i)
———— Boundary ——————————————————————————————————————————————
i = i0 ⊢ P₀ n x
i = i1 ⊢ P₀ m x
在 i = i0
,我们有 transport-filler Pt≡Ps Pt i0
,它应该 Pt
定义为 P₀ n x
,在 i = i1
,我们有 Ps
,它定义为 P₀ m x
。这么看来我们还是不错的。
然而,当我尝试用它的内容替换这个洞时,我得到了一个类型错误:
P₁ m x != transp (λ i → Pt≡Ps n m x i1 i) i0 (Pt n m x i1)
of type P₂ (rename n m x i1)
when checking the definition of elimIntoProp
此约束从何而来?如何在编辑期间在 goal-and-context
window 中显示此约束(以及类似约束)?
transport-filler Pt≡Ps Pt i1
虽然不是 Ps
,但您可以通过询问正常形式来查看它:
transp (λ i₁ → P (rename n m x i₁)) i0 (P₀ n x)
所以被违反的约束确实是来自边界的约束。
(其他相关约束可能会出现在上下文下方,但在这种情况下它们又只是边界。)