This PR refactors `QuadraticSymbolicExpression`: I removed the reference
to
[`SymbolicExpression`](f60e9d9f69/constraint-solver/src/quadratic_symbolic_expression.rs (L70)).
It can represent values that are known at runtime, represented as an
expression. We don't need this in the context of APC: Variables are
either unknown or known at compile time, and therefore can be
represented as a `FieldElement` instead.
The idea is to introduce [this
trait](4989be08f3/constraint-solver/src/runtime_constant.rs (L11)),
which is implemented by `SymbolicExpression` and any `T: FieldElement`.
This way, we can continue to use the solver with
`QuadraticSymbolicExpression<SymbolicExpression<T, V>, V>` (equivalent
to the current `QuadraticSymbolicExpression<T, V>`) in the old JIT
pipeline and use the simpler `QuadraticSymbolicExpression<T, V>` in the
APC pipeline.
---------
Co-authored-by: chriseth <chriseth.github@gmail.com>
This PR adds a new `powdr_expression` crate, containing a simplified
version of `powdr_ast::analyzed::AlgebraicExpression`. The idea here is
that this decouples our Autoprecompiles code from the PowdrVM & PIL
codebase. This will allow us to gradually change the expression type
according to our needs. See #2832 and #2833 as work-in-progress
examples.
Differences to previous `AlgebraicExpression`:
- Generic over the reference type (but
`powdr_autoprecompiles::legacy_expression` adds `AlgebraicReference` and
defines `type AlgebraicExpression<T> = ActualAlgebraicExpression<T,
AlgebraicReference>`, for now)
- Removed `AlgebraicExpression::{PublicReference,Challenge}` variants
- Removed `AlgebraicBinaryOperator::Pow` variant
- `degree_with_cache()` -> `degree()`, as we don't have intermediate
polynomials anymore
I included a `powdr_ast::analyzed::AlgebraicExpression <-->
powdr_autoprecompiles::legacy_expression::AlgebraicExpression`
conversion, which is only used to interact with the `powdr_pilopt`
crate, which still is used by the APC codebase and the PowdrVM / PIL
codebase.