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

    toc-toolkit/verification

    Independent checkers for the certificates of decide. A checker takes a certificate that holds the original operands and the evidence, replays the evidence with its own small algorithms, and returns a CheckedCertificate or a rejection. It reuses no producer, parser or solver, so a checked decision does not depend on the code that found it. The package exports CHECKERS, one checker for each CertificateKind, the types Checker and CheckedCertificate, and machineFamily, which tells whether an operand is a machine.

    The former checkReplay, ReplayBody and ReplayEvidence exports represented bounded replay as a certificate. checkBoundedAgreement checks bounded agreement described by BoundedAgreementEvidence, which the scheduler can record as a fact. Agreement through a bound does not establish equivalence.

    • Pumping derivations. Checks original grammar productions for a reachable variable that derives itself with a nonempty terminal context and derives a terminal word. (CHECKERS[CertificateKind.Pump])
    • Bounded agreement. Checks that two context-free grammars agree on every word through a bound. The result supports an agreement fact and does not prove equivalence. (checkBoundedAgreement)
    • Word replay. Proves that a word separates two models, that a model has a nonempty language, that a model rejects a word over a given alphabet or that a word is not a member. Context-free grammars use a span-chart closure, context-sensitive grammars a bounded rewrite closure and unrestricted grammars an unbounded one. A marked LBA non-membership proof is checked by rebuilding the backward closure on the original machine and query. Other machines use an exact configuration replay that proves rejection only after the reachable frontier is complete. Regexes expand to Thompson automata. (CHECKERS[CertificateKind.Word])
    • Derivation replay. Applies the named production steps at their positions and checks that they derive the word from the start variable. (CHECKERS[CertificateKind.Derivation])
    • Run replay. Follows a named path of transitions through a machine and checks that it accepts the word. For a DFA or NFA, a path with a consuming cycle proves an infinite language. (CHECKERS[CertificateKind.Run])
    • Two derivation trees. Checks two different parse trees of one word and so proves that a grammar is ambiguous. (CHECKERS[CertificateKind.TwoTrees])
    • Regular ambiguity. Reconstructs the right-linear grammar of a finite automaton or classical regular expression from the original operand and checks two trees against it. (CHECKERS[CertificateKind.TwoTrees])
    • Algebraic census. Checks both original parser-table unambiguity premises and one original induction inclusion, derives a finite degree horizon from the original productions and independently counts every coefficient through it. (CHECKERS[CertificateKind.Census])

    • Expression isomorphism. Checks a terminal bijection and compares the original and renamed expression trees after sorting union arguments. The original literal trees must match. (CHECKERS[CertificateKind.Isomorphism])

    • Greibach bisimulation. Checks a finite relation on sequences of variables, including the start pair, empty acceptance and matching successors in both directions. (CHECKERS[CertificateKind.Bisimulation])

    • Isomorphism. Checks a renaming of variables, states or controls between two grammars or machines. The forms cover grammar renaming, machine renaming, state elimination, the alphabet-star form and accepting-epsilon equality of two DPDAs. (CHECKERS[CertificateKind.Isomorphism])

    • Grammar rewrite chain. Checks a sequence of steps from one grammar to another, where each step is compared with the previous endpoint and no step is trusted. The steps are useful reduction, unit closure, fresh start, terminal isolation, binary factoring, nullable removal and concatenation closure, plus structural merge, acyclic inlining and redundant rule removal. The two endpoints are compared by a complete named bijection. (CHECKERS[CertificateKind.GrammarRewrite])

    • Bisimulation. Checks a relation between the state sets of two DFAs, NFAs or regexes (over the Thompson states of an expression, or in the form PartialDerivative over the Antimirov partial derivatives of an expression, which the checker computes itself), a partition of the control states of two machines, a synchronized linear relation of two linear grammars, or, in the form SimpleGrammar, a bisimulation up to congruence between two simple grammars, or, in the form OneCounter, a bisimulation between two real-time deterministic one-counter automata that the checker reads from the original pushdown machines, with single pairs and families of pairs whose counters grow together and whose steps keep both counters positive, whose successor pairs each have an explicit derivation by reflexivity, symmetry, transitivity and congruence under concatenation. (CHECKERS[CertificateKind.Bisimulation])

    • Composite. Checks a graph of logical steps where each premise is an earlier node. Steps are leaf certificates, symmetry, transitivity, union and concatenation of equal parts, both inclusions, action-trace projections, closure constructions and transports of translations. Closure steps check the construction frames against their original operands and bind them to equality premises. The standalone checker verifies a closure frame without asserting equality between the source and target. The projection checker rebuilds the complete actions of the original machines and checks the map to the NFA premises. The transports cover DFA quotients, NFA determinization, regex to NFA, NFA to right-linear grammar, finite and marked tape machines, CFG to PDA, PDA to CFG, two-way DFA to DFA, CNF to LBA parse forests, CNF to Greibach form, reverse CSG to LBA, entry LBA to CSG window grammars and Turing machine to unrestricted grammar. (CHECKERS[CertificateKind.Composite], checkClosureFrame)

      The NfaToRegex and CfgToCnf conversions have independently checked state-elimination and grammar-rewrite proofs through conversion-proof. The CfgToTm, PdaToLba and PdaToTm forest routes use checked component proofs through coldTapeProof. The shared-image rule binds both original operands, both complete converted targets and one total injective letter map on the original alphabet union. Two checked equalities relate the renamed originals to the targets. The CFG image equality uses the forest route, and the unrestricted image equality uses an independent reverse grammar queue and complete tape simulation check. Compatible nonidentity maps are admitted. (CompositeRule.Encoding, Registry.imageProof)

      The direct CsgToLba checker covers the reverse-rewrite construction. A CFG-shaped CSG uses a checked grammar isomorphism, a grammar rewrite and the CNF forest transport. The direct LbaToCsg checker covers both the original entry window grammar and the normalized grammar with virtual marker visits. It reconstructs the fresh controls and every simulation rule from the original LBA and checks empty-word acceptance with independent machine replay. Rejecting starts and rejecting dead ends keep their rejection. A deterministic read-only entry LBA uses checked regular transports, a grammar rewrite and a grammar isomorphism. These decompositions need supplied intermediate evidence. UnrestrictedToTm keeps its injective-image metadata. Its reverse queue checker verifies equality for the exact encoded grammar, and a checked rewrite supplies a normalized intermediate when needed.

      The later IDs RegularGrammarToNfa, RegularComponentsToNfa, RegexToGlushkov, RegexToAntimirov and KurodaForm have no transport or checked route established here. CfgToUnrestricted can use a grammar isomorphism for its unchanged productions. CfgToCsg can use a grammar rewrite followed by a grammar isomorphism. Neither ID has a direct transport here.

      Composite parser transports verify the original LL(1) or LR(1) table and independently reconstruct the entire DPDA, including exact end-of-input predecessor summaries. The reconstructed machine must equal the claimed conversion endpoint. The checker imports no table builder or pushdown constructor. (CompositeRule.ParserTranslation)

      Unary and strongly regular grammar transports independently rebuild the target NFA from the original grammar. The unary check reconstructs the bounded multiset graph. The strongly regular check reconstructs the oriented component templates and their copies.

    • Finite enumeration. Checks that a context-free grammar has no productive start variable, or that its language is finite and equals a listed set of words, by a productivity and reachability argument. Unary DFA, NFA, regex and two-way DFA claims use independent finite-state reachability, a bounded path potential that excludes useful consuming cycles and complete state-word closure. Regexes expand independently to Thompson automata, and two-way DFAs use exact boundary summaries. (CHECKERS[CertificateKind.Enumeration])

    • Semilinear equality. Checks that two context-free grammars with bounded letters have equal Parikh images, using covers by linear sets. A word-block descriptor binds the original languages to fresh tokens through checked inverse and intersection frames. The checker independently proves original containment in the supplied word envelope and verifies the exact ordered-token monitor before checking the covers. (CHECKERS[CertificateKind.Semilinear])

    • Induction. Checks that one grammar lies inside another, or that each of two grammars lies inside the other, by induction on derivations. An inclusion claim carries the forward proof alone, and an equivalence claim carries both proofs. For each useful variable of the contained grammar, the proof lists forms of the containing grammar. For each useful production and each choice of one listed form per symbol, the joined form must rewrite from a listed form of the head, after lemmas contract occurrences of a variable followed by a fixed tail into one form. The checker proves each lemma by induction on the derivation of its variable, from the right sides of that variable's productions. The rewrite test is its own span fixed point over the productions. A unary guard checks the count of each useful source production and derives the resulting singleton word from the target start. (CHECKERS[CertificateKind.Induction])

    • Type closure. Checks a finite table of paired types of two grammars whose rules split their terminals into internal, call and return roles. A table closed under every constructor proves that the two languages of well-matched words are equal. (CHECKERS[CertificateKind.TypeClosure])

      The same checker accepts two pushdown machines after independently checking one shared visible partition, empty initial and final stack requirements and the absence of rejecting controls. Each call pushes one symbol, each return pops one matching symbol, and each internal step leaves the stack unchanged. The checker reconstructs both balanced return grammars from the original transitions before checking the paired types.

    • Valuation. Proves that two grammars differ. Weights on the terminals and a value for each variable make every useful production of one grammar add up to its head, so every word of that grammar has the weight of its start value. A word of the other grammar with another weight is outside it. The same body refutes an inclusion when the valuation belongs to the sup grammar and the word to the sub grammar. (CHECKERS[CertificateKind.Valuation])
    • Parikh separation. Proves that two grammars differ by a count vector that one language reaches and the other cannot. (CHECKERS[CertificateKind.ParikhSeparation])
    • Regular separation. Proves that two grammars differ by a DFA that contains one language and excludes the other. (CHECKERS[CertificateKind.RegularSeparation])
    • Block exponents. Separates two DFAs or deterministic NFAs on words of repeated blocks, using powers of transition actions without expanding the words. The original-word form expands the blocks under the caller budget and independently replays membership in two original context-free grammars. Resource exhaustion stops the check. (CHECKERS[CertificateKind.BlockExponents])
    • Direct unboundedness. Checks two direct loops on the same side of the start variable, their noncommuting terminal contexts and a terminal base rule. Swapping the loops produces two distinct blocks of equal length and proves exponential word growth. This standalone witness adds no certificate family. (checkUnboundedWitness)
    • Antichain. Proves that one regular language is included in another, or that a regular language is universal, by a set of pairs of a state of the sub automaton and a set of states of the sup automaton. The checker recomputes both automata from the original operands and checks that the set holds the start pair, that every accepting sub state meets an accepting sup state, and that every move of a pair is covered by a pair that demands no more. A state counts as below another when the body relates them by a simulation of the sup automaton, which the checker verifies: the relation is transitive, an accepting state is below only states that reach acceptance silently, and each silent move and each move on a letter of a smaller state ends below a state that the larger one reaches. (CHECKERS[CertificateKind.Antichain])
    • Regular invariant. Proves that a context-free language is included in the language of a DFA, by a closed relation between grammar variables and DFA states. (CHECKERS[CertificateKind.RegularInvariant])
    • Position pairs. Rebuilds the original-production position graph and checks initial reachability, successor closure and absence of completed conflicting pairs. It includes distinct exposed reductions and structural end markers. (CHECKERS[CertificateKind.PairInvariant])

    • Regular overlap. Checks summary closure under every original production and containment of both regular approximations for every original alternative pair and split. It independently builds each exact regular overlap and verifies its regular-invariant proof of inclusion in the empty DFA. (CHECKERS[CertificateKind.RegularDisjointness])

    • Regular unambiguity recheck. Runs the path-product check on the original finite automaton or classical regular expression and reports agreement, disagreement or exhaustion. It issues no certificate and leaves verdict trust unchanged. Both the procedure and recheck use the same algorithm, so this is a repeated check rather than independent proof evidence. (recheckRegularUnambiguity, RecheckAgreement)

    • LL(1) table. Checks the first, follow and nullable sets of a grammar and the absence of table conflicts. (CHECKERS[CertificateKind.LlTable])

    • LR(1) table. Checks a closed LR(1) automaton of a grammar and the absence of conflicts. Closed item sets may merge canonical states, as in an LALR table. (CHECKERS[CertificateKind.LrTable])