DefiningRelationValidator

Syntactic validator for the words of a custom-fraction two-level design (see Fraction.Custom).

A defining relation has the algebraic form I = w1 = w2 = ... where each word w_i is a product of factor indices. This validator covers syntax only:

  • Each word is non-empty.

  • Every integer index lies in 1..numFactors.

  • No index repeats within a single word (each word is a set of factors, not a multiset).

  • The word count matches the declared fraction exponent.

Group-theoretic validity — whether the chosen words realise a non-degenerate 2^(k-p) fraction without collapsing unintentionally — is not checked here. That is the substrate's responsibility at engine-build time (TwoLevelFactorialDesign.fractionalIterator(...)); errors surface as runtime exceptions on submit.

Exposed as an object so the GUI editor can call it directly for live feedback (red/green badges next to each word field).

Types

Link copied to clipboard
sealed class Result

Outcome of validate. Ok carries the parsed words as integer sets (useful for downstream engine glue); Invalid carries one human-readable message per problem found.

Functions

Link copied to clipboard
fun validate(words: List<List<Int>>, numFactors: Int, fractionExponent: Int): DefiningRelationValidator.Result

Validate words against the declared factor count and fraction exponent. All errors are collected before returning — a single bad word does not short-circuit reporting of the others.