TorchLean API

NN.MLTheory.CROWN.Proofs.DirectedIBPAxisSemantics

The real evaluator and the backward flat permutation #

The forward evaluator lowers an axis array to adjacent swaps. The backward operation inverts the same array and linearizes its coordinates. Both implementations therefore describe one bijection of real tensor entries, including tensors with arbitrary rank and zero-length dimensions.

The forward permutation of flat tensor coordinates, obtained from the actual adjacent swaps.

Instances For

    The checked backward flat permutation is the inverse-read form of the forward swaps.

    theorem NN.MLTheory.CROWN.Graph.DirectedBackward.adjacentFlatEquiv_values (s : Spec.Shape) (swaps : List ℕ) (f g : ℕ → ℝ) (hvalues : (realTensor s f).permuteByAdjacentSwaps swaps = realTensor (s.applyAdjacentSwaps swaps) g) (i : Fin s.size) :
    g ↑((adjacentFlatEquiv s swaps) i) = f ↑i
    theorem NN.MLTheory.CROWN.Graph.DirectedBackward.permuteSomeTensor_flatEquation {s t : Spec.Shape} {forward : Array ℕ} {f g : ℕ → ℝ} (heval : IR.Graph.permuteSomeTensor { shape := s, tensor := realTensor s f } forward = Except.ok { shape := t, tensor := realTensor t g }) :
    s.size = t.size ∧ ∀ (inverse : Array ℕ), (IR.OpContracts.inversePerm forward).toOption = some inverse → ∀ (flat : Fin t.size → Fin t.size), flatAxisPermutation? t inverse t.size = some flat → Function.Bijective flat ∧ ∀ (i : Fin t.size), g ↑(flat i) = f ↑i

    A successful real permutation evaluator supplies exactly the backward coordinate equation.