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

Recursive replacement of probes

Lax833301.Expansion · concepts/Lax833301/Expansion.lean · lax-833301

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

    At depth 00 the replacement is a single interval. At depth d+1d+1 the events are the fixed events of the template and the events in a depth-dd copy for each probe. An external arc leaves a child's exit or arrives at its entry. A coordinate has one type per level. Its load is the number of active intervals whose prefix matches that coordinate.

    Concept map
    2 concepts; 9 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    In the paper

    • page 4 of this submission's paper

    Lean source view on GitHub

    1import Lax833301.Schedules
    2
    3/-!
    4---
    5title: Recursive replacement of probes
    6type: definition
    7---
    8At depth 00 the replacement is a single interval. At depth d+1d+1 the events
    9are the fixed events of the template and the events in a depth-dd copy for
    10each probe. An external arc leaves a child's exit or arrives at its entry.
    11A coordinate has one type per level. Its load is the number of active
    12intervals whose prefix matches that coordinate.
    13-/
    14
    15namespace Lax833301.Expansion
    16
    17open Schedules
    18
    19def Event (T : Template) : ℕ → Type
    20 | 0 => Bool
    21 | d+1 => T.Fixed ⊕ (T.Probe × Event T d)
    22
    23def Interval (T : Template) : ℕ → Type
    24 | 0 => Unit
    25 | d+1 => T.Blocker ⊕ (T.Probe × Interval T d)
    26
    27def Coord : ℕ → Type
    28 | 0 => Unit
    29 | d+1 => Kind × Coord d
    30
    31noncomputable instance eventFinite (T : Template) (d : ℕ) : Fintype (Event T d) := by
    32 induction d with
    33 | zero => exact inferInstanceAs (Fintype Bool)
    34 | succ d ih => exact inferInstanceAs (Fintype (T.Fixed ⊕ (T.Probe × Event T d)))
    35
    36noncomputable instance intervalFinite (T : Template) (d : ℕ) : Fintype (Interval T d) := by
    37 induction d with
    38 | zero => exact inferInstanceAs (Fintype Unit)
    39 | succ d ih => exact inferInstanceAs (Fintype (T.Blocker ⊕ (T.Probe × Interval T d)))
    40
    41instance coordFinite (d : ℕ) : Fintype (Coord d) := by
    42 induction d with
    43 | zero => exact inferInstanceAs (Fintype Unit)
    44 | succ d ih => exact inferInstanceAs (Fintype (Kind × Coord d))
    45
    46def terminal (T : Template) : (d : ℕ) → Bool → Event T d
    47 | 0, endPoint => endPoint
    48 | _+1, endPoint => Sum.inl (if endPoint then T.exit else T.entry)
    49
    50def endpoint (T : Template) : (d : ℕ) → Interval T d → Bool → Event T d
    51 | 0, _, e => e
    52 | _+1, .inl i, e => Sum.inl (if e then T.closing i else T.opening i)
    53 | d+1, .inr (p,i), e => Sum.inr (p, endpoint T d i e)
    54
    55def uses (T : Template) : (d : ℕ) → Interval T d → Coord d → Prop
    56 | 0, _, _ => True
    57 | _+1, .inl i, (r,_) => T.color i = r
    58 | d+1, .inr (p,i), (r,q) => T.test p = r ∧ uses T d i q
    59
    60def port (T : Template) (d : ℕ) (e : T.Event) (last : Bool) : Event T (d+1) :=
    61 match e with
    62 | .inl v => Sum.inl v
    63 | .inr p => Sum.inr (p, terminal T d last)
    64
    65def arc (T : Template) : (d : ℕ) → Event T d → Event T d → Prop
    66 | 0, a, b => a = false ∧ b = true
    67 | d+1, a, b =>
    68 (∃ u v, T.arc u v ∧ a = port T d u true ∧ b = port T d v false) ∨
    69 ∃ p x y, arc T d x y ∧ a = Sum.inr (p,x) ∧ b = Sum.inr (p,y)
    70
    71abbrev Clock (T : Template) (d : ℕ) := Event T d → ℕ
    72
    73def child {T : Template} {d : ℕ} (f : Clock T (d+1)) (p : T.Probe) : Clock T d :=
    74 fun x => f (Sum.inr (p,x))
    75
    76/-- Respect the local arcs and keep every copy between its entry and exit. -/
    77def Legal (T : Template) : (d : ℕ) → Clock T d → Prop
    78 | 0, f => f false < f true
    79 | d+1, f =>
    80 (∀ p, Legal T d (child f p)) ∧
    81 (∀ u v, T.arc u v → f (port T d u true) < f (port T d v false)) ∧
    82 ∀ x, f (terminal T (d+1) false) ≤ f x ∧ f x ≤ f (terminal T (d+1) true)
    83
    84noncomputable def load (T : Template) : (d : ℕ) → Clock T d → ℕ → Coord d → ℕ
    85 | 0, f, z, _ => if f false ≤ z ∧ z < f true then 1 else 0
    86 | d+1, f, z, (r,q) =>
    87 T.count (fun v => f (Sum.inl v)) z (fun i => T.color i = r) +
    88 ∑ p : T.Probe, if T.test p = r then load T d (child f p) z q else 0
    89
    90end Lax833301.Expansion
    91

    Discussion

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

    Loading discussion…