pub fn enumerate_patterns(
head_arity: u8,
candidate_arities: &[u8],
config: &NaryEnumerationConfig,
) -> Result<Vec<NaryRulePattern>>Expand description
Deterministically enumerate every well-formed canonical pattern.
Order is lexicographic in (body_len, candidate slots, bindings) with
Head(i) ordered before Join(j) at each position, so two calls with the
same inputs return identical vectors. Canonical join numbering is
generated directly (a join slot may only introduce the next unused join
index), so this function never produces an alpha-duplicate — it does
not need to filter them. Callers that construct patterns by hand
bypass that guarantee; NaryRulePattern::validate is what rejects a
non-canonical one.
Refuses with a typed error the moment the pattern count would exceed
config.max_patterns.