Decidability of Relation.ReflTransGen on a finite carrier #
Reachability along a relation whose successors lie in a finite set is decidable: close {a} under
the successor function until it stops growing, and test membership. Mathlib has the analogue for
finite simple graphs (SimpleGraph.Reachable), not for an arbitrary relation.
Main declarations #
Finset.isFixedPt_iterate_card: an inflationary operation on the subsets of a finite setureaches a fixed point withinu.carditerations.Relation.ReflTransGen.reach,mem_reach_iff: the set reached from a node, and its characterization.decidable_of_finset_stepand its wrappers for a list-valued successor function, a decidable relation with a bounding list, and aFintypecarrier; theTransGensiblings; and the twoDecidableRelinstances over aFintype.total_of_left_unique,antisymm_of_irrefl_transGen,of_forall_exists,exists_boundary: order-theoretic facts about the closure.partialOrderOfCovers,linearOrderOfCovers,decidableLEOfCovers: the order generated by a relation of immediate subsumption whose edges decrease a rank, and its decidability.
Implementation notes #
reach iterates one round of closure (insert a u).card times without testing for the fixed
point, so that by decide evaluates a plain Nat.iterate. The bound comes from cardinality alone:
a strictly growing chain of subsets of a finite set is no longer than the set.
An inflationary operation on the subsets of a finite set reaches a fixed point after as many iterations as the set has elements.
One round of closing a set under a successor function.
Equations
- Relation.ReflTransGen.closeStep step S = S ∪ S.biUnion step
Instances For
The nodes reached from a along step, when every successor lies in the finite set s.
Equations
- Relation.ReflTransGen.reach step s a = (Relation.ReflTransGen.closeStep step)^[(insert a s).card] {a}
Instances For
Decidability #
Relation.ReflTransGen r is decidable when r has a finset-valued successor function whose
values lie in a finite set.
Equations
- Relation.ReflTransGen.decidable_of_finset_step step s step_eq step_in_s a b = decidable_of_iff (b ∈ Relation.ReflTransGen.reach step s a) ⋯
Instances For
Relation.TransGen r is decidable under the hypotheses of decidable_of_finset_step: a first
step, then reachability.
Equations
- Relation.ReflTransGen.decidable_TransGen_of_finset_step step s step_eq step_in_s a b = decidable_of_iff (∃ c ∈ step a, b ∈ Relation.ReflTransGen.reach step s c) ⋯
Instances For
The list-valued form of decidable_of_finset_step.
Equations
- Relation.ReflTransGen.decidable_of_finite_step step s step_eq step_in_s a b = Relation.ReflTransGen.decidable_of_finset_step (fun (a : α) => (step a).toFinset) s.toFinset ⋯ ⋯ a b
Instances For
Relation.ReflTransGen r is decidable when r is decidable and its successors lie in a
list.
Equations
- Relation.ReflTransGen.decidable_of_finite s succ_in_s a b = Relation.ReflTransGen.decidable_of_finite_step (fun (a : α) => List.filter (fun (x : α) => decide (r a x)) s) s ⋯ ⋯ a b
Instances For
Relation.ReflTransGen r is decidable on a Fintype given a finset-valued successor
function.
Equations
- Relation.ReflTransGen.decidable_of_fintype_step step step_eq a b = Relation.ReflTransGen.decidable_of_finset_step step Finset.univ step_eq ⋯ a b
Instances For
Relation.TransGen r is decidable on a Fintype given a finset-valued successor function.
Equations
- Relation.ReflTransGen.decidable_TransGen_of_fintype_step step step_eq a b = Relation.ReflTransGen.decidable_TransGen_of_finset_step step Finset.univ step_eq ⋯ a b
Instances For
Relation.ReflTransGen r is decidable on a Fintype when r is.
Equations
- Relation.ReflTransGen.decidable_of_fintype a b = Relation.ReflTransGen.decidable_of_fintype_step (fun (a : α) => {x : α | r a x}) ⋯ a b
Instances For
Relation.TransGen r is decidable on a Fintype when r is.
Equations
- Relation.ReflTransGen.decidable_TransGen_of_fintype a b = Relation.ReflTransGen.decidable_TransGen_of_fintype_step (fun (a : α) => {x : α | r a x}) ⋯ a b
Instances For
Reachability on a Fintype is decidable, the analogue for a relation of mathlib's
DecidableRel G.Reachable for finite simple graphs. Concrete decides over this instance may
need +kernel.
The closure of an acyclic relation as an order #
The dual of Relation.ReflTransGen.total_of_right_unique: over a
left-unique relation, positions reaching a common target are comparable.
The reflexive-transitive closure of a relation whose transitive closure is irreflexive is antisymmetric.
On a finite carrier, if the relation is acyclic and every element other
than a has a predecessor, then a reaches everything.
Crossing a boundary #
A reflexive-transitive path from inside S to outside it crosses the
boundary at a single step, the source reaching the exit and the entry
reaching the target — the Relation.ReflTransGen analogue of
SimpleGraph.Walk.exists_boundary_dart.
On a finite carrier, a relation whose transitive closure is irreflexive is well founded.
The order generated by immediate subsumption #
A path along edges that decrease a rank, ending no lower than it starts, is trivial.
The partial order whose ≤ is the reflexive transitive closure of covers, given a rank
that every covers edge strictly decreases.
Equations
- partialOrderOfCovers covers rank hrank = { le := Relation.ReflTransGen covers, le_refl := ⋯, le_trans := ⋯, lt_iff_le_not_ge := ⋯, le_antisymm := ⋯ }
Instances For
The order of partialOrderOfCovers is decidable when allSorts lists every target of a
covers edge.
Equations
- decidableLEOfCovers allSorts complete a b = Relation.ReflTransGen.decidable_of_finite allSorts complete a b
Instances For
The linear order whose ≤ is the reflexive transitive closure of covers, for a relation
whose closure is total and which a rank strictly decreases along.
Equations
- One or more equations did not get rendered due to their size.