Structural Nodes #
Structural correctness facts for IR nodes that do not lower to ordinary executable operators.
The first node of a compiled graph is the distinguished input, but the recursive buildFrom loop
starts after that input node. If buildFrom ever encounters another .input node while compiling
the tail, successful compilation is impossible. We keep that fact as a named theorem so the
top-level semantic-equivalence proof can dispatch to it directly.
This file also contains the correctness lemma for .detach. Although .detach appears in the IR
as a node, it does not change the tensor value at the spec layer, and the compiled lowering is just
the identity function with a shape check.
Build note: structural nodes look simple, but they sit on the boundary between graph control flow
and tensor semantics. The .input case is an impossible-success proof, while .detach is a value
identity proof wrapped in parent and shape checks. These boundary cases should stay
small and separate from numeric operator proofs.
The recursive compiler cannot successfully compile an .input node in the graph tail.
Semantic-preservation lemma for .detach lowering.