Chains with a designated start and end #
This file defines List.IsChainFromTo, a variant of List.IsChain that also fixes the first and
last element of the chain. Such a chain is an explicit witness for the fact that its end point is
reachable from its start point, and its length bounds the number of steps that are needed.
Main definitions #
List.IsChainFromTo r chain a b:chainis a non-empty list whose adjacent elements are related byr, whose first element isaand whose last element isb.
Main results #
List.IsChainFromTo.reflTransGen: the start and the end of a chain are related byRelation.ReflTransGen.List.IsChainFromTo.head_induction_on: induction on a chain, peeling off elements at the start.List.IsChainFromTo.exists_length_lt_of_not_nodup: a chain with duplicates can always be shortened.List.IsChainFromTo.exists_nodup: iterating the above yields a chain without duplicates.
A "chain from to" is a list of elements where adjacent elements relate to each other
(cf. List.IsChain) and start and end with specific elements.
- isChain : IsChain r chain
Instances For
A chain has at least one element.
The first element of an r-chain from a to b is a.
The start and the end of an r-chain are reflexively-transitively related by r.
Create a List.IsChainFromTo from a non-empty List.IsChain.
A one-element list is an r-chain from that element to itself.
Prepend an r-related element to the start of the chain.
Removing the head yields a valid chain.
Appending a chain and the tail of a second one whose start point equals the end point of the first yields a valid chain.
Add an r-related element to the end of the chain.
Appending a chain, dropping its last element and another chain whose start point equals the end point of the first chain yields a valid chain.
Taking the first i + 1 elements of a chain yields a chain from the same start point to
chain[i].
Dropping the first i elements of a chain yields a chain from chain[i] to the same end
point.
Any element of an r-chain from a to b is reflexively-transitively related from a.
Any element of an r-chain from a to b is reflexively-transitively related to b.
If there is an r-chain from a to b with duplicates, then there is a shorter r-chain
from a to b (the one that skips the part between the duplicates).
For any r-chain from a to b there is one without duplicates.