Std. Regex. Runtime
(Cure Standard Library v0.37.2)
View Source
Executable Regex machine, evidence VM, typed compiler, and combinators.
Examples
use Std.Regex.Runtime
ascii_digit('7') # => true
ascii_word('_') # => true
ascii_space(' ') # => true
default_options()use Std.Regex.Runtime
compile_regex(concatenate(digit_class(false), word_class(false)))
Summary
Types
One winner slot per encountered intrinsic active state plus one accepted-state bit.
Traversal is left-to-right, so setting a slot preserves the first (highest
priority) thread and discards every later duplicate without rescanning the
growing winner list. Bounded(n) structurally indexes the slot spine: no
unchecked Nat conversion enters the machine and the erased bound need not
be materialized at runtime.
A named commitment decision keeps the control invariant visible at every search boundary: a commit at the current scope or an enclosing scope blocks the remaining siblings, while a commit strictly inside the current scope escapes to the caller so an outer alternative may still run.
The runtime search never compares scope depths with an unchecked Boolean. This finite decision relation carries the proof that a commit is either at-or-inside the current scope (so siblings are blocked) or strictly deeper than it (so the commit belongs to an inner scope and outer siblings remain eligible). The evidence fields are erased after the branch has been selected.
Runtime-only atomic plan. Ordinary Pattern values and their Thompson proofs stay unchanged; this parallel tree carries only the commitment scopes needed by the ordered runtime search.
Atomic commitment is runtime control state, not part of the ordinary proof-carrying search result. A commit failure stops siblings at the scope that closed, while an outer scope may still propagate it.
The conditional guard consumes an indexed decision produced from the destination epsilon routine. This is the finite participation fact used by named conditionals; it is deliberately separate from capture text and cannot be manufactured by replaying an unrelated slot.
Named capture metadata is additive. It never enters ShapeCode or the ordinary Match tuple, so existing typed regex APIs remain unchanged.
Option is a Type-level family, so it cannot hold a RegexProgram(result):
a family INDEXED by Type lives one universe up (level: 1), exactly as an
Agda data … : Set → Set₁ does. Cure has no universe polymorphism, so the
large case needs its own carrier rather than a Type-level Option.
A single winning NFA path through the evidence VM. Both the starting
thread and final evidence are indices: AcceptingNow can close only at an
accepted thread carrying exactly that evidence, while AcceptingNext can
advance only to a member of step_evidence_thread. Consequently a path
cannot invent a state, skip an input character, or claim evidence different
from the VM thread it reaches.
Thompson's evidence proof reasons over one NFA-independent instruction
stream. Observe records the consumed character (and advances open capture
frames); Regular embeds the existing VM instruction language.
The generalized Thompson proof uses an NFA-independent stream. Observe
advances capture input; Regular embeds the evidence VM language.
Intrinsic list membership. The witness is erased at every accepting-run boundary; its only purpose is to make every path edge name a destination that the checked transition relation actually produced.
Nested assertion decisions are existentially packaged because each child machine has its own state-count index. They are proof metadata attached to a parent path; the path constructors erase the list after checking.
A decision is the only value consumed by an assertion constraint. A satisfied branch now carries an existential package containing the finite child path. Refuted branches still record the finite-search outcome (or an explicit resource/history boundary). The search refutation retains the complete child and sibling traversal tree; the remaining work is to prove its soundness and completeness against the machine semantics.
Internal result for a destination-list traversal. Unlike the public result above, this carries the full destination list as a parameter, so recursive tail failures cannot escape as an unconstrained existential.
Lookaround compilation is a runtime-only parallel IR. It preserves the same finite Thompson constructors as the ordinary proof IR, but adds an explicit atomic scope so assertion operands cannot silently erase ordered commitment when they cross an assertion boundary. The ordinary typed proof remains over ThompsonCompilation; this tree is consumed only by the checked finite assertion evaluator.
Resource and history guards fail before a machine traversal exists. They retain the compact terminal witness used by the public decision types; ordinary search failures use the complete trees above.
Capture-free assertion paths carry state reachability plus an erased list
of the nested decisions used by each accepted transition. The depth index
is the same guard used by the evaluator: each nested assertion consumes
one level and zero fuel cannot manufacture a child path.
A failed path records the complete finite traversal below one thread.
Destination failures retain the child rejection and the tail rejection;
the only terminal constructor is reached with a structurally exhausted
MachineStateMembers witness. The capture context is indexed because
nested capture-condition checks must be refuted in the same environment
that produced the destination list.
Capture-aware assertion replay uses the same ordered commitment relation
as atomic_lookaround_accepts, but returns the selected finite routine.
The routine is replayed only by the named-capture side channel; the typed
matcher continues to consume the checked assertion path and never derives
a result from this replay value.
A complete failed start-list traversal. A start cannot be dropped from a refutation: the corresponding child path failure and the tail failure are both required before the terminal member proof can be returned.
A candidate list whose every element is paired with erased evidence that it belongs to the original transition result. State and proof are introduced by the same constructor, so dependent pattern refinement never has to relate two sibling scrutinees.
Match positions are zero-based Unicode-scalar offsets, not UTF-8 byte
offsets. start and length are native Int values so large subjects do
not allocate unary Nat structures at runtime.
A named replay is deliberately separate from the evidence VM. The ordinary certificate still proves the typed evidence; this effect-free interpreter replays the same certified routine and records only slot participation/text. No host regex engine or second language semantics is involved.
Erasure certificate: every named compilation has exactly the ordinary Thompson compilation obtained by dropping slot IDs. This is the bridge used by the typed proof path; capture metadata cannot alter language.
Runtime-only search for named machines. The ordinary search above is indexed by the evidence theorem and intentionally has no capture-guard parameter. Named search carries only the replay routine, while preserving the same ordered destination traversal and boundary calculations.
The public result type and the checked Thompson shape are independent:
conversions may expose Option, List, or a simplified tuple while the
machine still carries its constructor-preserving shape. Keep the machine
shape as an explicit index instead of letting it unify accidentally with
the public result (which would reject optional/one-or-more captures).
Named compilation is constructor-for-constructor parallel to the checked Thompson tree. Only group nodes differ: they carry the explicit slot ID used by the capture ledger. Erasing the IDs recovers the ordinary compilation, so language proofs can remain independent of names.
Public typed combinator layer. Mapped is the semantic bridge from a
structurally extracted Pattern value to the user-facing result type. It is
one-way: regex parsing does not imply an unparser.
Elixir-compatible literal modifiers, in i m s x u f U order. Repeated
letters are idempotent and modifier order is irrelevant. No accepted flag
is metadata-only: each one must affect parsing or machine execution.
A staged literal carries its checked machine and the erased equality that relates that machine to the canonical Thompson construction. The wrapper is indexed by the public shape (rather than by the dependent compilation itself) because that is the representation the constructor elaborator can refine without introducing an existential dependent constructor.
Constructor-preserving Thompson IR. Both runtime compilation and the evidence theorem consume this same tree, so proof code never reconstructs machine provenance from a function-valued transition table.
Functions
Return true if an active thread at state has already been recorded in slots.
Advance a Position by consuming a list of characters with the default policy.
Advance a Position by a list of characters using an explicit newline policy.
Match left or right, tagging the winning branch in a Choice.
Proof that inject_alternate_left equals widen_left.
Inject left-branch states into an alternation and tag them with marker.
Proof that widen_left equals inject_alternate_left.
Transition function for an alternation of two submachines.
Dispatch an alternation transition after classifying the state as left or right.
Compute the combined start states of an alternation submachine.
Construct the PatternMachine for alternating two submachines.
Proof that inject_alternate_right equals inject_right.
Inject right-branch states into an alternation and tag them with marker.
Order left and right alternation start states according to prefer_right.
Constant predicate returning true for every character.
Regex matching any single character (including newlines).
Append a branch marker instruction to the end of an evidence routine.
Concatenate two List(Char) values.
Concatenate two lists of BoundaryConstraint values.
Concatenate two ExtendedRoutine instruction lists.
Concatenate two lists of MachineState values with explicit state bound n.
Concatenate two EvidenceInstruction routines in execution order.
Concatenate two lists of MachineState values with the same state bound.
Concatenate two lists of EvidenceThreads.
Alias for captured: match regex and return the matched substring.
Return true if char is an ASCII letter or digit.
Return true if char is an ASCII letter (A-Z or a-z).
Return true if char is an ASCII space or horizontal tab.
Return true if char is an ASCII control character.
Return true if char is an ASCII decimal digit (0-9).
Return true if char is a visible ASCII graphical character (0x21..0x7E).
Return true if char is a printable ASCII character (0x20..0x7E).
Return true if char is an ASCII punctuation character.
Return true if char is an ASCII whitespace character.
Return true if char is an ASCII word character ([A-Za-z0-9_]).
Construct an ASCII word-boundary (\b / \B) constraint.
Decide whether an atomic commit at commit prunes a sibling at current depth.
Compare two atomic nesting depths as less-than, equal, or greater-than.
Return the maximum of two Nat atomic nesting depths.
Annotate accepting destinations with an atomic-commit instruction.
Atomic assertion search is the same finite ordered search as the ordinary assertion path, but every destination is first passed through the depth-aware lookaround constraint filter. This is what makes an assertion inside an atomic scope observable without introducing a host backtracking stack or rebuilding a child machine per attempt.
Search lookaround destination states with atomic-group commit pruning.
Return true if an atomic lookaround machine accepts input.
Search a single lookaround initial state with atomic-group commit pruning.
Search lookaround initial states with atomic-group commit pruning.
The capture replay evaluator mirrors the atomic lookaround search above.
It is deliberately separate from the Boolean evaluator: preserving the
selected routine must not alter the acceptance authority used by typed
extraction. Every successful branch prepends the observed character and
epsilon routine in the same order as the certified extended path.
prefix changes only the acceptance point: a prefix search may close as
soon as the ordered machine reaches ThreadAccepted, even when input
remains. The machine's start/destination order still chooses the path,
so lazy repeats and ordered alternation are preserved by the same DFS.
reversed_prefix records exactly the characters consumed on that path;
the result also carries the unconsumed suffix so callers never reconstruct
it by retrying every possible endpoint.
Run an atomic lookaround machine and return the winning ExtendedRoutine on acceptance.
Search a single atomic lookaround initial state while recording its ExtendedRoutine.
Search atomic lookaround initial states while recording the winning ExtendedRoutine.
Search atomic lookaround destinations while recording the winning ExtendedRoutine.
Find the winning prefix and ExtendedRoutine for an atomic lookaround machine.
Wrap a PatternMachine in an atomic group scope with enter/commit markers.
Extract the underlying ThompsonCompilation from an AtomicRuntimePattern.
Extract the underlying Pattern from an AtomicRuntimePattern.
Search for an accepting match from a single state with atomic-group commit pruning.
Search candidate destination states in order, pruning alternatives on atomic commit.
Run an atomic-aware PatternMachine on input and return whether it accepts.
Find the shortest prefix accepted by an atomic-aware PatternMachine.
Recursive helper for atomic_runtime_first_prefix.
Search a single initial start state under atomic-group semantics.
Search initial start states with atomic-group commit semantics.
Search initial start states while propagating an active atomic commit depth.
Find the longest prefix accepted by an atomic-aware PatternMachine.
Recursive helper for atomic_runtime_last_prefix.
Build the executable PatternMachine for an AtomicRuntimePattern.
Find the shortest (lazy: true) or longest (lazy: false) prefix accepted by an atomic-aware machine.
Compute the atomic nesting depth remaining after executing routine.
Compute the net atomic-scope depth change and commit depth of an instruction routine.
Compute the maximum atomic nesting depth reached while executing routine.
Accumulate the maximum atomic nesting depth across routine starting from current.
Atomic scopes preserve every ordinary machine state, but mark entry and every accepting exit in the routine stream. The ordered search consumes these markers to discard lower-priority siblings after the first exit; transition construction itself remains the same finite Thompson machine.
Construct the zero-state PatternMachine guarded by a single BoundaryConstraint.
Match regex at least min_count times with optional lazy preference.
Match regex between min_count and max_count times.
Match regex exactly count times.
Return true if two Bounded(n) state indices are equal.
Match regex at most max_count times with optional lazy preference.
Materialize transition rows for remaining states using inject into next.
Pointwise correctness of the row compiler. This is intentionally a smaller theorem than function extensionality: every concrete bounded source state reduces to the row installed for that state, so callers can transport an edge without changing the existing PatternMachine proof indices.
Construct a constraint requiring capture group index to be absent.
Convert a CaptureCondition into its corresponding BoundaryConstraint.
Evaluate a CaptureCondition against the executed capture routine.
Initialize an empty named-capture ledger from a NamedCaptureLayout.
Initialize an empty named-capture ledger from a list of CaptureSlots.
Construct a constraint requiring capture group index to have participated.
Decide whether capture group target has participated in routine.
Extract only capture-slot markers from a selected assertion routine. The child emits its own characters and evidence, but those must not be merged into the surrounding typed result; only participation markers cross the assertion boundary for later conditionals.
Match regex and return the matched substring as a String.
Compare two characters for case-insensitive equality under options.
Execute an ExtendedRoutine and return a certified ExtendedExecution witness.
Certify compilation of a NamedPattern into a NamedThompsonCompilation.
Compile a Pattern into a certified ThompsonCompilation.
Regex matching a character class of literals and ranges.
Regex matching an option-aware character class.
Test whether char matches any enabled shorthand class in kinds under options.
Test whether char matches a character class of literals and ranges.
Curried predicate for a character class of literals and ranges.
Close the top named-capture frame and commit its text to the ledger.
Compile a Pattern into a Sigma-packaged PatternMachine.
Compile a typed Regex(result) AST into an executable CompiledRegex(result).
Compile a PatternMachine's transition function into an indexed TransitionRows table.
Transition function for a concatenated pair of submachines.
Dispatch a concatenation transition after classifying the state as left or right.
Construct the PatternMachine for sequential concatenation of two submachines.
Equivalence unfolding pattern_machine_next_at for concat_pattern_machine.
Sequence two regexes, returning both results as a Tuple.
Apply RegexOptions to a sub-regex.
Test whether a BoundaryConstraint holds at boundary.
Test whether a BoundaryConstraint holds at boundary given the current capture routine.
Return true if every BoundaryConstraint in constraints holds at boundary.
Return true if all constraints hold at boundary with capture routine.
Return true if target appears in the character list chars.
Return true if target matches any character in chars under options.
Advance search_last_machine_prefix_loop while retaining the best certified match.
Route accepting left-submachine states into right_starts while keeping active left states.
Return true if policy recognizes CRLF pairs as a single line break.
Return the default RegexOptions (case-sensitive, single-line, ASCII mode).
Advance an EvidenceThread with char into a destination MachineState.
Advance an EvidenceThread with char into every destination in destinations.
Regex matching an ASCII digit (\d) or non-digit (\D when negated).
Regex matching \d / \D under options.
Test whether char matches \d / \D under options.
Curried predicate for \d / \D under options.
Congruence lifting PatternMachine equality to pattern_machine_next_at.
Congruence lifting PatternMachine equality to pattern_machine_starts.
Wrapper fixing the right submachine of alternate_pattern_machine for congruence proofs.
Wrapper fixing the left submachine of alternate_pattern_machine for congruence proofs.
Wrapper fixing the right submachine of concat_pattern_machine for congruence proofs.
Wrapper fixing the left submachine of concat_pattern_machine for congruence proofs.
Wrapper function applying group_pattern_machine for congruence proofs.
Proof that a DirectStagedCompilation's seed machine equals thompson_machine.
Wrapper applying repeat_pattern_machine with fixed lazy flag for congruence proofs.
Pointwise equivalence showing direct-staged rows match thompson_machine transitions.
Extract the underlying TransitionRowsFrom table from a DirectStagedCompilation.
Extract the start-state list from a DirectStagedCompilation.
Discard a matched Char and return Unit.
Conversion values used by the literal emitter's staged IR. Keeping these small adapters here lets generated literals publish a first-order Thompson tree without rebuilding a Regex/Pattern wrapper at runtime.
Match left then right, returning only right's result.
Match left then right, returning only left's result.
Deduplicate EvidenceThreads by state, keeping the highest-priority thread per state.
Deduplicate EvidenceThreads against an existing ThreadWinnerTable.
Return true if char matches . under options.
Curried predicate for . under options.
Test whether char matches . given dotall and policy.
Regex matching . under options.
Regex matching . given dotall and policy.
Regex matching the empty string and producing Unit.
Construct a Conversion turning Unit into an empty List(a).
Shape-indexed adapters keep generated bounded-literal conversions fully inferable. The emitter knows the inner shape, while the polymorphic convenience form above has no expected type at the generated call site.
Transition function for a zero-state empty or boundary machine.
Return an empty List(MachineState(n)).
Construct the zero-state PatternMachine accepting the empty string.
Transform Unit into an empty List(a) for zero-count repetitions.
Create an empty ThreadWinnerTable for deduplicating active and accepted threads.
Enable a single ClassKind flag in a ClassKinds set.
Zero-width anchor matching the end of subject or line.
Zero-width end anchor respecting multiline and newline options.
Prepend a loop-entry routine onto repetition body start states.
Prepend a loop-entry routine and constraints onto repetition body start states.
Prepend a left routine onto right-submachine start states.
Prepend a left routine and constraints onto right-submachine start states.
Erase named capture slots from a NamedThompsonCompilation to a ThompsonCompilation.
Return true if actual equals expected.
Curried character predicate testing equality with expected.
Regex matching the exact character expected and returning Unit.
Regex matching expected under options and returning Unit.
Run a typed Conversion to transform raw Sem(shape) evidence into a result value.
Evidence execution deliberately forgets ExtendedExecution.current.
Observe still advances every open capture frame, while the current
character is observational bookkeeping and cannot affect evidence.
Execute an ExtendedRoutine and return the final evidence stack if valid.
Execute a single ExtendedInstruction against an extended evidence state.
Execute an ExtendedRoutine, returning the updated stack, captures, and current buffer.
Execute a single EvidenceInstruction against the evidence stack and capture frame stack.
Wrap a converted left-branch result in ChoseLeft.
Map a Conversion over every element of a list.
Execute an ExtendedInstruction while tracking named-capture frames.
Execute an ExtendedRoutine while tracking named-capture frames and ledger.
Execute a single EvidenceInstruction while tracking named-capture frames.
Wrap a converted right-branch result in ChoseRight.
Execute a sequence of EvidenceInstructions, returning the final stack and captures.
Execute an evidence routine and return a certified RoutineExecution witness.
Extract the resulting capture frame stack from an executed routine state.
Extract the resulting Evidence stack from an executed routine state.
Extract the capture frame stack from an extended execution state.
Regex matching an extended character class.
Test whether char matches an extended character class (literals, ranges, kinds, POSIX).
Curried predicate for an extended character class.
Extract the current character buffer from an extended execution state.
Extract the Evidence stack from an extended execution state.
Test whether char matches an extended class that also includes Unicode properties.
Curried predicate for an extended character class with Unicode properties.
Named machines may carry capture-participation constraints on their
destination states. Those constraints are checked against the regular
evidence already executed on the path plus the destination's epsilon
routine: a group that participated contributes its EndCaptureSlot
instruction before the guarded branch is entered. Observe instructions
are intentionally erased from this view; they only advance capture text.
Ordinary machines deliberately continue through machine_destinations,
whose indexed proof contract does not mention capture conditions.
Regex matching an extended character class with Unicode properties.
Classify an accepting MachineState against boundary as kept or rejected.
Classify an active MachineState against boundary as kept or rejected.
Keep only MachineState values whose boundary constraints hold at boundary.
Filter MachineStates whose boundary constraints hold with capture routine.
Filter MachineState values at the boundary derived from position and remaining.
Append the default capture-end instruction to every accepting state in states.
Append end_instruction to every accepting state in states.
Append a pair-completion instruction to every accepting state in states.
Return the evidence stack of the first accepting thread in threads, if any.
Return true if char matches [low, high] under case folding.
Return the empty destination list for a group machine.
Wrap inner transition destinations with capture-end instructions for a group.
Equivalence unfolding group_machine_next to group_next_output.
Wrap inner transition destinations with a custom capture-end instruction.
Apply capture-end framing to a list of destination states.
Congruence lifting transition equivalence through group_next_output.
Wrap a PatternMachine in a standard capture group.
Equivalence unfolding pattern_machine_next_at for group_pattern_machine.
Wrap a PatternMachine in a named capture group identified by slot.
Guard all start states of a PatternMachine with a CaptureCondition.
Attach a leading BoundaryConstraint to every state in states.
Look up the offset-th previous character in reverse history.
Return true if reverse history contains at least width characters.
Histories are newest-first and bounded to one scalar beyond the eight- scalar assertion limit. The extra scalar supplies the boundary context immediately before a fixed-width lookbehind window.
Take up to limit characters from a reverse character history list.
Regex matching horizontal whitespace (\h or \H when negated).
Test whether char is horizontal whitespace (\h / \H).
Curried predicate for horizontal whitespace (\h / \H).
An active thread cannot have an accepting path over an empty input. Keeping this contradiction at the typed path boundary prevents a later refutation proof from accidentally treating an unconsumed active state as terminally accepted.
Return true if char falls in any inclusive (low, high) range in ranges.
Return true if char falls in any range in ranges under options.
Compute boundary-filtered initial states for machine at position.
Compute the Boundary at the start of remaining given an already-consumed prefix.
Create an initial EvidenceThread from a starting MachineState.
Create initial EvidenceThreads for all starting MachineStates.
Inject a left-branch bounded state index into an alternation's sum state space.
Inject a right-branch bounded state index into an alternation's sum state space.
Widen machine states from the left submachine into a combined sum state space.
Shift machine states from the right submachine into a combined sum state space.
Regex matching a line break (\R) under the default newline policy.
Return true if char can end a two-character CRLF line break under policy.
Test whether char is \n (end of a CRLF line break).
Return true if char can start a two-character CRLF line break under policy.
Test whether char is \r (start of a CRLF line break).
Test whether char starts a CRLF pair under policy.
Return true if char is a single-character line break under policy.
Test whether char is a single-character line break under policy.
Regex matching a line break (\R) under an explicit NewlinePolicy.
Construct a line-end ($) boundary constraint with the default newline policy.
Construct a line-end ($) boundary constraint with an explicit newline policy.
Determine whether a position is at a line end given previous, current, and policy.
Construct a line-start (^) boundary constraint with the default newline policy.
Construct a line-start (^) boundary constraint with an explicit newline policy.
Determine whether a position is at a line start given previous, current, and policy.
Return the maximum lookbehind history window retained during matching.
Assertions are staged as ordinary zero-state boundary nodes. The child machine is closed over once here; each boundary check only supplies the current finite subject context, so no source parser or machine rebuild is performed during matching.
Return true if a LookaheadDecision succeeded.
Wrap a prefix search path into a LookaheadWitness.
Search for an accepting path from a single MachineState over input.
Check whether a single MachineState accepts immediately with no remaining input.
Lookaround child evaluation reuses the checked Thompson machine and has a context-aware, finite search loop. The Boolean path records only the existence of an accepting child path; the named sidecar below replays the selected child routine when assertion-local captures are requested.
Evaluate a nested lookbehind constraint inside a lookaround at the remaining depth.
Package a LookaroundCompilation into an existentially quantified PatternMachine.
A successful positive assertion can publish capture participation to the parent's ordinary finite machine. The Boolean decision remains the admission check; the capture-aware routine supplies only slot markers.
Evaluate a LookaroundCondition at the current position and recursion depth.
Evaluate a LookaroundCondition and return its resulting ExtendedRoutine if satisfied.
Extract the capture context needed to evaluate a lookaround BoundaryConstraint.
Collect nested lookaround decisions produced while checking a single constraint.
Evaluate a lookaround BoundaryConstraint and return any captured routine.
Extract capture contexts for a list of lookaround BoundaryConstraints.
Capture-aware boundary evaluation returns the selected child routine for a positive assertion. A negative assertion succeeds with an empty routine: its private capture frame is intentionally discarded. The Boolean path above remains the acceptance authority; this side channel only preserves the witness needed by named replay.
Construct a LookaroundExhaustion witness from a list of failed member states.
Turn a structurally enumerated candidate list into the compact erased exhaustion witness used by assertion refutations. The recursive call is the only way to obtain the Nil remainder, so callers cannot manufacture a certificate for a list whose traversal has not terminated.
Assertion operands are validated as depth-bounded before emission. Their child machine can therefore recurse only through the explicit finite fuel; using this separate filter keeps Boolean child evaluation outside the parent constraint evaluator's ordinary totality SCC.
Find the shortest (first) prefix of input accepted by a lookaround machine.
Recursive helper for lookaround_first_prefix accumulating matched characters.
The empty start list has no accepting path. This is the base case used
by the eventual refutation-tree soundness proof: every search-path
constructor carries a membership witness in starts, so starts = []
is eliminated constructively rather than treated as an unchecked claim.
Find the longest (last) prefix of input accepted by a lookaround machine.
Recursive helper for lookaround_last_prefix tracking the latest match.
Build the finite child machine once. Atomic scopes are represented by the same BeginAtomic/EndAtomic routine markers used by the ordinary runtime plan, so nested assertion evaluation can apply one commitment invariant rather than maintaining a second backtracking mechanism.
Search for a full acceptance path of a lookaround machine on input.
Return true if a lookaround machine accepts input.
Compute filtered destination states for a lookaround machine step.
Compute unfiltered destination states for a lookaround machine step.
Collect nested lookaround decisions across a list of constraints.
Construct a path-failure witness when an accepting state still has remaining input.
Construct a path-failure witness when no candidate destinations remain.
Apply positive or negative lookaround polarity to a match boolean.
Find either the shortest (lazy: true) or longest (lazy: false) prefix accepted by a lookaround machine.
Filter a lookaround machine's start states at the current boundary.
Return true if a lookaround machine matches any prefix of input.
Search for a prefix-accepting path from a single MachineState over input.
Decide a lookahead assertion and return a certified LookaheadDecision.
Run a certified prefix lookaround search from machine's start states.
Run a certified prefix lookaround search across explicit start-state members.
Decide a lookbehind assertion and return a certified LookbehindDecision.
Construct a search-failure witness when no start states remain.
Eliminate an impossible lookaround search failure from an empty start list.
Run a certified full-input lookaround search from machine's start states.
Eliminate an impossible lookaround search path from an empty start list.
Run a certified full-input lookaround search across explicit start-state members.
Return the total number of states in a LookaroundCompilation.
Compute the Boundary after a lookaround machine consumes char.
Construct a lookbehind boundary constraint with polarity, width, and compiled machine.
Return true if a LookbehindDecision succeeded.
Compute the starting Position for a lookbehind window of length width.
Extract the last width characters from reverse history in forward order.
Wrap a full search path into a LookbehindWitness.
Execute a PatternMachine on a character list and return whether any thread accepts.
Compute boundary-filtered transitions for machine from state on char.
Return true if any state in states is accepting.
Build the reflexive MachineStateMembers witness for a list of states.
Extract the evidence instruction routine attached to a MachineState.
Step a list of active MachineState values on char via machine.
Step a single active MachineState on char via machine.
Transform the typed result of regex using transform.
Append a branch-choice marker instruction to every state in states.
Construct a ListMember witness pointing to the head of a cons list.
Lift a ListMember witness past the head of a cons list.
Look up the captured text for slot in a named-capture ledger.
Finalize a named-capture ledger into NamedCapture entries ordered by layout.
Finalize a named-capture ledger into NamedCapture entries ordered by slots.
Advance named_search_last_prefix_loop while retaining the best match seen so far.
Filter initial states of a named-capture machine against boundary constraints.
Match a NamedRegex against the full input string and return all named captures.
Named replay for a lookaround-aware compilation uses the same checked finite machine as assertion acceptance. Unlike the typed path, the returned routine is retained long enough to replay capture slots, including slots opened and closed inside a positive assertion.
Match a lookaround-capable NamedRegex prefix at position and return its named captures.
Compute boundary-filtered transitions for a named-capture machine with routine.
Match a NamedRegex prefix starting at position and return its named captures.
Search for an accepting run from a single named-capture MachineState.
Search candidate destination states of a named-capture machine.
Find the shortest prefix accepted by a named-capture machine.
Recursive helper for named_search_first_prefix.
Search initial member states of a named-capture machine for an accepting run.
Find the longest prefix accepted by a named-capture machine.
Recursive helper for named_search_last_prefix.
Search for an accepting match of a named-capture machine on input.
Package a NamedPattern, its Conversion, and its NamedCaptureLayout into a NamedRegex.
Package a NamedRegex after verifying its layout matches the pattern.
Build the executable PatternMachine from a NamedThompsonCompilation.
Return the total number of states in a NamedThompsonCompilation.
Negate a boolean result when negated is true.
Return true if char is a line-break character under policy.
Return true if the next character in remaining is an ASCII word character.
Evaluate the next destination states for an active thread on char.
Return true if the next character in remaining is a Unicode word character.
Return an empty List(Char).
Return an empty ClassKinds bitset with all shorthand classes disabled.
Regex matching any character in chars (or outside it if negated).
Match one or more occurrences of regex, returning OneOrMore(a).
One-or-more regex parameterized by lazy quantifier preference.
Return true if an Option(Char) is Some ASCII word character.
Apply optional negation to a character-class match result.
Test whether char matches a character class with shorthand kinds and options.
Curried predicate for an option-aware character class.
Return true if char is a digit under options (ASCII or Unicode).
Test whether actual matches expected under options (case folding if enabled).
Curried character predicate testing equality with expected under options.
Return the first element of a list as Option, or None() if empty.
Return true if an Option(Char) equals expected.
Return the second element of a list as Option, or None() if fewer than two elements.
Return true if char is whitespace under options (ASCII or Unicode).
Return true if an Option(Char) is Some Unicode word character.
Return true if char is a word character under options (ASCII or Unicode).
Match zero or one occurrence of regex, returning Option(a).
Optional regex parameterized by lazy quantifier preference.
Greedy optional regex returning Choice(a, Unit).
Match left or right when both branches produce the same result type.
Compile and run a Pattern on input, returning whether it matches the full string.
Compile and run a Pattern on input, returning its winning evidence stack.
Eta-equivalence reconstructing a PatternMachine from its starts and transition function.
Project the transition function from a PatternMachine.
Evaluate the transitions of machine from state on char.
Equivalence relating pattern_machine_next_at to pattern_machine_next.
Evaluate a PatternMachine's transition function at state and char.
Project the start-state list from a PatternMachine.
Find the shortest (lazy: true) or longest (lazy: false) matching prefix of input.
Find a matching prefix of input starting at position for pattern.
Greedy one-or-more regex returning List(a).
Advance a Position by a single character using the default newline policy.
Advance a Position by a single character using an explicit newline policy.
Compute the Boundary snapshot for position and remaining characters.
Construct a Boundary from a reverse character history, remaining input, and policy.
Test whether position followed by remaining is at a line end under policy.
Return true when remaining is empty (strict subject end).
Test whether position followed by remaining is at the subject end under policy.
Test whether char satisfies a (possibly negated) PosixClassMatch.
Test whether char belongs to a PosixClass under options.
Return true if char satisfies any entry in a list of PosixClassMatches.
Regex matching a single character that satisfies test.
Construct the accepting destination state after matching a single character.
Return the accepting destination when test(char) holds, or empty otherwise.
Transition function for a single-character predicate machine.
Construct the single start state of a predicate PatternMachine.
Return the singleton start-state list for a predicate machine.
Construct a one-state PatternMachine matching characters satisfying test.
Prepend a single EvidenceInstruction to every state in states.
Attach an initial-state witness to a MachineAcceptingSearch result.
Construct a Conversion prepending an optional (Choice(a, Unit)) element onto a list.
Construct a shape-indexed optional-repetition Conversion.
Prepend a Choice(a, Unit) element onto a repetition result list if present.
Construct a Conversion consing a repeated element onto a result list.
Construct a shape-indexed repetition-cons Conversion.
Cons a matched element onto a repetition result list.
Regex matching any character in the inclusive range [low, high].
Return true if char lies inclusively between low and high.
Curried predicate testing inclusion in [low, high].
Mark state as visited in the active-thread winner set slots.
Append char to every open named-capture frame on the active stack.
Record a thread's state in table so lower-priority duplicates are pruned.
Reference constructor retained for differential tests.
Check whether a routine executes cleanly to a valid evidence stack.
Update the latest recorded EvidencePrefix when an accepting thread is present.
Match zero or more occurrences of regex, collecting results in a List.
Construct the accepting end-of-repetition state for a Kleene-star machine.
Order loop-back and exit destinations according to lazy preference.
Expand body states into loop-back and accepting repetition destinations.
Transition function for a repetition machine.
Compute start states for a repetition machine, respecting lazy preference.
Construct the PatternMachine for greedy or lazy repetition of a submachine.
Zero-or-more regex parameterized by lazy quantifier preference.
Replay an ExtendedRoutine against a NamedCaptureLayout to extract named captures.
Adapt a TransitionRows table into a curried transition function.
Build a TransitionRows table directly from a transition function next.
Pointwise equivalence showing rows_from_next lookup agrees with next.
Equivalence unfolding rows_from_next to TransitionRows(build_transition_rows(...)).
Run active EvidenceThreads across input and return the winning evidence stack.
Find the shortest prefix of input that produces accepting evidence.
Find the longest prefix of input that produces accepting evidence.
Return true if two CaptureSlot identifiers refer to the same slot.
Compare two List(Char) values for exact equality.
Return true if two EvidenceThreads occupy the same machine state.
Perform certified backtracking acceptance search from a single MachineState.
Perform certified backtracking acceptance search across a list of member states.
Find the shortest certified prefix accepted by machine.
Recursive helper for search_first_machine_prefix.
Search a list of initial member states for a certified acceptance derivation.
Find the longest certified prefix accepted by machine.
Recursive helper for search_last_machine_prefix.
Perform certified full-string acceptance search for machine on input.
Identity Conversion on Sem(shape).
Predicate testing membership in chars, optionally negated.
Wrap regex with a compile-time shape simplification pass.
Apply shape simplification to a CompiledRegex.
Apply shape simplification to a compiled RegexProgram.
Regex matching ASCII whitespace (\s) or non-whitespace (\S when negated).
Regex matching \s / \S under options.
Test whether char matches \s / \S under options.
Curried predicate for \s / \S under options.
Transition step for a staged alternation machine.
Dispatch a staged alternation transition from a classified left/right state.
Curried transition function for a staged alternation machine.
Compute start states for a staged alternation machine.
Construct the empty TransitionRows table for a boundary constraint pattern.
Transition step for a staged concatenation machine.
Dispatch a staged concatenation transition from a classified left/right state.
Curried transition function for a staged concatenation machine.
Equivalence unfolding staged concatenation row lookup to staged_concat_next.
Compute start states for a staged concatenation machine.
Construct the empty TransitionRows table for an empty pattern.
Transition step for a staged group machine over TransitionRows.
Curried transition function for a staged group machine.
Compute start states for a staged group machine.
Staged literals use a row-backed machine. The transition rows are built from the direct staged machine seed below, rather than reconstructing a canonical Thompson machine for every child closure.
Equivalence showing staged machine rows match thompson_machine transitions.
Construct the closure machine once per Thompson subtree. Let-binding the child results is important: starts and next are two projections of the same child value, not two independent recursive reconstructions.
Proof that staged compilation start states equal thompson_machine start states.
Transition step for a staged single-character predicate machine.
Curried transition function for a staged predicate machine.
Transition step for a staged repetition machine.
Curried transition function for a staged repetition machine.
Compute start states for a staged repetition machine.
Extract the TransitionRows table from a StagedCompilation.
Pointwise equivalence showing staged compilation rows match thompson_machine transitions.
Compatibility reference retained for differential checking. It preserves the original row formulas while the active machine below uses the direct staged rows; this keeps the comparison path independent of the optimized construction.
Extract the start-state list from a StagedCompilation.
Zero-width anchor matching the start of subject or line.
Zero-width start anchor respecting multiline and newline options.
Step a single EvidenceThread on char at boundary using machine.
Step all active EvidenceThreads on char at boundary.
Zero-width anchor matching strictly at the end of the subject (\z).
Construct a strict subject-end (\z) boundary constraint with the default newline policy.
Construct a strict subject-end (\z) boundary constraint with an explicit newline policy.
Identity Conversion on String.
Construct a subject-end (\Z) boundary constraint with the default newline policy.
Construct a subject-end (\Z) boundary constraint with an explicit newline policy.
Determine whether a position is at the subject end (allowing a trailing newline) under policy.
Construct the starting Position at the beginning of a subject.
Construct a subject-start (\A) boundary constraint with the default newline policy.
Construct a subject-start (\A) boundary constraint with an explicit newline policy.
Return true if remaining consists solely of a single terminal line break under policy.
Package a ThompsonCompilation into an existentially quantified PatternMachine.
Canonical constructor. The reference copy above is deliberately kept separate so transition-row implementations can be compared without changing the proof theorem's original definitional equations.
Return the total number of states in a ThompsonCompilation.
Return true if a thread's state has already been visited in table.
Compute the Boundary immediately after consuming char at position.
Compute the Boundary before consuming char, incorporating trailing after_input.
Convert a transition's EvidenceInstruction list into an ExtendedRoutine.
Equivalence unfolding transition_rows_next applied to a TransitionRows constructor.
Look up transitions for a bounded state and char in a TransitionRowsFrom suffix.
A table-backed machine exposes the same indexed machine interface as the reference closure machine. The only runtime closure is this single row lookup adapter; transition construction itself is performed once when the table is built, not by recursively rebuilding Thompson combinators for each input character.
Equivalence relating pattern_machine_next_at on a table-backed machine to transition_rows_next.
Look up transitions for state and char in a compiled TransitionRows table.
Pointwise equivalence showing compile_transition_rows preserves a machine's transition function.
Pointwise equivalence relating compiled transition rows to pattern_machine_next_at.
Transport a ListMember witness along list equality.
Return true if char is a Unicode letter or decimal digit.
Return true if char is a Unicode alphabetic character.
Return true if category appears in the list categories.
Return true if char is a visible Unicode graphical character.
Return true if char is a printable Unicode character.
Regex matching a single UnicodeProperty (\p{...} / \P{...}).
Test whether char satisfies a (possibly negated) UnicodePropertyMatch.
Test whether char satisfies a UnicodeProperty.
Return true if char satisfies any entry in a list of UnicodePropertyMatches.
Curried predicate for a UnicodeProperty with optional negation.
Construct a Unicode word-boundary (\b / \B) constraint.
Identity Conversion on Unit.
Record or overwrite a captured text value for slot in the named-capture ledger.
Regex matching vertical whitespace (\v or \V when negated).
Test whether char is vertical whitespace (\v / \V).
Curried predicate for vertical whitespace (\v / \V).
Weaken a MachineStateMembers witness by prepending an extra element to the ambient list.
Zero-width word-boundary anchor (\b or negated \B) respecting options.
Regex matching an ASCII word character (\w) or non-word (\W when negated).
Regex matching \w / \W under options.
Test whether char matches \w / \W under options.
Curried predicate for \w / \W under options.
Types
type AcceptingFrom(n, machine) indices (input: List(Char), after_input: List(Char), state: ThreadState(n), current_evidence: List(Evidence), captures: List(CaptureFrame), final_evidence: List(Evidence), extended_routine: List(ExtendedInstruction))
AcceptingNow : AcceptingFrom(n, machine, Nil(), after_input, ThreadAccepted(), evidence, captures, evidence, Nil())
AcceptingNextActive : (destination: Bounded(n)) -> (regular: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (destination_evidence: List(Evidence)) -> (destination_captures: List(CaptureFrame)) -> (suffix_routine: List(ExtendedInstruction)) -> (edge: ListMember(MachineState(n), Active(destination, regular, constraints), machine_destinations(n, machine, state, char, transition_boundary_before(char, rest, after_input)))) -> (execution: RoutineExecution(regular, current_evidence, record_capture_char(captures, char), destination_evidence, destination_captures)) -> (suffix: AcceptingFrom(n, machine, rest, after_input, ThreadActive(destination), destination_evidence, destination_captures, final_evidence, suffix_routine)) -> AcceptingFrom(n, machine, Cons(char, rest), after_input, state, current_evidence, captures, final_evidence, append_extended_routines(transition_routine(char, regular), suffix_routine))
AcceptingNextAccepted : (regular: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (destination_evidence: List(Evidence)) -> (destination_captures: List(CaptureFrame)) -> (suffix_routine: List(ExtendedInstruction)) -> (edge: ListMember(MachineState(n), Accepted(regular, constraints), machine_destinations(n, machine, state, char, transition_boundary_before(char, rest, after_input)))) -> (execution: RoutineExecution(regular, current_evidence, record_capture_char(captures, char), destination_evidence, destination_captures)) -> (suffix: AcceptingFrom(n, machine, rest, after_input, ThreadAccepted(), destination_evidence, destination_captures, final_evidence, suffix_routine)) -> AcceptingFrom(n, machine, Cons(char, rest), after_input, state, current_evidence, captures, final_evidence, append_extended_routines(transition_routine(char, regular), suffix_routine))
type AcceptingSearch(n, machine) indices (input: List(Char), after_input: List(Char), state: ThreadState(n), current_evidence: List(Evidence), captures: List(CaptureFrame))
NoAcceptingPath : AcceptingSearch(n, machine, input, after_input, state, current_evidence, captures)
AcceptingPath : (final_evidence: List(Evidence)) -> (extended_routine: List(ExtendedInstruction)) -> (routine_certificate: CertifiedPathRoutine(extended_routine, current_evidence, captures, final_evidence)) -> (@erased path : AcceptingFrom(n, machine, input, after_input, state, current_evidence, captures, final_evidence, extended_routine)) -> AcceptingSearch(n, machine, input, after_input, state, current_evidence, captures)
enum ActiveWinnerSlots
NoWinnerSlots
ActiveWinnerSlot
One winner slot per encountered intrinsic active state plus one accepted-state bit.
Traversal is left-to-right, so setting a slot preserves the first (highest
priority) thread and discards every later duplicate without rescanning the
growing winner list. Bounded(n) structurally indexes the slot spine: no
unchecked Nat conversion enters the machine and the erased bound need not
be materialized at runtime.
type AtomicCommitDisposition indices (current: Nat, commit: Nat)
AtomicCommitBlocks : (@erased proof : AtomicDepthAtLeast(current, commit)) -> AtomicCommitDisposition(current, commit)
AtomicCommitEscapes : (@erased proof : AtomicDepthBelow(current, commit)) -> AtomicCommitDisposition(current, commit)
A named commitment decision keeps the control invariant visible at every search boundary: a commit at the current scope or an enclosing scope blocks the remaining siblings, while a commit strictly inside the current scope escapes to the caller so an outer alternative may still run.
type AtomicDepthAtLeast indices (left: Nat, right: Nat)
AtomicDepthAtLeastZero : AtomicDepthAtLeast(Z(), Z())
AtomicDepthAtLeastFromZero : AtomicDepthAtLeast(S(left), Z())
AtomicDepthAtLeastStep : (@erased prior : AtomicDepthAtLeast(left, right)) -> AtomicDepthAtLeast(S(left), S(right))
The runtime search never compares scope depths with an unchecked Boolean. This finite decision relation carries the proof that a commit is either at-or-inside the current scope (so siblings are blocked) or strictly deeper than it (so the commit belongs to an inner scope and outer siblings remain eligible). The evidence fields are erased after the branch has been selected.
type AtomicDepthBelow indices (left: Nat, right: Nat)
AtomicDepthBelowZero : AtomicDepthBelow(Z(), S(right))
AtomicDepthBelowStep : (@erased prior : AtomicDepthBelow(left, right)) -> AtomicDepthBelow(S(left), S(right))
type AtomicDepthComparison indices (left: Nat, right: Nat)
AtomicDepthStops : (@erased proof : AtomicDepthAtLeast(left, right)) -> AtomicDepthComparison(left, right)
AtomicDepthPasses : (@erased proof : AtomicDepthBelow(left, right)) -> AtomicDepthComparison(left, right)
type AtomicRuntimePattern indices (shape: ShapeCode)
AtomicRuntimeLeaf : (pattern: Pattern(shape)) -> AtomicRuntimePattern(shape)
AtomicRuntimeConcat : (left: AtomicRuntimePattern(left_shape)) -> (right: AtomicRuntimePattern(right_shape)) -> AtomicRuntimePattern(PairC(left_shape, right_shape))
AtomicRuntimeGroup : (inner: AtomicRuntimePattern(inner_shape)) -> AtomicRuntimePattern(StringC)
AtomicRuntimeAlternate : (left: AtomicRuntimePattern(left_shape)) -> (right: AtomicRuntimePattern(right_shape)) -> (prefer_right: Bool) -> AtomicRuntimePattern(ChoiceC(left_shape, right_shape))
AtomicRuntimeScope : (inner: AtomicRuntimePattern(inner_shape)) -> AtomicRuntimePattern(inner_shape)
AtomicRuntimeRepeat : (inner: AtomicRuntimePattern(inner_shape)) -> (lazy: Bool) -> AtomicRuntimePattern(ListC(inner_shape))
Runtime-only atomic plan. Ordinary Pattern values and their Thompson proofs stay unchanged; this parallel tree carries only the commitment scopes needed by the ordered runtime search.
enum AtomicScopeEffect
AtomicScopeEffect
Atomic commitment is runtime control state, not part of the ordinary proof-carrying search result. A commit failure stops siblings at the scope that closed, while an outer scope may still propagate it.
enum AtomicSearchResult
AtomicSearchNo
AtomicSearchCommit
AtomicSearchYes
enum CaptureLayout
CaptureLayout
type CaptureParticipationDecision indices (slot: Nat, routine: List(EvidenceInstruction))
CaptureParticipatedByRoutine : CaptureParticipationDecision(slot, routine)
CaptureAbsentByRoutine : CaptureParticipationDecision(slot, routine)
The conditional guard consumes an indexed decision produced from the destination epsilon routine. This is the finite participation fact used by named conditionals; it is deliberately separate from capture text and cannot be manufactured by replaying an unrelated slot.
enum CaptureSlot
CaptureSlot
Named capture metadata is additive. It never enters ShapeCode or the ordinary Match tuple, so existing typed regex APIs remain unchanged.
type CertifiedPathRoutine indices (routine: List(ExtendedInstruction), input_evidence: List(Evidence), input_captures: List(CaptureFrame), output_evidence: List(Evidence))
PathRoutineDone : CertifiedPathRoutine(Nil(), evidence, captures, evidence)
PathRoutineTransition : (char: Char) -> (regular: List(EvidenceInstruction)) -> (suffix_routine: List(ExtendedInstruction)) -> (destination_evidence: List(Evidence)) -> (destination_captures: List(CaptureFrame)) -> (regular_execution: ExtendedEvidenceRoutineExecution(regular_routine(regular), source_evidence, record_capture_char(source_captures, char), destination_evidence, destination_captures)) -> (suffix: CertifiedPathRoutine(suffix_routine, destination_evidence, destination_captures, final_evidence)) -> CertifiedPathRoutine(append_extended_routines(transition_routine(char, regular), suffix_routine), source_evidence, source_captures, final_evidence)
PathRoutineInitial : (regular: List(EvidenceInstruction)) -> (suffix_routine: List(ExtendedInstruction)) -> (initial_evidence: List(Evidence)) -> (initial_captures: List(CaptureFrame)) -> (regular_execution: ExtendedEvidenceRoutineExecution(regular_routine(regular), Nil(), Nil(), initial_evidence, initial_captures)) -> (suffix: CertifiedPathRoutine(suffix_routine, initial_evidence, initial_captures, final_evidence)) -> CertifiedPathRoutine(append_extended_routines(regular_routine(regular), suffix_routine), Nil(), Nil(), final_evidence)
type CertifiedPrefixSearch(n, machine) indices (position: InitialPosition)
NoCertifiedPrefix : CertifiedPrefixSearch(n, machine, position)
CertifiedPrefixPath : (matched_input: List(Char)) -> (remaining_input: List(Char)) -> (final_evidence: List(Evidence)) -> (extended_routine: List(ExtendedInstruction)) -> (@erased acceptance : MachineAcceptance(n, machine, position, matched_input, remaining_input, final_evidence, extended_routine)) -> CertifiedPrefixSearch(n, machine, position)
type CertifiedRoutineExecution indices (routine: List(EvidenceInstruction), input_evidence: List(Evidence), input_captures: List(CaptureFrame))
CertifiedRoutineExecuted : (output_evidence: List(Evidence)) -> (output_captures: List(CaptureFrame)) -> (certificate: RoutineExecution(routine, input_evidence, input_captures, output_evidence, output_captures)) -> (extended_certificate: ExtendedEvidenceRoutineExecution(regular_routine(routine), input_evidence, input_captures, output_evidence, output_captures)) -> CertifiedRoutineExecution(routine, input_evidence, input_captures)
enum CharacterRange
CharacterRange
enum ClassKind
DigitKind
NotDigitKind
WordKind
NotWordKind
SpaceKind
NotSpaceKind
HorizontalKind
NotHorizontalKind
VerticalKind
NotVerticalKind
enum ClassKinds
ClassKinds
type CompilationHint indices (shape: ShapeCode)
NoCompilationHint : CompilationHint(shape)
StagedCompilationHint : StagedMachine(shape) -> CompilationHint(shape)
type CompiledRegex indices (result: Type)
NoProgram : CompiledRegex(result)
SomeProgram : RegexProgram(result) -> CompiledRegex(result)
Option is a Type-level family, so it cannot hold a RegexProgram(result):
a family INDEXED by Type lives one universe up (level: 1), exactly as an
Agda data … : Set → Set₁ does. Cure has no universe polymorphism, so the
large case needs its own carrier rather than a Type-level Option.
type Conversion indices (raw: Type, result: Type)
IdentityConversion : Conversion(value, value)
ApplyConversion : Function(raw, result) -> Conversion(raw, result)
ComposedConversion : Conversion(raw, middle) -> Conversion(middle, result) -> Conversion(raw, result)
PairConversion : Conversion(left_raw, left_result) -> Conversion(right_raw, right_result) -> Conversion(Tuple(left_raw, right_raw), Tuple(left_result, right_result))
ChoiceConversion : Conversion(left_raw, left_result) -> Conversion(right_raw, right_result) -> Conversion(Choice(left_raw, right_raw), Choice(left_result, right_result))
ListConversion : Conversion(raw, result) -> Conversion(List(raw), List(result))
LeftPairConversion : Conversion(left_raw, left_result) -> Conversion(right_raw, right_result) -> Conversion(Tuple(left_raw, right_raw), left_result)
RightPairConversion : Conversion(left_raw, left_result) -> Conversion(right_raw, right_result) -> Conversion(Tuple(left_raw, right_raw), right_result)
SameChoiceConversion : Conversion(left_raw, result) -> Conversion(right_raw, result) -> Conversion(Choice(left_raw, right_raw), result)
OptionalConversion : Conversion(raw, result) -> Conversion(Choice(raw, Unit), Option(result))
OneOrMoreConversion : Conversion(raw, result) -> Conversion(Tuple(raw, List(raw)), OneOrMore(result))
PrependConversion : Conversion(raw, result) -> Conversion(Tuple(raw, List(raw)), List(result))
SimplifyConversion : (shape: ShapeCode) -> Conversion(Sem(shape), Sem(Simplify(shape)))
type DistinctThreadResult indices (n: Nat)
DistinctThreadResult : ThreadWinnerTable -> List(EvidenceThread(n)) -> DistinctThreadResult(n)
type EvidenceStep(n, machine) indices (char: Char, boundary: Boundary, source_state: ThreadState(n), source_evidence: List(Evidence), source_captures: List(CaptureFrame), destination_state: ThreadState(n), destination_evidence: List(Evidence), destination_captures: List(CaptureFrame))
EvidenceStepActive : (destination: Bounded(n)) -> (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (edge: ListMember(MachineState(n), Active(destination, routine, constraints), machine_destinations(n, machine, source_state, char, boundary))) -> (execution: RoutineExecution(routine, source_evidence, record_capture_char(source_captures, char), result_evidence, result_captures)) -> EvidenceStep(n, machine, char, boundary, source_state, source_evidence, source_captures, ThreadActive(destination), result_evidence, result_captures)
EvidenceStepAccepted : (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (edge: ListMember(MachineState(n), Accepted(routine, constraints), machine_destinations(n, machine, source_state, char, boundary))) -> (execution: RoutineExecution(routine, source_evidence, record_capture_char(source_captures, char), result_evidence, result_captures)) -> EvidenceStep(n, machine, char, boundary, source_state, source_evidence, source_captures, ThreadAccepted(), result_evidence, result_captures)
A single winning NFA path through the evidence VM. Both the starting
thread and final evidence are indices: AcceptingNow can close only at an
accepted thread carrying exactly that evidence, while AcceptingNext can
advance only to a member of step_evidence_thread. Consequently a path
cannot invent a state, skip an input character, or claim evidence different
from the VM thread it reaches.
Boundary filtering is part of the indexed edge, including the exact suffix
used by the runtime boundary calculation. This covers zero-width boundary
constraints without adding an unchecked side condition to the theorem.
One evidence-preserving transition. It separates machine reachability from
routine execution: edge proves the destination came from the checked
bounded transition relation, and execution proves that destination's
routine produced exactly the evidence/capture state named by the result.
type ExtendedEvidenceRoutineExecution indices (routine: List(ExtendedInstruction), input_evidence: List(Evidence), input_captures: List(CaptureFrame), output_evidence: List(Evidence), output_captures: List(CaptureFrame))
ExtendedEvidenceDone : {input_evidence: List(Evidence)} -> {input_captures: List(CaptureFrame)} -> ExtendedEvidenceRoutineExecution(Nil(), input_evidence, input_captures, input_evidence, input_captures)
ExtendedEvidenceObserve : (char: Char) -> {input_captures: List(CaptureFrame)} -> (suffix: ExtendedEvidenceRoutineExecution(rest, input_evidence, record_capture_char(input_captures, char), output_evidence, output_captures)) -> ExtendedEvidenceRoutineExecution(Cons(Observe(char), rest), input_evidence, input_captures, output_evidence, output_captures)
ExtendedEvidenceRegular : (instruction: EvidenceInstruction) -> {input_evidence: List(Evidence)} -> {input_captures: List(CaptureFrame)} -> (suffix: ExtendedEvidenceRoutineExecution(rest, executed_evidence(execute_instruction(instruction, input_evidence, input_captures)), executed_captures(execute_instruction(instruction, input_evidence, input_captures)), output_evidence, output_captures)) -> ExtendedEvidenceRoutineExecution(Cons(Regular(instruction), rest), input_evidence, input_captures, output_evidence, output_captures)
enum ExtendedExecution
ExtendedExecution
Thompson's evidence proof reasons over one NFA-independent instruction
stream. Observe records the consumed character (and advances open capture
frames); Regular embeds the existing VM instruction language.
enum ExtendedInstruction
Regular
Observe
The generalized Thompson proof uses an NFA-independent stream. Observe
advances capture input; Regular embeds the evidence VM language.
type ExtendedRoutineExecution indices (routine: List(ExtendedInstruction), input_current: Option(Char), input_evidence: List(Evidence), input_captures: List(CaptureFrame), output_current: Option(Char), output_evidence: List(Evidence), output_captures: List(CaptureFrame))
ExtendedRoutineExecuted : ExtendedRoutineExecution(routine, input_current, input_evidence, input_captures, extended_current(execute_extended_routine(routine, input_current, input_evidence, input_captures)), extended_evidence(execute_extended_routine(routine, input_current, input_evidence, input_captures)), extended_captures(execute_extended_routine(routine, input_current, input_evidence, input_captures)))
type InitialEvidenceStep(n, machine) indices (position: InitialPosition, input: List(Char), after_input: List(Char), destination_state: ThreadState(n), destination_evidence: List(Evidence), destination_captures: List(CaptureFrame))
InitialEvidenceActive : (destination: Bounded(n)) -> (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (edge: ListMember(MachineState(n), Active(destination, routine, constraints), initial_machine_destinations(n, machine, position, input, after_input))) -> (execution: RoutineExecution(routine, Nil(), Nil(), result_evidence, result_captures)) -> InitialEvidenceStep(n, machine, position, input, after_input, ThreadActive(destination), result_evidence, result_captures)
InitialEvidenceAccepted : (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (edge: ListMember(MachineState(n), Accepted(routine, constraints), initial_machine_destinations(n, machine, position, input, after_input))) -> (execution: RoutineExecution(routine, Nil(), Nil(), result_evidence, result_captures)) -> InitialEvidenceStep(n, machine, position, input, after_input, ThreadAccepted(), result_evidence, result_captures)
type ListMember(a) indices (value: a, values: List(a))
ListMemberHere : ListMember(a, value, Cons(value, rest))
ListMemberThere : (prior: ListMember(a, value, rest)) -> ListMember(a, value, Cons(other, rest))
Intrinsic list membership. The witness is erased at every accepting-run boundary; its only purpose is to make every path edge name a destination that the checked transition relation actually produced.
type LookaheadDecision(n, machine) indices ()
LookaheadSatisfied : (witness: LookaheadWitness(n, machine)) -> LookaheadDecision(n, machine)
LookaheadRefuted : (certificate: LookaheadRefutation(n, machine)) -> LookaheadDecision(n, machine)
type LookaheadDecisionEvidence
Nested assertion decisions are existentially packaged because each child machine has its own state-count index. They are proof metadata attached to a parent path; the path constructors erase the list after checking.
type LookaheadRefutation(n, machine) indices ()
LookaheadSearchExhausted : {starts: List(MachineState(n))} -> (@erased depth : Nat) -> (input: List(Char)) -> (after_input: List(Char)) -> (history: List(Char)) -> (policy: NewlinePolicy) -> (@erased failure : LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)) -> LookaheadRefutation(n, machine)
LookaheadDepthExhausted : (depth: Nat) -> (input: List(Char)) -> (history: List(Char)) -> (policy: NewlinePolicy) -> (@erased exhaustion : LookaroundExhaustion(n)) -> LookaheadRefutation(n, machine)
A decision is the only value consumed by an assertion constraint. A satisfied branch now carries an existential package containing the finite child path. Refuted branches still record the finite-search outcome (or an explicit resource/history boundary). The search refutation retains the complete child and sibling traversal tree; the remaining work is to prove its soundness and completeness against the machine semantics.
type LookaheadWitness(n, machine) indices ()
LookaheadWitnessPacked : {starts: List(MachineState(n))} -> {depth: Nat} -> {input: List(Char)} -> {after_input: List(Char)} -> {history: List(Char)} -> {policy: NewlinePolicy} -> (path: LookaroundPrefixSearchPath(depth, n, machine, starts, input, after_input, history, policy)) -> LookaheadWitness(n, machine)
type LookaroundAcceptingMembersResult(depth, n, machine, destinations, current) indices (input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), policy: NewlinePolicy, capture_context: List(EvidenceInstruction))
LookaroundAcceptingMembersRejected : (failure: LookaroundPathFailure(depth, n, machine, input, after_input, state, history, capture_context, policy, destinations, current)) -> LookaroundAcceptingMembersResult(depth, n, machine, destinations, current, input, after_input, state, history, policy, capture_context)
LookaroundAcceptingMembersFound : (path: LookaroundAcceptingPath(depth, n, machine, input, after_input, state, history, policy)) -> LookaroundAcceptingMembersResult(depth, n, machine, destinations, current, input, after_input, state, history, policy, capture_context)
Internal result for a destination-list traversal. Unlike the public result above, this carries the full destination list as a parameter, so recursive tail failures cannot escape as an unconstrained existential.
type LookaroundAcceptingPath(depth, n, machine) indices (input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), policy: NewlinePolicy)
LookaroundAcceptedNow : LookaroundAcceptingPath(depth, n, machine, Nil(), after_input, ThreadAccepted(), history, policy)
LookaroundAcceptedNextActive : (source: Bounded(n)) -> (char: Char) -> (rest: List(Char)) -> (destination: Bounded(n)) -> (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (capture_context: List(EvidenceInstruction)) -> (@erased nested_decisions : List(LookaroundNestedDecision)) -> (edge: ListMember(MachineState(n), Active(destination, routine, constraints), lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy))) -> (@erased suffix : LookaroundAcceptingPath(depth, n, machine, rest, after_input, ThreadActive(destination), history_push_bounded(history, char), policy)) -> LookaroundAcceptingPath(depth, n, machine, Cons(char, rest), after_input, ThreadActive(source), history, policy)
LookaroundAcceptedNextAccepted : (source: Bounded(n)) -> (char: Char) -> (rest: List(Char)) -> (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (capture_context: List(EvidenceInstruction)) -> (@erased nested_decisions : List(LookaroundNestedDecision)) -> (edge: ListMember(MachineState(n), Accepted(routine, constraints), lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy))) -> (@erased suffix : LookaroundAcceptingPath(depth, n, machine, rest, after_input, ThreadAccepted(), history_push_bounded(history, char), policy)) -> LookaroundAcceptingPath(depth, n, machine, Cons(char, rest), after_input, ThreadActive(source), history, policy)
type LookaroundAcceptingPathResult(depth, n, machine) indices (input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), policy: NewlinePolicy, capture_context: List(EvidenceInstruction))
LookaroundAcceptingPathRejected : {remaining_destinations: List(MachineState(n))} -> (failure: LookaroundPathFailure(depth, n, machine, input, after_input, state, history, capture_context, policy, destinations, remaining_destinations)) -> LookaroundAcceptingPathResult(depth, n, machine, input, after_input, state, history, policy, capture_context)
LookaroundAcceptingPathFound : (path: LookaroundAcceptingPath(depth, n, machine, input, after_input, state, history, policy)) -> LookaroundAcceptingPathResult(depth, n, machine, input, after_input, state, history, policy, capture_context)
type LookaroundCompilation indices (shape: ShapeCode)
LookaroundPredicate : (test: ((Char) -> Bool)) -> LookaroundCompilation(CharC)
LookaroundEmpty : LookaroundCompilation(UnitC)
LookaroundBoundary : (constraint: BoundaryConstraint) -> LookaroundCompilation(UnitC)
LookaroundConcat : (left: LookaroundCompilation(left_shape)) -> (right: LookaroundCompilation(right_shape)) -> LookaroundCompilation(PairC(left_shape, right_shape))
LookaroundGroup : (inner: LookaroundCompilation(inner_shape)) -> LookaroundCompilation(StringC)
LookaroundGroupSlot : (slot: Nat) -> (inner: LookaroundCompilation(inner_shape)) -> LookaroundCompilation(StringC)
LookaroundAlternate : (left: LookaroundCompilation(left_shape)) -> (right: LookaroundCompilation(right_shape)) -> (prefer_right: Bool) -> LookaroundCompilation(ChoiceC(left_shape, right_shape))
LookaroundRepeat : (inner: LookaroundCompilation(inner_shape)) -> (lazy: Bool) -> LookaroundCompilation(ListC(inner_shape))
LookaroundAtomic : (inner: LookaroundCompilation(inner_shape)) -> LookaroundCompilation(inner_shape)
LookaroundGuard : (slot: Nat) -> (participated: Bool) -> (inner: LookaroundCompilation(inner_shape)) -> LookaroundCompilation(inner_shape)
Lookaround compilation is a runtime-only parallel IR. It preserves the same finite Thompson constructors as the ordinary proof IR, but adds an explicit atomic scope so assertion operands cannot silently erase ordered commitment when they cross an assertion boundary. The ordinary typed proof remains over ThompsonCompilation; this tree is consumed only by the checked finite assertion evaluator.
type LookaroundExhaustion(n) indices ()
LookaroundExhausted : (@erased whole : List(MachineState(n))) -> (@erased members : MachineStateMembers(n, whole, Nil())) -> (token: Unit) -> LookaroundExhaustion(n)
Resource and history guards fail before a machine traversal exists. They retain the compact terminal witness used by the public decision types; ordinary search failures use the complete trees above.
enum LookaroundNestedDecision
LookaheadNestedDecision
LookbehindNestedDecision
type LookaroundPathFailure(depth, n, machine) indices (input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, destinations: List(MachineState(n)), remaining_destinations: List(MachineState(n)))
LookaroundPathExhausted : (source: Bounded(n)) -> (@erased members : MachineStateMembers(n, destinations, Nil())) -> (@erased destinations_equivalent : Equivalent(List(MachineState(n)), destinations, empty_machine_states(n))) -> LookaroundPathFailure(depth, n, machine, Nil(), after_input, ThreadActive(source), history, capture_context, policy, destinations, Nil())
LookaroundPathStepExhausted : (char: Char) -> (rest: List(Char)) -> (source: Bounded(n)) -> (@erased members : MachineStateMembers(n, destinations, Nil())) -> (@erased destinations_equivalent : Equivalent(List(MachineState(n)), destinations, lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy))) -> LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, ThreadActive(source), history, capture_context, policy, destinations, Nil())
LookaroundPathAcceptedWithInput : LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, ThreadAccepted(), history, capture_context, policy, Nil(), Nil())
LookaroundPathDestinationActiveRejected : {remaining_destinations: List(MachineState(n))} -> (char: Char) -> (rest: List(Char)) -> (destination: Bounded(n)) -> (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (edge: ListMember(MachineState(n), Active(destination, routine, constraints), destinations)) -> (@erased current_edge : ListMember(MachineState(n), Active(destination, routine, constraints), Cons(Active(destination, routine, constraints), remaining_destinations))) -> (@erased members : MachineStateMembers(n, destinations, Cons(Active(destination, routine, constraints), remaining_destinations))) -> (@erased child : LookaroundPathFailure(depth, n, machine, rest, after_input, ThreadActive(destination), history_push_bounded(history, char), append_routine(capture_context, routine), policy, child_destinations, child_remaining_destinations)) -> (@erased tail : LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, state, history, capture_context, policy, destinations, remaining_destinations)) -> (@erased destinations_equivalent : Equivalent(List(MachineState(n)), destinations, lookaround_machine_destinations(depth, n, machine, source, char, rest, after_input, history, capture_context, policy))) -> LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, state, history, capture_context, policy, destinations, Cons(Active(destination, routine, constraints), remaining_destinations))
LookaroundPathDestinationAcceptedRejected : {remaining_destinations: List(MachineState(n))} -> (char: Char) -> (rest: List(Char)) -> (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (edge: ListMember(MachineState(n), Accepted(routine, constraints), destinations)) -> (@erased current_edge : ListMember(MachineState(n), Accepted(routine, constraints), Cons(Accepted(routine, constraints), remaining_destinations))) -> (@erased members : MachineStateMembers(n, destinations, Cons(Accepted(routine, constraints), remaining_destinations))) -> (@erased child : LookaroundPathFailure(depth, n, machine, rest, after_input, ThreadAccepted(), history_push_bounded(history, char), append_routine(capture_context, routine), policy, child_destinations, child_remaining_destinations)) -> (@erased tail : LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, state, history, capture_context, policy, destinations, remaining_destinations)) -> (@erased destinations_equivalent : Equivalent(List(MachineState(n)), destinations, lookaround_machine_destinations(depth, n, machine, source, char, rest, after_input, history, capture_context, policy))) -> LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, state, history, capture_context, policy, destinations, Cons(Accepted(routine, constraints), remaining_destinations))
Capture-free assertion paths carry state reachability plus an erased list
of the nested decisions used by each accepted transition. The depth index
is the same guard used by the evaluator: each nested assertion consumes
one level and zero fuel cannot manufacture a child path.
A failed path records the complete finite traversal below one thread.
Destination failures retain the child rejection and the tail rejection;
the only terminal constructor is reached with a structurally exhausted
MachineStateMembers witness. The capture context is indexed because
nested capture-condition checks must be refuted in the same environment
that produced the destination list.
type LookaroundPrefixMembersResult(depth, n, machine, destinations, current) indices (input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), policy: NewlinePolicy, capture_context: List(EvidenceInstruction))
LookaroundPrefixMembersRejected : (failure: LookaroundPathFailure(depth, n, machine, input, after_input, state, history, capture_context, policy, destinations, current)) -> LookaroundPrefixMembersResult(depth, n, machine, destinations, current, input, after_input, state, history, policy, capture_context)
LookaroundPrefixMembersFound : (path: LookaroundPrefixPath(depth, n, machine, input, after_input, state, history, policy)) -> LookaroundPrefixMembersResult(depth, n, machine, destinations, current, input, after_input, state, history, policy, capture_context)
type LookaroundPrefixPath(depth, n, machine) indices (input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), policy: NewlinePolicy)
LookaroundPrefixAccepted : LookaroundPrefixPath(depth, n, machine, input, after_input, ThreadAccepted(), history, policy)
LookaroundPrefixNextActive : (source: Bounded(n)) -> (char: Char) -> (rest: List(Char)) -> (destination: Bounded(n)) -> (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (capture_context: List(EvidenceInstruction)) -> (@erased nested_decisions : List(LookaroundNestedDecision)) -> (edge: ListMember(MachineState(n), Active(destination, routine, constraints), lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy))) -> (@erased suffix : LookaroundPrefixPath(depth, n, machine, rest, after_input, ThreadActive(destination), history_push_bounded(history, char), policy)) -> LookaroundPrefixPath(depth, n, machine, Cons(char, rest), after_input, ThreadActive(source), history, policy)
LookaroundPrefixNextAccepted : (source: Bounded(n)) -> (char: Char) -> (rest: List(Char)) -> (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (capture_context: List(EvidenceInstruction)) -> (@erased nested_decisions : List(LookaroundNestedDecision)) -> (edge: ListMember(MachineState(n), Accepted(routine, constraints), lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy))) -> (@erased suffix : LookaroundPrefixPath(depth, n, machine, rest, after_input, ThreadAccepted(), history_push_bounded(history, char), policy)) -> LookaroundPrefixPath(depth, n, machine, Cons(char, rest), after_input, ThreadActive(source), history, policy)
type LookaroundPrefixPathResult(depth, n, machine) indices (input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), policy: NewlinePolicy, capture_context: List(EvidenceInstruction))
LookaroundPrefixPathRejected : {remaining_destinations: List(MachineState(n))} -> (failure: LookaroundPathFailure(depth, n, machine, input, after_input, state, history, capture_context, policy, destinations, remaining_destinations)) -> LookaroundPrefixPathResult(depth, n, machine, input, after_input, state, history, policy, capture_context)
LookaroundPrefixPathFound : (path: LookaroundPrefixPath(depth, n, machine, input, after_input, state, history, policy)) -> LookaroundPrefixPathResult(depth, n, machine, input, after_input, state, history, policy, capture_context)
type LookaroundPrefixSearchMembersResult(depth, n, machine, starts) indices (input: List(Char), after_input: List(Char), history: List(Char), policy: NewlinePolicy, capture_context: List(EvidenceInstruction))
LookaroundPrefixSearchMembersRejected : (failure: LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)) -> LookaroundPrefixSearchMembersResult(depth, n, machine, starts, input, after_input, history, policy, capture_context)
LookaroundPrefixSearchMembersFound : (path: LookaroundPrefixSearchPath(depth, n, machine, starts, input, after_input, history, policy)) -> LookaroundPrefixSearchMembersResult(depth, n, machine, starts, input, after_input, history, policy, capture_context)
type LookaroundPrefixSearchPath(depth, n, machine, starts) indices (input: List(Char), after_input: List(Char), history: List(Char), policy: NewlinePolicy)
LookaroundPrefixSearchFoundActive : (state: Bounded(n)) -> (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (@erased member : ListMember(MachineState(n), Active(state, routine, constraints), starts)) -> (@erased path : LookaroundPrefixPath(depth, n, machine, input, after_input, ThreadActive(state), history, policy)) -> LookaroundPrefixSearchPath(depth, n, machine, starts, input, after_input, history, policy)
LookaroundPrefixSearchFoundAccepted : (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (@erased member : ListMember(MachineState(n), Accepted(routine, constraints), starts)) -> (@erased path : LookaroundPrefixPath(depth, n, machine, input, after_input, ThreadAccepted(), history, policy)) -> LookaroundPrefixSearchPath(depth, n, machine, starts, input, after_input, history, policy)
type LookaroundPrefixSearchResult(depth, n, machine) indices (input: List(Char), after_input: List(Char), history: List(Char), policy: NewlinePolicy, capture_context: List(EvidenceInstruction))
LookaroundPrefixSearchResultRejected : {starts: List(MachineState(n))} -> (failure: LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)) -> LookaroundPrefixSearchResult(depth, n, machine, input, after_input, history, policy, capture_context)
LookaroundPrefixSearchResultFound : {starts: List(MachineState(n))} -> (path: LookaroundPrefixSearchPath(depth, n, machine, starts, input, after_input, history, policy)) -> LookaroundPrefixSearchResult(depth, n, machine, input, after_input, history, policy, capture_context)
enum LookaroundRoutineSearchResult
LookaroundRoutineSearchNo
LookaroundRoutineSearchCommit
LookaroundRoutineSearchYes
Capture-aware assertion replay uses the same ordered commitment relation
as atomic_lookaround_accepts, but returns the selected finite routine.
The routine is replayed only by the named-capture side channel; the typed
matcher continues to consume the checked assertion path and never derives
a result from this replay value.
type LookaroundSearchFailure(depth, n, machine) indices (input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n)))
LookaroundSearchExhausted : (@erased members : MachineStateMembers(n, starts, Nil())) -> LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)
LookaroundSearchActiveRejected : {remaining_starts: List(MachineState(n))} -> (state: Bounded(n)) -> (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (member: ListMember(MachineState(n), Active(state, routine, constraints), starts)) -> (@erased members : MachineStateMembers(n, starts, Cons(Active(state, routine, constraints), remaining_starts))) -> (@erased child : LookaroundPathFailure(depth, n, machine, input, after_input, ThreadActive(state), history, append_routine(capture_context, routine), policy, child_destinations, child_remaining_destinations)) -> (@erased tail : LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)) -> LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)
LookaroundSearchAcceptedRejected : {remaining_starts: List(MachineState(n))} -> (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (member: ListMember(MachineState(n), Accepted(routine, constraints), starts)) -> (@erased members : MachineStateMembers(n, starts, Cons(Accepted(routine, constraints), remaining_starts))) -> (@erased child : LookaroundPathFailure(depth, n, machine, input, after_input, ThreadAccepted(), history, append_routine(capture_context, routine), policy, child_destinations, child_remaining_destinations)) -> (@erased tail : LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)) -> LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)
A complete failed start-list traversal. A start cannot be dropped from a refutation: the corresponding child path failure and the tail failure are both required before the terminal member proof can be returned.
type LookaroundSearchMembersResult(depth, n, machine, starts) indices (input: List(Char), after_input: List(Char), history: List(Char), policy: NewlinePolicy, capture_context: List(EvidenceInstruction))
LookaroundSearchMembersRejected : (failure: LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)) -> LookaroundSearchMembersResult(depth, n, machine, starts, input, after_input, history, policy, capture_context)
LookaroundSearchMembersFound : (path: LookaroundSearchPath(depth, n, machine, starts, input, after_input, history, policy)) -> LookaroundSearchMembersResult(depth, n, machine, starts, input, after_input, history, policy, capture_context)
type LookaroundSearchPath(depth, n, machine, starts) indices (input: List(Char), after_input: List(Char), history: List(Char), policy: NewlinePolicy)
LookaroundSearchFoundActive : (state: Bounded(n)) -> (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (@erased member : ListMember(MachineState(n), Active(state, routine, constraints), starts)) -> (@erased path : LookaroundAcceptingPath(depth, n, machine, input, after_input, ThreadActive(state), history, policy)) -> LookaroundSearchPath(depth, n, machine, starts, input, after_input, history, policy)
LookaroundSearchFoundAccepted : (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (@erased member : ListMember(MachineState(n), Accepted(routine, constraints), starts)) -> (@erased path : LookaroundAcceptingPath(depth, n, machine, input, after_input, ThreadAccepted(), history, policy)) -> LookaroundSearchPath(depth, n, machine, starts, input, after_input, history, policy)
type LookaroundSearchResult(depth, n, machine) indices (input: List(Char), after_input: List(Char), history: List(Char), policy: NewlinePolicy, capture_context: List(EvidenceInstruction))
LookaroundSearchResultRejected : {starts: List(MachineState(n))} -> (failure: LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)) -> LookaroundSearchResult(depth, n, machine, input, after_input, history, policy, capture_context)
LookaroundSearchResultFound : {starts: List(MachineState(n))} -> (path: LookaroundSearchPath(depth, n, machine, starts, input, after_input, history, policy)) -> LookaroundSearchResult(depth, n, machine, input, after_input, history, policy, capture_context)
type LookbehindDecision(n, machine) indices ()
LookbehindSatisfied : (witness: LookbehindWitness(n, machine)) -> LookbehindDecision(n, machine)
LookbehindRefuted : (certificate: LookbehindRefutation(n, machine)) -> LookbehindDecision(n, machine)
type LookbehindDecisionEvidence
type LookbehindRefutation(n, machine) indices ()
LookbehindSearchExhausted : {starts: List(MachineState(n))} -> (@erased depth : Nat) -> (input: List(Char)) -> (after_input: List(Char)) -> (history: List(Char)) -> (policy: NewlinePolicy) -> (@erased failure : LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)) -> LookbehindRefutation(n, machine)
LookbehindDepthExhausted : (depth: Nat) -> (input: List(Char)) -> (history: List(Char)) -> (policy: NewlinePolicy) -> (@erased exhaustion : LookaroundExhaustion(n)) -> LookbehindRefutation(n, machine)
LookbehindHistoryUnavailable : (width: Nat) -> (history: List(Char)) -> (policy: NewlinePolicy) -> (@erased exhaustion : LookaroundExhaustion(n)) -> LookbehindRefutation(n, machine)
type LookbehindWitness(n, machine) indices ()
LookbehindWitnessPacked : {starts: List(MachineState(n))} -> {depth: Nat} -> {input: List(Char)} -> {after_input: List(Char)} -> {history: List(Char)} -> {policy: NewlinePolicy} -> (path: LookaroundSearchPath(depth, n, machine, starts, input, after_input, history, policy)) -> LookbehindWitness(n, machine)
type MachineAcceptance(n, machine) indices (position: InitialPosition, input: List(Char), after_input: List(Char), final_evidence: List(Evidence), extended_routine: List(ExtendedInstruction))
MachineAccepted : (destination: MachineState(n)) -> (initial_evidence: List(Evidence)) -> (initial_captures: List(CaptureFrame)) -> (path_routine: List(ExtendedInstruction)) -> (edge: ListMember(MachineState(n), destination, initial_machine_destinations(n, machine, position, input, after_input))) -> (execution: RoutineExecution(machine_state_routine(n, destination), Nil(), Nil(), initial_evidence, initial_captures)) -> (routine_certificate: CertifiedPathRoutine(append_extended_routines(regular_routine(machine_state_routine(n, destination)), path_routine), Nil(), Nil(), final_evidence)) -> (path: AcceptingFrom(n, machine, input, after_input, machine_state_thread(n, destination), initial_evidence, initial_captures, final_evidence, path_routine)) -> MachineAcceptance(n, machine, position, input, after_input, final_evidence, append_extended_routines(regular_routine(machine_state_routine(n, destination)), path_routine))
type MachineAcceptingSearch(n, machine) indices (position: InitialPosition, input: List(Char), after_input: List(Char))
MachineNoAcceptingPath : MachineAcceptingSearch(n, machine, position, input, after_input)
MachineAcceptingPath : (final_evidence: List(Evidence)) -> (extended_routine: List(ExtendedInstruction)) -> (@erased acceptance : MachineAcceptance(n, machine, position, input, after_input, final_evidence, extended_routine)) -> MachineAcceptingSearch(n, machine, position, input, after_input)
type MachineStateMembers(n) indices (whole: List(MachineState(n)), remaining_values: List(MachineState(n)))
MachineStateMembersNil : MachineStateMembers(n, whole, Nil())
MachineStateMembersActive : (state: Bounded(n)) -> (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (member: ListMember(MachineState(n), Active(state, routine, constraints), whole)) -> (remaining: MachineStateMembers(n, whole, values)) -> MachineStateMembers(n, whole, Cons(Active(state, routine, constraints), values))
MachineStateMembersAccepted : (routine: List(EvidenceInstruction)) -> (constraints: List(BoundaryConstraint)) -> (member: ListMember(MachineState(n), Accepted(routine, constraints), whole)) -> (remaining: MachineStateMembers(n, whole, values)) -> MachineStateMembers(n, whole, Cons(Accepted(routine, constraints), values))
A candidate list whose every element is paired with erased evidence that it belongs to the original transition result. State and proof are introduced by the same constructor, so dependent pattern refinement never has to relate two sibling scrutinees.
enum Match
Match
Match positions are zero-based Unicode-scalar offsets, not UTF-8 byte
offsets. start and length are native Int values so large subjects do
not allocate unary Nat structures at runtime.
enum NamedCapture
NamedCapture
enum NamedCaptureExecution
NamedCaptureExecution
enum NamedCaptureFrame
NamedCaptureFrame
A named replay is deliberately separate from the evidence VM. The ordinary certificate still proves the typed evidence; this effect-free interpreter replays the same certified routine and records only slot participation/text. No host regex engine or second language semantics is involved.
enum NamedCaptureLedgerEntry
NamedCaptureLedgerEntry
type NamedCompilationErasure indices (shape: ShapeCode, named: NamedThompsonCompilation(shape), ordinary: ThompsonCompilation(shape))
NamedPredicateErasure : NamedCompilationErasure(CharC, NamedThompsonPredicate(test), ThompsonPredicate(test))
NamedEmptyErasure : NamedCompilationErasure(UnitC, NamedThompsonEmpty(), ThompsonEmpty())
NamedBoundaryErasure : NamedCompilationErasure(UnitC, NamedThompsonBoundary(constraint), ThompsonBoundary(constraint))
NamedConcatErasure : {left_shape: ShapeCode} -> {right_shape: ShapeCode} -> {left_named: NamedThompsonCompilation(left_shape)} -> {right_named: NamedThompsonCompilation(right_shape)} -> {left_ordinary: ThompsonCompilation(left_shape)} -> {right_ordinary: ThompsonCompilation(right_shape)} -> (@erased left : NamedCompilationErasure(left_shape, left_named, left_ordinary)) -> (@erased right : NamedCompilationErasure(right_shape, right_named, right_ordinary)) -> NamedCompilationErasure(PairC(left_shape, right_shape), NamedThompsonConcat(left_named, right_named), ThompsonConcat(left_ordinary, right_ordinary))
NamedCaptureErasure : {inner_shape: ShapeCode} -> {inner_named: NamedThompsonCompilation(inner_shape)} -> {inner_ordinary: ThompsonCompilation(inner_shape)} -> (@erased inner : NamedCompilationErasure(inner_shape, inner_named, inner_ordinary)) -> NamedCompilationErasure(StringC, NamedThompsonCapture(inner_named), ThompsonGroup(inner_ordinary))
NamedGroupErasure : {inner_shape: ShapeCode} -> {inner_named: NamedThompsonCompilation(inner_shape)} -> {inner_ordinary: ThompsonCompilation(inner_shape)} -> (slot: Nat) -> (@erased inner : NamedCompilationErasure(inner_shape, inner_named, inner_ordinary)) -> NamedCompilationErasure(StringC, NamedThompsonGroup(slot, inner_named), ThompsonGroup(inner_ordinary))
NamedGuardErasure : {inner_shape: ShapeCode} -> {inner_named: NamedThompsonCompilation(inner_shape)} -> {inner_ordinary: ThompsonCompilation(inner_shape)} -> (slot: Nat) -> (participated: Bool) -> (@erased inner : NamedCompilationErasure(inner_shape, inner_named, inner_ordinary)) -> NamedCompilationErasure(inner_shape, NamedThompsonGuard(slot, participated, inner_named), inner_ordinary)
NamedAlternateErasure : {left_shape: ShapeCode} -> {right_shape: ShapeCode} -> {left_named: NamedThompsonCompilation(left_shape)} -> {right_named: NamedThompsonCompilation(right_shape)} -> {left_ordinary: ThompsonCompilation(left_shape)} -> {right_ordinary: ThompsonCompilation(right_shape)} -> (@erased left : NamedCompilationErasure(left_shape, left_named, left_ordinary)) -> (@erased right : NamedCompilationErasure(right_shape, right_named, right_ordinary)) -> (prefer_right: Bool) -> NamedCompilationErasure(ChoiceC(left_shape, right_shape), NamedThompsonAlternate(left_named, right_named, prefer_right), ThompsonAlternate(left_ordinary, right_ordinary, prefer_right))
NamedRepeatErasure : {inner_shape: ShapeCode} -> {inner_named: NamedThompsonCompilation(inner_shape)} -> {inner_ordinary: ThompsonCompilation(inner_shape)} -> (@erased inner : NamedCompilationErasure(inner_shape, inner_named, inner_ordinary)) -> (lazy: Bool) -> NamedCompilationErasure(ListC(inner_shape), NamedThompsonRepeat(inner_named, lazy), ThompsonRepeat(inner_ordinary, lazy))
Erasure certificate: every named compilation has exactly the ordinary Thompson compilation obtained by dropping slot IDs. This is the bridge used by the typed proof path; capture metadata cannot alter language.
enum NamedMachineSearch
NamedMachineNoPath
NamedMachinePath
Runtime-only search for named machines. The ordinary search above is indexed by the evidence theorem and intentionally has no capture-guard parameter. Named search carries only the replay routine, while preserving the same ordered destination traversal and boundary calculations.
enum NamedMatch
NamedMatch
enum NamedParse
NamedParse
enum NamedPrefixCapture
NamedPrefixCapture
enum NamedPrefixSearch
NamedNoPrefix
NamedPrefixPath
type NamedRegex(result) indices (shape: ShapeCode)
NamedRegex : Regex(result) -> NamedThompsonCompilation(shape) -> LookaroundCompilation(shape) -> CaptureLayout -> Bool -> NewlinePolicy -> NamedRegex(result, shape)
The public result type and the checked Thompson shape are independent:
conversions may expose Option, List, or a simplified tuple while the
machine still carries its constructor-preserving shape. Keep the machine
shape as an explicit index instead of letting it unify accidentally with
the public result (which would reject optional/one-or-more captures).
type NamedThompsonCompilation indices (shape: ShapeCode)
NamedThompsonPredicate : (test: ((Char) -> Bool)) -> NamedThompsonCompilation(CharC)
NamedThompsonEmpty : NamedThompsonCompilation(UnitC)
NamedThompsonBoundary : (constraint: BoundaryConstraint) -> NamedThompsonCompilation(UnitC)
NamedThompsonConcat : (left: NamedThompsonCompilation(left_shape)) -> (right: NamedThompsonCompilation(right_shape)) -> NamedThompsonCompilation(PairC(left_shape, right_shape))
NamedThompsonCapture : (inner: NamedThompsonCompilation(inner_shape)) -> NamedThompsonCompilation(StringC)
NamedThompsonGroup : (slot: Nat) -> (inner: NamedThompsonCompilation(inner_shape)) -> NamedThompsonCompilation(StringC)
NamedThompsonGuard : (slot: Nat) -> (participated: Bool) -> (inner: NamedThompsonCompilation(inner_shape)) -> NamedThompsonCompilation(inner_shape)
NamedThompsonAlternate : (left: NamedThompsonCompilation(left_shape)) -> (right: NamedThompsonCompilation(right_shape)) -> (prefer_right: Bool) -> NamedThompsonCompilation(ChoiceC(left_shape, right_shape))
NamedThompsonRepeat : (inner: NamedThompsonCompilation(inner_shape)) -> (lazy: Bool) -> NamedThompsonCompilation(ListC(inner_shape))
Named compilation is constructor-for-constructor parallel to the checked Thompson tree. Only group nodes differ: they carry the explicit slot ID used by the capture ledger. Erasing the IDs recovers the ordinary compilation, so language proofs can remain independent of names.
enum OneOrMore
OneOrMore
Public typed combinator layer. Mapped is the semantic bridge from a
structurally extracted Pattern value to the user-facing result type. It is
one-way: regex parsing does not imply an unparser.
enum PosixClass
PosixAlnum
PosixAlpha
PosixAscii
PosixBlank
PosixCntrl
PosixDigit
PosixGraph
PosixLower
PosixPrint
PosixPunct
PosixSpace
PosixUpper
PosixWord
PosixXdigit
enum PosixClassMatch
PosixClassMatch
type Regex indices (result: Type)
FromPattern : (shape: ShapeCode) -> Pattern(shape) -> Regex(Sem(shape))
StagedRegex : (shape: ShapeCode) -> Pattern(shape) -> ThompsonCompilation(shape) -> StagedMachine(shape) -> Conversion(Sem(shape), result) -> Regex(result)
Mapped : Function(a, b) -> Regex(a) -> Regex(b)
Concatenated : Regex(a) -> Regex(b) -> Regex(Tuple(a, b))
Alternated : Regex(a) -> Regex(b) -> Regex(Choice(a, b))
Repeated : Regex(a) -> Regex(List(a))
MatchedText : Regex(a) -> Regex(String)
KeptRight : Regex(a) -> Regex(b) -> Regex(b)
KeptLeft : Regex(a) -> Regex(b) -> Regex(a)
SameAlternative : Regex(a) -> Regex(a) -> Regex(a)
OptionalRegex : Regex(a) -> Regex(Option(a))
OneOrMoreRegex : Regex(a) -> Regex(OneOrMore(a))
SimplifiedRegex : (shape: ShapeCode) -> Regex(Sem(shape)) -> Regex(Sem(Simplify(shape)))
OptionalPattern : Regex(a) -> Regex(Choice(a, Unit))
PlusPattern : Regex(a) -> Regex(List(a))
RepeatedPattern : Regex(a) -> Bool -> Regex(List(a))
OneOrMorePattern : Regex(a) -> Bool -> Regex(List(a))
OptionalLiteral : Regex(a) -> Bool -> Regex(Choice(a, Unit))
ConfiguredRegex : RegexOptions -> Regex(a) -> Regex(a)
StartAnchor : Bool -> Regex(Unit)
EndAnchor : Bool -> Regex(Unit)
StrictEndAnchor : Regex(Unit)
enum RegexOptions
RegexOptions
Elixir-compatible literal modifiers, in i m s x u f U order. Repeated
letters are idempotent and modifier order is irrelevant. No accepted flag
is metadata-only: each one must affect parsing or machine execution.
type RegexProgram indices (result: Type)
BuiltRegex : (shape: ShapeCode) -> Pattern(shape) -> Conversion(Sem(shape), result) -> CompilationHint(shape) -> RegexProgram(result)
type RoutineExecution indices (routine: List(EvidenceInstruction), input_evidence: List(Evidence), input_captures: List(CaptureFrame), output_evidence: List(Evidence), output_captures: List(CaptureFrame))
RoutineDone : {evidence: List(Evidence)} -> {captures: List(CaptureFrame)} -> RoutineExecution(Nil(), evidence, captures, evidence, captures)
RoutineStep : (instruction: EvidenceInstruction) -> {input_evidence: List(Evidence)} -> {input_captures: List(CaptureFrame)} -> (suffix: RoutineExecution(rest, executed_evidence(execute_instruction(instruction, input_evidence, input_captures)), executed_captures(execute_instruction(instruction, input_evidence, input_captures)), output_evidence, output_captures)) -> RoutineExecution(Cons(instruction, rest), input_evidence, input_captures, output_evidence, output_captures)
enum SplitInclusion
ExcludeSeparators
IncludeSeparators
enum SplitLimit
UnlimitedSplit
AtMostSplitParts
enum SplitOptions
SplitOptions
enum SplitTrimming
KeepEmptyParts
TrimEmptyParts
type StagedMachine indices (shape: ShapeCode)
StagedMachineValue : (compilation: ThompsonCompilation(shape)) -> StagedMachine(shape)
StagedAtomicPatternValue : (plan: AtomicRuntimePattern(shape)) -> StagedMachine(shape)
StagedLookaroundValue : (pattern: Pattern(shape)) -> (compilation: LookaroundCompilation(shape)) -> (policy: NewlinePolicy) -> StagedMachine(shape)
A staged literal carries its checked machine and the erased equality that relates that machine to the canonical Thompson construction. The wrapper is indexed by the public shape (rather than by the dependent compilation itself) because that is the representation the constructor elaborator can refine without introducing an existential dependent constructor.
type StagedRows(n) indices ()
StagedRowsValue : (starts: List(MachineState(n))) -> (rows: TransitionRows(n)) -> StagedRows(n)
type ThompsonCompilation indices (shape: ShapeCode)
ThompsonPredicate : (test: ((Char) -> Bool)) -> ThompsonCompilation(CharC)
ThompsonEmpty : ThompsonCompilation(UnitC)
ThompsonBoundary : (constraint: BoundaryConstraint) -> ThompsonCompilation(UnitC)
ThompsonConcat : (left: ThompsonCompilation(left_shape)) -> (right: ThompsonCompilation(right_shape)) -> ThompsonCompilation(PairC(left_shape, right_shape))
ThompsonGroup : (inner: ThompsonCompilation(inner_shape)) -> ThompsonCompilation(StringC)
ThompsonAlternate : (left: ThompsonCompilation(left_shape)) -> (right: ThompsonCompilation(right_shape)) -> (prefer_right: Bool) -> ThompsonCompilation(ChoiceC(left_shape, right_shape))
ThompsonRepeat : (inner: ThompsonCompilation(inner_shape)) -> (lazy: Bool) -> ThompsonCompilation(ListC(inner_shape))
Constructor-preserving Thompson IR. Both runtime compilation and the evidence theorem consume this same tree, so proof code never reconstructs machine provenance from a function-valued transition table.
enum ThreadWinnerTable
ThreadWinnerTable
enum UnicodeProperty
PropertyAny
PropertyLetter
PropertyLowercaseLetter
PropertyUppercaseLetter
PropertyTitlecaseLetter
PropertyModifierLetter
PropertyOtherLetter
PropertyMark
PropertySpacingMark
PropertyEnclosingMark
PropertyNonspacingMark
PropertyNumber
PropertyDecimalNumber
PropertyLetterNumber
PropertyOtherNumber
PropertyPunctuation
PropertyConnectorPunctuation
PropertyDashPunctuation
PropertyClosePunctuation
PropertyFinalPunctuation
PropertyInitialPunctuation
PropertyOtherPunctuation
PropertyOpenPunctuation
PropertySymbol
PropertyCurrencySymbol
PropertyModifierSymbol
PropertyMathSymbol
PropertyOtherSymbol
PropertySeparator
PropertyLineSeparator
PropertyParagraphSeparator
PropertySpaceSeparator
PropertyOther
PropertyControl
PropertyFormat
PropertyUnassigned
PropertyPrivateUse
PropertySurrogate
enum UnicodePropertyMatch
UnicodePropertyMatch
Functions
fn active_winner_seen(n: Nat, slots: ActiveWinnerSlots, index: Bounded(n)) -> Bool
Return true if an active thread at state has already been recorded in slots.
fn advance_initial_position(position: InitialPosition, input: List(Char)) -> InitialPosition
Advance a Position by consuming a list of characters with the default policy.
fn advance_initial_position_with_policy(position: InitialPosition, input: List(Char), policy: NewlinePolicy) -> InitialPosition
Advance a Position by a list of characters using an explicit newline policy.
fn alternate(a: Type, b: Type, left: Regex(a), right: Regex(b)) -> Regex(Choice(a, b))
Match left or right, tagging the winning branch in a Choice.
fn alternate_left_injection_is_widening(left_count: Nat, right_count: Nat, state: Bounded(left_count)) -> Equivalent(Bounded(plus(left_count, right_count)), inject_alternate_left(left_count, right_count, state), inject_left_at(left_count, right_count, state))
Proof that inject_alternate_left equals widen_left.
fn alternate_left_states(left_count: Nat, right_count: Nat, states: List(MachineState(left_count)), marker: EvidenceInstruction) -> List(MachineState(plus(left_count, right_count)))
Inject left-branch states into an alternation and tag them with marker.
fn alternate_left_widening_is_injection(left_count: Nat, right_count: Nat, state: Bounded(left_count)) -> Equivalent(Bounded(plus(left_count, right_count)), inject_left_at(left_count, right_count, state), inject_alternate_left(left_count, right_count, state))
Proof that widen_left equals inject_alternate_left.
alternate_machine_next(left_count: Nat, right_count: Nat, left_next: Function(Bounded(left_count), Function(Char, List(MachineState(left_count)))), right_next: Function(Bounded(right_count), Function(Char, List(MachineState(right_count)))), state: Bounded(plus(left_count, right_count)), char: Char) -> List(MachineState(plus(left_count, right_count)))
fn alternate_machine_next(left_count: Nat, right_count: Nat, left_next: Function(Bounded(left_count), Function(Char, List(MachineState(left_count)))), right_next: Function(Bounded(right_count), Function(Char, List(MachineState(right_count)))), state: Bounded(plus(left_count, right_count)), char: Char) -> List(MachineState(plus(left_count, right_count)))
Transition function for an alternation of two submachines.
alternate_machine_next_from_side(left_count: Nat, right_count: Nat, left_next: Function(Bounded(left_count), Function(Char, List(MachineState(left_count)))), right_next: Function(Bounded(right_count), Function(Char, List(MachineState(right_count)))), side: BoundedSum(left_count, right_count), char: Char) -> List(MachineState(plus(left_count, right_count)))
fn alternate_machine_next_from_side(left_count: Nat, right_count: Nat, left_next: Function(Bounded(left_count), Function(Char, List(MachineState(left_count)))), right_next: Function(Bounded(right_count), Function(Char, List(MachineState(right_count)))), side: BoundedSum(left_count, right_count), char: Char) -> List(MachineState(plus(left_count, right_count)))
Dispatch an alternation transition after classifying the state as left or right.
fn alternate_machine_starts(left_count: Nat, right_count: Nat, left_starts: List(MachineState(left_count)), right_starts: List(MachineState(right_count)), prefer_right: Bool) -> List(MachineState(plus(left_count, right_count)))
Compute the combined start states of an alternation submachine.
fn alternate_pattern_machine(left_count: Nat, left_machine: PatternMachine(left_count), right_count: Nat, right_machine: PatternMachine(right_count), prefer_right: Bool) -> PatternMachine(plus(left_count, right_count))
Construct the PatternMachine for alternating two submachines.
fn alternate_right_injection_is_inject_right(left_count: Nat, right_count: Nat, state: Bounded(right_count)) -> Equivalent(Bounded(plus(left_count, right_count)), inject_alternate_right(left_count, right_count, state), inject_right_at(left_count, right_count, state))
Proof that inject_alternate_right equals inject_right.
fn alternate_right_states(left_count: Nat, right_count: Nat, states: List(MachineState(right_count)), marker: EvidenceInstruction) -> List(MachineState(plus(left_count, right_count)))
Inject right-branch states into an alternation and tag them with marker.
fn alternate_starts_order(n: Nat, left: List(MachineState(n)), right: List(MachineState(n)), prefer_right: Bool) -> List(MachineState(n))
Order left and right alternation start states according to prefer_right.
fn always(_char: Char) -> Bool
Constant predicate returning true for every character.
fn any_char() -> Regex(Char)
Regex matching any single character (including newlines).
fn append_branch_marker(routine: List(EvidenceInstruction), marker: EvidenceInstruction) -> List(EvidenceInstruction)
Append a branch marker instruction to the end of an evidence routine.
fn append_characters(left: List(Char), right: List(Char)) -> List(Char)
Concatenate two List(Char) values.
fn append_constraints(left: List(BoundaryConstraint), right: List(BoundaryConstraint)) -> List(BoundaryConstraint)
Concatenate two lists of BoundaryConstraint values.
fn append_extended_routines(left: List(ExtendedInstruction), right: List(ExtendedInstruction)) -> List(ExtendedInstruction)
Concatenate two ExtendedRoutine instruction lists.
fn append_machine_states(n: Nat, left: List(MachineState(n)), right: List(MachineState(n))) -> List(MachineState(n))
Concatenate two lists of MachineState values with explicit state bound n.
fn append_routine(left: List(EvidenceInstruction), right: List(EvidenceInstruction)) -> List(EvidenceInstruction)
Concatenate two EvidenceInstruction routines in execution order.
fn append_states(n: Nat, left: List(MachineState(n)), right: List(MachineState(n))) -> List(MachineState(n))
Concatenate two lists of MachineState values with the same state bound.
fn append_threads(n: Nat, left: List(EvidenceThread(n)), right: List(EvidenceThread(n))) -> List(EvidenceThread(n))
Concatenate two lists of EvidenceThreads.
fn as_string(a: Type, regex: Regex(a)) -> Regex(String)
Alias for captured: match regex and return the matched substring.
fn ascii_alnum(actual: Char) -> Bool
Return true if char is an ASCII letter or digit.
fn ascii_alpha(actual: Char) -> Bool
Return true if char is an ASCII letter (A-Z or a-z).
fn ascii_blank(actual: Char) -> Bool
Return true if char is an ASCII space or horizontal tab.
fn ascii_control(actual: Char) -> Bool
Return true if char is an ASCII control character.
fn ascii_digit(char: Char) -> Bool
Return true if char is an ASCII decimal digit (0-9).
fn ascii_graph(actual: Char) -> Bool
Return true if char is a visible ASCII graphical character (0x21..0x7E).
fn ascii_print(actual: Char) -> Bool
Return true if char is a printable ASCII character (0x20..0x7E).
fn ascii_punct(actual: Char) -> Bool
Return true if char is an ASCII punctuation character.
fn ascii_space(char: Char) -> Bool
Return true if char is an ASCII whitespace character.
fn ascii_word(char: Char) -> Bool
Return true if char is an ASCII word character ([A-Za-z0-9_]).
fn ascii_word_constraint(expected: Bool) -> BoundaryConstraint
Construct an ASCII word-boundary (\b / \B) constraint.
fn atomic_commit_disposition(current: Nat, commit: Nat) -> AtomicCommitDisposition(current, commit)
Decide whether an atomic commit at commit prunes a sibling at current depth.
fn atomic_depth_comparison(left: Nat, right: Nat) -> AtomicDepthComparison(left, right)
Compare two atomic nesting depths as less-than, equal, or greater-than.
fn atomic_depth_max(left: Nat, right: Nat) -> Nat
Return the maximum of two Nat atomic nesting depths.
fn atomic_destination_states(n: Nat, states: List(MachineState(n))) -> List(MachineState(n))
Annotate accepting destinations with an atomic-commit instruction.
fn atomic_lookaround_accepting_from(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, scope_depth: Nat) -> AtomicSearchResult
Atomic assertion search is the same finite ordered search as the ordinary assertion path, but every destination is first passed through the depth-aware lookaround constraint filter. This is what makes an assertion inside an atomic scope observable without introducing a host backtracking stack or rebuilding a child machine per attempt.
atomic_lookaround_accepting_members(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source_state: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, scope_depth: Nat, destinations: List(MachineState(n))) -> AtomicSearchResult
fn atomic_lookaround_accepting_members(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source_state: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, scope_depth: Nat, destinations: List(MachineState(n))) -> AtomicSearchResult
Search lookaround destination states with atomic-group commit pruning.
fn atomic_lookaround_accepts(depth: Nat, n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> Bool
Return true if an atomic lookaround machine accepts input.
atomic_lookaround_initial_member(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, blocked_depth: Option(Nat), head: MachineState(n), remaining: List(MachineState(n))) -> AtomicSearchResult
fn atomic_lookaround_initial_member(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, blocked_depth: Option(Nat), head: MachineState(n), remaining: List(MachineState(n))) -> AtomicSearchResult
Search a single lookaround initial state with atomic-group commit pruning.
fn atomic_lookaround_initial_members(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, blocked_depth: Option(Nat), starts: List(MachineState(n))) -> AtomicSearchResult
Search lookaround initial states with atomic-group commit pruning.
atomic_lookaround_routine_accepting_from(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, scope_depth: Nat, prefix_mode: Bool, reversed_prefix: List(Char)) -> LookaroundRoutineSearchResult
fn atomic_lookaround_routine_accepting_from(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, scope_depth: Nat, prefix_mode: Bool, reversed_prefix: List(Char)) -> LookaroundRoutineSearchResult
The capture replay evaluator mirrors the atomic lookaround search above.
It is deliberately separate from the Boolean evaluator: preserving the
selected routine must not alter the acceptance authority used by typed
extraction. Every successful branch prepends the observed character and
epsilon routine in the same order as the certified extended path.
prefix changes only the acceptance point: a prefix search may close as
soon as the ordered machine reaches ThreadAccepted, even when input
remains. The machine's start/destination order still chooses the path,
so lazy repeats and ordered alternation are preserved by the same DFS.
reversed_prefix records exactly the characters consumed on that path;
the result also carries the unconsumed suffix so callers never reconstruct
it by retrying every possible endpoint.
fn atomic_lookaround_routine_accepts(depth: Nat, n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> Option(List(ExtendedInstruction))
Run an atomic lookaround machine and return the winning ExtendedRoutine on acceptance.
atomic_lookaround_routine_initial_member(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), position: InitialPosition, history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, blocked_depth: Option(Nat), head: MachineState(n), remaining: List(MachineState(n)), prefix_mode: Bool, reversed_prefix: List(Char)) -> LookaroundRoutineSearchResult
fn atomic_lookaround_routine_initial_member(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), position: InitialPosition, history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, blocked_depth: Option(Nat), head: MachineState(n), remaining: List(MachineState(n)), prefix_mode: Bool, reversed_prefix: List(Char)) -> LookaroundRoutineSearchResult
Search a single atomic lookaround initial state while recording its ExtendedRoutine.
atomic_lookaround_routine_initial_members(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), position: InitialPosition, history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, blocked_depth: Option(Nat), starts: List(MachineState(n)), prefix_mode: Bool, reversed_prefix: List(Char)) -> LookaroundRoutineSearchResult
fn atomic_lookaround_routine_initial_members(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), position: InitialPosition, history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, blocked_depth: Option(Nat), starts: List(MachineState(n)), prefix_mode: Bool, reversed_prefix: List(Char)) -> LookaroundRoutineSearchResult
Search atomic lookaround initial states while recording the winning ExtendedRoutine.
atomic_lookaround_routine_members(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source_state: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, scope_depth: Nat, prefix_mode: Bool, reversed_prefix: List(Char), destinations: List(MachineState(n))) -> LookaroundRoutineSearchResult
fn atomic_lookaround_routine_members(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source_state: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, scope_depth: Nat, prefix_mode: Bool, reversed_prefix: List(Char), destinations: List(MachineState(n))) -> LookaroundRoutineSearchResult
Search atomic lookaround destinations while recording the winning ExtendedRoutine.
fn atomic_lookaround_routine_prefix(depth: Nat, n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), _greedy: Bool, history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> Option(Tuple(List(Char), List(Char), List(ExtendedInstruction)))
Find the winning prefix and ExtendedRoutine for an atomic lookaround machine.
fn atomic_pattern_machine(n: Nat, machine: PatternMachine(n)) -> PatternMachine(n)
Wrap a PatternMachine in an atomic group scope with enter/commit markers.
fn atomic_plan_compilation(shape: ShapeCode, plan: AtomicRuntimePattern(shape)) -> ThompsonCompilation(shape)
Extract the underlying ThompsonCompilation from an AtomicRuntimePattern.
fn atomic_plan_pattern(shape: ShapeCode, plan: AtomicRuntimePattern(shape)) -> Pattern(shape)
Extract the underlying Pattern from an AtomicRuntimePattern.
fn atomic_runtime_accepting_from(n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), state: ThreadState(n), evidence: List(Evidence), captures: List(CaptureFrame), depth: Nat) -> AtomicSearchResult
Search for an accepting match from a single state with atomic-group commit pruning.
fn atomic_runtime_accepting_members(n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source_state: ThreadState(n), source_evidence: List(Evidence), source_captures: List(CaptureFrame), depth: Nat, destinations: List(MachineState(n))) -> AtomicSearchResult
Search candidate destination states in order, pruning alternatives on atomic commit.
fn atomic_runtime_accepts(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char)) -> Bool
Run an atomic-aware PatternMachine on input and return whether it accepts.
fn atomic_runtime_first_prefix(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char)) -> Option(Tuple(List(Char), List(Char)))
Find the shortest prefix accepted by an atomic-aware PatternMachine.
fn atomic_runtime_first_prefix_loop(n: Nat, machine: PatternMachine(n), position: InitialPosition, reversed_prefix: List(Char), remaining_input: List(Char)) -> Option(Tuple(List(Char), List(Char)))
Recursive helper for atomic_runtime_first_prefix.
fn atomic_runtime_initial_member(n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), blocked_depth: Option(Nat), head: MachineState(n), remaining: List(MachineState(n))) -> AtomicSearchResult
Search a single initial start state under atomic-group semantics.
fn atomic_runtime_initial_members(n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), starts: List(MachineState(n))) -> AtomicSearchResult
Search initial start states with atomic-group commit semantics.
fn atomic_runtime_initial_members_with_commit(n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), blocked_depth: Option(Nat), starts: List(MachineState(n))) -> AtomicSearchResult
Search initial start states while propagating an active atomic commit depth.
fn atomic_runtime_last_prefix(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char)) -> Option(Tuple(List(Char), List(Char)))
Find the longest prefix accepted by an atomic-aware PatternMachine.
fn atomic_runtime_last_prefix_loop(n: Nat, machine: PatternMachine(n), position: InitialPosition, reversed_prefix: List(Char), remaining_input: List(Char), previous: Option(Tuple(List(Char), List(Char)))) -> Option(Tuple(List(Char), List(Char)))
Recursive helper for atomic_runtime_last_prefix.
fn atomic_runtime_machine_from_plan(shape: ShapeCode, plan: AtomicRuntimePattern(shape)) -> PatternMachine(thompson_state_count(atomic_plan_compilation(plan)))
Build the executable PatternMachine for an AtomicRuntimePattern.
fn atomic_runtime_prefix(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), greedy: Bool) -> Option(Tuple(List(Char), List(Char)))
Find the shortest (lazy: true) or longest (lazy: false) prefix accepted by an atomic-aware machine.
fn atomic_scope_depth_after(routine: List(EvidenceInstruction), depth: Nat) -> Nat
Compute the atomic nesting depth remaining after executing routine.
fn atomic_scope_effect(routine: List(EvidenceInstruction), depth: Nat) -> AtomicScopeEffect
Compute the net atomic-scope depth change and commit depth of an instruction routine.
fn atomic_scope_max_depth(routine: List(EvidenceInstruction), depth: Nat) -> Nat
Compute the maximum atomic nesting depth reached while executing routine.
fn atomic_scope_max_depth_with(routine: List(EvidenceInstruction), depth: Nat, maximum: Nat) -> Nat
Accumulate the maximum atomic nesting depth across routine starting from current.
fn atomic_start_states(n: Nat, states: List(MachineState(n))) -> List(MachineState(n))
Atomic scopes preserve every ordinary machine state, but mark entry and every accepting exit in the routine stream. The ordered search consumes these markers to discard lower-priority siblings after the first exit; transition construction itself remains the same finite Thompson machine.
fn boundary_pattern_machine(constraint: BoundaryConstraint) -> PatternMachine(Z())
Construct the zero-state PatternMachine guarded by a single BoundaryConstraint.
fn bounded_at_least_pattern(a: Type, regex: Regex(a), minimum: Nat, lazy: Bool) -> Regex(List(a))
Match regex at least min_count times with optional lazy preference.
fn bounded_between_pattern(a: Type, regex: Regex(a), minimum: Nat, maximum: Nat, lazy: Bool) -> Regex(List(a))
Match regex between min_count and max_count times.
fn bounded_exact_pattern(a: Type, regex: Regex(a), count: Nat) -> Regex(List(a))
Match regex exactly count times.
fn bounded_same(n: Nat, left: Bounded(n), right: Bounded(n)) -> Bool
Return true if two Bounded(n) state indices are equal.
fn bounded_up_to_pattern(a: Type, regex: Regex(a), maximum: Nat, lazy: Bool) -> Regex(List(a))
Match regex at most max_count times with optional lazy preference.
fn build_transition_rows(remaining: Nat, total: Nat, inject: Function(Bounded(remaining), Bounded(total)), next: Function(Bounded(total), Function(Char, List(MachineState(total))))) -> TransitionRowsFrom(remaining, total)
Materialize transition rows for remaining states using inject into next.
build_transition_rows_equivalent(remaining: Nat, total: Nat, inject: Function(Bounded(remaining), Bounded(total)), next: Function(Bounded(total), Function(Char, List(MachineState(total)))), state: Bounded(remaining), char: Char) -> Equivalent(List(MachineState(total)), transition_rows_from_next(build_transition_rows(remaining, inject, next), state, char), next(inject(state), char))
fn build_transition_rows_equivalent(remaining: Nat, total: Nat, inject: Function(Bounded(remaining), Bounded(total)), next: Function(Bounded(total), Function(Char, List(MachineState(total)))), state: Bounded(remaining), char: Char) -> Equivalent(List(MachineState(total)), transition_rows_from_next(build_transition_rows(remaining, inject, next), state, char), next(inject(state), char))
Pointwise correctness of the row compiler. This is intentionally a smaller theorem than function extensionality: every concrete bounded source state reduces to the row installed for that state, so callers can transport an edge without changing the existing PatternMachine proof indices.
fn capture_absent_constraint(slot: Nat) -> BoundaryConstraint
Construct a constraint requiring capture group index to be absent.
fn capture_condition_constraint(slot: Nat, participated: Bool) -> BoundaryConstraint
Convert a CaptureCondition into its corresponding BoundaryConstraint.
fn capture_condition_holds(condition: Option(CaptureCondition), routine: List(EvidenceInstruction)) -> Bool
Evaluate a CaptureCondition against the executed capture routine.
fn capture_ledger_from_layout(layout: CaptureLayout) -> List(NamedCaptureLedgerEntry)
Initialize an empty named-capture ledger from a NamedCaptureLayout.
fn capture_ledger_from_slots(slots: List(CaptureSlot)) -> List(NamedCaptureLedgerEntry)
Initialize an empty named-capture ledger from a list of CaptureSlots.
fn capture_participated_constraint(slot: Nat) -> BoundaryConstraint
Construct a constraint requiring capture group index to have participated.
fn capture_participation_decision(slot: Nat, routine: List(EvidenceInstruction)) -> CaptureParticipationDecision(slot, routine)
Decide whether capture group target has participated in routine.
fn capture_slot_markers_from_extended(routine: List(ExtendedInstruction)) -> List(EvidenceInstruction)
Extract only capture-slot markers from a selected assertion routine. The child emits its own characters and evidence, but those must not be merged into the surrounding typed result; only participation markers cross the assertion boundary for later conditionals.
fn captured(a: Type, regex: Regex(a)) -> Regex(String)
Match regex and return the matched substring as a String.
fn caseless_same(expected: Char, actual: Char, unicode: Bool) -> Bool
Compare two characters for case-insensitive equality under options.
certify_extended_routine(routine: List(ExtendedInstruction), input_current: Option(Char), input_evidence: List(Evidence), input_captures: List(CaptureFrame)) -> ExtendedRoutineExecution(routine, input_current, input_evidence, input_captures, extended_current(execute_extended_routine(routine, input_current, input_evidence, input_captures)), extended_evidence(execute_extended_routine(routine, input_current, input_evidence, input_captures)), extended_captures(execute_extended_routine(routine, input_current, input_evidence, input_captures)))
fn certify_extended_routine(routine: List(ExtendedInstruction), input_current: Option(Char), input_evidence: List(Evidence), input_captures: List(CaptureFrame)) -> ExtendedRoutineExecution(routine, input_current, input_evidence, input_captures, extended_current(execute_extended_routine(routine, input_current, input_evidence, input_captures)), extended_evidence(execute_extended_routine(routine, input_current, input_evidence, input_captures)), extended_captures(execute_extended_routine(routine, input_current, input_evidence, input_captures)))
Execute an ExtendedRoutine and return a certified ExtendedExecution witness.
fn certify_named_compilation(shape: ShapeCode, compilation: NamedThompsonCompilation(shape)) -> NamedCompilationErasure(shape, compilation, erase_named_thompson(compilation))
Certify compilation of a NamedPattern into a NamedThompsonCompilation.
fn certify_thompson(shape: ShapeCode, pattern: Pattern(shape)) -> ThompsonCompilation(shape)
Compile a Pattern into a certified ThompsonCompilation.
fn character_class(chars: List(Char), ranges: List(CharacterRange), negated: Bool) -> Regex(Char)
Regex matching a character class of literals and ranges.
fn character_class_with_options(chars: List(Char), ranges: List(CharacterRange), negated: Bool, caseless: Bool, unicode: Bool) -> Regex(Char)
Regex matching an option-aware character class.
fn class_kinds_match(kinds: ClassKinds, actual: Char, unicode: Bool) -> Bool
Test whether char matches any enabled shorthand class in kinds under options.
fn class_predicate(chars: List(Char), ranges: List(CharacterRange), negated: Bool, actual: Char) -> Bool
Test whether char matches a character class of literals and ranges.
fn class_test(chars: List(Char), ranges: List(CharacterRange), negated: Bool) -> Function(Char, Bool)
Curried predicate for a character class of literals and ranges.
fn close_named_capture_frame(frames: List(NamedCaptureFrame), entries: List(NamedCaptureLedgerEntry)) -> NamedCaptureExecution
Close the top named-capture frame and commit its text to the ledger.
fn compile_pattern(shape: ShapeCode, pattern: Pattern(shape)) -> Sigma(n: Nat, PatternMachine(n))
Compile a Pattern into a Sigma-packaged PatternMachine.
fn compile_regex(result: Type, regex: Regex(result)) -> CompiledRegex(result)
Compile a typed Regex(result) AST into an executable CompiledRegex(result).
fn compile_transition_rows(n: Nat, machine: PatternMachine(n)) -> TransitionRows(n)
Compile a PatternMachine's transition function into an indexed TransitionRows table.
concat_machine_next(left_count: Nat, right_count: Nat, left_next: Function(Bounded(left_count), Function(Char, List(MachineState(left_count)))), right_starts: List(MachineState(right_count)), right_next: Function(Bounded(right_count), Function(Char, List(MachineState(right_count)))), state: Bounded(plus(left_count, right_count)), char: Char) -> List(MachineState(plus(left_count, right_count)))
fn concat_machine_next(left_count: Nat, right_count: Nat, left_next: Function(Bounded(left_count), Function(Char, List(MachineState(left_count)))), right_starts: List(MachineState(right_count)), right_next: Function(Bounded(right_count), Function(Char, List(MachineState(right_count)))), state: Bounded(plus(left_count, right_count)), char: Char) -> List(MachineState(plus(left_count, right_count)))
Transition function for a concatenated pair of submachines.
concat_machine_next_from_side(left_count: Nat, right_count: Nat, left_next: Function(Bounded(left_count), Function(Char, List(MachineState(left_count)))), right_starts: List(MachineState(right_count)), right_next: Function(Bounded(right_count), Function(Char, List(MachineState(right_count)))), side: BoundedSum(left_count, right_count), char: Char) -> List(MachineState(plus(left_count, right_count)))
fn concat_machine_next_from_side(left_count: Nat, right_count: Nat, left_next: Function(Bounded(left_count), Function(Char, List(MachineState(left_count)))), right_starts: List(MachineState(right_count)), right_next: Function(Bounded(right_count), Function(Char, List(MachineState(right_count)))), side: BoundedSum(left_count, right_count), char: Char) -> List(MachineState(plus(left_count, right_count)))
Dispatch a concatenation transition after classifying the state as left or right.
fn concat_pattern_machine(left_count: Nat, left_machine: PatternMachine(left_count), right_count: Nat, right_machine: PatternMachine(right_count)) -> PatternMachine(plus(left_count, right_count))
Construct the PatternMachine for sequential concatenation of two submachines.
concat_pattern_machine_next_equation(left_count: Nat, left_machine: PatternMachine(left_count), right_count: Nat, right_machine: PatternMachine(right_count), state: Bounded(plus(left_count, right_count)), char: Char) -> Equivalent(List(MachineState(plus(left_count, right_count))), pattern_machine_next_at(concat_pattern_machine(left_count, left_machine, right_count, right_machine), state, char), concat_machine_next(left_count, pattern_machine_next(left_machine), pattern_machine_starts(right_machine), pattern_machine_next(right_machine), state, char))
fn concat_pattern_machine_next_equation(left_count: Nat, left_machine: PatternMachine(left_count), right_count: Nat, right_machine: PatternMachine(right_count), state: Bounded(plus(left_count, right_count)), char: Char) -> Equivalent(List(MachineState(plus(left_count, right_count))), pattern_machine_next_at(concat_pattern_machine(left_count, left_machine, right_count, right_machine), state, char), concat_machine_next(left_count, pattern_machine_next(left_machine), pattern_machine_starts(right_machine), pattern_machine_next(right_machine), state, char))
Equivalence unfolding pattern_machine_next_at for concat_pattern_machine.
fn concatenate(a: Type, b: Type, left: Regex(a), right: Regex(b)) -> Regex(Tuple(a, b))
Sequence two regexes, returning both results as a Tuple.
fn configured(a: Type, options: RegexOptions, regex: Regex(a)) -> Regex(a)
Apply RegexOptions to a sub-regex.
fn constraint_holds(constraint: BoundaryConstraint, boundary: Boundary) -> Bool
Test whether a BoundaryConstraint holds at boundary.
fn constraint_holds_with_routine(constraint: BoundaryConstraint, boundary: Boundary, routine: List(EvidenceInstruction)) -> Bool
Test whether a BoundaryConstraint holds at boundary given the current capture routine.
fn constraints_hold(constraints: List(BoundaryConstraint), boundary: Boundary) -> Bool
Return true if every BoundaryConstraint in constraints holds at boundary.
fn constraints_hold_with_routine(constraints: List(BoundaryConstraint), boundary: Boundary, routine: List(EvidenceInstruction)) -> Bool
Return true if all constraints hold at boundary with capture routine.
fn contains_char(chars: List(Char), actual: Char) -> Bool
Return true if target appears in the character list chars.
fn contains_char_with_options(chars: List(Char), actual: Char, caseless: Bool, unicode: Bool) -> Bool
Return true if target matches any character in chars under options.
fn continue_last_machine_prefix(n: Nat, machine: PatternMachine(n), position: InitialPosition, reversed_prefix: List(Char), remaining_input: List(Char), previous: CertifiedPrefixSearch(n, machine, position)) -> CertifiedPrefixSearch(n, machine, position)
Advance search_last_machine_prefix_loop while retaining the best certified match.
fn continue_with_right(left_count: Nat, right_count: Nat, left_states: List(MachineState(left_count)), right_starts: List(MachineState(right_count))) -> List(MachineState(plus(left_count, right_count)))
Route accepting left-submachine states into right_starts while keeping active left states.
fn crlf_policy(policy: NewlinePolicy) -> Bool
Return true if policy recognizes CRLF pairs as a single line break.
fn default_options() -> RegexOptions
Return the default RegexOptions (case-sensitive, single-line, ASCII mode).
fn destination_thread(n: Nat, destination: MachineState(n), evidence: List(Evidence), captures: List(CaptureFrame)) -> EvidenceThread(n)
Advance an EvidenceThread with char into a destination MachineState.
fn destination_threads(n: Nat, destinations: List(MachineState(n)), evidence: List(Evidence), captures: List(CaptureFrame)) -> List(EvidenceThread(n))
Advance an EvidenceThread with char into every destination in destinations.
fn digit_class(negated: Bool) -> Regex(Char)
Regex matching an ASCII digit (\d) or non-digit (\D when negated).
fn digit_class_with_options(negated: Bool, unicode: Bool) -> Regex(Char)
Regex matching \d / \D under options.
fn digit_option_predicate(negated: Bool, unicode: Bool, char: Char) -> Bool
Test whether char matches \d / \D under options.
fn digit_options_test(negated: Bool, unicode: Bool) -> Function(Char, Bool)
Curried predicate for \d / \D under options.
direct_pattern_machine_next_congruence(n: Nat, left: PatternMachine(n), right: PatternMachine(n), state: Bounded(n), char: Char, equality: Equivalent(PatternMachine(n), left, right)) -> Equivalent(List(MachineState(n)), pattern_machine_next_at(left, state, char), pattern_machine_next_at(right, state, char))
fn direct_pattern_machine_next_congruence(n: Nat, left: PatternMachine(n), right: PatternMachine(n), state: Bounded(n), char: Char, equality: Equivalent(PatternMachine(n), left, right)) -> Equivalent(List(MachineState(n)), pattern_machine_next_at(left, state, char), pattern_machine_next_at(right, state, char))
Congruence lifting PatternMachine equality to pattern_machine_next_at.
fn direct_pattern_machine_starts_congruence(n: Nat, left: PatternMachine(n), right: PatternMachine(n), equality: Equivalent(PatternMachine(n), left, right)) -> Equivalent(List(MachineState(n)), pattern_machine_starts(left), pattern_machine_starts(right))
Congruence lifting PatternMachine equality to pattern_machine_starts.
fn direct_staged_alternate_left_machine_function(left_count: Nat, right_count: Nat, right_machine: PatternMachine(right_count), prefer_right: Bool) -> Function(PatternMachine(left_count), PatternMachine(plus(left_count, right_count)))
Wrapper fixing the right submachine of alternate_pattern_machine for congruence proofs.
fn direct_staged_alternate_right_machine_function(left_count: Nat, right_count: Nat, left_machine: PatternMachine(left_count), prefer_right: Bool) -> Function(PatternMachine(right_count), PatternMachine(plus(left_count, right_count)))
Wrapper fixing the left submachine of alternate_pattern_machine for congruence proofs.
fn direct_staged_concat_left_machine_function(left_count: Nat, right_count: Nat, right_machine: PatternMachine(right_count)) -> Function(PatternMachine(left_count), PatternMachine(plus(left_count, right_count)))
Wrapper fixing the right submachine of concat_pattern_machine for congruence proofs.
fn direct_staged_concat_right_machine_function(left_count: Nat, right_count: Nat, left_machine: PatternMachine(left_count)) -> Function(PatternMachine(right_count), PatternMachine(plus(left_count, right_count)))
Wrapper fixing the left submachine of concat_pattern_machine for congruence proofs.
fn direct_staged_group_machine_function(n: Nat) -> Function(PatternMachine(n), PatternMachine(n))
Wrapper function applying group_pattern_machine for congruence proofs.
fn direct_staged_machine_seed_equivalent(shape: ShapeCode, compilation: ThompsonCompilation(shape)) -> Equivalent(PatternMachine(thompson_state_count(compilation)), staged_machine_seed_from_compilation(compilation), thompson_machine(compilation))
Proof that a DirectStagedCompilation's seed machine equals thompson_machine.
fn direct_staged_repeat_machine_function(n: Nat, lazy: Bool) -> Function(PatternMachine(n), PatternMachine(n))
Wrapper applying repeat_pattern_machine with fixed lazy flag for congruence proofs.
direct_staged_rows_transition_equivalent(shape: ShapeCode, compilation: ThompsonCompilation(shape), state: Bounded(thompson_state_count(compilation)), char: Char) -> Equivalent(List(MachineState(thompson_state_count(compilation))), transition_rows_next(direct_staged_rows_values_from_compilation(compilation), state, char), pattern_machine_next_at(thompson_machine(compilation), state, char))
fn direct_staged_rows_transition_equivalent(shape: ShapeCode, compilation: ThompsonCompilation(shape), state: Bounded(thompson_state_count(compilation)), char: Char) -> Equivalent(List(MachineState(thompson_state_count(compilation))), transition_rows_next(direct_staged_rows_values_from_compilation(compilation), state, char), pattern_machine_next_at(thompson_machine(compilation), state, char))
Pointwise equivalence showing direct-staged rows match thompson_machine transitions.
fn direct_staged_rows_values_from_compilation(shape: ShapeCode, compilation: ThompsonCompilation(shape)) -> TransitionRows(thompson_state_count(compilation))
Extract the underlying TransitionRowsFrom table from a DirectStagedCompilation.
fn direct_staged_starts_from_compilation(shape: ShapeCode, compilation: ThompsonCompilation(shape)) -> List(MachineState(thompson_state_count(compilation)))
Extract the start-state list from a DirectStagedCompilation.
fn discard_char(_char: Char) -> Unit
Discard a matched Char and return Unit.
fn discard_char_conversion() -> Conversion(Char, Unit)
Conversion values used by the literal emitter's staged IR. Keeping these small adapters here lets generated literals publish a first-order Thompson tree without rebuilding a Regex/Pattern wrapper at runtime.
fn discard_left(a: Type, b: Type, left: Regex(a), right: Regex(b)) -> Regex(b)
Match left then right, returning only right's result.
fn discard_right(a: Type, b: Type, left: Regex(a), right: Regex(b)) -> Regex(a)
Match left then right, returning only left's result.
fn distinct_threads(n: Nat, threads: List(EvidenceThread(n))) -> List(EvidenceThread(n))
Deduplicate EvidenceThreads by state, keeping the highest-priority thread per state.
fn distinct_threads_with(n: Nat, threads: List(EvidenceThread(n)), table: ThreadWinnerTable) -> DistinctThreadResult(n)
Deduplicate EvidenceThreads against an existing ThreadWinnerTable.
fn dot_predicate(dotall: Bool, char: Char) -> Bool
Return true if char matches . under options.
fn dot_test(dotall: Bool) -> Function(Char, Bool)
Curried predicate for . under options.
fn dot_test_with_policy(dotall: Bool, policy: NewlinePolicy) -> Function(Char, Bool)
Test whether char matches . given dotall and policy.
fn dot_with_options(dotall: Bool) -> Regex(Char)
Regex matching . under options.
fn dot_with_policy(dotall: Bool, policy: NewlinePolicy) -> Regex(Char)
Regex matching . given dotall and policy.
fn empty() -> Regex(Unit)
Regex matching the empty string and producing Unit.
fn empty_list_conversion(a: Type) -> Conversion(Unit, List(a))
Construct a Conversion turning Unit into an empty List(a).
fn empty_list_conversion_for(shape: ShapeCode) -> Conversion(Unit, List(Sem(shape)))
Shape-indexed adapters keep generated bounded-literal conversions fully inferable. The emitter knows the inner shape, while the polymorphic convenience form above has no expected type at the generated call site.
fn empty_machine_next(n: Nat, _state: Bounded(n), _char: Char) -> List(MachineState(n))
Transition function for a zero-state empty or boundary machine.
fn empty_machine_states(n: Nat) -> List(MachineState(n))
Return an empty List(MachineState(n)).
fn empty_pattern_machine() -> PatternMachine(Z())
Construct the zero-state PatternMachine accepting the empty string.
fn empty_repetition_transform(a: Type, _: Regex(a)) -> Function(Unit, List(a))
Transform Unit into an empty List(a) for zero-count repetitions.
fn empty_thread_winners() -> ThreadWinnerTable
Create an empty ThreadWinnerTable for deduplicating active and accepted threads.
fn enable_class_kind(kind: ClassKind, kinds: ClassKinds) -> ClassKinds
Enable a single ClassKind flag in a ClassKinds set.
fn end_anchor() -> Regex(Unit)
Zero-width anchor matching the end of subject or line.
fn end_anchor_with_options(multiline: Bool) -> Regex(Unit)
Zero-width end anchor respecting multiline and newline options.
fn enter_repeat(n: Nat, routine: List(EvidenceInstruction), starts: List(MachineState(n))) -> List(MachineState(n))
Prepend a loop-entry routine onto repetition body start states.
fn enter_repeat_with_constraints(n: Nat, routine: List(EvidenceInstruction), constraints: List(BoundaryConstraint), starts: List(MachineState(n))) -> List(MachineState(n))
Prepend a loop-entry routine and constraints onto repetition body start states.
fn enter_right(left_count: Nat, right_count: Nat, left_routine: List(EvidenceInstruction), right_starts: List(MachineState(right_count))) -> List(MachineState(plus(left_count, right_count)))
Prepend a left routine onto right-submachine start states.
fn enter_right_with_constraints(left_count: Nat, right_count: Nat, left_routine: List(EvidenceInstruction), left_constraints: List(BoundaryConstraint), right_starts: List(MachineState(right_count))) -> List(MachineState(plus(left_count, right_count)))
Prepend a left routine and constraints onto right-submachine start states.
fn erase_named_thompson(shape: ShapeCode, compilation: NamedThompsonCompilation(shape)) -> ThompsonCompilation(shape)
Erase named capture slots from a NamedThompsonCompilation to a ThompsonCompilation.
fn exact_predicate(expected: Char, actual: Char) -> Bool
Return true if actual equals expected.
fn exact_test(expected: Char) -> Function(Char, Bool)
Curried character predicate testing equality with expected.
fn exactly(expected: Char) -> Regex(Unit)
Regex matching the exact character expected and returning Unit.
fn exactly_with_options(expected: Char, caseless: Bool, unicode: Bool) -> Regex(Unit)
Regex matching expected under options and returning Unit.
fn execute_conversion(raw: Type, result: Type, conversion: Conversion(raw, result), value: raw) -> result
Run a typed Conversion to transform raw Sem(shape) evidence into a result value.
fn execute_extended_evidence_instruction(instruction: ExtendedInstruction, evidence: List(Evidence), captures: List(CaptureFrame)) -> EvidenceExecution
Evidence execution deliberately forgets ExtendedExecution.current.
Observe still advances every open capture frame, while the current
character is observational bookkeeping and cannot affect evidence.
fn execute_extended_evidence_routine(routine: List(ExtendedInstruction), evidence: List(Evidence), captures: List(CaptureFrame)) -> EvidenceExecution
Execute an ExtendedRoutine and return the final evidence stack if valid.
fn execute_extended_instruction(instruction: ExtendedInstruction, current: Option(Char), evidence: List(Evidence), captures: List(CaptureFrame)) -> ExtendedExecution
Execute a single ExtendedInstruction against an extended evidence state.
fn execute_extended_routine(routine: List(ExtendedInstruction), current: Option(Char), evidence: List(Evidence), captures: List(CaptureFrame)) -> ExtendedExecution
Execute an ExtendedRoutine, returning the updated stack, captures, and current buffer.
fn execute_instruction(instruction: EvidenceInstruction, evidence: List(Evidence), captures: List(CaptureFrame)) -> EvidenceExecution
Execute a single EvidenceInstruction against the evidence stack and capture frame stack.
fn execute_left_choice_conversion(left_raw: Type, left_result: Type, right_raw: Type, right_result: Type, left: Conversion(left_raw, left_result), _right: Conversion(right_raw, right_result), value: left_raw) -> Choice(left_result, right_result)
Wrap a converted left-branch result in ChoseLeft.
fn execute_list_conversion(raw: Type, result: Type, conversion: Conversion(raw, result), values: List(raw)) -> List(result)
Map a Conversion over every element of a list.
fn execute_named_extended_instruction(instruction: ExtendedInstruction, frames: List(NamedCaptureFrame), entries: List(NamedCaptureLedgerEntry)) -> NamedCaptureExecution
Execute an ExtendedInstruction while tracking named-capture frames.
fn execute_named_extended_routine(routine: List(ExtendedInstruction), frames: List(NamedCaptureFrame), entries: List(NamedCaptureLedgerEntry)) -> NamedCaptureExecution
Execute an ExtendedRoutine while tracking named-capture frames and ledger.
fn execute_named_instruction(instruction: EvidenceInstruction, frames: List(NamedCaptureFrame), entries: List(NamedCaptureLedgerEntry)) -> NamedCaptureExecution
Execute a single EvidenceInstruction while tracking named-capture frames.
fn execute_right_choice_conversion(left_raw: Type, left_result: Type, right_raw: Type, right_result: Type, _left: Conversion(left_raw, left_result), right: Conversion(right_raw, right_result), value: right_raw) -> Choice(left_result, right_result)
Wrap a converted right-branch result in ChoseRight.
fn execute_routine(routine: List(EvidenceInstruction), evidence: List(Evidence), captures: List(CaptureFrame)) -> EvidenceExecution
Execute a sequence of EvidenceInstructions, returning the final stack and captures.
fn execute_routine_certified(routine: List(EvidenceInstruction), input_evidence: List(Evidence), input_captures: List(CaptureFrame)) -> CertifiedRoutineExecution(routine, input_evidence, input_captures)
Execute an evidence routine and return a certified RoutineExecution witness.
fn executed_captures(execution: EvidenceExecution) -> List(CaptureFrame)
Extract the resulting capture frame stack from an executed routine state.
fn executed_evidence(execution: EvidenceExecution) -> List(Evidence)
Extract the resulting Evidence stack from an executed routine state.
fn extended_captures(execution: ExtendedExecution) -> List(CaptureFrame)
Extract the capture frame stack from an extended execution state.
fn extended_character_class(chars: List(Char), ranges: List(CharacterRange), kinds: ClassKinds, negated: Bool, caseless: Bool, unicode: Bool) -> Regex(Char)
Regex matching an extended character class.
fn extended_class_predicate(chars: List(Char), ranges: List(CharacterRange), kinds: ClassKinds, negated: Bool, caseless: Bool, unicode: Bool, actual: Char) -> Bool
Test whether char matches an extended character class (literals, ranges, kinds, POSIX).
fn extended_class_test(chars: List(Char), ranges: List(CharacterRange), kinds: ClassKinds, negated: Bool, caseless: Bool, unicode: Bool) -> Function(Char, Bool)
Curried predicate for an extended character class.
fn extended_current(execution: ExtendedExecution) -> Option(Char)
Extract the current character buffer from an extended execution state.
fn extended_evidence(execution: ExtendedExecution) -> List(Evidence)
Extract the Evidence stack from an extended execution state.
fn extended_property_class_predicate(chars: List(Char), ranges: List(CharacterRange), kinds: ClassKinds, properties: List(UnicodePropertyMatch), posix: List(PosixClassMatch), negated: Bool, caseless: Bool, unicode: Bool, actual: Char) -> Bool
Test whether char matches an extended class that also includes Unicode properties.
fn extended_property_class_test(chars: List(Char), ranges: List(CharacterRange), kinds: ClassKinds, properties: List(UnicodePropertyMatch), posix: List(PosixClassMatch), negated: Bool, caseless: Bool, unicode: Bool) -> Function(Char, Bool)
Curried predicate for an extended character class with Unicode properties.
fn extended_regular_instructions(routine: List(ExtendedInstruction)) -> List(EvidenceInstruction)
Named machines may carry capture-participation constraints on their
destination states. Those constraints are checked against the regular
evidence already executed on the path plus the destination's epsilon
routine: a group that participated contributes its EndCaptureSlot
instruction before the guarded branch is entered. Observe instructions
are intentionally erased from this view; they only advance capture text.
Ordinary machines deliberately continue through machine_destinations,
whose indexed proof contract does not mention capture conditions.
fn extended_unicode_property_class(chars: List(Char), ranges: List(CharacterRange), kinds: ClassKinds, properties: List(UnicodePropertyMatch), posix: List(PosixClassMatch), negated: Bool, caseless: Bool, unicode: Bool) -> Regex(Char)
Regex matching an extended character class with Unicode properties.
fn filter_accepted_decision(n: Nat, keep: Bool, routine: List(EvidenceInstruction), rest: List(MachineState(n)), boundary: Boundary) -> List(MachineState(n))
Classify an accepting MachineState against boundary as kept or rejected.
fn filter_active_decision(n: Nat, keep: Bool, state: Bounded(n), routine: List(EvidenceInstruction), rest: List(MachineState(n)), boundary: Boundary) -> List(MachineState(n))
Classify an active MachineState against boundary as kept or rejected.
fn filter_boundary_states(n: Nat, states: List(MachineState(n)), boundary: Boundary) -> List(MachineState(n))
Keep only MachineState values whose boundary constraints hold at boundary.
fn filter_boundary_states_with_routine(n: Nat, states: List(MachineState(n)), boundary: Boundary, prior_routine: List(EvidenceInstruction)) -> List(MachineState(n))
Filter MachineStates whose boundary constraints hold with capture routine.
fn filter_machine_states(n: Nat, states: List(MachineState(n)), boundary: Boundary) -> List(MachineState(n))
Filter MachineState values at the boundary derived from position and remaining.
fn finish_capture(n: Nat, states: List(MachineState(n))) -> List(MachineState(n))
Append the default capture-end instruction to every accepting state in states.
fn finish_capture_with(n: Nat, end_instruction: EvidenceInstruction, states: List(MachineState(n))) -> List(MachineState(n))
Append end_instruction to every accepting state in states.
fn finish_pair(n: Nat, states: List(MachineState(n))) -> List(MachineState(n))
Append a pair-completion instruction to every accepting state in states.
fn first_accepted_evidence(n: Nat, threads: List(EvidenceThread(n))) -> Option(List(Evidence))
Return the evidence stack of the first accepting thread in threads, if any.
fn folded_range_match(first: Char, last: Char, actual: Char, unicode: Bool) -> Bool
Return true if char matches [low, high] under case folding.
fn group_empty_output(n: Nat) -> List(MachineState(n))
Return the empty destination list for a group machine.
fn group_machine_next(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), state: Bounded(n), char: Char) -> List(MachineState(n))
Wrap inner transition destinations with capture-end instructions for a group.
fn group_machine_next_equation(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), state: Bounded(n), char: Char) -> Equivalent(List(MachineState(n)), group_machine_next(next, state, char), group_next_output(next(state, char)))
Equivalence unfolding group_machine_next to group_next_output.
fn group_machine_next_with(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), end_instruction: EvidenceInstruction, state: Bounded(n), char: Char) -> List(MachineState(n))
Wrap inner transition destinations with a custom capture-end instruction.
fn group_next_output(n: Nat, destinations: List(MachineState(n))) -> List(MachineState(n))
Apply capture-end framing to a list of destination states.
group_next_output_equivalent(n: Nat, left_next: Function(Bounded(n), Function(Char, List(MachineState(n)))), right_next: Function(Bounded(n), Function(Char, List(MachineState(n)))), state: Bounded(n), char: Char, equality: Equivalent(List(MachineState(n)), left_next(state, char), right_next(state, char))) -> Equivalent(List(MachineState(n)), group_machine_next(left_next, state, char), group_machine_next(right_next, state, char))
fn group_next_output_equivalent(n: Nat, left_next: Function(Bounded(n), Function(Char, List(MachineState(n)))), right_next: Function(Bounded(n), Function(Char, List(MachineState(n)))), state: Bounded(n), char: Char, equality: Equivalent(List(MachineState(n)), left_next(state, char), right_next(state, char))) -> Equivalent(List(MachineState(n)), group_machine_next(left_next, state, char), group_machine_next(right_next, state, char))
Congruence lifting transition equivalence through group_next_output.
fn group_pattern_machine(n: Nat, starts: List(MachineState(n)), next: Function(Bounded(n), Function(Char, List(MachineState(n))))) -> PatternMachine(n)
Wrap a PatternMachine in a standard capture group.
group_pattern_machine_next_equation(n: Nat, starts: List(MachineState(n)), next: Function(Bounded(n), Function(Char, List(MachineState(n)))), state: Bounded(n), char: Char) -> Equivalent(List(MachineState(n)), pattern_machine_next_at(group_pattern_machine(n, starts, next), state, char), group_machine_next(next, state, char))
fn group_pattern_machine_next_equation(n: Nat, starts: List(MachineState(n)), next: Function(Bounded(n), Function(Char, List(MachineState(n)))), state: Bounded(n), char: Char) -> Equivalent(List(MachineState(n)), pattern_machine_next_at(group_pattern_machine(n, starts, next), state, char), group_machine_next(next, state, char))
Equivalence unfolding pattern_machine_next_at for group_pattern_machine.
fn group_pattern_machine_with_slot(n: Nat, starts: List(MachineState(n)), next: Function(Bounded(n), Function(Char, List(MachineState(n)))), slot: Nat) -> PatternMachine(n)
Wrap a PatternMachine in a named capture group identified by slot.
fn guard_pattern_machine(n: Nat, constraint: BoundaryConstraint, machine: PatternMachine(n)) -> PatternMachine(n)
Guard all start states of a PatternMachine with a CaptureCondition.
fn guard_states(n: Nat, constraint: BoundaryConstraint, states: List(MachineState(n))) -> List(MachineState(n))
Attach a leading BoundaryConstraint to every state in states.
fn history_at(history: List(Char), index: Nat) -> Option(Char)
Look up the offset-th previous character in reverse history.
fn history_has_width(history: List(Char), width: Nat) -> Bool
Return true if reverse history contains at least width characters.
fn history_push_bounded(history: List(Char), char: Char) -> List(Char)
Histories are newest-first and bounded to one scalar beyond the eight- scalar assertion limit. The extra scalar supplies the boundary context immediately before a fixed-width lookbehind window.
fn history_take_limit(values: List(Char), limit: Nat) -> List(Char)
Take up to limit characters from a reverse character history list.
fn horizontal_class(negated: Bool) -> Regex(Char)
Regex matching horizontal whitespace (\h or \H when negated).
fn horizontal_predicate(negated: Bool, char: Char) -> Bool
Test whether char is horizontal whitespace (\h / \H).
fn horizontal_test(negated: Bool) -> Function(Char, Bool)
Curried predicate for horizontal whitespace (\h / \H).
impossible_lookaround_empty_active_path(depth: Nat, n: Nat, machine: PatternMachine(n), after_input: List(Char), source: Bounded(n), history: List(Char), policy: NewlinePolicy, result: Type, path: LookaroundAcceptingPath(depth, n, machine, Nil(), after_input, ThreadActive(source), history, policy)) -> result
fn impossible_lookaround_empty_active_path(depth: Nat, n: Nat, machine: PatternMachine(n), after_input: List(Char), source: Bounded(n), history: List(Char), policy: NewlinePolicy, result: Type, path: LookaroundAcceptingPath(depth, n, machine, Nil(), after_input, ThreadActive(source), history, policy)) -> result
An active thread cannot have an accepting path over an empty input. Keeping this contradiction at the typed path boundary prevents a later refutation proof from accidentally treating an unconsumed active state as terminally accepted.
fn in_ranges(ranges: List(CharacterRange), actual: Char) -> Bool
Return true if char falls in any inclusive (low, high) range in ranges.
fn in_ranges_with_options(ranges: List(CharacterRange), actual: Char, caseless: Bool, unicode: Bool) -> Bool
Return true if char falls in any range in ranges under options.
fn initial_machine_destinations(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char)) -> List(MachineState(n))
Compute boundary-filtered initial states for machine at position.
fn initial_position_boundary(position: InitialPosition, input: List(Char)) -> Boundary
Compute the Boundary at the start of remaining given an already-consumed prefix.
fn initial_thread(n: Nat, destination: MachineState(n)) -> EvidenceThread(n)
Create an initial EvidenceThread from a starting MachineState.
fn initial_threads(n: Nat, starts: List(MachineState(n))) -> List(EvidenceThread(n))
Create initial EvidenceThreads for all starting MachineStates.
fn inject_alternate_left(left_count: Nat, right_count: Nat, state: Bounded(left_count)) -> Bounded(plus(left_count, right_count))
Inject a left-branch bounded state index into an alternation's sum state space.
fn inject_alternate_right(left_count: Nat, right_count: Nat, state: Bounded(right_count)) -> Bounded(plus(left_count, right_count))
Inject a right-branch bounded state index into an alternation's sum state space.
fn inject_left_states(left_count: Nat, right_count: Nat, states: List(MachineState(left_count))) -> List(MachineState(plus(left_count, right_count)))
Widen machine states from the left submachine into a combined sum state space.
fn inject_right_states(left_count: Nat, right_count: Nat, states: List(MachineState(right_count))) -> List(MachineState(plus(left_count, right_count)))
Shift machine states from the right submachine into a combined sum state space.
fn line_break() -> Regex(String)
Regex matching a line break (\R) under the default newline policy.
fn line_break_pair_end_policy(policy: NewlinePolicy) -> Bool
Return true if char can end a two-character CRLF line break under policy.
fn line_break_pair_end_test(policy: NewlinePolicy, char: Char) -> Bool
Test whether char is \n (end of a CRLF line break).
fn line_break_pair_start_policy(policy: NewlinePolicy) -> Bool
Return true if char can start a two-character CRLF line break under policy.
fn line_break_pair_start_test(policy: NewlinePolicy, char: Char) -> Bool
Test whether char is \r (start of a CRLF line break).
fn line_break_pair_test(policy: NewlinePolicy, expected: Char) -> Function(Char, Bool)
Test whether char starts a CRLF pair under policy.
fn line_break_scalar_policy(policy: NewlinePolicy, char: Char) -> Bool
Return true if char is a single-character line break under policy.
fn line_break_scalar_test(policy: NewlinePolicy, expected: Char) -> Function(Char, Bool)
Test whether char is a single-character line break under policy.
fn line_break_with_policy(policy: NewlinePolicy) -> Regex(String)
Regex matching a line break (\R) under an explicit NewlinePolicy.
fn line_end_constraint() -> BoundaryConstraint
Construct a line-end ($) boundary constraint with the default newline policy.
fn line_end_constraint_with_policy(policy: NewlinePolicy) -> BoundaryConstraint
Construct a line-end ($) boundary constraint with an explicit newline policy.
fn line_end_for(policy: NewlinePolicy, next_char: Option(Char), after_next_char: Option(Char)) -> Bool
Determine whether a position is at a line end given previous, current, and policy.
fn line_start_constraint() -> BoundaryConstraint
Construct a line-start (^) boundary constraint with the default newline policy.
fn line_start_constraint_with_policy(policy: NewlinePolicy) -> BoundaryConstraint
Construct a line-start (^) boundary constraint with an explicit newline policy.
fn line_start_for(policy: NewlinePolicy, previous_char: Option(Char), next_char: Option(Char)) -> Bool
Determine whether a position is at a line start given previous, current, and policy.
fn literal_history_limit() -> Nat
Return the maximum lookbehind history window retained during matching.
fn lookahead_constraint(shape: ShapeCode, compilation: LookaroundCompilation(shape), positive: Bool, policy: NewlinePolicy) -> BoundaryConstraint
Assertions are staged as ordinary zero-state boundary nodes. The child machine is closed over once here; each boundary check only supplies the current finite subject context, so no source parser or machine rebuild is performed during matching.
fn lookahead_decision_holds(n: Nat, machine: PatternMachine(n), positive: Bool, decision: LookaheadDecision(n, machine)) -> Bool
Return true if a LookaheadDecision succeeded.
lookahead_witness(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), policy: NewlinePolicy, starts: List(MachineState(n)), path: LookaroundPrefixSearchPath(depth, n, machine, starts, input, after_input, history, policy)) -> LookaheadWitness(n, machine)
fn lookahead_witness(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), policy: NewlinePolicy, starts: List(MachineState(n)), path: LookaroundPrefixSearchPath(depth, n, machine, starts, input, after_input, history, policy)) -> LookaheadWitness(n, machine)
Wrap a prefix search path into a LookaheadWitness.
lookaround_accepting_members_path(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source: Bounded(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, current: List(MachineState(n)), members: MachineStateMembers(n, lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy), current)) -> LookaroundAcceptingMembersResult(depth, n, machine, lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy), current, Cons(char, rest), after_input, ThreadActive(source), history, policy, capture_context)
fn lookaround_accepting_members_path(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source: Bounded(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, current: List(MachineState(n)), members: MachineStateMembers(n, lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy), current)) -> LookaroundAcceptingMembersResult(depth, n, machine, lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy), current, Cons(char, rest), after_input, ThreadActive(source), history, policy, capture_context)
Search for an accepting path across a list of member MachineStates.
lookaround_accepting_path(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookaroundAcceptingPathResult(depth, n, machine, input, after_input, state, history, policy, capture_context)
fn lookaround_accepting_path(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookaroundAcceptingPathResult(depth, n, machine, input, after_input, state, history, policy, capture_context)
Search for an accepting path from a single MachineState over input.
lookaround_accepting_path_now(depth: Nat, n: Nat, machine: PatternMachine(n), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookaroundAcceptingPathResult(depth, n, machine, Nil(), after_input, ThreadAccepted(), history, policy, capture_context)
fn lookaround_accepting_path_now(depth: Nat, n: Nat, machine: PatternMachine(n), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookaroundAcceptingPathResult(depth, n, machine, Nil(), after_input, ThreadAccepted(), history, policy, capture_context)
Check whether a single MachineState accepts immediately with no remaining input.
fn lookaround_child_lookahead(depth: Nat, n: Nat, machine: PatternMachine(n), boundary: Boundary, remaining: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookaheadDecision(n, machine)
Lookaround child evaluation reuses the checked Thompson machine and has a context-aware, finite search loop. The Boolean path records only the existence of an accepting child path; the named sidecar below replays the selected child routine when assertion-local captures are requested.
fn lookaround_child_lookbehind(depth: Nat, n: Nat, machine: PatternMachine(n), width: Nat, boundary: Boundary, remaining: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookbehindDecision(n, machine)
Evaluate a nested lookbehind constraint inside a lookaround at the remaining depth.
fn lookaround_compiled(shape: ShapeCode, compilation: LookaroundCompilation(shape)) -> Sigma(n: Nat, PatternMachine(n))
Package a LookaroundCompilation into an existentially quantified PatternMachine.
fn lookaround_condition_capture_context(depth: Nat, condition: Option(LookaroundCondition), boundary: Boundary, remaining: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> Option(List(EvidenceInstruction))
A successful positive assertion can publish capture participation to the parent's ordinary finite machine. The Boolean decision remains the admission check; the capture-aware routine supplies only slot markers.
fn lookaround_condition_holds(depth: Nat, condition: Option(LookaroundCondition), boundary: Boundary, remaining: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> Bool
Evaluate a LookaroundCondition at the current position and recursion depth.
fn lookaround_condition_routine(depth: Nat, condition: Option(LookaroundCondition), boundary: Boundary, remaining: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> Option(List(ExtendedInstruction))
Evaluate a LookaroundCondition and return its resulting ExtendedRoutine if satisfied.
fn lookaround_constraint_capture_context(depth: Nat, constraint: BoundaryConstraint, boundary: Boundary, remaining: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> Option(List(EvidenceInstruction))
Extract the capture context needed to evaluate a lookaround BoundaryConstraint.
fn lookaround_constraint_nested_decisions(depth: Nat, constraint: BoundaryConstraint, boundary: Boundary, remaining: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> List(LookaroundNestedDecision)
Collect nested lookaround decisions produced while checking a single constraint.
fn lookaround_constraint_routine(depth: Nat, constraint: BoundaryConstraint, boundary: Boundary, remaining: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> Option(List(ExtendedInstruction))
Evaluate a lookaround BoundaryConstraint and return any captured routine.
fn lookaround_constraints_capture_context(depth: Nat, constraints: List(BoundaryConstraint), boundary: Boundary, remaining: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> Option(List(EvidenceInstruction))
Extract capture contexts for a list of lookaround BoundaryConstraints.
fn lookaround_constraints_routine(depth: Nat, constraints: List(BoundaryConstraint), boundary: Boundary, remaining: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> Option(List(ExtendedInstruction))
Capture-aware boundary evaluation returns the selected child routine for a positive assertion. A negative assertion succeeds with an empty routine: its private capture frame is intentionally discarded. The Boolean path above remains the acceptance authority; this side channel only preserves the witness needed by named replay.
fn lookaround_exhaustion_from_list(n: Nat, values: List(MachineState(n))) -> LookaroundExhaustion(n)
Construct a LookaroundExhaustion witness from a list of failed member states.
fn lookaround_exhaustion_from_members(n: Nat, whole: List(MachineState(n)), values: List(MachineState(n)), members: MachineStateMembers(n, whole, values)) -> LookaroundExhaustion(n)
Turn a structurally enumerated candidate list into the compact erased exhaustion witness used by assertion refutations. The recursive call is the only way to obtain the Nil remainder, so callers cannot manufacture a certificate for a list whose traversal has not terminated.
fn lookaround_filter_boundary_states(depth: Nat, n: Nat, states: List(MachineState(n)), boundary: Boundary, remaining: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> List(MachineState(n))
Assertion operands are validated as depth-bounded before emission. Their child machine can therefore recurse only through the explicit finite fuel; using this separate filter keeps Boolean child evaluation outside the parent constraint evaluator's ordinary totality SCC.
fn lookaround_first_prefix(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), history: List(Char), policy: NewlinePolicy) -> Option(Tuple(List(Char), List(Char)))
Find the shortest (first) prefix of input accepted by a lookaround machine.
fn lookaround_first_prefix_loop(n: Nat, machine: PatternMachine(n), position: InitialPosition, reversed_prefix: List(Char), remaining_input: List(Char), history: List(Char), policy: NewlinePolicy) -> Option(Tuple(List(Char), List(Char)))
Recursive helper for lookaround_first_prefix accumulating matched characters.
fn lookaround_impossible_list_member(item_type: Type, item: item_type, result: Type, membership: ListMember(item_type, item, Nil())) -> result
The empty start list has no accepting path. This is the base case used
by the eventual refutation-tree soundness proof: every search-path
constructor carries a membership witness in starts, so starts = []
is eliminated constructively rather than treated as an unchecked claim.
fn lookaround_last_prefix(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), history: List(Char), policy: NewlinePolicy) -> Option(Tuple(List(Char), List(Char)))
Find the longest (last) prefix of input accepted by a lookaround machine.
fn lookaround_last_prefix_loop(n: Nat, machine: PatternMachine(n), position: InitialPosition, reversed_prefix: List(Char), remaining_input: List(Char), previous: Option(Tuple(List(Char), List(Char))), history: List(Char), policy: NewlinePolicy) -> Option(Tuple(List(Char), List(Char)))
Recursive helper for lookaround_last_prefix tracking the latest match.
fn lookaround_machine(shape: ShapeCode, compilation: LookaroundCompilation(shape)) -> PatternMachine(lookaround_state_count(compilation))
Build the finite child machine once. Atomic scopes are represented by the same BeginAtomic/EndAtomic routine markers used by the ordinary runtime plan, so nested assertion evaluation can apply one commitment invariant rather than maintaining a second backtracking mechanism.
lookaround_machine_acceptance_path(depth: Nat, n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookaroundSearchResult(depth, n, machine, input, after_input, history, policy, capture_context)
fn lookaround_machine_acceptance_path(depth: Nat, n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookaroundSearchResult(depth, n, machine, input, after_input, history, policy, capture_context)
Search for a full acceptance path of a lookaround machine on input.
fn lookaround_machine_accepts(depth: Nat, n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> Bool
Return true if a lookaround machine accepts input.
fn lookaround_machine_destinations(depth: Nat, n: Nat, machine: PatternMachine(n), state: ThreadState(n), char: Char, rest: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> List(MachineState(n))
Compute filtered destination states for a lookaround machine step.
fn lookaround_machine_raw_destinations(n: Nat, machine: PatternMachine(n), state: ThreadState(n), char: Char) -> List(MachineState(n))
Compute unfiltered destination states for a lookaround machine step.
fn lookaround_nested_decisions(depth: Nat, constraints: List(BoundaryConstraint), boundary: Boundary, remaining: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> List(LookaroundNestedDecision)
Collect nested lookaround decisions across a list of constraints.
lookaround_path_accepted_with_input(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, ThreadAccepted(), history, capture_context, policy, Nil(), Nil())
fn lookaround_path_accepted_with_input(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, ThreadAccepted(), history, capture_context, policy, Nil(), Nil())
Construct a path-failure witness when an accepting state still has remaining input.
lookaround_path_destination_accepted_rejected(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, destinations: List(MachineState(n)), routine: List(EvidenceInstruction), constraints: List(BoundaryConstraint), edge: ListMember(MachineState(n), Accepted(routine, constraints), destinations), child_destinations: List(MachineState(n)), child_remaining_destinations: List(MachineState(n)), child_failure: LookaroundPathFailure(depth, n, machine, rest, after_input, ThreadAccepted(), history_push_bounded(history, char), append_routine(capture_context, routine), policy, child_destinations, child_remaining_destinations), remaining_destinations: List(MachineState(n)), tail: LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, source, history, capture_context, policy, destinations, remaining_destinations), members: MachineStateMembers(n, destinations, Cons(Accepted(routine, constraints), remaining_destinations)), destinations_equivalent: Equivalent(List(MachineState(n)), destinations, lookaround_machine_destinations(depth, n, machine, source, char, rest, after_input, history, capture_context, policy))) -> LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, source, history, capture_context, policy, destinations, Cons(Accepted(routine, constraints), remaining_destinations))
fn lookaround_path_destination_accepted_rejected(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, destinations: List(MachineState(n)), routine: List(EvidenceInstruction), constraints: List(BoundaryConstraint), edge: ListMember(MachineState(n), Accepted(routine, constraints), destinations), child_destinations: List(MachineState(n)), child_remaining_destinations: List(MachineState(n)), child_failure: LookaroundPathFailure(depth, n, machine, rest, after_input, ThreadAccepted(), history_push_bounded(history, char), append_routine(capture_context, routine), policy, child_destinations, child_remaining_destinations), remaining_destinations: List(MachineState(n)), tail: LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, source, history, capture_context, policy, destinations, remaining_destinations), members: MachineStateMembers(n, destinations, Cons(Accepted(routine, constraints), remaining_destinations)), destinations_equivalent: Equivalent(List(MachineState(n)), destinations, lookaround_machine_destinations(depth, n, machine, source, char, rest, after_input, history, capture_context, policy))) -> LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, source, history, capture_context, policy, destinations, Cons(Accepted(routine, constraints), remaining_destinations))
Construct a path-failure witness for an accepting destination rejected by boundary constraints.
lookaround_path_destination_active_rejected(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, destinations: List(MachineState(n)), destination: Bounded(n), routine: List(EvidenceInstruction), constraints: List(BoundaryConstraint), edge: ListMember(MachineState(n), Active(destination, routine, constraints), destinations), child_destinations: List(MachineState(n)), child_remaining_destinations: List(MachineState(n)), child_failure: LookaroundPathFailure(depth, n, machine, rest, after_input, ThreadActive(destination), history_push_bounded(history, char), append_routine(capture_context, routine), policy, child_destinations, child_remaining_destinations), remaining_destinations: List(MachineState(n)), tail: LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, source, history, capture_context, policy, destinations, remaining_destinations), members: MachineStateMembers(n, destinations, Cons(Active(destination, routine, constraints), remaining_destinations)), destinations_equivalent: Equivalent(List(MachineState(n)), destinations, lookaround_machine_destinations(depth, n, machine, source, char, rest, after_input, history, capture_context, policy))) -> LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, source, history, capture_context, policy, destinations, Cons(Active(destination, routine, constraints), remaining_destinations))
fn lookaround_path_destination_active_rejected(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, destinations: List(MachineState(n)), destination: Bounded(n), routine: List(EvidenceInstruction), constraints: List(BoundaryConstraint), edge: ListMember(MachineState(n), Active(destination, routine, constraints), destinations), child_destinations: List(MachineState(n)), child_remaining_destinations: List(MachineState(n)), child_failure: LookaroundPathFailure(depth, n, machine, rest, after_input, ThreadActive(destination), history_push_bounded(history, char), append_routine(capture_context, routine), policy, child_destinations, child_remaining_destinations), remaining_destinations: List(MachineState(n)), tail: LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, source, history, capture_context, policy, destinations, remaining_destinations), members: MachineStateMembers(n, destinations, Cons(Active(destination, routine, constraints), remaining_destinations)), destinations_equivalent: Equivalent(List(MachineState(n)), destinations, lookaround_machine_destinations(depth, n, machine, source, char, rest, after_input, history, capture_context, policy))) -> LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, source, history, capture_context, policy, destinations, Cons(Active(destination, routine, constraints), remaining_destinations))
Construct a path-failure witness for an active destination rejected by boundary constraints.
lookaround_path_exhausted(depth: Nat, n: Nat, machine: PatternMachine(n), after_input: List(Char), source: Bounded(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, destinations: List(MachineState(n)), members: MachineStateMembers(n, destinations, Nil()), destinations_equivalent: Equivalent(List(MachineState(n)), destinations, empty_machine_states(n))) -> LookaroundPathFailure(depth, n, machine, Nil(), after_input, ThreadActive(source), history, capture_context, policy, destinations, Nil())
fn lookaround_path_exhausted(depth: Nat, n: Nat, machine: PatternMachine(n), after_input: List(Char), source: Bounded(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, destinations: List(MachineState(n)), members: MachineStateMembers(n, destinations, Nil()), destinations_equivalent: Equivalent(List(MachineState(n)), destinations, empty_machine_states(n))) -> LookaroundPathFailure(depth, n, machine, Nil(), after_input, ThreadActive(source), history, capture_context, policy, destinations, Nil())
Construct a path-failure witness when no candidate destinations remain.
lookaround_path_step_exhausted(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source: Bounded(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, destinations: List(MachineState(n)), members: MachineStateMembers(n, destinations, Nil()), destinations_equivalent: Equivalent(List(MachineState(n)), destinations, lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy))) -> LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, ThreadActive(source), history, capture_context, policy, destinations, Nil())
fn lookaround_path_step_exhausted(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source: Bounded(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, destinations: List(MachineState(n)), members: MachineStateMembers(n, destinations, Nil()), destinations_equivalent: Equivalent(List(MachineState(n)), destinations, lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy))) -> LookaroundPathFailure(depth, n, machine, Cons(char, rest), after_input, ThreadActive(source), history, capture_context, policy, destinations, Nil())
Construct a path-failure witness when all successor states fail.
fn lookaround_polarity_holds(positive: Bool, result: Bool) -> Bool
Apply positive or negative lookaround polarity to a match boolean.
fn lookaround_prefix(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), greedy: Bool, history: List(Char), policy: NewlinePolicy) -> Option(Tuple(List(Char), List(Char)))
Find either the shortest (lazy: true) or longest (lazy: false) prefix accepted by a lookaround machine.
fn lookaround_prefix_filtered_starts(depth: Nat, n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> List(MachineState(n))
Filter a lookaround machine's start states at the current boundary.
fn lookaround_prefix_machine_accepts(depth: Nat, n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> Bool
Return true if a lookaround machine matches any prefix of input.
lookaround_prefix_members_path(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source: Bounded(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, current: List(MachineState(n)), members: MachineStateMembers(n, lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy), current)) -> LookaroundPrefixMembersResult(depth, n, machine, lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy), current, Cons(char, rest), after_input, ThreadActive(source), history, policy, capture_context)
fn lookaround_prefix_members_path(depth: Nat, n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source: Bounded(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, current: List(MachineState(n)), members: MachineStateMembers(n, lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy), current)) -> LookaroundPrefixMembersResult(depth, n, machine, lookaround_machine_destinations(depth, n, machine, ThreadActive(source), char, rest, after_input, history, capture_context, policy), current, Cons(char, rest), after_input, ThreadActive(source), history, policy, capture_context)
Search for a prefix-accepting path across a list of member MachineStates.
lookaround_prefix_path(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookaroundPrefixPathResult(depth, n, machine, input, after_input, state, history, policy, capture_context)
fn lookaround_prefix_path(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), state: ThreadState(n), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookaroundPrefixPathResult(depth, n, machine, input, after_input, state, history, policy, capture_context)
Search for a prefix-accepting path from a single MachineState over input.
fn lookaround_prefix_search_decision(depth: Nat, n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookaheadDecision(n, machine)
Decide a lookahead assertion and return a certified LookaheadDecision.
lookaround_prefix_search_path(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n))) -> LookaroundPrefixSearchResult(depth, n, machine, input, after_input, history, policy, capture_context)
fn lookaround_prefix_search_path(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n))) -> LookaroundPrefixSearchResult(depth, n, machine, input, after_input, history, policy, capture_context)
Run a certified prefix lookaround search from machine's start states.
lookaround_prefix_search_path_members(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n)), current: List(MachineState(n)), members: MachineStateMembers(n, starts, current)) -> LookaroundPrefixSearchMembersResult(depth, n, machine, starts, input, after_input, history, policy, capture_context)
fn lookaround_prefix_search_path_members(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n)), current: List(MachineState(n)), members: MachineStateMembers(n, starts, current)) -> LookaroundPrefixSearchMembersResult(depth, n, machine, starts, input, after_input, history, policy, capture_context)
Run a certified prefix lookaround search across explicit start-state members.
lookaround_search_accepted_rejected(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n)), routine: List(EvidenceInstruction), constraints: List(BoundaryConstraint), member: ListMember(MachineState(n), Accepted(routine, constraints), starts), child_destinations: List(MachineState(n)), child_remaining_destinations: List(MachineState(n)), child_failure: LookaroundPathFailure(depth, n, machine, input, after_input, ThreadAccepted(), history, append_routine(capture_context, routine), policy, child_destinations, child_remaining_destinations), remaining_starts: List(MachineState(n)), tail: LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts), members: MachineStateMembers(n, starts, Cons(Accepted(routine, constraints), remaining_starts))) -> LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)
fn lookaround_search_accepted_rejected(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n)), routine: List(EvidenceInstruction), constraints: List(BoundaryConstraint), member: ListMember(MachineState(n), Accepted(routine, constraints), starts), child_destinations: List(MachineState(n)), child_remaining_destinations: List(MachineState(n)), child_failure: LookaroundPathFailure(depth, n, machine, input, after_input, ThreadAccepted(), history, append_routine(capture_context, routine), policy, child_destinations, child_remaining_destinations), remaining_starts: List(MachineState(n)), tail: LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts), members: MachineStateMembers(n, starts, Cons(Accepted(routine, constraints), remaining_starts))) -> LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)
Construct a search-failure witness for a rejected accepting start state.
lookaround_search_active_rejected(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n)), state: Bounded(n), routine: List(EvidenceInstruction), constraints: List(BoundaryConstraint), member: ListMember(MachineState(n), Active(state, routine, constraints), starts), child_destinations: List(MachineState(n)), child_remaining_destinations: List(MachineState(n)), child_failure: LookaroundPathFailure(depth, n, machine, input, after_input, ThreadActive(state), history, append_routine(capture_context, routine), policy, child_destinations, child_remaining_destinations), remaining_starts: List(MachineState(n)), tail: LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts), members: MachineStateMembers(n, starts, Cons(Active(state, routine, constraints), remaining_starts))) -> LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)
fn lookaround_search_active_rejected(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n)), state: Bounded(n), routine: List(EvidenceInstruction), constraints: List(BoundaryConstraint), member: ListMember(MachineState(n), Active(state, routine, constraints), starts), child_destinations: List(MachineState(n)), child_remaining_destinations: List(MachineState(n)), child_failure: LookaroundPathFailure(depth, n, machine, input, after_input, ThreadActive(state), history, append_routine(capture_context, routine), policy, child_destinations, child_remaining_destinations), remaining_starts: List(MachineState(n)), tail: LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts), members: MachineStateMembers(n, starts, Cons(Active(state, routine, constraints), remaining_starts))) -> LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)
Construct a search-failure witness for a rejected active start state.
fn lookaround_search_decision(depth: Nat, n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy) -> LookbehindDecision(n, machine)
Decide a lookbehind assertion and return a certified LookbehindDecision.
lookaround_search_exhausted(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n)), members: MachineStateMembers(n, starts, Nil())) -> LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)
fn lookaround_search_exhausted(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n)), members: MachineStateMembers(n, starts, Nil())) -> LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, starts)
Construct a search-failure witness when no start states remain.
lookaround_search_failure_excludes_empty_starts(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, result: Type, failure: LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, Nil()), path: LookaroundSearchPath(depth, n, machine, Nil(), input, after_input, history, policy)) -> result
fn lookaround_search_failure_excludes_empty_starts(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, result: Type, failure: LookaroundSearchFailure(depth, n, machine, input, after_input, history, capture_context, policy, Nil()), path: LookaroundSearchPath(depth, n, machine, Nil(), input, after_input, history, policy)) -> result
Eliminate an impossible lookaround search failure from an empty start list.
lookaround_search_path(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n))) -> LookaroundSearchResult(depth, n, machine, input, after_input, history, policy, capture_context)
fn lookaround_search_path(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n))) -> LookaroundSearchResult(depth, n, machine, input, after_input, history, policy, capture_context)
Run a certified full-input lookaround search from machine's start states.
fn lookaround_search_path_excludes_empty_starts(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), policy: NewlinePolicy, result: Type, path: LookaroundSearchPath(depth, n, machine, Nil(), input, after_input, history, policy)) -> result
Eliminate an impossible lookaround search path from an empty start list.
lookaround_search_path_members(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n)), current: List(MachineState(n)), members: MachineStateMembers(n, starts, current)) -> LookaroundSearchMembersResult(depth, n, machine, starts, input, after_input, history, policy, capture_context)
fn lookaround_search_path_members(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), capture_context: List(EvidenceInstruction), policy: NewlinePolicy, starts: List(MachineState(n)), current: List(MachineState(n)), members: MachineStateMembers(n, starts, current)) -> LookaroundSearchMembersResult(depth, n, machine, starts, input, after_input, history, policy, capture_context)
Run a certified full-input lookaround search across explicit start-state members.
fn lookaround_state_count(shape: ShapeCode, compilation: LookaroundCompilation(shape)) -> Nat
Return the total number of states in a LookaroundCompilation.
fn lookaround_transition_boundary(char: Char, rest: List(Char), after_input: List(Char), policy: NewlinePolicy) -> Boundary
Compute the Boundary after a lookaround machine consumes char.
fn lookbehind_constraint(shape: ShapeCode, compilation: LookaroundCompilation(shape), positive: Bool, width: Nat, policy: NewlinePolicy) -> BoundaryConstraint
Construct a lookbehind boundary constraint with polarity, width, and compiled machine.
fn lookbehind_decision_holds(n: Nat, machine: PatternMachine(n), positive: Bool, decision: LookbehindDecision(n, machine)) -> Bool
Return true if a LookbehindDecision succeeded.
fn lookbehind_initial_position(boundary: Boundary, history: List(Char), width: Nat, policy: NewlinePolicy) -> InitialPosition
Compute the starting Position for a lookbehind window of length width.
fn lookbehind_window(history: List(Char), width: Nat) -> Option(List(Char))
Extract the last width characters from reverse history in forward order.
lookbehind_witness(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), policy: NewlinePolicy, starts: List(MachineState(n)), path: LookaroundSearchPath(depth, n, machine, starts, input, after_input, history, policy)) -> LookbehindWitness(n, machine)
fn lookbehind_witness(depth: Nat, n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), history: List(Char), policy: NewlinePolicy, starts: List(MachineState(n)), path: LookaroundSearchPath(depth, n, machine, starts, input, after_input, history, policy)) -> LookbehindWitness(n, machine)
Wrap a full search path into a LookbehindWitness.
fn machine_accepts_chars(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), input: List(Char), current: List(MachineState(n))) -> Bool
Execute a PatternMachine on a character list and return whether any thread accepts.
fn machine_destinations(n: Nat, machine: PatternMachine(n), state: ThreadState(n), char: Char, boundary: Boundary) -> List(MachineState(n))
Compute boundary-filtered transitions for machine from state on char.
fn machine_has_accept(n: Nat, states: List(MachineState(n))) -> Bool
Return true if any state in states is accepting.
fn machine_state_members(n: Nat, values: List(MachineState(n))) -> MachineStateMembers(n, values, values)
Build the reflexive MachineStateMembers witness for a list of states.
fn machine_state_routine(n: Nat, state: MachineState(n)) -> List(EvidenceInstruction)
Extract the evidence instruction routine attached to a MachineState.
fn machine_step(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), char: Char, current: List(MachineState(n))) -> List(MachineState(n))
Step a list of active MachineState values on char via machine.
fn machine_step_one(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), char: Char, current: MachineState(n)) -> List(MachineState(n))
Step a single active MachineState on char via machine.
fn map(a: Type, b: Type, regex: Regex(a), transform: Function(a, b)) -> Regex(b)
Transform the typed result of regex using transform.
fn mark_branch(n: Nat, states: List(MachineState(n)), marker: EvidenceInstruction) -> List(MachineState(n))
Append a branch-choice marker instruction to every state in states.
fn member_here(a: Type, value: a, rest: List(a)) -> ListMember(a, value, Cons(value, rest))
Construct a ListMember witness pointing to the head of a cons list.
fn member_there(a: Type, head: a, value: a, rest: List(a), member: ListMember(a, value, rest)) -> ListMember(a, value, Cons(head, rest))
Lift a ListMember witness past the head of a cons list.
fn named_capture_value(slot: Nat, entries: List(NamedCaptureLedgerEntry)) -> Option(String)
Look up the captured text for slot in a named-capture ledger.
fn named_captures_from_layout(layout: CaptureLayout, entries: List(NamedCaptureLedgerEntry)) -> List(NamedCapture)
Finalize a named-capture ledger into NamedCapture entries ordered by layout.
fn named_captures_from_slots(slots: List(CaptureSlot), entries: List(NamedCaptureLedgerEntry)) -> List(NamedCapture)
Finalize a named-capture ledger into NamedCapture entries ordered by slots.
fn named_continue_last_prefix(n: Nat, machine: PatternMachine(n), position: InitialPosition, reversed_prefix: List(Char), remaining_input: List(Char), previous: NamedPrefixSearch) -> NamedPrefixSearch
Advance named_search_last_prefix_loop while retaining the best match seen so far.
fn named_filter_initial(n: Nat, starts: List(MachineState(n)), position: InitialPosition, input: List(Char), after_input: List(Char)) -> List(MachineState(n))
Filter initial states of a named-capture machine against boundary constraints.
fn named_full_capture(shape: ShapeCode, compilation: NamedThompsonCompilation(shape), input: String, layout: CaptureLayout) -> Option(List(NamedCapture))
Match a NamedRegex against the full input string and return all named captures.
fn named_lookaround_full_capture(shape: ShapeCode, compilation: LookaroundCompilation(shape), input: String, layout: CaptureLayout, policy: NewlinePolicy) -> Option(List(NamedCapture))
Named replay for a lookaround-aware compilation uses the same checked finite machine as assertion acceptance. Unlike the typed path, the returned routine is retained long enough to replay capture slots, including slots opened and closed inside a positive assertion.
fn named_lookaround_prefix_capture_at(shape: ShapeCode, compilation: LookaroundCompilation(shape), input: List(Char), greedy: Bool, position: InitialPosition, history: List(Char), layout: CaptureLayout, policy: NewlinePolicy) -> Option(NamedPrefixCapture)
Match a lookaround-capable NamedRegex prefix at position and return its named captures.
fn named_machine_destinations(n: Nat, machine: PatternMachine(n), state: ThreadState(n), char: Char, boundary: Boundary, prior_routine: List(EvidenceInstruction)) -> List(MachineState(n))
Compute boundary-filtered transitions for a named-capture machine with routine.
fn named_prefix_capture_at(shape: ShapeCode, compilation: NamedThompsonCompilation(shape), input: List(Char), greedy: Bool, position: InitialPosition, layout: CaptureLayout) -> Option(NamedPrefixCapture)
Match a NamedRegex prefix starting at position and return its named captures.
fn named_search_accepting_from(n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), state: ThreadState(n), current_routine: List(ExtendedInstruction)) -> NamedMachineSearch
Search for an accepting run from a single named-capture MachineState.
fn named_search_accepting_members(n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), current_routine: List(ExtendedInstruction), destinations: List(MachineState(n))) -> NamedMachineSearch
Search candidate destination states of a named-capture machine.
fn named_search_first_prefix(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char)) -> NamedPrefixSearch
Find the shortest prefix accepted by a named-capture machine.
fn named_search_first_prefix_loop(n: Nat, machine: PatternMachine(n), position: InitialPosition, reversed_prefix: List(Char), remaining_input: List(Char)) -> NamedPrefixSearch
Recursive helper for named_search_first_prefix.
fn named_search_initial_members(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char), starts: List(MachineState(n))) -> NamedMachineSearch
Search initial member states of a named-capture machine for an accepting run.
fn named_search_last_prefix(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char)) -> NamedPrefixSearch
Find the longest prefix accepted by a named-capture machine.
fn named_search_last_prefix_loop(n: Nat, machine: PatternMachine(n), position: InitialPosition, reversed_prefix: List(Char), remaining_input: List(Char), previous: NamedPrefixSearch) -> NamedPrefixSearch
Recursive helper for named_search_last_prefix.
fn named_search_machine_acceptance(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char)) -> NamedMachineSearch
Search for an accepting match of a named-capture machine on input.
fn named_staged(result: Type, shape: ShapeCode, ordinary: Regex(result), compilation: NamedThompsonCompilation(shape), lookaround: LookaroundCompilation(shape), layout: CaptureLayout, firstline_only: Bool, policy: NewlinePolicy) -> NamedRegex(result, shape)
Package a NamedPattern, its Conversion, and its NamedCaptureLayout into a NamedRegex.
named_staged_checked(result: Type, shape: ShapeCode, ordinary: Regex(result), compilation: NamedThompsonCompilation(shape), lookaround: LookaroundCompilation(shape), layout: CaptureLayout, firstline_only: Bool, policy: NewlinePolicy, _proof: NamedCompilationErasure(shape, compilation, erase_named_thompson(compilation))) -> NamedRegex(result, shape)
fn named_staged_checked(result: Type, shape: ShapeCode, ordinary: Regex(result), compilation: NamedThompsonCompilation(shape), lookaround: LookaroundCompilation(shape), layout: CaptureLayout, firstline_only: Bool, policy: NewlinePolicy, _proof: NamedCompilationErasure(shape, compilation, erase_named_thompson(compilation))) -> NamedRegex(result, shape)
Package a NamedRegex after verifying its layout matches the pattern.
fn named_thompson_machine(shape: ShapeCode, compilation: NamedThompsonCompilation(shape)) -> PatternMachine(named_thompson_state_count(compilation))
Build the executable PatternMachine from a NamedThompsonCompilation.
fn named_thompson_state_count(shape: ShapeCode, compilation: NamedThompsonCompilation(shape)) -> Nat
Return the total number of states in a NamedThompsonCompilation.
fn negate_test(test: Function(Char, Bool)) -> Function(Char, Bool)
Negate a boolean result when negated is true.
fn newline_char(policy: NewlinePolicy, char: Char) -> Bool
Return true if char is a line-break character under policy.
fn next_ascii_word(input: List(Char)) -> Bool
Return true if the next character in remaining is an ASCII word character.
fn next_for_thread(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), state: ThreadState(n), char: Char) -> List(MachineState(n))
Evaluate the next destination states for an active thread on char.
fn next_unicode_word(input: List(Char)) -> Bool
Return true if the next character in remaining is a Unicode word character.
fn no_characters() -> List(Char)
Return an empty List(Char).
fn no_class_kinds() -> ClassKinds
Return an empty ClassKinds bitset with all shorthand classes disabled.
fn one_of(chars: List(Char)) -> Regex(Char)
Regex matching any character in chars (or outside it if negated).
fn one_or_more(a: Type, regex: Regex(a)) -> Regex(OneOrMore(a))
Match one or more occurrences of regex, returning OneOrMore(a).
fn one_or_more_pattern(a: Type, regex: Regex(a), lazy: Bool) -> Regex(List(a))
One-or-more regex parameterized by lazy quantifier preference.
fn option_ascii_word(previous: Option(Char)) -> Bool
Return true if an Option(Char) is Some ASCII word character.
fn option_class_negated(test: Function(Char, Bool), negated: Bool, char: Char) -> Bool
Apply optional negation to a character-class match result.
fn option_class_predicate(chars: List(Char), ranges: List(CharacterRange), negated: Bool, caseless: Bool, unicode: Bool, actual: Char) -> Bool
Test whether char matches a character class with shorthand kinds and options.
fn option_class_test(chars: List(Char), ranges: List(CharacterRange), negated: Bool, caseless: Bool, unicode: Bool) -> Function(Char, Bool)
Curried predicate for an option-aware character class.
fn option_digit(char: Char, unicode: Bool) -> Bool
Return true if char is a digit under options (ASCII or Unicode).
fn option_exact_predicate(expected: Char, caseless: Bool, unicode: Bool, actual: Char) -> Bool
Test whether actual matches expected under options (case folding if enabled).
fn option_exact_test(expected: Char, caseless: Bool, unicode: Bool) -> Function(Char, Bool)
Curried character predicate testing equality with expected under options.
fn option_head(input: List(Char)) -> Option(Char)
Return the first element of a list as Option, or None() if empty.
fn option_is_char(value: Option(Char), expected: Char) -> Bool
Return true if an Option(Char) equals expected.
fn option_second(input: List(Char)) -> Option(Char)
Return the second element of a list as Option, or None() if fewer than two elements.
fn option_space(char: Char, unicode: Bool) -> Bool
Return true if char is whitespace under options (ASCII or Unicode).
fn option_unicode_word(previous: Option(Char)) -> Bool
Return true if an Option(Char) is Some Unicode word character.
fn option_word(char: Char, unicode: Bool) -> Bool
Return true if char is a word character under options (ASCII or Unicode).
fn optional(a: Type, regex: Regex(a)) -> Regex(Option(a))
Match zero or one occurrence of regex, returning Option(a).
fn optional_literal(a: Type, regex: Regex(a), lazy: Bool) -> Regex(Choice(a, Unit))
Optional regex parameterized by lazy quantifier preference.
fn optional_pattern(a: Type, regex: Regex(a)) -> Regex(Choice(a, Unit))
Greedy optional regex returning Choice(a, Unit).
fn or_same(a: Type, left: Regex(a), right: Regex(a)) -> Regex(a)
Match left or right when both branches produce the same result type.
fn pattern_accepts(shape: ShapeCode, pattern: Pattern(shape), input: String) -> Bool
Compile and run a Pattern on input, returning whether it matches the full string.
fn pattern_evidence(shape: ShapeCode, pattern: Pattern(shape), input: List(Char)) -> Option(List(Evidence))
Compile and run a Pattern on input, returning its winning evidence stack.
fn pattern_machine_eta(n: Nat, machine: PatternMachine(n)) -> Equivalent(PatternMachine(n), machine, MkPatternMachine(pattern_machine_starts(machine), pattern_machine_next(machine)))
Eta-equivalence reconstructing a PatternMachine from its starts and transition function.
fn pattern_machine_next(n: Nat, machine: PatternMachine(n)) -> Function(Bounded(n), Function(Char, List(MachineState(n))))
Project the transition function from a PatternMachine.
fn pattern_machine_next_at(n: Nat, machine: PatternMachine(n), state: Bounded(n), char: Char) -> List(MachineState(n))
Evaluate the transitions of machine from state on char.
fn pattern_machine_next_at_from_next(n: Nat, machine: PatternMachine(n), state: Bounded(n), char: Char) -> Equivalent(List(MachineState(n)), pattern_machine_next_at(machine, state, char), pattern_machine_next_value(machine, state, char))
Equivalence relating pattern_machine_next_at to pattern_machine_next.
fn pattern_machine_next_value(n: Nat, machine: PatternMachine(n), state: Bounded(n), char: Char) -> List(MachineState(n))
Evaluate a PatternMachine's transition function at state and char.
fn pattern_machine_starts(n: Nat, machine: PatternMachine(n)) -> List(MachineState(n))
Project the start-state list from a PatternMachine.
fn pattern_prefix_evidence(shape: ShapeCode, pattern: Pattern(shape), input: List(Char), greedy: Bool) -> Option(EvidencePrefix)
Find the shortest (lazy: true) or longest (lazy: false) matching prefix of input.
fn pattern_prefix_evidence_at(shape: ShapeCode, pattern: Pattern(shape), input: List(Char), greedy: Bool, subject_start: Bool, line_start: Bool, previous_ascii_word: Bool, previous_unicode_word: Bool) -> Option(EvidencePrefix)
Find a matching prefix of input starting at position for pattern.
fn plus_pattern(a: Type, regex: Regex(a)) -> Regex(List(a))
Greedy one-or-more regex returning List(a).
fn position_after_character(char: Char) -> InitialPosition
Advance a Position by a single character using the default newline policy.
fn position_after_character_with_policy(char: Char, policy: NewlinePolicy) -> InitialPosition
Advance a Position by a single character using an explicit newline policy.
fn position_boundary(subject_start: Bool, line_start: Bool, previous_ascii_word: Bool, previous_unicode_word: Bool, previous_char: Option(Char), input: List(Char)) -> Boundary
Compute the Boundary snapshot for position and remaining characters.
fn position_boundary_for_history(position: InitialPosition, input: List(Char), history: List(Char)) -> Boundary
Construct a Boundary from a reverse character history, remaining input, and policy.
fn position_line_end(input: List(Char)) -> Bool
Test whether position followed by remaining is at a line end under policy.
fn position_strict_subject_end(input: List(Char)) -> Bool
Return true when remaining is empty (strict subject end).
fn position_subject_end(input: List(Char)) -> Bool
Test whether position followed by remaining is at the subject end under policy.
fn posix_class_match_matches(value: PosixClassMatch, actual: Char, unicode: Bool) -> Bool
Test whether char satisfies a (possibly negated) PosixClassMatch.
fn posix_class_matches(posix_class: PosixClass, actual: Char, unicode: Bool) -> Bool
Test whether char belongs to a PosixClass under options.
fn posix_class_matches_any(values: List(PosixClassMatch), actual: Char, unicode: Bool) -> Bool
Return true if char satisfies any entry in a list of PosixClassMatches.
fn predicate(test: Function(Char, Bool)) -> Regex(Char)
Regex matching a single character that satisfies test.
fn predicate_accepting_destination(char: Char) -> MachineState(S(Z()))
Construct the accepting destination state after matching a single character.
fn predicate_machine_destinations(holds: Bool, char: Char) -> List(MachineState(S(Z())))
Return the accepting destination when test(char) holds, or empty otherwise.
fn predicate_machine_next(test: Function(Char, Bool), _state: Bounded(S(Z())), char: Char) -> List(MachineState(S(Z())))
Transition function for a single-character predicate machine.
fn predicate_machine_start() -> MachineState(S(Z()))
Construct the single start state of a predicate PatternMachine.
fn predicate_machine_thread() -> ThreadState(S(Z()))
Return the singleton start-state list for a predicate machine.
fn predicate_pattern_machine(test: Function(Char, Bool)) -> PatternMachine(S(Z()))
Construct a one-state PatternMachine matching characters satisfying test.
fn prefix_routine(n: Nat, instruction: EvidenceInstruction, states: List(MachineState(n))) -> List(MachineState(n))
Prepend a single EvidenceInstruction to every state in states.
prepend_initial_certificate(routine: List(EvidenceInstruction), path_routine: List(ExtendedInstruction), initial_evidence: List(Evidence), initial_captures: List(CaptureFrame), final_evidence: List(Evidence), regular_execution: ExtendedEvidenceRoutineExecution(regular_routine(routine), Nil(), Nil(), initial_evidence, initial_captures), path_certificate: CertifiedPathRoutine(path_routine, initial_evidence, initial_captures, final_evidence)) -> CertifiedPathRoutine(append_extended_routines(regular_routine(routine), path_routine), Nil(), Nil(), final_evidence)
fn prepend_initial_certificate(routine: List(EvidenceInstruction), path_routine: List(ExtendedInstruction), initial_evidence: List(Evidence), initial_captures: List(CaptureFrame), final_evidence: List(Evidence), regular_execution: ExtendedEvidenceRoutineExecution(regular_routine(routine), Nil(), Nil(), initial_evidence, initial_captures), path_certificate: CertifiedPathRoutine(path_routine, initial_evidence, initial_captures, final_evidence)) -> CertifiedPathRoutine(append_extended_routines(regular_routine(routine), path_routine), Nil(), Nil(), final_evidence)
Attach an initial-state witness to a MachineAcceptingSearch result.
fn prepend_optional_repetition_conversion(a: Type) -> Conversion(Tuple(Choice(a, Unit), List(a)), List(a))
Construct a Conversion prepending an optional (Choice(a, Unit)) element onto a list.
fn prepend_optional_repetition_conversion_for(shape: ShapeCode) -> Conversion(Tuple(Choice(Sem(shape), Unit), List(Sem(shape))), List(Sem(shape)))
Construct a shape-indexed optional-repetition Conversion.
fn prepend_optional_repetition_result(a: Type, value: Tuple(Choice(a, Unit), List(a))) -> List(a)
Prepend a Choice(a, Unit) element onto a repetition result list if present.
fn prepend_repetition_conversion(a: Type) -> Conversion(Tuple(a, List(a)), List(a))
Construct a Conversion consing a repeated element onto a result list.
fn prepend_repetition_conversion_for(shape: ShapeCode) -> Conversion(Tuple(Sem(shape), List(Sem(shape))), List(Sem(shape)))
Construct a shape-indexed repetition-cons Conversion.
fn prepend_repetition_result(a: Type, value: Tuple(a, List(a))) -> List(a)
Cons a matched element onto a repetition result list.
prepend_transition_certificate(char: Char, routine: List(EvidenceInstruction), suffix_routine: List(ExtendedInstruction), source_evidence: List(Evidence), source_captures: List(CaptureFrame), destination_evidence: List(Evidence), destination_captures: List(CaptureFrame), final_evidence: List(Evidence), regular_execution: ExtendedEvidenceRoutineExecution(regular_routine(routine), source_evidence, record_capture_char(source_captures, char), destination_evidence, destination_captures), suffix_certificate: CertifiedPathRoutine(suffix_routine, destination_evidence, destination_captures, final_evidence)) -> CertifiedPathRoutine(append_extended_routines(transition_routine(char, routine), suffix_routine), source_evidence, source_captures, final_evidence)
fn prepend_transition_certificate(char: Char, routine: List(EvidenceInstruction), suffix_routine: List(ExtendedInstruction), source_evidence: List(Evidence), source_captures: List(CaptureFrame), destination_evidence: List(Evidence), destination_captures: List(CaptureFrame), final_evidence: List(Evidence), regular_execution: ExtendedEvidenceRoutineExecution(regular_routine(routine), source_evidence, record_capture_char(source_captures, char), destination_evidence, destination_captures), suffix_certificate: CertifiedPathRoutine(suffix_routine, destination_evidence, destination_captures, final_evidence)) -> CertifiedPathRoutine(append_extended_routines(transition_routine(char, routine), suffix_routine), source_evidence, source_captures, final_evidence)
Prepend a single-character transition step onto a MachineAcceptingSearch result.
fn range(first: Char, last: Char) -> Regex(Char)
Regex matching any character in the inclusive range [low, high].
fn range_predicate(first: Char, last: Char, actual: Char) -> Bool
Return true if char lies inclusively between low and high.
fn range_test(first: Char, last: Char) -> Function(Char, Bool)
Curried predicate testing inclusion in [low, high].
fn record_active_winner(n: Nat, slots: ActiveWinnerSlots, index: Bounded(n)) -> ActiveWinnerSlots
Mark state as visited in the active-thread winner set slots.
fn record_named_capture_char(frames: List(NamedCaptureFrame), char: Char) -> List(NamedCaptureFrame)
Append char to every open named-capture frame on the active stack.
fn record_thread_winner(n: Nat, table: ThreadWinnerTable, state: ThreadState(n)) -> ThreadWinnerTable
Record a thread's state in table so lower-priority duplicates are pruned.
fn reference_thompson_machine(shape: ShapeCode, compilation: ThompsonCompilation(shape)) -> PatternMachine(thompson_state_count(compilation))
Reference constructor retained for differential tests.
fn regular_routine(routine: List(EvidenceInstruction)) -> List(ExtendedInstruction)
Check whether a routine executes cleanly to a valid evidence stack.
fn remember_prefix(n: Nat, threads: List(EvidenceThread(n)), rest: List(Char), previous: Option(EvidencePrefix)) -> Option(EvidencePrefix)
Update the latest recorded EvidencePrefix when an accepting thread is present.
fn repeat(a: Type, regex: Regex(a)) -> Regex(List(a))
Match zero or more occurrences of regex, collecting results in a List.
fn repeat_accepting(n: Nat, routine: List(EvidenceInstruction), constraints: List(BoundaryConstraint)) -> List(MachineState(n))
Construct the accepting end-of-repetition state for a Kleene-star machine.
fn repeat_destination_order(n: Nat, routine: List(EvidenceInstruction), constraints: List(BoundaryConstraint), starts: List(MachineState(n)), lazy: Bool) -> List(MachineState(n))
Order loop-back and exit destinations according to lazy preference.
fn repeat_destinations(n: Nat, destinations: List(MachineState(n)), starts: List(MachineState(n)), lazy: Bool) -> List(MachineState(n))
Expand body states into loop-back and accepting repetition destinations.
fn repeat_machine_next(n: Nat, starts: List(MachineState(n)), lazy: Bool, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), state: Bounded(n), char: Char) -> List(MachineState(n))
Transition function for a repetition machine.
fn repeat_machine_starts(n: Nat, starts: List(MachineState(n)), lazy: Bool) -> List(MachineState(n))
Compute start states for a repetition machine, respecting lazy preference.
fn repeat_pattern_machine(n: Nat, machine: PatternMachine(n), lazy: Bool) -> PatternMachine(n)
Construct the PatternMachine for greedy or lazy repetition of a submachine.
fn repeated_pattern(a: Type, regex: Regex(a), lazy: Bool) -> Regex(List(a))
Zero-or-more regex parameterized by lazy quantifier preference.
fn replay_named_capture_routine(routine: List(ExtendedInstruction), layout: CaptureLayout) -> Option(List(NamedCapture))
Replay an ExtendedRoutine against a NamedCaptureLayout to extract named captures.
fn rows_as_next(n: Nat, rows: TransitionRows(n)) -> Function(Bounded(n), Function(Char, List(MachineState(n))))
Adapt a TransitionRows table into a curried transition function.
fn rows_from_next(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n))))) -> TransitionRows(n)
Build a TransitionRows table directly from a transition function next.
fn rows_from_next_equivalent(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), state: Bounded(n), char: Char) -> Equivalent(List(MachineState(n)), transition_rows_next(rows_from_next(n, next), state, char), next(state, char))
Pointwise equivalence showing rows_from_next lookup agrees with next.
fn rows_from_next_value_equivalent(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n))))) -> Equivalent(TransitionRows(n), rows_from_next(n, next), TransitionRows(build_transition_rows(n, fn(state) -> state, next)))
Equivalence unfolding rows_from_next to TransitionRows(build_transition_rows(...)).
fn run_evidence(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), input: List(Char), threads: List(EvidenceThread(n))) -> Option(List(Evidence))
Run active EvidenceThreads across input and return the winning evidence stack.
fn run_first_prefix_evidence(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), input: List(Char), threads: List(EvidenceThread(n))) -> Option(EvidencePrefix)
Find the shortest prefix of input that produces accepting evidence.
fn run_last_prefix_evidence(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), input: List(Char), threads: List(EvidenceThread(n)), previous: Option(EvidencePrefix)) -> Option(EvidencePrefix)
Find the longest prefix of input that produces accepting evidence.
fn same_capture_slot(left: Nat, right: Nat) -> Bool
Return true if two CaptureSlot identifiers refer to the same slot.
fn same_chars(left: List(Char), right: List(Char)) -> Bool
Compare two List(Char) values for exact equality.
fn same_thread_state(n: Nat, left: ThreadState(n), right: ThreadState(n)) -> Bool
Return true if two EvidenceThreads occupy the same machine state.
fn search_accepting_from(n: Nat, machine: PatternMachine(n), input: List(Char), after_input: List(Char), state: ThreadState(n), current_evidence: List(Evidence), captures: List(CaptureFrame)) -> AcceptingSearch(n, machine, input, after_input, state, current_evidence, captures)
Perform certified backtracking acceptance search from a single MachineState.
search_accepting_members(n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source_state: ThreadState(n), source_evidence: List(Evidence), source_captures: List(CaptureFrame), current: List(MachineState(n)), members: MachineStateMembers(n, machine_destinations(n, machine, source_state, char, transition_boundary_before(char, rest, after_input)), current)) -> AcceptingSearch(n, machine, Cons(char, rest), after_input, source_state, source_evidence, source_captures)
fn search_accepting_members(n: Nat, machine: PatternMachine(n), char: Char, rest: List(Char), after_input: List(Char), source_state: ThreadState(n), source_evidence: List(Evidence), source_captures: List(CaptureFrame), current: List(MachineState(n)), members: MachineStateMembers(n, machine_destinations(n, machine, source_state, char, transition_boundary_before(char, rest, after_input)), current)) -> AcceptingSearch(n, machine, Cons(char, rest), after_input, source_state, source_evidence, source_captures)
Perform certified backtracking acceptance search across a list of member states.
fn search_first_machine_prefix(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char)) -> CertifiedPrefixSearch(n, machine, position)
Find the shortest certified prefix accepted by machine.
fn search_first_machine_prefix_loop(n: Nat, machine: PatternMachine(n), position: InitialPosition, reversed_prefix: List(Char), remaining_input: List(Char)) -> CertifiedPrefixSearch(n, machine, position)
Recursive helper for search_first_machine_prefix.
search_initial_members(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char), current: List(MachineState(n)), members: MachineStateMembers(n, initial_machine_destinations(n, machine, position, input, after_input), current)) -> MachineAcceptingSearch(n, machine, position, input, after_input)
fn search_initial_members(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char), current: List(MachineState(n)), members: MachineStateMembers(n, initial_machine_destinations(n, machine, position, input, after_input), current)) -> MachineAcceptingSearch(n, machine, position, input, after_input)
Search a list of initial member states for a certified acceptance derivation.
fn search_last_machine_prefix(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char)) -> CertifiedPrefixSearch(n, machine, position)
Find the longest certified prefix accepted by machine.
fn search_last_machine_prefix_loop(n: Nat, machine: PatternMachine(n), position: InitialPosition, reversed_prefix: List(Char), remaining_input: List(Char), previous: CertifiedPrefixSearch(n, machine, position)) -> CertifiedPrefixSearch(n, machine, position)
Recursive helper for search_last_machine_prefix.
fn search_machine_acceptance(n: Nat, machine: PatternMachine(n), position: InitialPosition, input: List(Char), after_input: List(Char)) -> MachineAcceptingSearch(n, machine, position, input, after_input)
Perform certified full-string acceptance search for machine on input.
fn sem_identity_conversion(shape: ShapeCode) -> Conversion(Sem(shape), Sem(shape))
Identity Conversion on Sem(shape).
fn set_test(chars: List(Char)) -> Function(Char, Bool)
Predicate testing membership in chars, optionally negated.
fn simplified(shape: ShapeCode, regex: Regex(Sem(shape))) -> Regex(Sem(Simplify(shape)))
Wrap regex with a compile-time shape simplification pass.
fn simplify_compiled(shape: ShapeCode, program: CompiledRegex(Sem(shape))) -> CompiledRegex(Sem(Simplify(shape)))
Apply shape simplification to a CompiledRegex.
fn simplify_program(shape: ShapeCode, program: RegexProgram(Sem(shape))) -> RegexProgram(Sem(Simplify(shape)))
Apply shape simplification to a compiled RegexProgram.
fn space_class(negated: Bool) -> Regex(Char)
Regex matching ASCII whitespace (\s) or non-whitespace (\S when negated).
fn space_class_with_options(negated: Bool, unicode: Bool) -> Regex(Char)
Regex matching \s / \S under options.
fn space_option_predicate(negated: Bool, unicode: Bool, char: Char) -> Bool
Test whether char matches \s / \S under options.
fn space_options_test(negated: Bool, unicode: Bool) -> Function(Char, Bool)
Curried predicate for \s / \S under options.
fn staged_alternate_next(left_count: Nat, right_count: Nat, left_rows: TransitionRows(left_count), right_rows: TransitionRows(right_count), state: Bounded(plus(left_count, right_count)), char: Char) -> List(MachineState(plus(left_count, right_count)))
Transition step for a staged alternation machine.
fn staged_alternate_next_from_side(left_count: Nat, right_count: Nat, left_rows: TransitionRows(left_count), right_rows: TransitionRows(right_count), side: BoundedSum(left_count, right_count), char: Char) -> List(MachineState(plus(left_count, right_count)))
Dispatch a staged alternation transition from a classified left/right state.
fn staged_alternate_next_function(left_count: Nat, right_count: Nat, left_rows: TransitionRows(left_count), right_rows: TransitionRows(right_count)) -> Function(Bounded(plus(left_count, right_count)), Function(Char, List(MachineState(plus(left_count, right_count)))))
Curried transition function for a staged alternation machine.
fn staged_alternate_starts(left_count: Nat, right_count: Nat, left_starts: List(MachineState(left_count)), right_starts: List(MachineState(right_count)), prefer_right: Bool) -> List(MachineState(plus(left_count, right_count)))
Compute start states for a staged alternation machine.
fn staged_boundary_rows(constraint: BoundaryConstraint) -> TransitionRows(Z())
Construct the empty TransitionRows table for a boundary constraint pattern.
fn staged_concat_next(left_count: Nat, right_count: Nat, left_rows: TransitionRows(left_count), right_starts: List(MachineState(right_count)), right_rows: TransitionRows(right_count), state: Bounded(plus(left_count, right_count)), char: Char) -> List(MachineState(plus(left_count, right_count)))
Transition step for a staged concatenation machine.
fn staged_concat_next_from_side(left_count: Nat, right_count: Nat, left_rows: TransitionRows(left_count), right_starts: List(MachineState(right_count)), right_rows: TransitionRows(right_count), side: BoundedSum(left_count, right_count), char: Char) -> List(MachineState(plus(left_count, right_count)))
Dispatch a staged concatenation transition from a classified left/right state.
staged_concat_next_function(left_count: Nat, right_count: Nat, left_rows: TransitionRows(left_count), right_starts: List(MachineState(right_count)), right_rows: TransitionRows(right_count)) -> Function(Bounded(plus(left_count, right_count)), Function(Char, List(MachineState(plus(left_count, right_count)))))
fn staged_concat_next_function(left_count: Nat, right_count: Nat, left_rows: TransitionRows(left_count), right_starts: List(MachineState(right_count)), right_rows: TransitionRows(right_count)) -> Function(Bounded(plus(left_count, right_count)), Function(Char, List(MachineState(plus(left_count, right_count)))))
Curried transition function for a staged concatenation machine.
staged_concat_rows_transition_equation(left_count: Nat, right_count: Nat, left_rows: TransitionRows(left_count), right_starts: List(MachineState(right_count)), right_rows: TransitionRows(right_count), state: Bounded(plus(left_count, right_count)), char: Char) -> Equivalent(List(MachineState(plus(left_count, right_count))), transition_rows_next(rows_from_next(plus(left_count, right_count), staged_concat_next_function(left_count, left_rows, right_starts, right_rows)), state, char), staged_concat_next(left_count, left_rows, right_starts, right_rows, state, char))
fn staged_concat_rows_transition_equation(left_count: Nat, right_count: Nat, left_rows: TransitionRows(left_count), right_starts: List(MachineState(right_count)), right_rows: TransitionRows(right_count), state: Bounded(plus(left_count, right_count)), char: Char) -> Equivalent(List(MachineState(plus(left_count, right_count))), transition_rows_next(rows_from_next(plus(left_count, right_count), staged_concat_next_function(left_count, left_rows, right_starts, right_rows)), state, char), staged_concat_next(left_count, left_rows, right_starts, right_rows, state, char))
Equivalence unfolding staged concatenation row lookup to staged_concat_next.
fn staged_concat_starts(left_count: Nat, right_count: Nat, left_starts: List(MachineState(left_count)), right_starts: List(MachineState(right_count))) -> List(MachineState(plus(left_count, right_count)))
Compute start states for a staged concatenation machine.
fn staged_empty_rows() -> TransitionRows(Z())
Construct the empty TransitionRows table for an empty pattern.
fn staged_group_next(n: Nat, rows: TransitionRows(n), state: Bounded(n), char: Char) -> List(MachineState(n))
Transition step for a staged group machine over TransitionRows.
fn staged_group_next_function(n: Nat, rows: TransitionRows(n)) -> Function(Bounded(n), Function(Char, List(MachineState(n))))
Curried transition function for a staged group machine.
fn staged_group_starts(n: Nat, starts: List(MachineState(n))) -> List(MachineState(n))
Compute start states for a staged group machine.
fn staged_machine_from_compilation(shape: ShapeCode, compilation: ThompsonCompilation(shape)) -> PatternMachine(thompson_state_count(compilation))
Staged literals use a row-backed machine. The transition rows are built from the direct staged machine seed below, rather than reconstructing a canonical Thompson machine for every child closure.
staged_machine_rows_transition_equivalent(shape: ShapeCode, compilation: ThompsonCompilation(shape), state: Bounded(thompson_state_count(compilation)), char: Char) -> Equivalent(List(MachineState(thompson_state_count(compilation))), pattern_machine_next_at(staged_machine_from_compilation(compilation), state, char), transition_rows_next(direct_staged_rows_values_from_compilation(compilation), state, char))
fn staged_machine_rows_transition_equivalent(shape: ShapeCode, compilation: ThompsonCompilation(shape), state: Bounded(thompson_state_count(compilation)), char: Char) -> Equivalent(List(MachineState(thompson_state_count(compilation))), pattern_machine_next_at(staged_machine_from_compilation(compilation), state, char), transition_rows_next(direct_staged_rows_values_from_compilation(compilation), state, char))
Equivalence showing staged machine rows match thompson_machine transitions.
fn staged_machine_seed_from_compilation(shape: ShapeCode, compilation: ThompsonCompilation(shape)) -> PatternMachine(thompson_state_count(compilation))
Construct the closure machine once per Thompson subtree. Let-binding the child results is important: starts and next are two projections of the same child value, not two independent recursive reconstructions.
fn staged_machine_starts_equivalent(shape: ShapeCode, compilation: ThompsonCompilation(shape)) -> Equivalent(List(MachineState(thompson_state_count(compilation))), pattern_machine_starts(staged_machine_from_compilation(compilation)), pattern_machine_starts(thompson_machine(compilation)))
Proof that staged compilation start states equal thompson_machine start states.
fn staged_predicate_next(test: Function(Char, Bool), state: Bounded(S(Z())), char: Char) -> List(MachineState(S(Z())))
Transition step for a staged single-character predicate machine.
fn staged_predicate_next_function(test: Function(Char, Bool)) -> Function(Bounded(S(Z())), Function(Char, List(MachineState(S(Z())))))
Curried transition function for a staged predicate machine.
fn staged_repeat_next(n: Nat, starts: List(MachineState(n)), rows: TransitionRows(n), lazy: Bool, state: Bounded(n), char: Char) -> List(MachineState(n))
Transition step for a staged repetition machine.
fn staged_repeat_next_function(n: Nat, starts: List(MachineState(n)), rows: TransitionRows(n), lazy: Bool) -> Function(Bounded(n), Function(Char, List(MachineState(n))))
Curried transition function for a staged repetition machine.
fn staged_repeat_starts(n: Nat, starts: List(MachineState(n)), lazy: Bool) -> List(MachineState(n))
Compute start states for a staged repetition machine.
fn staged_rows_from_compilation(shape: ShapeCode, compilation: ThompsonCompilation(shape)) -> StagedRows(thompson_state_count(compilation))
Extract the TransitionRows table from a StagedCompilation.
staged_rows_transition_equivalent(shape: ShapeCode, compilation: ThompsonCompilation(shape), state: Bounded(thompson_state_count(compilation)), char: Char) -> Equivalent(List(MachineState(thompson_state_count(compilation))), transition_rows_next(direct_staged_rows_values_from_compilation(compilation), state, char), pattern_machine_next_at(thompson_machine(compilation), state, char))
fn staged_rows_transition_equivalent(shape: ShapeCode, compilation: ThompsonCompilation(shape), state: Bounded(thompson_state_count(compilation)), char: Char) -> Equivalent(List(MachineState(thompson_state_count(compilation))), transition_rows_next(direct_staged_rows_values_from_compilation(compilation), state, char), pattern_machine_next_at(thompson_machine(compilation), state, char))
Pointwise equivalence showing staged compilation rows match thompson_machine transitions.
fn staged_rows_values_from_compilation(shape: ShapeCode, compilation: ThompsonCompilation(shape)) -> TransitionRows(thompson_state_count(compilation))
Compatibility reference retained for differential checking. It preserves the original row formulas while the active machine below uses the direct staged rows; this keeps the comparison path independent of the optimized construction.
fn staged_starts_from_compilation(shape: ShapeCode, compilation: ThompsonCompilation(shape)) -> List(MachineState(thompson_state_count(compilation)))
Extract the start-state list from a StagedCompilation.
fn start_anchor() -> Regex(Unit)
Zero-width anchor matching the start of subject or line.
fn start_anchor_with_options(multiline: Bool) -> Regex(Unit)
Zero-width start anchor respecting multiline and newline options.
fn step_evidence_thread(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), char: Char, boundary: Boundary, thread: EvidenceThread(n)) -> List(EvidenceThread(n))
Step a single EvidenceThread on char at boundary using machine.
fn step_evidence_threads(n: Nat, next: Function(Bounded(n), Function(Char, List(MachineState(n)))), char: Char, boundary: Boundary, threads: List(EvidenceThread(n))) -> List(EvidenceThread(n))
Step all active EvidenceThreads on char at boundary.
fn strict_end_anchor() -> Regex(Unit)
Zero-width anchor matching strictly at the end of the subject (\z).
fn strict_end_constraint() -> BoundaryConstraint
Construct a strict subject-end (\z) boundary constraint with the default newline policy.
fn strict_end_constraint_with_policy(policy: NewlinePolicy) -> BoundaryConstraint
Construct a strict subject-end (\z) boundary constraint with an explicit newline policy.
fn string_identity_conversion() -> Conversion(String, String)
Identity Conversion on String.
fn subject_end_constraint() -> BoundaryConstraint
Construct a subject-end (\Z) boundary constraint with the default newline policy.
fn subject_end_constraint_with_policy(policy: NewlinePolicy) -> BoundaryConstraint
Construct a subject-end (\Z) boundary constraint with an explicit newline policy.
fn subject_end_for(policy: NewlinePolicy, next_char: Option(Char), after_next_char: Option(Char)) -> Bool
Determine whether a position is at the subject end (allowing a trailing newline) under policy.
fn subject_initial_position() -> InitialPosition
Construct the starting Position at the beginning of a subject.
fn subject_start_constraint() -> BoundaryConstraint
Construct a subject-start (\A) boundary constraint with the default newline policy.
fn subject_start_constraint_with_policy(policy: NewlinePolicy) -> BoundaryConstraint
Construct a subject-start (\A) boundary constraint with an explicit newline policy.
fn terminal_newline(policy: NewlinePolicy, char: Char) -> Bool
Return true if remaining consists solely of a single terminal line break under policy.
fn thompson_compiled(shape: ShapeCode, compilation: ThompsonCompilation(shape)) -> Sigma(n: Nat, PatternMachine(n))
Package a ThompsonCompilation into an existentially quantified PatternMachine.
fn thompson_machine(shape: ShapeCode, compilation: ThompsonCompilation(shape)) -> PatternMachine(thompson_state_count(compilation))
Canonical constructor. The reference copy above is deliberately kept separate so transition-row implementations can be compared without changing the proof theorem's original definitional equations.
fn thompson_state_count(shape: ShapeCode, compilation: ThompsonCompilation(shape)) -> Nat
Return the total number of states in a ThompsonCompilation.
fn thread_winner_seen(n: Nat, table: ThreadWinnerTable, state: ThreadState(n)) -> Bool
Return true if a thread's state has already been visited in table.
fn transition_boundary(char: Char, rest: List(Char)) -> Boundary
Compute the Boundary immediately after consuming char at position.
fn transition_boundary_before(char: Char, rest: List(Char), after_input: List(Char)) -> Boundary
Compute the Boundary before consuming char, incorporating trailing after_input.
fn transition_routine(char: Char, routine: List(EvidenceInstruction)) -> List(ExtendedInstruction)
Convert a transition's EvidenceInstruction list into an ExtendedRoutine.
fn transition_rows_constructor_equivalent(n: Nat, values: TransitionRowsFrom(n, n), state: Bounded(n), char: Char) -> Equivalent(List(MachineState(n)), transition_rows_next(TransitionRows(values), state, char), transition_rows_from_next(values, state, char))
Equivalence unfolding transition_rows_next applied to a TransitionRows constructor.
fn transition_rows_from_next(remaining: Nat, total: Nat, rows: TransitionRowsFrom(remaining, total), state: Bounded(remaining), char: Char) -> List(MachineState(total))
Look up transitions for a bounded state and char in a TransitionRowsFrom suffix.
fn transition_rows_machine(n: Nat, starts: List(MachineState(n)), rows: TransitionRows(n)) -> PatternMachine(n)
A table-backed machine exposes the same indexed machine interface as the reference closure machine. The only runtime closure is this single row lookup adapter; transition construction itself is performed once when the table is built, not by recursively rebuilding Thompson combinators for each input character.
fn transition_rows_machine_next_equation(n: Nat, starts: List(MachineState(n)), rows: TransitionRows(n), state: Bounded(n), char: Char) -> Equivalent(List(MachineState(n)), pattern_machine_next_at(transition_rows_machine(starts, rows), state, char), transition_rows_next(rows, state, char))
Equivalence relating pattern_machine_next_at on a table-backed machine to transition_rows_next.
fn transition_rows_next(n: Nat, rows: TransitionRows(n), state: Bounded(n), char: Char) -> List(MachineState(n))
Look up transitions for state and char in a compiled TransitionRows table.
transition_rows_next_equivalent(n: Nat, starts: List(MachineState(n)), next: Function(Bounded(n), Function(Char, List(MachineState(n)))), state: Bounded(n), char: Char) -> Equivalent(List(MachineState(n)), transition_rows_next(compile_transition_rows(n, MkPatternMachine(starts, next)), state, char), next(state, char))
fn transition_rows_next_equivalent(n: Nat, starts: List(MachineState(n)), next: Function(Bounded(n), Function(Char, List(MachineState(n)))), state: Bounded(n), char: Char) -> Equivalent(List(MachineState(n)), transition_rows_next(compile_transition_rows(n, MkPatternMachine(starts, next)), state, char), next(state, char))
Pointwise equivalence showing compile_transition_rows preserves a machine's transition function.
fn transition_rows_next_from_machine(n: Nat, machine: PatternMachine(n), state: Bounded(n), char: Char) -> Equivalent(List(MachineState(n)), transition_rows_next(compile_transition_rows(n, machine), state, char), pattern_machine_next_at(machine, state, char))
Pointwise equivalence relating compiled transition rows to pattern_machine_next_at.
fn transport_list_member(a: Type, value: a, left: List(a), right: List(a), member: ListMember(a, value, left), equality: Equivalent(List(a), left, right)) -> ListMember(a, value, right)
Transport a ListMember witness along list equality.
fn unicode_alnum(actual: Char) -> Bool
Return true if char is a Unicode letter or decimal digit.
fn unicode_alpha(actual: Char) -> Bool
Return true if char is a Unicode alphabetic character.
fn unicode_category_in(category: Atom, values: List(Atom)) -> Bool
Return true if category appears in the list categories.
fn unicode_graph(actual: Char) -> Bool
Return true if char is a visible Unicode graphical character.
fn unicode_print(actual: Char) -> Bool
Return true if char is a printable Unicode character.
fn unicode_property_class(property: UnicodeProperty, negated: Bool) -> Regex(Char)
Regex matching a single UnicodeProperty (\p{...} / \P{...}).
fn unicode_property_match_matches(value: UnicodePropertyMatch, actual: Char) -> Bool
Test whether char satisfies a (possibly negated) UnicodePropertyMatch.
fn unicode_property_matches(property: UnicodeProperty, actual: Char) -> Bool
Test whether char satisfies a UnicodeProperty.
fn unicode_property_matches_any(values: List(UnicodePropertyMatch), actual: Char) -> Bool
Return true if char satisfies any entry in a list of UnicodePropertyMatches.
fn unicode_property_test(property: UnicodeProperty, negated: Bool) -> Function(Char, Bool)
Curried predicate for a UnicodeProperty with optional negation.
fn unicode_word_constraint(expected: Bool) -> BoundaryConstraint
Construct a Unicode word-boundary (\b / \B) constraint.
fn unit_identity_conversion() -> Conversion(Unit, Unit)
Identity Conversion on Unit.
fn update_named_capture_ledger(slot: Nat, value: String, entries: List(NamedCaptureLedgerEntry)) -> List(NamedCaptureLedgerEntry)
Record or overwrite a captured text value for slot in the named-capture ledger.
fn vertical_class(negated: Bool) -> Regex(Char)
Regex matching vertical whitespace (\v or \V when negated).
fn vertical_predicate(negated: Bool, char: Char) -> Bool
Test whether char is vertical whitespace (\v / \V).
fn vertical_test(negated: Bool) -> Function(Char, Bool)
Curried predicate for vertical whitespace (\v / \V).
fn weaken_machine_state_members(n: Nat, head: MachineState(n), whole: List(MachineState(n)), values: List(MachineState(n)), members: MachineStateMembers(n, whole, values)) -> MachineStateMembers(n, Cons(head, whole), values)
Weaken a MachineStateMembers witness by prepending an extra element to the ambient list.
fn word_boundary(unicode: Bool, negated: Bool) -> Regex(Unit)
Zero-width word-boundary anchor (\b or negated \B) respecting options.
fn word_class(negated: Bool) -> Regex(Char)
Regex matching an ASCII word character (\w) or non-word (\W when negated).
fn word_class_with_options(negated: Bool, unicode: Bool) -> Regex(Char)
Regex matching \w / \W under options.
fn word_option_predicate(negated: Bool, unicode: Bool, char: Char) -> Bool
Test whether char matches \w / \W under options.
fn word_options_test(negated: Bool, unicode: Bool) -> Function(Char, Bool)
Curried predicate for \w / \W under options.