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

Support sums in div witgen #2464

Closed
wants to merge 1 commit into from
Closed

Conversation

Schaeff
Copy link
Collaborator

@Schaeff Schaeff commented Feb 7, 2025

Division witgen expects a pattern like dividend = divisor * quotient + remainder (where the two terms on the rhs can also be swapped).
This works when quotient and remainder are witness columns, but fails when they are intermediate columns.

Extend division witgen to support a pattern of the form:

dividend = sum_n(divisor * (limb_size ** i) * quotient_i) + sum_n((limb_size ** i) * remainder_i)

This enables in particular solving:

12 = 3 * SimpleDiv::X_b1 + 768 * SimpleDiv::X_b2 + SimpleDiv::R_b1 + 256 * SimpleDiv::R_b2

Some(
let quotient_value = dividend.to_arbitrary_integer() / divisor.to_arbitrary_integer();
println!("Quotient: {quotient_value}");
let limb_size_bits = limb_size_bits.ok_or("No limb size")?;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The original case where there's a single limb is not implemented yet

@Schaeff Schaeff mentioned this pull request Feb 10, 2025
1 task
@Schaeff
Copy link
Collaborator Author

Schaeff commented Feb 10, 2025

Closing for now as we can instead amend the div test in #2425

@Schaeff Schaeff closed this Feb 10, 2025
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.

1 participant