Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HB does not preserve the name of implicit arguments #455

Open
silene opened this issue Oct 25, 2024 · 5 comments
Open

HB does not preserve the name of implicit arguments #455

silene opened this issue Oct 25, 2024 · 5 comments

Comments

@silene
Copy link

silene commented Oct 25, 2024

From HB Require Import structures.

HB.mixin Record IsAddComoid A := { zero : A }.
HB.structure Definition AddComoid := { A of IsAddComoid A }.

About zero.
(* zero : forall {s : AddComoid.type}, s *)

Note how the implicit argument of zero is named s instead of A. This makes it a bit tedious to port developments. Here is an example of an actual modification I had to make to avoid depending on the automatically generated identifier:

-change Rmult with (scal (V := R)).
+change Rmult with (@scal _ R).

(I could also have written Arguments scal K V : rename. But I do not want to perform such a command for all the symbols of the hierarchy.)

@gares
Copy link
Member

gares commented Oct 25, 2024

I see your point, but both A in your directives denote the carrier of what HB called s, eg AddComoid.sort s, so it not really about preserving a name, but rather using one as a good default.

I don't if we have a better pattern for writing @scal _ R in mathcomp, since we surely don't rely on the s name.
I suspect R should be inferred by a CS inference if you unify Rmult with @scal _ _ (and change should do it).
Does rewrite -[Rmult]/(@scal) work?

@CohenCyril
Copy link
Member

We must indeed honor the name given by HB.structure

@CohenCyril
Copy link
Member

Actually naming is not really stable by operator transfer from one structure to another :-/ so I'm not sure how to handle this in a backward compatible way...

@gares
Copy link
Member

gares commented Oct 25, 2024

Let's first see if the use case for making the name part of the "API" is motivated by the tactic language or not.

@silene
Copy link
Author

silene commented Oct 25, 2024

No, using rewrite -[Rmult]/scal (as well as @scal variants) does not work any better than change Rmult with (@scal _ R), since the "fold pattern scal does not match redex Rmult". I have to use rewrite -[Rmult]/(@scal _ R).

That said, you are at least right that, e.g., rewrite -[Rminus]/minus works better than change Rminus with minus. But in the case of scal, the relation with Rmult is not that canonical.

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

No branches or pull requests

3 participants