Rational hitting lists: the model #
Noncommutative rational formulas are formulas (Cslib.Circuits.Formula) over the signature
ratSignature of rational constants, addition, ordered multiplication and inversion. They are
evaluated relationally in any ring with a rational structure map: an inverse node requires an
actual two-sided inverse of its operand's value, so evaluation is partial. A formula is
admissible if some substitution of square rational matrices of positive dimension lies in its
domain, and nonzero if some such substitution yields a nonzero value. A finite list of matrix
substitutions hits the formulas of node count at most s if every admissible nonzero such
formula has an invertible value at some substitution on the list.
The node count of a formula, the source's size measure, counts every syntax-tree node: input
leaves, constants and operations (the generic Cslib.Circuits.Formula.nodeCount, the native gate
count Formula.size plus the leaf count Formula.leafSize).
Main definitions #
Cslib.Circuits.Rational.RatOp,Cslib.Circuits.Rational.ratSignature,Cslib.Circuits.Rational.Formula: the operation symbols, signature, and formulas, with constructorsFormula.var,Formula.const,Formula.add,Formula.mul,Formula.invand the induction principleFormula.inductionOn.Cslib.Circuits.Rational.Formula.Eval: partial evaluation as a relation.Cslib.Circuits.Rational.Mat,Cslib.Circuits.Rational.Tuple: square rational matrices and matrix substitutions.Cslib.Circuits.Rational.Evaluates,Cslib.Circuits.Rational.Admissible,Cslib.Circuits.Rational.Nonzero: evaluation on rational matrices, and its domain and support.Cslib.Circuits.Rational.Output,Cslib.Circuits.Rational.encodeNat,Cslib.Circuits.Rational.encodeRat,Cslib.Circuits.Rational.encodeTuple,Cslib.Circuits.Rational.encodeOutput: lists of matrix substitutions of a common positive dimension and their binary encoding.Cslib.Circuits.Rational.Hits: the hitting property.
Main results #
Cslib.Circuits.Rational.Formula.eval_add_iffand its siblings: evaluation unfolds along the constructors.
References #
The signature of rational formulas: constants are nullary, addition and multiplication are binary, and inversion is unary.
A noncommutative rational formula over n variables and rational constants.
The input variable i.
The rational constant q.
The sum of two formulas.
The ordered product of two formulas.
The inverse of a formula.
Induction on rational formulas, with one case for each constructor.
The generic Cslib.Circuits.Formula.nodeCount_input and Cslib.Circuits.Formula.nodeCount_gate
specialized to the constructors; simp derives these from the generic lemmas, so they are not
simp lemmas themselves.
A variable leaf has node count 1.
A rational constant node has node count 1.
The node count of add f g is f.nodeCount + g.nodeCount + 1.
The node count of mul f g is f.nodeCount + g.nodeCount + 1.
The node count of inv f is f.nodeCount + 1.
A formula has at least one node.
f.Eval c X v: the formula f is defined at the substitution X in the ring R, with
rational constants interpreted by c, and has the value v. An inverse node requires an actual
two-sided inverse of the value of its operand, not a totalized inverse.
Square rational matrices of the specified dimension.
A matrix substitution for every input variable.
Some positive-dimensional rational matrix substitution is in the formula's domain.
Instances For
Some positive-dimensional rational matrix substitution has a defined nonzero value.
Instances For
A finite list of matrix substitutions, all of one common positive dimension.
- dimension : ℕ
Common dimension of all matrix tuples.
Exclude the trivial zero-dimensional matrix ring.
The finite list of matrix substitutions, in output order.
Little-endian unsigned binary, prefixed by a unary bit-length and a zero terminator. This is a self-delimiting binary encoding, including zero.