Decidability helpers for Sym2 and Set #
Small, graph-independent deciders that Mathlib does not provide in the form needed by a
library whose objects are Set-valued rather than type-valued. Everything here is
stated in the root namespace, since nothing in it mentions graphs; these are natural
candidates for upstreaming.
Main results #
Sym2.decidableForallMem—∀ v ∈ e, p vis decidable fore : Sym2 α.Set.decidableSubsetOfFintype—s ⊆ tis decidable whensis finite (as data) andthas decidable membership.Set.decidableSubsingletonOfFintype—s.Subsingletonis decidable for a finites.
Design choices #
[Fintype ↥s], not[Fintype α]. Mathlib's deciders for⊆andSubsingleton(Fintype.decidableSubsingleton) quantify over a finite type. A library in which a graph is avertexSet : Set αfor an arbitraryαnever has that, but it does have finiteness of the individual sets involved, which is all these proofs need.- Decidability, not
Classical. Each result is stated so that itsDecidableinstance actually evaluates:Set.toFinsetneeds only[Fintype ↥s]and computes.
A bounded universal quantifier over the two endpoints of an unordered pair is
decidable. Mathlib provides Sym2.Mem.decidable but no decider for ∀ v ∈ e, p v.
The elimination has to go through Sym2.recOnSubsingleton: the goal is Decidable-,
hence Sort-valued, so the Prop-valued recursor Sym2.ind does not apply.
Equations
- e.decidableForallMem = Sym2.recOnSubsingleton e fun (x y : α) => decidable_of_iff (p x ∧ p y) ⋯
Inclusion is decidable when the smaller set is finite and the larger one has decidable membership.
Equations
- s.decidableSubsetOfFintype t = decidable_of_iff (∀ x ∈ s.toFinset, x ∈ t) ⋯
Set.Subsingleton is decidable for a set with finite coercion.
Equations
- s.decidableSubsingletonOfFintype = decidable_of_iff (s.toFinset.card ≤ 1) ⋯
Membership in the coercion of a Finset is decidable. Stated as an instance because
(↑s : Set α) and s have different head symbols, so instance search does not reach
Finset.decidableMem on its own in every position.
Equations
- s.decidablePredMemCoe a = decidable_of_iff (a ∈ s) ⋯