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

Slot allocation of bit decomposition #738

Merged
merged 5 commits into from
Oct 16, 2023
Merged

Slot allocation of bit decomposition #738

merged 5 commits into from
Oct 16, 2023

Conversation

gabriel-barrett
Copy link
Member

This PR replaces slot allocation for "less-than" operations with slot allocation for bit decomposition.
Slot allocating bit decomposition allows us to reuse bit decomposition in truncate operations, leading to 1k less constraints/auxiliaries

Copy link
Member

@arthurpaulino arthurpaulino left a comment

Choose a reason for hiding this comment

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

Thanks a lot! I added a few commentaries, the main one being about documentation.

src/lem/circuit.rs Outdated Show resolved Hide resolved
src/lem/circuit.rs Outdated Show resolved Hide resolved
src/lem/circuit.rs Show resolved Hide resolved
src/lem/circuit.rs Outdated Show resolved Hide resolved
src/lem/eval.rs Outdated Show resolved Hide resolved
src/lem/slot.rs Outdated Show resolved Hide resolved
Copy link
Member

@arthurpaulino arthurpaulino left a comment

Choose a reason for hiding this comment

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

This is ok by me, but let's wait for more reviews

);
}
let AllocatedVal::Boolean(lt) = lt else { panic!("Expected boolean") };
// To find out whether a < b, we will use the following reasoning:
Copy link
Contributor

Choose a reason for hiding this comment

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

@gabriel-barrett Since I have you here, perhaps you'd care to give a review to #563 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

My point being that it informs details and limitations of the less_than semantics.

Copy link
Contributor

Choose a reason for hiding this comment

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

and I've added the final comparison to these tests.

@gabriel-barrett gabriel-barrett marked this pull request as draft October 12, 2023 16:45
@gabriel-barrett gabriel-barrett marked this pull request as ready for review October 12, 2023 16:55
huitseeker added a commit to huitseeker/lurk-rs that referenced this pull request Oct 16, 2023
Copy link
Contributor

@huitseeker huitseeker left a comment

Choose a reason for hiding this comment

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

This LGTM, thanks a bunch!

);
}
let AllocatedVal::Boolean(lt) = lt else { panic!("Expected boolean") };
// To find out whether a < b, we will use the following reasoning:
Copy link
Contributor

Choose a reason for hiding this comment

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

and I've added the final comparison to these tests.

@huitseeker huitseeker added this pull request to the merge queue Oct 16, 2023
@@ -55,56 +49,56 @@ impl<F: LurkField> VarMap<Val<F>> {
}

#[derive(Clone, Debug, Default)]
/// `Preimages` hold the non-deterministic advices for hashes and `Func` calls.
/// `Advices` hold the non-deterministic advices for hashes and `Func` calls.
Copy link
Contributor

Choose a reason for hiding this comment

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

Advices is a bit of an awkward formulation. Maybe this could be Hints?

Copy link
Contributor

@porcuquine porcuquine left a comment

Choose a reason for hiding this comment

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

Looks good, but please see naming suggestion.

Merged via the queue into master with commit f88060f Oct 16, 2023
9 checks passed
@huitseeker huitseeker deleted the lem-bitdecomp branch October 16, 2023 22:16
huitseeker added a commit to huitseeker/lurk-rs that referenced this pull request Nov 7, 2023
huitseeker added a commit to huitseeker/lurk-rs that referenced this pull request Nov 8, 2023
huitseeker added a commit to huitseeker/lurk-rs that referenced this pull request Nov 8, 2023
github-merge-queue bot pushed a commit that referenced this pull request Nov 10, 2023
* test: Enhance `Num<Fr>` testing

- Enhanced property testing coverage and introduced new tests for `U64` and `Scalar` types.
- Provided comprehensive test scenarios including basic operations, assertions, checking sign, and "lesser" properties.
- Improved coverage for scalars and u64, encompassing overflow/underflow cases and edge conditions.

Closes #52

* refactor: Refine numeric comparison in `prop_lesser` function

- add a direct comparison from #738
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.

Implement slot allocation for bit decomposition
5 participants