Skip to content

Conversation

andreasabel
Copy link
Member

@andreasabel andreasabel commented Oct 4, 2024

Issue #7529 demonstrates that --level-universe is not (fully) integrated with --cubical (yet).

In this PR, I expand some catch-alls for sorts to fill in some speculative values for the new sort LevelUniv.
I need some experts to look over this: @arthur-adjedj @plt-amy @mortberg @Saizan @sattlerc

One should probably check the Cubical Agda code for more such matches on sorts, e.g. grep for Type l or getSort.

Related are also:

Commits:

@andreasabel andreasabel added cubical Cubical Agda paraphernalia: Paths, Glue, partial elements, hcomp, transp level-universe labels Oct 4, 2024
@andreasabel andreasabel added this to the 2.8.0 milestone Oct 4, 2024
Prop _ -> pure Nothing
SSet _ -> pure Nothing
Inf _ _ -> pure Nothing
LevelUniv -> pure Nothing
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this matches isCoFibrantSort, we only return Just here for the True cases there: that's when a pi type should support kan operations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it would make sense to tie this code more closely to isCofibrantSort (or at least to add some documentation of the connection).

IntervalUniv -> noTranspSort
Prop{} -> noTranspSort
_ -> noTranspError b'
LevelUniv -> noTranspSort
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as the rest, yes.

Univ _ _ -> pure Nothing
Inf _ _ -> pure Nothing
IntervalUniv -> pure Nothing
LevelUniv -> pure Nothing
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct?

Prop _ -> pure Nothing
Inf _ _ -> pure Nothing
IntervalUniv -> pure Nothing -- ClosedType? (See comment on CType.)
LevelUniv -> pure Nothing -- TODO: Or some ClosedType?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, actually IntervalUniv should have the check that's at SSet atm. I suppose that got overlooked when IntervalUniv got introduced. OTOH it seems then that the whole ClosedType thing might not actually be needed then.

I think it was meant to support path constructors for HITs, but those needed special care anyway?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I raised this as #7542.

@andreasabel andreasabel changed the title Fix #7529 Fix #7529: treat LevelUniv in Cubical Agda Oct 4, 2024
@arthur-adjedj
Copy link
Contributor

arthur-adjedj commented Oct 4, 2024

I have not dived into the issue, but from what I remember, there already were some known issues with regards to mixing --level-universe and --cubical. In particular, Cubical.agda does not use --level-universe. According to @plt-amy at the time, adding the (IUniv, LevelUniv, LevelUniv) PTS rule should not be problematic. If a full compatibility between the two pragmas is desirable, adding the rule and making it so that cubical.agda does compile with --level-universe might be worth looking into.

_ -> noTranspError (Abs "i" (unDom t))
t <- open $ Abs "i" (unDom t)
Univ UType l -> Just <$> open (lam_i (Level l))
Univ _ _ -> pure Nothing
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change of the behavior for Prop (from exception to Nothing) makes the failing test for #6060 pass.
However the test passes when we have Propω instead of Prop, see #7535.

Shouldn't Prop be treated like SSet here? If not, why not?
I think this case distinction deserves a comment on what the intended behavior is on a higher level, in particular, when to return Nothing and when to throw an exception.
It also feels this should not be an adhoc pattern matching, but a function to be called with a proper documentation. There are similar matches allover the Cubical Agda code base.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am now distinguishing UProp for both Univ and Inf, erroring out rather than returning Nothing.
This fixes the regressions for #6060 and #7535.

Fixes #7529 by speculating values for LevelUniv in Cubical Agda fibrancy.
Also fixes #7535 by treation Prop\omega like Prop.
@andreasabel andreasabel self-assigned this Oct 7, 2024
@andreasabel andreasabel marked this pull request as ready for review October 7, 2024 08:54
@andreasabel andreasabel merged commit f2baffb into master Oct 7, 2024
27 checks passed
@andreasabel andreasabel deleted the leveluniv-cubical branch October 7, 2024 09:33
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 level-universe
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in 2.6.4: Agda thinks large propositions can be transported Strange problem with --level-universe and --cubical
4 participants