noname
noname copied to clipboard
Add Bool type in stdlib
When creating a variable to represent a bool value, we have to make sure it is constrained as a boolean.
For example:
assert_eq(bit * (bit - 1), 0); // where bit is a field variable
To make the code more expressive by itself, we can add a bool type in stdlib to constrain the field variable as a boolean value.
For example:
use std::bits;
let bool = bits::Bool::new(1); // the new method should also constrain the argument value.
This Bool type can be an addition to the existing std::bits stdlib module.
Related: https://github.com/zksecurity/noname/pull/201#discussion_r1813111834
To make it distinguishable from TyKind::Bool (mentioned here as well: https://github.com/zksecurity/noname/pull/201#discussion_r1813111834 ). Would it make sense to have bits::Bit::new(1); instead of bits::Bool::new(1);?