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

Lookup abstracted terms using unification #109

Merged
merged 2 commits into from
Jan 22, 2025
Merged

Conversation

Tragicus
Copy link
Contributor

When quote.ring finds a term that it can not translate, it looks it up in a list of terms it has already abstracted and if it does not find it adds it to the list. This is not robust to composition of coercions however, since it uses equality of terms instead of unification.

@pi8027
Copy link
Member

pi8027 commented Jan 22, 2025

In my opinion, it has to be done by keyed matching: we first compare the head symbols, and perform conversion only when the head symbols are the same. I also wish to have a mechanism to cache the results of conversion. See #18.

@pi8027
Copy link
Member

pi8027 commented Jan 22, 2025

Error: Failed to get sources of coq-mathcomp-algebra.2.2.0, coq-mathcomp-character.2.2.0, coq-mathcomp-field.2.2.0, coq-mathcomp-fingroup.2.2.0, coq-mathcomp-solvable.2.2.0, coq-mathcomp-ssreflect.2.2.0 (https://github.com/math-comp/math-comp/archive/mathcomp-2.2.0.tar.gz): Bad checksum

Is this one of the unexpected consequences of what we did this morning? @CohenCyril

@Tragicus
Copy link
Contributor Author

I would not think it is on the critical path for performance, this is only for terms that can not be translated, and I would have thought that the costlier part is the decision procedure. Do we have any benchmark?

@pi8027
Copy link
Member

pi8027 commented Jan 22, 2025

Do we have any benchmark?

examples/from_sander.v and Apery.

@pi8027
Copy link
Member

pi8027 commented Jan 22, 2025

According to https://inria.hal.science/hal-00984057v1/, one call of ring in Apery handles 18,602 occurrences of variables. If there are 10 variables, we probably call coq.unify-eq about 100,000 times.

@Tragicus
Copy link
Contributor Author

+3% in from_sanders.v

@CohenCyril
Copy link
Member

Error: Failed to get sources of coq-mathcomp-algebra.2.2.0, coq-mathcomp-character.2.2.0, coq-mathcomp-field.2.2.0, coq-mathcomp-fingroup.2.2.0, coq-mathcomp-solvable.2.2.0, coq-mathcomp-ssreflect.2.2.0 (https://github.com/math-comp/math-comp/archive/mathcomp-2.2.0.tar.gz): Bad checksum

Is this one of the unexpected consequences of what we did this morning? @CohenCyril

Yes, most probably, so I revert for now

@Tragicus
Copy link
Contributor Author

Tragicus commented Jan 22, 2025

Would that be better (+1% in from_sanders.v)? Unfortunately, I can not test if it solves my issue, so I can not be absolutely sure, but I would be very surprised it does not. Nevermind, I could test it and it works.

@pi8027
Copy link
Member

pi8027 commented Jan 22, 2025

+1% sounds ok for me. What about Apery? (I suggest to insert time before the three heavy calls of ring field. There are two in the recAperyB lemma and one in the P_eq_Delta_Q lemma.)

Copy link
Member

@pi8027 pi8027 left a comment

Choose a reason for hiding this comment

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

Looks ok to me. Performance evaluation is needed.

@Tragicus
Copy link
Contributor Author

I get +.1%, -1% and -2% for the three field; ring_lia that are marked as slow in ops_for_b.v.

@pi8027
Copy link
Member

pi8027 commented Jan 22, 2025

FTR: I still wish to see the overall performance change of Apery. To do so, you probably need to use Coq 8.20.

@Tragicus
Copy link
Contributor Author

-.07% on Apery.

@pi8027 pi8027 merged commit a9ce79a into math-comp:master Jan 22, 2025
20 checks passed
@Tragicus Tragicus deleted the mc1256 branch January 22, 2025 14:44
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.

3 participants