Documentation

CslibFrontier.Foundations.Relation.Layered

Layering a bounded reachability problem #

A vertex records its time layer and its original vertex. Each edge advances exactly one layer and either follows the original relation or stays at the original vertex. Thus a walk of at most T original steps is represented at layer T, including computations that finish early. The lifted relation has no self edges, even when the original relation does.

This is the bounded-walk construction used by the native configuration-graph reduction in #6747, not an unambiguity or resource theorem for a reachability algorithm.

Main results #

structure Relation.LayeredVertex (α : Type u_1) :
Type u_1

A vertex together with its time layer in a layered reachability graph.

  • layer : ℕ

    The time layer.

  • vertex : α

    The original vertex.

def Relation.instDecidableEqLayeredVertex.decEq {α✝ : Type u_1} [DecidableEq α✝] (x✝ x✝¹ : LayeredVertex α✝) :
Decidable (x✝ = x✝¹)
@[instance_reducible]
def Relation.LayeredVertex.Step {α : Type u_1} (r : α → α → Prop) (T : ℕ) (a b : LayeredVertex α) :

Edges advance one layer, before the horizon, and follow an original edge or wait. Waiting changes the layered vertex and therefore introduces no self edge.

theorem Relation.LayeredVertex.step_irrefl {α : Type u_1} {r : α → α → Prop} {T : ℕ} (a : LayeredVertex α) :
¬Step r T a a

Layering turns even a reflexive original relation into an irreflexive relation.

theorem Relation.LayeredVertex.reachable_iff {α : Type u_1} {r : α → α → Prop} {T : ℕ} (a b : α) :
ReflTransGen (Step r T) { layer := 0, vertex := a } { layer := T, vertex := b } ↔ RelatesWithinSteps r a b T

Reachability at the final layer is exactly reachability in at most the horizon many original steps. In particular, early termination can be padded without changing the answer.

@[reducible, inline]
abbrev Relation.LayeredVertex.Bounded (α : Type u_2) (T : ℕ) :
Type u_2

Vertices in the finite window of layers from zero through the horizon.

Instances For
    def Relation.LayeredVertex.boundedEquiv (α : Type u_2) (T : ℕ) :
    Bounded α T ≃ Fin (T + 1) × α

    The finite window as a bounded layer index and an original vertex.

    @[instance_reducible]
    noncomputable instance Relation.LayeredVertex.instFintypeBounded {α : Type u_2} [Fintype α] (T : ℕ) :
    theorem Relation.LayeredVertex.card_bounded {α : Type u_2} (T : ℕ) :
    Nat.card (Bounded α T) = (T + 1) * Nat.card α

    The finite layered window contains one copy of the original vertices in each layer.

    theorem Relation.LayeredVertex.bounded_reachable_iff {α : Type u_1} {r : α → α → Prop} {T : ℕ} (a b : Bounded α T) :
    ReflTransGen (fun (u v : Bounded α T) => Step r T ↑u ↑v) a b ↔ ReflTransGen (Step r T) ↑a ↑b

    Restricting to the finite window loses no layered walk between vertices in the window.

    theorem Relation.LayeredVertex.bounded_reachable_iff_relatesWithinSteps {α : Type u_1} {r : α → α → Prop} {T : ℕ} (a b : α) :
    ReflTransGen (fun (u v : Bounded α T) => Step r T ↑u ↑v) ⟨{ layer := 0, vertex := a }, ⋯⟩ ⟨{ layer := T, vertex := b }, ⋯⟩ ↔ RelatesWithinSteps r a b T

    In the finite layered window, reaching b at layer T from a at layer zero is equivalent to an original walk of at most T steps.