Skip to content

Panic: Pattern match failure with Setω and --without-K #6005

Closed

Description

@flupe

There seem to be a regression in the current master of Agda.

The following code (where we define the equality type at Setω)

{-# OPTIONS --without-K #-}

open import Agda.Builtin.Equality
open import Agda.Primitive using (Setω)

data _≡ω_ {A : Setω} (x : A) : A → Setω where
  refl : x ≡ω x

congω : {A : Set} {B : Setω} (f : A → B)
      → ∀ {x y} → x ≡ y → f x ≡ω f y
congω f refl = refl

fails with the following message:

cong.agda:11,1-20
Panic: Pattern match failure in do expression at
src/full/Agda/TypeChecking/Primitive/Cubical.hs:2310:7-21
when checking the definition of congω

Can confirm this typechecks fine with the latest release (2.6.2.2) and with --with-K.

Activity

  1. flupe commented on Aug 3, 2022

    @flupe
    ContributorAuthor

    Just noticed the code fails at the same place as #6001. I also logged the types passed to toLType, giving:

    toLType @14 ≡ @11 @0
    toLType @14 ≡ @11 @0
    toLType @13 ≡ @10 @0
    toLType @13 ≡ @10 @0
    toLType @11 @10 ≡ω @11 @9
    

    As expected, the code fails because toLType does not handle things that live in Setω, just as for Prop (See #5816 and the fix #5897). I tried checking the example with the fix from #5897 and it no longer fails, so we can consider this issue to also be fixed by #5897.

  2. added
    type: bug
    cubical
    internal-error
    on Aug 15, 2022
  3. added
    regression on master
    on Aug 23, 2022
  4. added this to the 2.6.3 milestone on Aug 23, 2022
  5. added
    set-omega
    on Aug 23, 2022
  6. andreasabel commented on Aug 29, 2022

    @andreasabel
    Member

    Current error (after #5730 has been improved) is more benign:

    Cannot generate inferred clause for congω. Case to handle:
      congω f
        (Agda.Primitive.Cubical.primHComp {.Agda.Primitive.lzero}
           {.(_ ≡ _)}
           {φ = φ}
           u
           a)
    Cannot compose with type family: f x ≡ω f y.
    when checking the definition of congω
    
  7. plt-amy commented on Aug 31, 2022

    @plt-amy
    Contributor

    Part of #6049, still an internal error to be fixed

  8. self-assigned this
    on Aug 31, 2022
  9. stschaef commented on Nov 28, 2025

    @stschaef

    @plt-amy

    The message of 2b4be2c reads

    Closes #5816 and closes #6005: since cubical stuff is not generated when
    just --without-K is specified, the examples there no longer panic. (They
    don't panic with --cubical anymore either, but that's slightly beside
    the point)

    When compiling with Agda 2.8.0 the code

    open import Agda.Builtin.Equality
    open import Agda.Primitive using (Setω)
    
    data _≡ω_ {A : Setω} (x : A) : A → Setω where
      refl : x ≡ω x
    
    congω : {A : Set} {B : Setω} (f : A → B)
          → ∀ {x y} → x ≡ y → f x ≡ω f y
    congω f refl = refl
    

    gives the following error

    error: [CannotGenerateHCompClause]
    Cannot generate hcomp clause at type @7 @6 ≡ω @7 @5
    when checking the definition of congω
    

    when compiled with --cubical or --cubical-compatible. You mention that the previous commit fixing panics with --cubical was beside the point, so I'm not sure if this is actually a regression or if this is to be expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cubicalinternal-errorregression on masterset-omegatype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions