Skip to content

Dependent types Mechanization backend#215

Draft
DCupello1 wants to merge 3 commits into
mainfrom
exp-dep-backend
Draft

Dependent types Mechanization backend#215
DCupello1 wants to merge 3 commits into
mainfrom
exp-dep-backend

Conversation

@DCupello1
Copy link
Copy Markdown

@DCupello1 DCupello1 commented Feb 10, 2026

This is an experimental branch that does the following:

  • Introduces a new pass, "subdep" that combines "sub" and "sub expansion" with the "sub expansion" step made even bigger by expanding relation rules, type cases, and function clauses whenever there is a sub type expression present in a type family's arguments. This allows the validation to be able to reduce these type families and show that they are in fact equivalent.
  • Fix on the evaluator that was removing CvtE whenever it failed to convert a numtyp to another.
  • Fix on sub pass that did not preserve dependent types correctly in projection functions.
  • Fix on improveids in order to aid the evaluator when modifying the environment per definition.

Currently a draft until we figure out testing in this case.

Comment thread spectec/src/il/eval.ml Outdated
(match Num.cvt nt2 n with
| Some n' -> NumE n' $> e
| None -> e1'
| None -> CvtE (e1', _nt1, nt2) $> e
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@rossberg quick question on this change.

This makes the frontend fail with this issue:

[valid_exp] x
test.spectec:197.30-197.31: validation error: expression's type `val($pppp((3 : nat <:> int), (4 : nat <:> int)))` = `val($pppp(+3, +4))` does not equal expected type `val((7 : nat <:> int))` = `val(+7)`

Which feels like it should not fail since it is able to convert successfully. Do you might know why this would happen?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah, this looks like a sensible bug fix. This causes failure because it was masking another bug, which is that match_exp is missing a case for handling CvtE.

I just pushed a fix.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants