Relations Across Steps #
This file defines Relation.RelatesInSteps (and Relation.RelatesWithinSteps).
These are inductively defined propositions that communicate whether a relation forms a
chain of length n (or at most n) between two elements.
The lemma RelatesInSteps.exists_isChainFromTo allows to obtain a chain
(List.IsChainFromTo) of related elements that witness the reachability, and
List.IsChainFromTo.relatesInSteps is the converse direction.
Relation.relatesInSteps_iff_exists_isChainFromTo combines both.
Another result is Relation.ReflTransGen.relatesInSteps_lt_encard, which states that any element
reachable from a is reachable in fewer steps than there are elements reachable from a.
A relation r relates two elements of α in n steps
if there is a chain of n pairs (t_i, t_{i+1}) such that r t_i t_{i+1} for each i,
starting from the first element and ending at the second.
- refl {α : Type u_1} {r : α → α → Prop} (a : α) : RelatesInSteps r a a 0
- tail {α : Type u_1} {r : α → α → Prop} (t t' t'' : α) (n : ℕ) (h₁ : RelatesInSteps r t t' n) (h₂ : r t' t'') : RelatesInSteps r t t'' (n + 1)
Instances For
If b is reachable from a via r, then they relate to each other for some number
of steps.
If h : α → ℕ increases by at most 1 on each step of r,
then the value of h at the output is at most h at the input plus the number of steps.
If g is a homomorphism from r to r' (i.e., it preserves the reduction relation),
then RelatesInSteps is preserved under g.
Translating between RelatesInSteps and chains (List.IsChainFromTo) #
If b is related to a via r in n steps, then there is an r-chain of n + 1 elements
starting at a and ending at b.
This is similar to List.exists_isChain_ne_nil_of_relationReflTransGen, but also provides
a length guarantee.
If there is an r-chain of n + 1 elements from a to b, then a and b are related
to each other in n steps.
a and b are related in n steps exactly when there is an r-chain of n + 1 elements
from a to b.
RelatesWithinSteps - only requires an upper bound on the number of steps #
RelatesWithinSteps is a variant of RelatesInSteps that allows for a loose bound.
It states that a relates to b in at most n steps.
Equations
- Relation.RelatesWithinSteps r a b n = ∃ m ≤ n, Relation.RelatesInSteps r a b m
Instances For
RelatesInSteps implies RelatesWithinSteps with the same bound.
Transitivity of RelatesWithinSteps in the sum of the step bounds.
If two elements a and b are related in at most n₁ steps in the relation r and
n₁ ≤ n₂, then they are also related in at most n₂ steps.
If h : α → ℕ increases by at most 1 on each step of r,
then the value of h at the output is at most h at the input plus the step bound.
If g is a homomorphism from r to r' (i.e., it preserves the reduction relation),
then RelatesWithinSteps is preserved under g.
Reachability under a bound on the number of reachable elements #
A more precise version of ReflTransGen.relatesInSteps: if b is reachable from a, then it
is related to a in fewer steps than there are elements reachable from a.
Note that this cardinality is an ℕ∞, and if it is infinite, no bound on the number of steps
is stated.