Skip to content

feat: Remove Type eliminates to any sort by default#21453

Open
TDiazT wants to merge 5 commits intorocq-prover:masterfrom
TDiazT:remove-type-to-sorts
Open

feat: Remove Type eliminates to any sort by default#21453
TDiazT wants to merge 5 commits intorocq-prover:masterfrom
TDiazT:remove-type-to-sorts

Conversation

@TDiazT
Copy link
Contributor

@TDiazT TDiazT commented Dec 23, 2025

This PR depends on #21417 .

This PR removes the default behavior of Type eliminating to any sort.

Associated RFC : rocq-prover/rfcs#111.


  • Added / updated test-suite.
  • Added changelog.
  • Added / updated documentation.
  • Opened overlay pull requests.

@coqbot-app coqbot-app bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Dec 23, 2025
@SkySkimmer
Copy link
Contributor

Why?

@JasonGross
Copy link
Member

Right now we have eq in Type implies eq in SProp, and not the other way around.
Is this PR going to allow the possibility of reversing this, so that we can have a nonfibrant sort with univalence and a variant of SProp that can be treated to some extent as reflecting judgmental equality? (Or do we already have that possibility, so long as we don't say that Type is the fibrant sort?)

@thomas-lamiaux
Copy link
Contributor

I do imagine we would want to keep Type -> Prop / SProp but potentially not for any fresh shorts we would add ?
I don't think there are much SortPoly code out there that would rely on Type eliminating to every sort, so it should be fine

@tabareau
Copy link
Contributor

@coqbot run full ci

@coqbot-app coqbot-app bot removed the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Dec 24, 2025
@tabareau
Copy link
Contributor

Why?

Type eliminates to any sort is an unnecessary constraint. In particular, it is not compatible with a more general mechanism for erasure/extraction that @jrosain is working on.

@tabareau
Copy link
Contributor

Right now we have eq in Type implies eq in SProp, and not the other way around. Is this PR going to allow the possibility of reversing this, so that we can have a nonfibrant sort with univalence and a variant of SProp that can be treated to some extent as reflecting judgmental equality? (Or do we already have that possibility, so long as we don't say that Type is the fibrant sort?)

Indeed, the idea for adding a univalent sort would rather be "don't say that Type is the fibrant sort". Note that the fact that equality in SProp can be eliminated to other sorts (as in observational type theory) is not an elimination constraint but rather a specific rule for equality which admit a "cast" operator that can be used to emulate J/elimination of equality.

@TDiazT TDiazT force-pushed the remove-type-to-sorts branch from 85151a7 to 8596187 Compare January 6, 2026 14:39
@coqbot-app coqbot-app bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Jan 6, 2026
@github-actions github-actions bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jan 8, 2026
@TDiazT TDiazT force-pushed the remove-type-to-sorts branch from 0d54c1b to 604730b Compare January 10, 2026 11:33
@coqbot-app coqbot-app bot removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jan 10, 2026
@TDiazT TDiazT force-pushed the remove-type-to-sorts branch from 604730b to 50b74a1 Compare January 10, 2026 17:37
@SkySkimmer
Copy link
Contributor

Does this interact properly with nested schemes (#21429 etc)?

With nested schemes the _all scheme puts arbitrary sort data in a Type, eg prod_all:

Inductive prod_all@{sPA sPB;+} A (PA:A -> Type@{sA;_}) B (PB:B -> Type@{sB;_}) : Type :=
  pair_all a (_:PA a) b (_:PB b) : prod_all A PA B PB (pair a b).

for scheme generation we don't actually eliminate it, but when we want to use the scheme we will want to eliminate it and typically expect prod_all A PA _ _ (x,y) -> PA x to hold.

@thomas-lamiaux
Copy link
Contributor

thomas-lamiaux commented Jan 14, 2026

ind_all is in the same sort as the sort of ind so that it is possible to prove ind_all_forall.
This could be generalised once sort constrains PR are fully merged

@github-actions github-actions bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jan 15, 2026
@TDiazT
Copy link
Contributor Author

TDiazT commented Jan 15, 2026

Does this interact properly with nested schemes (#21429 etc)?

With nested schemes the _all scheme puts arbitrary sort data in a Type, eg prod_all:

Inductive prod_all@{sPA sPB;+} A (PA:A -> Type@{sA;_}) B (PB:B -> Type@{sB;_}) : Type :=
  pair_all a (_:PA a) b (_:PB b) : prod_all A PA B PB (pair a b).

for scheme generation we don't actually eliminate it, but when we want to use the scheme we will want to eliminate it and typically expect prod_all A PA _ _ (x,y) -> PA x to hold.

I don't know, but at a first glance it seems like it would conflict and that someone (?) would need to add the Type -> sB constraint in the eliminator (if I'm understanding correctly)

@TDiazT TDiazT force-pushed the remove-type-to-sorts branch from 50b74a1 to e59364d Compare January 15, 2026 23:28
@coqbot-app coqbot-app bot removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jan 15, 2026
@tabareau
Copy link
Contributor

Does this interact properly with nested schemes (#21429 etc)?
With nested schemes the _all scheme puts arbitrary sort data in a Type, eg prod_all:

Inductive prod_all@{sPA sPB;+} A (PA:A -> Type@{sA;_}) B (PB:B -> Type@{sB;_}) : Type :=
  pair_all a (_:PA a) b (_:PB b) : prod_all A PA B PB (pair a b).

for scheme generation we don't actually eliminate it, but when we want to use the scheme we will want to eliminate it and typically expect prod_all A PA _ _ (x,y) -> PA x to hold.

I don't know, but at a first glance it seems like it would conflict and that someone (?) would need to add the Type -> sB constraint in the eliminator (if I'm understanding correctly)

No as @thomas-lamiaux was saying, we fix the return sort of prod_all to be the same as the one of prod, not necessarily Type. So we use reflexivity of elimination constraints.

@github-actions github-actions bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jan 16, 2026
@TDiazT TDiazT force-pushed the remove-type-to-sorts branch from b248865 to 3611d16 Compare January 17, 2026 17:51
@coqbot-app coqbot-app bot removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jan 17, 2026
@coqbot-app coqbot-app bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jan 28, 2026
@TDiazT TDiazT force-pushed the remove-type-to-sorts branch from bd12644 to 056f4e6 Compare January 28, 2026 15:23
@coqbot-app coqbot-app bot removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Jan 28, 2026
@TDiazT TDiazT force-pushed the remove-type-to-sorts branch from 056f4e6 to ba188e6 Compare January 28, 2026 15:34
@TDiazT TDiazT marked this pull request as ready for review January 28, 2026 15:50
@TDiazT TDiazT requested review from a team as code owners January 28, 2026 15:50
@SkySkimmer SkySkimmer added this to the 9.3+rc1 milestone Jan 28, 2026
@SkySkimmer
Copy link
Contributor

@coqbot run full ci

@coqbot-app coqbot-app bot removed the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Jan 28, 2026
@@ -0,0 +1,4 @@
- **Changed:**
`Type` does not eliminate to any sort by default
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`Type` does not eliminate to any sort by default
`Type` does not eliminate to every sort by default

? it still eliminates to Prop & SProp right?

@TDiazT TDiazT force-pushed the remove-type-to-sorts branch from ba188e6 to 406aa96 Compare January 30, 2026 13:28
@TDiazT TDiazT requested a review from a team as a code owner January 30, 2026 13:28
@coqbot-app coqbot-app bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Jan 30, 2026
@TDiazT TDiazT force-pushed the remove-type-to-sorts branch from 406aa96 to d6777bb Compare January 30, 2026 13:44
fix: Update to have dominance check not be done on same quality

Notably, dominance updates between sort variables were not checking
if the variables were the same. If both were the same and they were
not dominated (e.g. when removing the default Type->s constraint),
then it would loop because it would postpone the dominance check.
It really doesn't make sense though to update the dominance of a
sort variable when adding the reflexive elimination constraint.
The dominant will be the same in both cases, and if there is none,
then it will be dominated eventually when checking with other sorts.
fix: Add Type->s to MaybeSquashed
@TDiazT TDiazT force-pushed the remove-type-to-sorts branch from d6777bb to 72ff7ad Compare January 30, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants