Skip to content

proof-libs/lean Add a coercion for unit#1618

Closed
clementblaudeau wants to merge 1 commit intomainfrom
proof-lib/lean-add-unit-coercion
Closed

proof-libs/lean Add a coercion for unit#1618
clementblaudeau wants to merge 1 commit intomainfrom
proof-lib/lean-add-unit-coercion

Conversation

@clementblaudeau
Copy link
Copy Markdown
Contributor

@clementblaudeau clementblaudeau commented Aug 25, 2025

This PR adds a coercion: hax_Tuple0 can be coerced into a Result hax_Tuple0, used when translating a unit in a return position. It should fix: https://hax-playground.cryspen.com/#lean/latest-main/gist=1494268f2d5e4dafc2a2b78b99df3d3f

@clementblaudeau clementblaudeau requested a review from a team as a code owner August 25, 2025 09:21
@clementblaudeau clementblaudeau requested a review from W95Psp August 25, 2025 09:21
@clementblaudeau clementblaudeau changed the title Add a coercion for unit and for results of nats. Add a coercion for unit and an instance of OfNat for results of nats. Aug 25, 2025
@clementblaudeau clementblaudeau changed the title Add a coercion for unit and an instance of OfNat for results of nats. proof-libs/lean Add a coercion for unit Aug 25, 2025
@clementblaudeau clementblaudeau marked this pull request as draft August 25, 2025 09:26
@clementblaudeau clementblaudeau force-pushed the proof-lib/lean-add-unit-coercion branch from 94de949 to 1ed4418 Compare August 25, 2025 09:27
@clementblaudeau clementblaudeau marked this pull request as ready for review August 25, 2025 09:27
Copy link
Copy Markdown
Contributor

@W95Psp W95Psp left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good, but why is that not polymorphic, and also, this should go away if the backend inserts pure nodes in a smart way, right?

@clementblaudeau
Copy link
Copy Markdown
Contributor Author

This issue is a bit orthogonal to the smart insertion of pure : it comes from the fact that hax_Tuple0 is used both as a type and a term of that type.

@W95Psp
Copy link
Copy Markdown
Contributor

W95Psp commented Aug 25, 2025

I see, that's a (OCaml) engine bug, right?
Let's file an issue to fix that, so that you can mention it there in the fix.
(we should revert this PR whenever that issue is fixed)

@clementblaudeau
Copy link
Copy Markdown
Contributor Author

It might be better to treat this with a proper resugaring phase. I'm moving it to draft in the meantime

@clementblaudeau clementblaudeau marked this pull request as draft August 25, 2025 15:04
@clementblaudeau
Copy link
Copy Markdown
Contributor Author

This came from a confusion in name rendering between the constructor of a struct and its type. Fixed by #1624

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