jellyfish
jellyfish copied to clipboard
[Constraint] Introduce ConstraintSystemReference idea for friendly API
From @zhenfeizhang in https://github.com/EspressoSystems/jellyfish/pull/94#issuecomment-1209379869
In general I want to advocate my "circuit ref" idea. For example
struct BoolVar<'a> { index: Variable, cs: &'a ConstraintSystem }
On top of overloading operators here are some additional thoughts:
- to access the variable, we should use an API
get_index(&self)->Variable
-- i think it is a bit cleaner thaninto()
- it makes more sense to me to implement Into/From for
Vec<BoolVar>
andVariable
, in both directions, which are binary (de)composition- to create new variables we should use associated function
BoolVar::new(cs: &ConstraintSystem, value: bool)
rather thanCircuit::create_bool_variable(...)
and so on...- to check variable bound we can simply call
bool_var.check_bound()
, and we do not need to pass parameters
- [ ] add CSRef for
BoolVar
- [ ] add CSRef for
PointVar
- [ ] add CSRef for
Variable