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

Dettman Multiplication Arithmetic #1500

Merged
merged 13 commits into from
Dec 6, 2022
Merged

Dettman Multiplication Arithmetic #1500

merged 13 commits into from
Dec 6, 2022

Conversation

OwenConoly
Copy link
Collaborator

This is a part of #1481. It just adds the Dettman multiplication algorithm to the Arithmetic directory.

@OwenConoly OwenConoly force-pushed the dettman-mul-only-arith branch 2 times, most recently from b96724a to 7db96f0 Compare November 13, 2022 19:22
Copy link
Contributor

@andres-erbsen andres-erbsen left a comment

Choose a reason for hiding this comment

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

🎉

All the comments are truly optional, of the kind that I'd purse when trying to make my code look nice but not worry about if they got merged.

@OwenConoly OwenConoly force-pushed the dettman-mul-only-arith branch from 3ad1a1a to e693787 Compare November 14, 2022 07:17
@JasonGross
Copy link
Collaborator

COQC src/Arithmetic/DettmanMultiplication.v
Error: The reference carry_down was not found in the current environment.

@OwenConoly OwenConoly force-pushed the dettman-mul-only-arith branch from e693787 to 94909fe Compare November 14, 2022 14:55
@OwenConoly
Copy link
Collaborator Author

oops
I fixed that error, and I tested it on my machine before pushing this time

@OwenConoly OwenConoly force-pushed the dettman-mul-only-arith branch from 94909fe to 846c5d4 Compare November 21, 2022 05:32
Qed.
Lemma reifiable_existsb_is_existsb : forall (f : X -> bool) (l : list X),
existsb f l = List.existsb f l.
Proof. reflexivity. Qed.
Copy link
Collaborator

Choose a reason for hiding this comment

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

How does this end up being provable by reflexivity?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wasn't expecting it to be! I don't fully understand how Coq represents fixpoints, but apparently it's very good at simplifying them.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess it's probably the case that List.existsb is set up to be fix existsb (A : Type) (l : list A) : bool, and fold_right probably simplifies to something similar. You can check with Print.

@OwenConoly OwenConoly force-pushed the dettman-mul-only-arith branch 2 times, most recently from 3c076f9 to a6b7254 Compare November 21, 2022 06:08
OwenConoly and others added 13 commits December 5, 2022 09:38
…n multiplication algorithm--it now multiplies c by 16, instead of bit-shifting x before multiplying by c, as before. Defined and proved a term-collecting function for numbers in associative representation. The mulmod function now uses the term-collection function. With term collection, the mulmod function now appears to have been defined properly. Refactored, putting mulmod function, generalized mulmod function, and helper functions in separate files.
…sly, there was a reification error). Compiling general version now outputs identical C code to compiling specific version.
…ized mulmod algorithm--compiling to C with 9-limb representation for multiplication modulo 2^512 - 569.
…cation algorithm fails to compile to Bedrock2 for some reason.
…dded automatic limb number, limb width inference to cli.
@JasonGross JasonGross force-pushed the dettman-mul-only-arith branch from a6b7254 to d5eb3cd Compare December 5, 2022 14:38
@JasonGross
Copy link
Collaborator

I've rebased. Is this ready for merge?

@OwenConoly
Copy link
Collaborator Author

Yes!

@OwenConoly
Copy link
Collaborator Author

OwenConoly commented Dec 5, 2022

Do we want to just merge, or to rebase and merge?
I'm just referring to the the options in the dropdown menu for the "Merge pull request" button.
Or should it not matter?

@andres-erbsen
Copy link
Contributor

Merge away :) Let's leave these commits grouped in a merge commit as we didn't test the intermediate ones.

@OwenConoly OwenConoly merged commit cf4faa8 into master Dec 6, 2022
@OwenConoly OwenConoly deleted the dettman-mul-only-arith branch December 6, 2022 03:11
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