Soundness Proof
Mathematical Definitions
Soundness of Translation
ReLU
ONNX ReLU node is defined as:
The translation defines the interactions:
By definition this interaction is equal to:
Gemm
ONNX Gemm node is defined as:
The translation defines the interactions:
By definition this interaction is equal to:
By grouping the operations we get:
Identiry / Flatten / Reshape / Squeeze / Unsqueeze
Just identity mapping because wires represent a single element and they are not structured as Tensors.
MatMul
Equal to Gemm with ,
and
.
Add
ONNX Add node is defined as:
The translation defines the interactions:
By definition this interaction is equal to:
By grouping the operations we get:
Sub
ONNX Sub node is defined as:
The translation defines the interactions:
By definition this interaction is equal to:
By grouping the operations we get:
Slice
ONNX Slice is defined as:
The translations creates a wiring analog to the above definition:
Soundness of Interaction Rules
Materialize
The Materialize agent transforms a Linear agent into a tree of explicit mathematical operations
that are used as final representation for the solver.
In the Python module the terms are defined as:
def TermAdd(a, b):
return a + b
def TermMul(a, b):
return a * b
def TermReLU(x):
return z3.If(x > 0, x, 0)
Linear >< Materialize
LHS:
Case 1:
RHS:
EQUIVALENCE:
Case 2:
RHS:
EQUIVALENCE:
Case 3:
RHS:
EQUIVALENCE:
Case 4:
RHS:
EQUIVALENCE:
Case 5:
RHS:
EQUIVALENCE:
Concrete >< Materialize
LHS:
RHS:
EQUIVALENCE:
Add
Linear >< Add
LHS:
RHS:
EQUIVALENCE:
Concrete >< Add
LHS:
Case 1:
RHS:
EQUIVALENCE:
Case 2:
RHS:
EQUIVALENCE:
Linear >< AddCheckLinear
LHS:
Case 1:
RHS:
EQUIVALENCE:
Case 2:
RHS:
EQUIVALENCE:
Case 3:
RHS:
EQUIVALENCE:
Case 4:
RHS:
Because TermAdd(a, b) is defined as a+b:
EQUIVALENCE:
Concrete >< AddCheckLinear
LHS:
RHS:
EQUIVALENCE:
Linear >< AddCheckConcrete
LHS:
RHS:
EQUIVALENCE:
Concrete >< AddCheckConcrete
LHS:
Case 1:
RHS:
EQUIVALENCE:
Case 2:
RHS:
EQUIVALENCE:
Mul
Linear >< Mul
LHS:
RHS:
EQUIVALENCE:
Concrete >< Mul
LHS:
Case 1:
RHS:
EQUIVALENCE:
Case 2:
RHS:
EQUIVALENCE:
Case 3:
RHS:
EQUIVALENCE:
Linear >< MulCheckLinear
LHS:
Case 1:
RHS:
EQUIVALENCE:
Case 2:
RHS:
Because TermMul(a, b) is defined as a*b:
EQUIVALENCE:
Concrete >< MulCheckLinear
LHS:
RHS:
EQUIVALENCE:
Linear >< MulCheckConcrete
LHS:
RHS:
EQUIVALENCE:
Concrete >< MulCheckConcrete
LHS:
Case 1:
RHS:
EQUIVALENCE:
Case 2:
RHS:
EQUIVALENCE:
Case 3:
RHS:
EQUIVALENCE:
ReLU
Linear >< ReLU
LHS:
RHS:
Because TermReLU(x) is defined as z3.If(x > 0, x, 0):
EQUIVALENCE:
Concrete >< ReLU
LHS:
Case 1:
RHS:
EQUIVALENCE:
Case 2:
RHS:
EQUIVALENCE:
Soundness of Reduction
Let be the Interaction Net translated from a Neural Network
. Let
be the state of the net
after reduction steps. Then
.
Proof by Induction
- Base Case (
): By the Soundness of Translation, the initial net
is constructed such that
its semanticsexactly match the mathematical definition of the ONNX nodes in
.
- Induction Step (
): Assume
. If
is in normal form, the proof is complete.
Otherwise, there exists an active pairthat reduces
.
By the Soundness of Interaction Rules, the mathematical definition is preserved after any reduction step,
it follows that. By the inductive hypothesis,
.
By the principle of mathematical induction, the Interaction Net remains semantically equivalent to the original
Neural Network at every step of the reduction process.
Since Interaction Nets are confluent, the reduced mathematical expression is unique regardless
of order in which rules are applied.
