final class ConstrainedCompletion

Finds the cheapest completion respecting occurrence-specific patterns and pending siblings. Unconstrained grammar costs are an admissible lower bound, never a claimed constrained minimum.

Methods§

public function __construct(private Grammar $grammar, private CompletionCosts $costs)

Reuses the grammar's unconstrained fixed point for pruning completed constraint prefixes.

Parameters

Calls 5
public function minimum(
    list<Symbol> $symbols,
    GenerationPlan<bool> $plan,
    array<string, int> $occurrences,
    bool $nonEmpty,
    int $budget,
): int
public function within(
    list<Symbol> $symbols,
    GenerationPlan<bool> $plan,
    array<string, int> $occurrences,
    bool $nonEmpty,
    int $budget,
): bool

Stops at the first affordable witness when derivation only needs feasibility, not another shortest proof.

Parameters

$symbolslist<Symbol>
$planGenerationPlan<bool>
$occurrencesarray<string, int>
$nonEmptybool
$budgetint

Returns

bool
Test cases 1
Called from 1
Calls 1
public function complete(
    list<Symbol> $symbols,
    GenerationPlan<bool> $plan,
    array<string, int> $occurrences,
    bool $nonEmpty,
    int $budget,
    bool $minimum,
): int
public function search(
    list<Symbol> $symbols,
    GenerationPlan<bool> $plan,
    array<string, int> $occurrences,
    bool $nonEmpty,
    int $budget,
    bool $minimum,
): int
public function witness(
    CompletionState $state,
    GenerationPlan<bool> $plan,
    int $total,
    int $budget,
): int

Private surface 6§

Implementation details, listed for orientation only.

private CompletionReduction $reduction
private CompletionMemo $memo
private CompletionWitness $witness
private PatternProductions $productions
private Grammar $grammar
private CompletionCosts $costs

Test cases 28§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 6
Other tests reaching this symbol 22

Relations§

Instantiated in 2
Method calls 2
Type declarations 1