Equations
- Hex.Mono.instInhabited = { default := Hex.Mono.zero }
The monomial consisting of one copy of variable i.
Equations
- Hex.Mono.unit i = Hex.Vector.ofFn' fun (j : Fin n) => if j = i then 1 else 0
Instances For
Multiply every exponent by k.
Equations
- Hex.Mono.scale k m = Hex.Vector.ofFn' fun (i : Fin n) => k * m[i]
Instances For
Total degree of a monomial.
Equations
- m.degree = List.foldl (fun (acc : Nat) (i : Fin n) => acc + m[i]) 0 (List.finRange n)
Instances For
Variables occurring with positive exponent, in increasing index order.
Equations
- m.support = List.filter (fun (i : Fin n) => m[i] != 0) (List.finRange n)
Instances For
Rename variables, adding exponents when several source variables map to the same target variable.
Equations
- Hex.Mono.rename f m = Hex.Vector.ofFn' fun (j : Fin k) => List.foldl (fun (acc : Nat) (i : Fin n) => acc + if f i = j then m[i] else 0) 0 (List.finRange n)
Instances For
Increase the exponent of variable i by one.
Equations
- Hex.Mono.succAt i m = m.mul (Hex.Mono.unit i)
Instances For
All decompositions a * b = m. Each exponent is split independently,
so the list has ∏ i, (m[i] + 1) entries.
Equations
- One or more equations did not get rendered due to their size.
- x_2.splits = [(Hex.Mono.zero, Hex.Mono.zero)]
Instances For
Exponentiation by repeated squaring, used here so monomial evaluation
does not depend on a coefficient type's choice of Pow implementation.
Equations
- One or more equations did not get rendered due to their size.
- Hex.Mono.powBySq a 0 = 1
Instances For
Repeated-squaring exponentiation agrees with the semiring power.
Evaluate a monomial at x, using logarithmic exponentiation for each
variable.
Equations
- Hex.Mono.prod x m = List.foldl (fun (acc : R) (i : Fin n) => acc * Hex.Mono.powBySq (x i) m[i]) 1 (List.finRange n)
Instances For
Plain lexicographic comparison, with the first variable most significant.
Equations
- a.lex b = List.compareLex compare (Vector.toList a) (Vector.toList b)
Instances For
Graded lexicographic comparison: total degree first, then lex.
Equations
- a.grlex b = compareLex (fun (x y : Hex.Mono n) => compare x.degree y.degree) Hex.Mono.lex a b
Instances For
Reverse-lexicographic tie breaker used by grevlex.
Equations
- a.revlex b = List.compareLex (fun (x y : Nat) => compare y x) (Vector.toList a).reverse (Vector.toList b).reverse
Instances For
Graded reverse lexicographic comparison: total degree first; among equal-degree monomials, the monomial with the larger exponent in the last differing variable compares smaller.
Equations
- a.grevlex b = compareLex (fun (x y : Hex.Mono n) => compare x.degree y.degree) Hex.Mono.revlex a b
Instances For
Laws needed of a comparator by leading-term and reduction algorithms.
Storage itself uses the inherited TransCmp and LawfulEqCmp laws.
The constant monomial is least.
Multiplying both sides by the same monomial preserves comparison.
- wf : WellFounded fun (a b : Mono n) => cmp a b = Ordering.lt
Strict comparison is well founded.
Instances
Every monomial is the product of its scaled unit monomials.
Prepending a monomial's head to its tail reconstructs it.
Converting a prepended monomial to a list prepends the exponent.
The exponent list of a product is the pointwise sum of exponent lists.