TOC Toolkit API - v0.1.0
    Preparing search index...

    toc-toolkit/decisions/regular

    Budgeted decision procedures on regular languages. Each procedure has an expert function that returns its search result and a decide adapter that produces a certificate for the original operands.

    • Expression isomorphism. Compares regular expression trees after sorting union arguments and checking a terminal bijection. The original literal trees must also match, so the certificate proves equality over the original alphabet. (expressionIsomorphismProcedure)

    • Canonical equivalence of DFAs. Minimizes both complete DFAs, compares the two minimal tables, and answers Equivalent when they are equal, with a relation that joins the original states of each minimal state. It gives no answer for different languages, so Hopcroft-Karp decides those. (canonicalDfaProcedure)

    • Hopcroft-Karp equivalence. Decides whether two DFAs accept the same language by merging the classes of reachable state pairs in a union-find structure. It returns a distinguishing word when the languages differ. (proveDfaEquivalent, hopcroftKarpProcedure)

    • HKC equivalence. Decides equivalence of DFAs, NFAs and regular expressions by bisimulation up to congruence on interned subsets. A regular expression is searched as its Glushkov position automaton, and the proof maps each position back to the closed set of Thompson states that the checker views as the expression. The congruence indexes its equations by member, so a new member wakes only the equations that hold it, and each charge covers one scan and not one bit. (proveNfaEquivalent, decideNfaEquivalent, hkcProcedure)

    • Derivative equivalence. Decides equivalence of two regular expressions by comparing Brzozowski residuals in a union-find structure. (proveRegexDerivatives, derivativesProcedure)

    • Antimirov HKC equivalence. Decides equivalence of two regular expressions by HKC over their partial derivative automata. A proof is a union-congruence relation over derivative states, in the bisimulation form PartialDerivative, and the independent checker derives the partial derivatives of the original expressions itself. It runs after HKC on the position automaton, because its smaller automata do not always make the search shorter. (decideAntimirov, antimirovProcedure)

    • Product search. Searches the product of two automata breadth-first and returns the shortest distinguishing word in each direction. (productSearch, decideShortestDfa, productSearchProcedure)

    • Inclusion. Decides whether the language of one NFA, DFA or regular expression lies inside another's by antichains (De Wulf, Doyen, Henzinger and Raskin 2006). The search keeps, for each state of the sub automaton, the smallest sets of sup states that it has met, so it never builds the subset automaton of the sup side. It runs plain subsets first, so a small search costs what it always did, and after 200 queued pairs it computes the greatest forward simulation of the sup automaton, with silent moves, and prunes by it (Abdulla, Chen, Holik, Mayr and Vojnar 2010): a set is below another when each of its states is below a state of the other, and a state below another state of its set is dropped. A sup automaton of more than 300 states keeps plain subsets. A word that the sub automaton accepts and the sup automaton rejects refutes the inclusion, and the closed antichain proves it. The sup side of a regular expression is searched as its Glushkov automaton. (decideInclusion, inclusionProcedure)

    • Universality. Decides whether an automaton or regular expression accepts every word over an explicit alphabet, by the same antichain search with a one-state universal automaton as the sub side. (decideUniversality, universalityProcedure)

    • HKC traversal. The equivalence search exposes breadth-first and depth-first orders for explicit comparison. Breadth-first remains the procedure default. (HkcTraversalOrder, proveNfaEquivalent)

    • Infiniteness. Finds an accepting path with a cycle that consumes input, using reachability and strongly connected components, to prove that a DFA or NFA language is infinite. (decideInfinite, infiniteProcedure)

    • Emptiness. Searches a finite automaton with epsilon relaxations and input breadth-first layers to produce a shortest accepted word or an empty Enumeration certificate. DFA, NFA and regex operands prepare directly. The facade supplies the existing two-way DFA conversion through a preparation port. (decideEmpty, emptinessProcedure, createEmptinessProcedure)

    • Finiteness. Bounds accepting path lengths on useful states, rejects consuming useful cycles and enumerates the complete finite language by state and token-word closure. Epsilon cycles keep their finite language. The independent checker verifies the original operand. (decideFinite, finiteProcedure, createFiniteProcedure)

    • Regex non-membership. Rejects a word by simulating the Thompson NFA of a regular expression. (decideRegexNonMember, regexNonmemberProcedure)

    • Regex membership. Searches an accepting path in the expression's automaton and returns it for independent replay. (regexMembershipProcedure)

    • Regular ambiguity. Searches pairs of finite automaton paths for a common accepted word. Classical regular expressions use their occurrence-bearing Thompson automaton. Boolean expressions are declined. (ambiguityProcedure)

    The 100, 200 and 400 state pre-pass trials used a WordLength limit of 512 and kept every other budget limit at its default. No pre-pass met the 1.2× median threshold. At 400 states, the breadth-first baseline median divided by the depth-first median was ~0.918×. The product baseline median divided by the epsilon-removal median was ~0.382×. Simulation quotient was slower at 100 states and exhausted the default Cells limit at 200 and 400 states in HKC, product and universality trials. The trial helpers remain under test/support for repeatable comparison. The test is prepass.perf.test.ts.

    • Prepared operands. Pairs and single inputs captured before the search, with their untrimmed automata. (prepareNfaPair, prepareUniversality, prepareInfinite, prepareRegexMembership, DfaPair, NfaPair, NfaOperands, RegexPair, PreparedUniversality, PreparedInfinite, PreparedRegexMembership)
    • Product run. The result of a product search together with its counters. (ProductRun)
    • Enumerations. Name the closed sets of strings that the types and the wire data of the package use. (RegularProcedureId)
    • Scalar preparation. Keeps the original emptiness or finiteness question beside its exact automaton. An injected port prepares two-way DFA operands without adding a package dependency. (PreparedScalar, TwoWayPreparation)