Decision by enumeration #
For a type X
that is finite (or more generally, compact), it is possible to automatically decide
any statement of the form ∀ x : X, P x
by enumeration when P
is a decidable predicate on X
(i.e., a predicate for the individual propositions P x
are decidable for any given x : X
).
Overview #
The EnumDecide.decideForall
typeclass defines the property of a type being exhaustively checkable.
Results in this file include
EnumDecide.decideFin
- the typeFin n
(the canonical finite set withn
elements) is checkable for anyn : ℕ
.EnumDecide.decideUnit
- the single-element type is exhaustively checkable.EnumDecide.decideProd
,EnumDecide.decideSum
- the product and direct sum of two exhaustively checkable.EnumDecide.funEnum
- the type of functions from an exhaustively checkable type to a type with decidable equality is exhaustively checkable.
It is possible to check whether a given decidable predicate holds for all natural numbers below a given bound.
Equations
- One or more equations did not get rendered due to their size.
- EnumDecide.decideBelow p 0 = isTrue fun n bd => False.elim (_ : False)
Equations
- One or more equations did not get rendered due to their size.
- EnumDecide.decideBelowFin p 0 = isTrue fun n bd => False.elim (_ : False)
It is possible to decide whether a predicate holds for all elements of Fin n
.
Equations
- EnumDecide.decideFin p = match EnumDecide.decideBelowFin p m with | isTrue hyp => isTrue (EnumDecide.decideFin.proof_1 p hyp) | isFalse hyp => isFalse (_ : ((n : Fin m) → p n) → False)
- decideForall : (p : α → Prop) → [inst : DecidablePred p] → Decidable (∀ (x : α), p x)
A typeclass for "exhaustively verifiable types", i.e., types for which it is possible to decide whether a given (decidable) predicate holds for all its elements.
Instances
Equations
- EnumDecide.instDecideForallFin = { decideForall := EnumDecide.decideFin }
Equations
- EnumDecide.instDecidableForAll = EnumDecide.DecideForall.decideForall p
Equations
- EnumDecide.decideProd p = if c : (x : α) → (y : β) → p (x, y) then isTrue (EnumDecide.decideProd.proof_1 p c) else isFalse (_ : ((xy : α × β) → p xy) → False)
Equations
- EnumDecide.instDecideForallProd = { decideForall := EnumDecide.decideProd }
Equations
- EnumDecide.decideUnit p = if c : p () then isTrue (EnumDecide.decideUnit.proof_1 p c) else isFalse (_ : ((x : Unit) → p x) → False)
Equations
- EnumDecide.instDecideForallUnit = { decideForall := EnumDecide.decideUnit }
Equations
- One or more equations did not get rendered due to their size.
Equations
- EnumDecide.instDecideForallSum = { decideForall := EnumDecide.decideSum }