0

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?

Cactus
  • 27,075
  • 9
  • 69
  • 149

1 Answers1

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.)

Saizan
  • 1,391
  • 8
  • 4
  • I see, it is not `Ps` even though it is equal to it (by `PIsProp s`). But then, if I have `r : transport-filler Pt≡Ps Pt i1 ≡ Ps`, how can I apply this "right endpoint-rewriting"? I would have hoped I can do `compPath (transport-filler Pt≡Ps Pt) r i`, but then the left endpoint is messed up. – Cactus Aug 07 '20 at 04:39
  • 1
    Btw, to solve the goal you can use: `isOfHLevel→isOfHLevelDep (suc zero) PIsProp Pt Ps (rename n m x) i` – Saizan Aug 10 '20 at 07:58