Documentation

AlgoLib.Util.Decidable

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 #

Design choices #

Sym2 #

@[implicit_reducible]
instance Sym2.decidableForallMem {α : Type u_1} {p : α → Prop} [DecidablePred p] (e : Sym2 α) :
Decidable (∀ v ∈ e, p v)

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

Set #

theorem Set.subset_iff_forall_mem_toFinset {α : Type u_1} (s t : Set α) [Fintype ↑s] :
s ⊆ t ↔ ∀ x ∈ s.toFinset, x ∈ t

Inclusion of a finite Set into another, as a bounded quantifier over a Finset.

@[implicit_reducible]
instance Set.decidableSubsetOfFintype {α : Type u_1} (s t : Set α) [Fintype ↑s] [DecidablePred fun (x : α) => x ∈ t] :

Inclusion is decidable when the smaller set is finite and the larger one has decidable membership.

Equations

Being a subsingleton, as a cardinality bound on the Finset view.

@[implicit_reducible]

Set.Subsingleton is decidable for a set with finite coercion.

Equations
@[implicit_reducible]
instance Finset.decidablePredMemCoe {α : Type u_1} [DecidableEq α] (s : Finset α) :
DecidablePred fun (x : α) => x ∈ ↑s

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