pub struct NormalForm {
pub kind: NormalFormKind,
pub result_type: Arc<LemmaType>,
pub fold_types: Vec<Arc<LemmaType>>,
pub source: Option<Source>,
pub origin: Option<NormalFormId>,
pub rule_ref: Option<RulePath>,
}Expand description
One node in THE DAG: algebraic Kind, stamped result type, optional conversion span, optional fold origin, optional rule use-site identity.
A rule use-site shares the completed body’s Kind (same child ids) and sets
rule_ref. Type is the graph rule type (RulePath) or data resolved type
(rule-target DataPath) — not the post-rewrite body cell type. Cons keys on
(kind, rule_ref, result_type) so a rule reference never collapses into the
bare body cell, and DataPath leaves that differ only in resolved type stay
distinct.
Fields§
§kind: NormalFormKind§result_type: Arc<LemmaType>Type of the value this cell evaluates to. Stamped at planning.
fold_types: Vec<Arc<LemmaType>>For Sum/Product: type after folding children[..=k]. Empty for other kinds.
fold_types.last() equals result_type for n-ary arithmetic.
source: Option<Source>Span for unit-conversion nodes; does not affect sharing.
origin: Option<NormalFormId>Pre-image destroyed by a fold; blocks sharing when present.
rule_ref: Option<RulePath>Use-site of a named rule (None on ordinary cells).