Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module fails to type check after parametrising it by postulates #4365

Closed
bafain opened this issue Jan 9, 2020 · 4 comments
Closed

Module fails to type check after parametrising it by postulates #4365

bafain opened this issue Jan 9, 2020 · 4 comments
Assignees
Labels
cubical Cubical Agda paraphernalia: Paths, Glue, partial elements, hcomp, transp type: enhancement Issues and pull requests about possible improvements
Milestone

Comments

@bafain
Copy link
Contributor

bafain commented Jan 9, 2020

In the following Agda code, module M2 is obtained by parametrising module M1 by what it postulates.

{-# OPTIONS --cubical #-}
module Issue where

open import Agda.Primitive.Cubical
open import Agda.Builtin.Cubical.Path

module M1 where
  postulate A : Set; a a' b b' : A; α : a ≡ a'; β : b ≡ b'; p : a ≡ b

  p' l : a' ≡ b'
  p' = primTransp (λ j  α j ≡ β j) i0 p
  l  = λ i  primHComp (λ { j (i = i0)  α j ; j (i = i1)  β j }) (p i)

  -- SUCCEEDS:
  _ : p' ≡ l
  _ = λ _  p'

module M2 (A : Set) (a a' b b' : A) (α : a ≡ a') (β : b ≡ b') (p : a ≡ b) where
  p' l : a' ≡ b'
  p' = primTransp (λ j  α j ≡ β j) i0 p
  l  = λ i  primHComp (λ { j (i = i0)  α j ; j (i = i1)  β j }) (p i)

  -- FAILS:
  -- _ : p' ≡ l
  -- _ = λ _ → p'
  -- 
  -- `transp` for `_≡_ {A} = PathP (λ _ → A)` computes in terms of
  -- `comp` for `λ _ → A` which computes in terms of (`hcomp` for `A`
  -- and) `transp` for `λ _ → A` which is not the identity in general.

Module M1 type checks but module M2 fails to type check and Agda (version 2.6.1-ab2cd05) makes the following complaint:

primTransp (λ i → A) i
(primPOr i0 (primIMax (primINeg i0) i0) (λ .o → p i0)
 (primPOr (primINeg i0) i0 (λ _ → α i) (λ _ → β i)) _)
[= primTransp (λ i → A) i (α i)]
!= α i of type A

Is this behaviour expected?

@nad
Copy link
Contributor

nad commented Jan 9, 2020

I don't know, but postulates and variables are not treated in exactly the same way, because variables can be instantiated, whereas postulates cannot.

@Saizan Saizan added the cubical Cubical Agda paraphernalia: Paths, Glue, partial elements, hcomp, transp label Jan 23, 2020
@Saizan Saizan self-assigned this Jan 23, 2020
@Saizan
Copy link
Contributor

Saizan commented Jan 23, 2020

When A is a postulate we assume transp is the identity, this works well for String, Int and such other builtins.

It also makes sense if you think of postulates as global axioms: a fibrant type in a closed context might as well have transp be the identity.

In practice I also use postulates to sketch something and then turn it into parameters later, so I agree this is a bit confusing.

Maybe only postulates connected to a builtin should behave this way?

@WolframKahl
Copy link
Member

I'd say that postulates are parameters that just happen to be declared in a way that makes it impossible to actually supply them.

So it makes sense to make postulates otherwise behave like parameters.

@jespercockx jespercockx added the type: enhancement Issues and pull requests about possible improvements label May 22, 2020
@jespercockx jespercockx added this to the 2.6.2 milestone May 22, 2020
@Saizan Saizan modified the milestones: 2.6.2, 2.6.3 Feb 8, 2021
@jespercockx
Copy link
Member

@Saizan Are you still planning to fix this before the release? If not, please bump it to 2.6.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cubical Cubical Agda paraphernalia: Paths, Glue, partial elements, hcomp, transp type: enhancement Issues and pull requests about possible improvements
Projects
None yet
Development

No branches or pull requests

5 participants