Draft — mutable and not usable as a dependency; its citation marks the draft state.

Lax53.TreeModelCheckingEncoding

Distinguished structural inputs for tree-automaton evaluation

concepts/Lax53/TreeModelCheckingEncoding.lean · lax-53

proven

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Concept map

    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Evidence

    Each proof establishes this claim relative to its assumptions.

    Definition and theorem

    An automaton together with a ranked tree is represented by one fixed constructor whose two fields use the certified structural presentations of automata and trees. This complete equation determines the entire represented content and therefore permits no compiled table, traversal order, semantic annotation, or other advice.

    The physical word-RAM input is the distinguished lax58lax-58 input tape of this structural value: its root word followed by its immutable arena. The exact input length is three words per structural node plus the root word. No specialized evaluator layout is part of this concept.

    Lean source view on GitHub

    1import Lax53.StructuralRepresentations
    2
    3/-!
    4---
    5title: Distinguished structural inputs for tree-automaton evaluation
    6type: definition and theorem
    7---
    8
    9An automaton together with a ranked tree is represented by one fixed
    10constructor whose two fields use the certified structural presentations of
    11automata and trees. This complete equation determines the entire represented
    12content and therefore permits no compiled table, traversal order, semantic
    13annotation, or other advice.
    14
    15The physical word-RAM input is the distinguished `lax-58` input tape of this
    16structural value: its root word followed by its immutable arena. The exact
    17input length is three words per structural node plus the root word. No
    18specialized evaluator layout is part of this concept.
    19-/
    20
    21namespace Lax53.TreeModelCheckingEncoding
    22
    23open Lax53.RankedTree
    24open Lax53.ValueTranslations
    25open Lax53.StructuralRepresentations
    26open Lax58.StructuralPresentation
    27open Lax58.StructuralPresentation.Presentation
    28open Lax58.StructuralCombinators
    29open Lax58.WordArena
    30
    31/-- Number of constructor occurrences in a ranked tree. -/
    32def treeSize {A : RankedAlphabet} : Tree A → Nat
    33 | .node _ children =>
    34 1 + (List.ofFn fun i => treeSize (children i)).sum
    35
    36/-- Structural size of the certified automaton representation. -/
    37def automatonSize (M : EncodedAutomaton) : Nat :=
    38 StructuralRepresentations.automatonPresentation.structuralSize M
    39
    40/-- Largest symbol rank in a finite encoded alphabet. This is mathematical
    41alphabet data, independently of any evaluator representation. -/
    42def maximumRank (alphabet : RankedAlphabetCode) : Nat :=
    43 alphabet.foldl max 0
    44
    45/-- A runtime instance for uniform tree-automaton acceptance. Bundling the
    46dependent tree with its automaton makes the complete input an ordinary type
    47that can be passed to reusable complexity predicates. -/
    48structure AutomatonAcceptanceInstance where
    49 automaton : EncodedAutomaton
    50 tree : Tree automaton.1.toRankedAlphabet
    51
    52/-- Complete advice-free structural content of an automaton-evaluation
    53instance. Both fields use named, constructor-certified presentations. -/
    54def automatonTreeRaw (M : EncodedAutomaton)
    55 (t : Tree M.1.toRankedAlphabet) : Raw :=
    56 Raw.constructor "automatonAcceptance"
    57 [StructuralRepresentations.automatonPresentation.toRaw M,
    58 StructuralRepresentations.treeStructure M.1 t]
    59
    60/-- The complete certified content of a bundled uniform acceptance input. -/
    61def automatonAcceptanceRaw (input : AutomatonAcceptanceInstance) : Raw :=
    62 automatonTreeRaw input.automaton input.tree
    63
    64/-- Explicit presentation used by the uniform reusable RAM predicate. Its
    65encoder is exactly `automatonTreeRaw`; no evaluator-specific data is added. -/
    66noncomputable def automatonAcceptancePresentation :
    67 Presentation AutomatonAcceptanceInstance :=
    68 presentationOf automatonAcceptanceRaw
    69
    70/-- Explicit presentation for the old fixed-automaton input convention. The
    71fixed automaton remains physically present, exactly as in `automatonInput`. -/
    72noncomputable def fixedAutomatonPresentation (M : EncodedAutomaton) :
    73 Presentation (Tree M.1.toRankedAlphabet) :=
    74 presentationOf (automatonTreeRaw M)
    75
    76/-- Structural size of the complete runtime input. -/
    77def inputStructuralSize (M : EncodedAutomaton)
    78 (t : Tree M.1.toRankedAlphabet) : Nat :=
    79 (automatonTreeRaw M t).nodes
    80
    81/-- All primitive natural payloads in the complete runtime input fit in one
    82`w`-bit word. -/
    83def InputPayloadsFitInWord (M : EncodedAutomaton)
    84 (t : Tree M.1.toRankedAlphabet) (w : Nat) : Prop :=
    85 (automatonTreeRaw M t).PayloadsFitInWord w
    86
    87/-- Largest primitive natural payload in the complete structural input. -/
    88def inputPayloadMax (M : EncodedAutomaton)
    89 (t : Tree M.1.toRankedAlphabet) : Nat :=
    90 (automatonTreeRaw M t).maxNat
    91
    92/-- The unique machine input admitted by the runtime theorem. -/
    93def automatonInput (M : EncodedAutomaton)
    94 (t : Tree M.1.toRankedAlphabet) : List Nat :=
    95 (encodeRaw (automatonTreeRaw M t)).toInput
    96
    97/-- Exact footprint of the distinguished structural machine input. -/
    98axiom automatonInput_length (M : EncodedAutomaton)
    99 (t : Tree M.1.toRankedAlphabet) :
    100 (automatonInput M t).length = 3 * inputStructuralSize M t + 1
    101
    102end Lax53.TreeModelCheckingEncoding
    103
    Show Proof

    Community review

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above; your ORCID profile must share a public name.

    0 comments

    Loading discussion…