privacy-scaling-explorations / chiquito

DSL for Halo2 circuits
https://docs.pecadorplonkish.xyz/
161 stars 36 forks source link

implemented if expression should be bool rule #256

Closed rutefig closed 3 weeks ago

leolara commented 1 month ago

The test should pass if the expression is a query on a signal that is of type bool. I am not sure if this works with is_arith is_bool

leolara commented 1 month ago

And as oppositte we should not pass if the expression is a signal that is not type bool

rutefig commented 1 month ago

The test should pass if the expression is a query on a signal that is of type bool. I am not sure if this works with is_arith is_bool

What do you mean? Is this not supposed to check if the if condition is a boolean expression and throw an error if is not?

leolara commented 1 month ago

is_arith and is_bool does not have access to the symbol table so it does not know the type of a signal.

so

if a where a is a signal is only valid if and only if a is of type bool. For the rest of cases it is ok to check is_bool, but in the future we should add another rule that checks the types and operators are compatible.

rutefig commented 4 weeks ago

is_arith and is_bool does not have access to the symbol table so it does not know the type of a signal.

so

if a where a is a signal is only valid if and only if a is of type bool. For the rest of cases it is ok to check is_bool, but in the future we should add another rule that checks the types and operators are compatible.

Cool I didn't think about it, but it makes sense, fixed right now. Now it is allowing only logical expressions and bool signals. Thank you for the observation 😄