Unlawful multivariate polynomials #
This file defines the Unlawful type, which represents multivariate polynomials
as a map from monomials to coefficients. Unlike Lawful, it does not enforce
the absence of zero coefficients.
Main definitions #
CPoly.Unlawful n R: A map fromCMvMonomial ntoR, implemented usingStd.ExtTreeMap.
Polynomial in n variables with coefficients in R.
Internally represented as a tree map from monomials to coefficients.
Equations
- CPoly.Unlawful n R = Std.ExtTreeMap (CPoly.CMvMonomial n) R compare
Instances For
Equations
- CPoly.instEmptyCollectionUnlawful = { emptyCollection := ∅ }
Equations
Equations
instance
CPoly.instLawfulSingletonMonoRUnlawful
{n : ℕ}
{R : Type}
:
LawfulSingleton (MonoR n R) (Unlawful n R)
instance
CPoly.instMembershipCMvMonomialUnlawful
{n : ℕ}
{R : Type}
:
Membership (CMvMonomial n) (Unlawful n R)
Equations
@[instance 10000, defaultInstance 1000]
instance
CPoly.instGetElemUnlawfulCMvMonomialMem
{n : ℕ}
{R : Type}
:
GetElem (Unlawful n R) (CMvMonomial n) R fun (lp : Unlawful n R) (m : CMvMonomial n) => m ∈ lp
Equations
- One or more equations did not get rendered due to their size.
instance
CPoly.instGetElem?UnlawfulCMvMonomialMem
{n : ℕ}
{R : Type}
:
GetElem? (Unlawful n R) (CMvMonomial n) R fun (lp : Unlawful n R) (m : CMvMonomial n) => m ∈ lp
Equations
- One or more equations did not get rendered due to their size.
instance
CPoly.instLawfulGetElemUnlawfulCMvMonomialMem
{n : ℕ}
{R : Type}
:
LawfulGetElem (Unlawful n R) (CMvMonomial n) R fun (lp : Unlawful n R) (m : CMvMonomial n) => m ∈ lp
Extend the number of variables by padding monomials with zeros.
Equations
Instances For
@[reducible, inline]
Check if the polynomial has no zero coefficients.
Equations
- p.isNoZeroCoef = ∀ (m : CPoly.CMvMonomial n), p[m]? ≠ some 0
Instances For
def
CPoly.Unlawful.toFinset
{n : ℕ}
{R : Type}
[DecidableEq R]
(p : Unlawful n R)
:
Finset (CMvMonomial n × R)
Equations
Instances For
@[reducible, inline]
The list of monomials present in the polynomial.
Equations
Instances For
@[simp]
Constant polynomial.
Equations
Instances For
Equations
- CPoly.Unlawful.instOfNatOfNatNat = { ofNat := CPoly.Unlawful.C 0 }
@[simp]
theorem
CPoly.Unlawful.not_mem_zero
{n : ℕ}
{R : Type}
[Zero R]
{x : CMvMonomial n}
[BEq R]
[LawfulBEq R]
:
x ∉ 0
Pointwise addition of coefficients.
Equations
- p₁.add p₂ = Std.ExtTreeMap.mergeWith (fun (x : CPoly.CMvMonomial n) (c₁ c₂ : R) => c₁ + c₂) p₁ p₂
Instances For
Equations
- CPoly.Unlawful.instAdd = { add := CPoly.Unlawful.add }
Negation (negates all coefficients).
Equations
- p.neg = Std.ExtTreeMap.map (fun (x : CPoly.CMvMonomial n) (v : R) => -v) p
Instances For
Equations
- CPoly.Unlawful.instNeg = { neg := CPoly.Unlawful.neg }
Equations
Return the term with the lexicographically largest monomial.
Instances For
Return the lexicographically largest monomial.
Instances For
instance
CPoly.Unlawful.instDecidableEq
{n : ℕ}
{R : Type}
[DecidableEq R]
:
DecidableEq (Unlawful n R)
Equations
- x.instDecidableEq y = if h : Std.ExtTreeMap.toList x = Std.ExtTreeMap.toList y then isTrue ⋯ else isFalse ⋯
Instances For
@[simp]
theorem
CPoly.Unlawful.filter_get
{n : ℕ}
{R : Type}
[BEq R]
[LawfulBEq R]
{v : R}
{m : CMvMonomial n}
(a : Unlawful n R)
: