TorchLean API

NN.Proofs.Autograd.FDeriv.PrimitiveArithmetic

Captured arithmetic derivatives #

These theorems certify the actual forward and backward functions of the arithmetic OpSpecs. The right-hand tensor is fixed, so every derivative is diagonal. This is the input-gradient contract of these specifications; differentiating a second variable requires the corresponding two-input rule.

Over the reals, division by a fixed denominator is a linear map even when that denominator is zero: the totalized quotient is then constantly zero. The same fact applies to the fixed shifted denominator in safeDivOp. It does not remove the pole of safeInvOp, whose denominator varies with the differentiated input, or change the nonzero-denominator contract of floating-point division.

Adding a captured tensor has the identity coordinate derivative on every shape.

The captured addition backward is the adjoint of its forward derivative.

Subtracting a fixed tensor leaves the input derivative equal to the identity.

The captured subtraction backward has the positive input-gradient sign.

Multiplication by a fixed tensor scales each tangent by the matching captured entry.

The stored multiplication backward is the adjoint of the diagonal forward derivative.

A fixed real denominator gives a linear quotient, including the totalized zero case.

The captured quotient backward agrees with the adjoint for every real fixed denominator.

The epsilon shift belongs to the fixed denominator, so it does not contribute a derivative.

The actual shifted-division backward uses the same fixed denominator as its forward map.