Point-evaluated gradients and Hessians #
Formal derivatives define gradients and Hessians over any commutative semiring. The product rule expresses a product's Hessian as a linear combination of the two Hessians and two outer products of gradients. No assumption on the characteristic is needed.
Main definitions #
MvPolynomial.gradient: the gradient at a point.MvPolynomial.hessian: the Hessian matrix at a point.
Main results #
MvPolynomial.hessian_add,MvPolynomial.hessian_C,MvPolynomial.hessian_X.MvPolynomial.hessian_mul: the product rule for Hessians.MvPolynomial.hessian_sum_X_mul_X: the pairing polynomial has a block-swap Hessian.
References #
- Ported from LowerBound/Fusion/Arithmetic/Interaction/Hessian.lean and its
Pairing.leanapplication in S. Schlesinger, Algebraic circuit formalizations in Complexitylib.
noncomputable def MvPolynomial.gradient {ι : Type u_1} {R : Type u_2} [CommSemiring R] (x : ι → R) (p : MvPolynomial ι R) :
ι → R
The gradient of a formal polynomial, evaluated at a point.
Instances For
noncomputable def MvPolynomial.hessian {ι : Type u_1} {R : Type u_2} [CommSemiring R] (x : ι → R) (p : MvPolynomial ι R) :
Matrix ι ι R
The Hessian of a formal polynomial, evaluated at a point.
Instances For
@[simp]
theorem MvPolynomial.hessian_add {ι : Type u_1} {R : Type u_2} [CommSemiring R] (x : ι → R) (p q : MvPolynomial ι R) :
The Hessian of a sum is the sum of the Hessians.
@[simp]
A constant polynomial has zero Hessian.
@[simp]
A variable has zero Hessian.
theorem MvPolynomial.hessian_mul {ι : Type u_1} {R : Type u_2} [CommSemiring R] (x : ι → R) (p q : MvPolynomial ι R) :
A product's Hessian has two additional outer products of gradients.
theorem MvPolynomial.hessian_sum_X_mul_X {ι : Type u_1} {R : Type u_2} [CommSemiring R] [Fintype ι] [DecidableEq ι] (point : ι ⊕ ι → R) :
hessian point (∑ i : ι, X (Sum.inl i) * X (Sum.inr i)) = Matrix.submatrix 1 ⇑(Equiv.sumComm ι ι) ⇑(Equiv.refl (ι ⊕ ι))
The Hessian of the pairing polynomial swaps the two coordinate blocks. This identity holds over any commutative semiring, including characteristic two.