问题
In the following Agda code, I have one hole with some potential filling; alas, the filling doesn't typecheck. It seems to fulfill all the constraints Agda shows, so I'd like to know where I could find what other, invisible constraints there are.
{-# 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)
So in the hole on the right-hand side of the elimIntoProp (rename n m x i)
clause, if I ask Agda to show me the goal and the type, it shows me a matching type and it shows me boundary conditions that transport-filler
should satisfy:
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
At i = i0
, we have transport-filler Pt≡Ps Pt i0
which should be Pt
defined as P₀ n x
, and at i = i1
we have Ps
which is defined as P₀ m x
. So it seems that we're good.
Yet when I try to replace the hole with its contents, I get a type error:
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
Where does this constraint come from and how do I show this (and similar ones) in the goal-and-context
window during editing?
回答1:
transport-filler Pt≡Ps Pt i1
is not Ps
though, you can see it by asking for the normal form:
transp (λ i₁ → P (rename n m x i₁)) i0 (P₀ n x)
so the constraint being violated is indeed the one from the boundary.
(Other relevant constrains might show up below the context, but in this case they are just the boundary again.)
来源:https://stackoverflow.com/questions/63265516/how-do-i-find-further-constraints-than-boundary-conditions