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

Flattening and contexts

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

definition

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

    Definition

    Flattening substitutes a finite set-system at each vertex of a pattern. Inner transition edges are retained; an inner variable edge is connected according to the corresponding direction in the pattern. Inner roots remain roots, and inner initial vertices become roots when the outer vertex is a root. Unreachable vertices are removed. A context has exactly one vertex labelled by a hole of the prescribed rank. See Sections 2.6 and 2.8.

    Concept map
    2 concepts
    100%
    DefinitionThis conceptRelated conceptA → B: B builds on ADescendants are omitted for concepts with more than 10 descendants.

    Lean source view on GitHub

    1import Lax369799.RankedSystems
    2
    3/-!
    4---
    5title: Flattening and contexts
    6type: definition
    7---
    8Flattening substitutes a finite set-system at each vertex of a pattern.
    9Inner transition edges are retained; an inner variable edge is connected
    10according to the corresponding direction in the pattern. Inner roots remain
    11roots, and inner initial vertices become roots when the outer vertex is a
    12root. Unreachable vertices are removed. A context has exactly one vertex
    13labelled by a hole of the prescribed rank. See Sections 2.6 and 2.8.
    14-/
    15
    16namespace Lax369799.Flattening
    17open RankedSystems
    18
    19abbrev Inner {A : RankedSet} {n : ℕ} (S : SetSystem (SetSystem A) n)
    20 (v : S.Vertex) := (S.graph.label v).2
    21
    22noncomputable def flatten {A : RankedSet} {n : ℕ}
    23 (S : SetSystem (SetSystem A) n) : SetSystem A n :=
    24 trim (V := (v : S.Vertex) × (Inner S v).Vertex) {
    25 label := fun v => (Inner S v.1).graph.label v.2
    26 initial := fun v => v.1 ∈ S.graph.initial ∧ v.2 ∈ (Inner S v.1).graph.initial
    27 root := fun v => v.2 ∈ (Inner S v.1).graph.root ∨
    28 (v.1 ∈ S.graph.root ∧ v.2 ∈ (Inner S v.1).graph.initial)
    29 edge := fun v d t =>
    30 (∃ w, (Inner S v.1).graph.edge v.2 d (.inl w) ∧ t = .inl ⟨v.1, w⟩) ∨
    31 (∃ i : Fin (S.graph.label v.1).1,
    32 (Inner S v.1).graph.edge v.2 d (.inr i) ∧
    33 ((∃ w : (v : S.Vertex) × (Inner S v).Vertex,
    34 S.graph.edge v.1 i.val (.inl w.1) ∧
    35 w.2 ∈ (Inner S w.1).graph.initial ∧ t = .inl w) ∨
    36 (∃ j, S.graph.edge v.1 i.val (.inr j) ∧ t = .inr j)))
    37 direction_valid := by
    38 intro v d t h
    39 rcases h with ⟨w, hw, _⟩ | ⟨i, hi, _⟩
    40 · exact (Inner S v.1).graph.direction_valid v.2 d _ hw
    41 · exact (Inner S v.1).graph.direction_valid v.2 d _ hi }
    42
    43abbrev WithHole (A : RankedSet) (k : ℕ) : RankedSet := fun n => A n ⊕ PLift (k = n)
    44
    45def IsHole {A : RankedSet} {k : ℕ} (a : Symbol (WithHole A k)) : Prop :=
    46 ∃ h, a.2 = Sum.inr h
    47
    48structure SetContext (A : RankedSet) (k n : ℕ) where
    49 system : SetSystem (WithHole A k) n
    50 one_hole : ∃! v, IsHole (system.graph.label v)
    51
    52abbrev Context (A : RankedSet) (k n : ℕ) :=
    53 {C : SetContext A k n // C.system.Deterministic}
    54
    55def substitution {A : RankedSet} {k : ℕ} (S : SetSystem A k) :
    56 RankedMap (WithHole A k) (SetSystem A) :=
    57 fun _ a => match a with
    58 | .inl a => atomic a
    59 | .inr ⟨h⟩ => h ▸ S
    60
    61noncomputable def plug {A : RankedSet} {k n : ℕ}
    62 (C : SetContext A k n) (S : SetSystem A k) : SetSystem A n :=
    63 flatten (relabel (substitution S) C.system)
    64
    65/-- The flattening relation avoids making a choice of proof of determinism. -/
    66def SystemFlattening {A : RankedSet} {n : ℕ}
    67 (S : System (System A) n) (T : System A n) : Prop :=
    68 T.val = flatten (relabel (fun _ U => U.val) S.val)
    69
    70end Lax369799.Flattening
    71

    Discussion

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

    Loading discussion…