Elementwise Operators #
Semantic-preservation lemmas for same-shape binary elementwise operators in the IR -> compiled runtime bridge.
The operators in this file all share the same compiler shape:
- two parent ids,
- both parents typed at the declared output shape,
- one compiled
GraphDatanode whoseforwardclosure calls the corresponding tensor spec op.
Factoring these cases out keeps the recursive semantic-equivalence theorem focused on graph traversal rather than on repeating parent-list and typed-index boilerplate for every elementwise op.
Build note: elementwise proofs spend most of their time on the shared two-parent shape discipline,
not on addition or multiplication themselves. Each branch must rule out bad parent lists, recover
typed indices for both parents, and match the compiled output against NN.IR.Graph.evalAt.
The shared two-parent pattern belongs in a helper lemma so these lemmas state only the
operator-specific tensor equation.
Semantic-preservation lemma for .add lowering.
Semantic-preservation lemma for .sub lowering.
Semantic-preservation lemma for .mul_elem lowering.
Semantic-preservation lemma for .maxElem lowering.
Semantic-preservation lemma for .minElem lowering.