While this submission is a draft, it cannot be used by other submissions.

Finite path-summary algebras

Lax369799.PathAlgebra · concepts/Lax369799/PathAlgebra.lean · lax-369799

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.

    Natural Language Statement

    Theorem

    An element records, for each entry state, the possible final states and variable exits with their states. Evaluation follows a finite path through the system, composing local summaries. This gives a rankwise-finite algebra when the state set is finite, suitable for recognizing local predicates along paths from the initial vertex.

    Concept map
    6 concepts; 1 descendant hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A
    Evidence

    This concept declares 2 statements. Each proof establishes one of them relative to its assumptions.

    Lean source view on GitHub

    1import Lax369799.InitialAlgebra
    2import Mathlib.Data.Fintype.Powerset
    3import Mathlib.Data.Fintype.Pi
    4import Mathlib.Data.Fintype.Prod
    5
    6/-!
    7---
    8title: Finite path-summary algebras
    9type: theorem
    10---
    11An element records, for each entry state, the possible final states and
    12variable exits with their states. Evaluation follows a finite path through
    13the system, composing local summaries. This gives a rankwise-finite algebra
    14when the state set is finite, suitable for recognizing local predicates
    15along paths from the initial vertex.
    16-/
    17namespace Lax369799.PathAlgebra
    18open RankedSystems Algebras InitialAlgebra
    19
    20abbrev Result (Q : Type) (n : ℕ) := Q ⊕ (Fin n × Q)
    21abbrev Carrier (Q : Type) : RankedSet := fun n => Q → Set (Result Q n)
    22
    23def Halt {Q : Type} (a : Symbol (Carrier Q)) (q r : Q) : Prop :=
    24 Sum.inl r ∈ a.2 q
    25
    26def Exit {Q : Type} (a : Symbol (Carrier Q)) (d : ℕ) (q r : Q) : Prop :=
    27 ∃ i : Fin a.1, i.val = d ∧ Sum.inr (i, r) ∈ a.2 q
    28
    29inductive Run {Q V : Type} {n : ℕ} (G : Presentation (Carrier Q) n V) :
    30 V → Q → Result Q n → Prop
    31 | halt {v q r} (h : Halt (G.label v) q r) : Run G v q (.inl r)
    32 | exit {v q r i} (d : ℕ)
    33 (h : Exit (G.label v) d q r) (he : G.edge v d (.inr i)) :
    34 Run G v q (.inr (i, r))
    35 | step {v w q r out} (d : ℕ)
    36 (h : Exit (G.label v) d q r) (he : G.edge v d (.inl w))
    37 (tail : Run G w r out) : Run G v q out
    38
    39noncomputable def evaluate {Q : Type} (n : ℕ) (S : System (Carrier Q) n) : Carrier Q n :=
    40 fun q out => Run S.val.graph (initial S) q out
    41
    42axiom algebra (Q : Type) : ∃ E : Algebra (Carrier Q), E.eval = evaluate
    43
    44axiom finite_carrier (Q : Type) [Finite Q] : RankwiseFinite (Carrier Q)
    45
    46end Lax369799.PathAlgebra
    47
    Show ProofShow Proof

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…