8000 Added guards for remaining p1cs functions by akitaki79 · Pull Request #1783 · acl2/acl2 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added guards for remaining p1cs functions #1783

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

Open
wants to merge 6 commits into
base: testing-kestrel
Choose a base branch
from

Conversation

akitaki79
Copy link

I also converted nums-to-strings from a constant to a function and added some other proofs to admit the guards for p1cs-coefficient & p1cs-term. These proofs are really inefficient right now, so I will try to get them working faster in the future.

8000 @gjurgensen gjurgensen requested a review from bendyarm June 30, 2025 18:44
@bendyarm
Copy link
Member
bendyarm commented Jul 3, 2025

Converting nums-to-strings from a constant to a function may degrade performance. Can you find a large R1CS (e.g. from this circuit samples directory) and time p1cs on it both with and without the change? Besides the timings, how many times is nums-to-strings called?

If it is important to make it a function, perhaps it should take the prime as an argument and output the appropriate data structure. Then use add-io-pairs to cache the map from prime to data structure for the two current primes, and document how to add a new prime.

@bendyarm
Copy link
Member
bendyarm commented Jul 3, 2025

^^^ @akitaki79

Copy link
Member
@bendyarm bendyarm left a comment

Choose a reason for hiding this comment

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

See above comment.

@ericwhitmansmith
Copy link
Member

Another way to prevent huge constants from showing up in proofs is described in :doc evisc-table. Maybe see also :doc untranslate-patterns.

@gjurgensen
Copy link
Member

Another possibility is defining the nullary function in a make-event such that the computation is done during the macro expansion and not during the function call.

@akitaki79 akitaki79 requested review from gjurgensen and bendyarm July 7, 2025 18:33
@gjurgensen
Copy link
Member

Looks good. One thing -- did you try running this on any large R1CS circuits as Eric suggested? If this change from constant to function doesn't actually cause a slowdown, perhaps we could remove the add-io-pairs caching.

;; This shows there are no collisions:
;; (assert-equal (len *nums-to-strings*) (len (remove-duplicates (strip-cars *nums-to-strings*))))
;;This shows there are no collisions:
;;(assert-equal (len *nums-to-strings*) (len (remove-duplicates (strip-cars *nums-to-strings*))))
Copy link
Member

Choose a reason for hiding this comment

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

This comment should be updated to reflect the other changes. Run the assert-equal to make sure it was updated correctly.

@bendyarm
Copy link
Member
bendyarm commented Jul 8, 2025

Looks good. One thing -- did you try running this on any large R1CS circuits as Eric suggested? If this change from constant to function doesn't actually cause a slowdown, perhaps we could remove the add-io-pairs caching.

The change currently does not "first calculate the constant and then define the function as exactly that constant" (quote from Zulip). As currently structured, it does calculate each constant only once, triggered by add-io-pairs. Maybe better would be to calculate the two constants outside the function and then use those constants in the function. That would obviate the need for the add-io-pairs.

akitaki79 and others added 2 commits July 7, 2025 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
4581 None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0