A computable model of ZFA without infinity #
In this file we define finite hereditary lists. This is useful for calculations in naive set theory.
We distinguish two kinds of ZFA lists:
- Atoms. Directly correspond to an element of the original type.
- Proper ZFA lists. Can be thought of (but aren't implemented) as a list of ZFA lists (not necessarily proper).
For example, Lists ℕ
contains stuff like 23
, []
, [37]
, [1, [[2], 3], 4]
.
Implementation note #
As we want to be able to append both atoms and proper ZFA lists to proper ZFA lists, it's handy that
atoms and proper ZFA lists belong to the same type, even though atoms of α
could be modelled as
α
directly. But we don't want to be able to append anything to atoms.
This calls for a two-steps definition of ZFA lists:
- First, define ZFA prelists as atoms and proper ZFA prelists. Those proper ZFA prelists are defined by inductive appending of (not necessarily proper) ZFA lists.
- Second, define ZFA lists by rubbing out the distinction between atoms and proper lists.
Main declarations #
Lists' α false
: Atoms as ZFA prelists. Basically a copy ofα
.Lists' α true
: Proper ZFA prelists. Defined inductively from the empty ZFA prelist (Lists'.nil
) and from appending a ZFA prelist to a proper ZFA prelist (Lists'.cons a l
).Lists α
: ZFA lists. Sum of the atoms and proper ZFA prelists.Finsets α
: ZFA sets. Defined asLists
quotiented byLists.Equiv
, the extensional equivalence.
Prelists, helper type to define Lists
. Lists' α false
are the "atoms", a copy of α
.
Lists' α true
are the "proper" ZFA prelists, inductively defined from the empty ZFA prelist and
from appending a ZFA prelist to a proper ZFA prelist. It is made so that you can't append anything
to an atom while having only one appending function for appending both atoms and proper ZFC prelists
to a proper ZFA prelist.
- atom: {α : Type u} → α → Lists' α false
- nil: {α : Type u} → Lists' α true
- cons': {α : Type u} → {b : Bool} → Lists' α b → Lists' α true → Lists' α true
Instances For
Equations
- instDecidableEqLists' = decEqLists'✝
Hereditarily finite list, aka ZFA list. A ZFA list is either an "atom" (b = false
),
corresponding to an element of α
, or a "proper" ZFA list, inductively defined from the empty ZFA
list and from appending a ZFA list to a proper ZFA list.
Instances For
Equations
- Lists'.instInhabited true = { default := Lists'.nil }
- Lists'.instInhabited false = { default := Lists'.atom default }
Appending a ZFA list to a proper ZFA prelist.
Equations
- Lists'.cons ⟨fst, a⟩ x = a.cons' x
Instances For
Converts a List
of ZFA lists to a proper ZFA prelist.
Equations
- Lists'.ofList [] = Lists'.nil
- Lists'.ofList (a :: l) = Lists'.cons a (Lists'.ofList l)
Instances For
ZFA prelist membership. A ZFA list is in a ZFA prelist if some element of this ZFA prelist is equivalent as a ZFA list to this ZFA list.
Sends a : α
to the corresponding atom in Lists α
.
Equations
- Lists.atom a = ⟨false, Lists'.atom a⟩
Instances For
Converts a ZFA list to a List
of ZFA lists. Atoms are sent to []
.
Equations
- Lists.toList ⟨fst, l⟩ = l.toList
Instances For
Converts a List
of ZFA lists to a ZFA list.
Equations
- Lists.ofList l = Lists.of' (Lists'.ofList l)
Instances For
A recursion principle for pairs of ZFA lists and proper ZFA prelists.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lists.Equiv.decidable ⟨false, l₁⟩ ⟨false, l₂⟩ = decidable_of_iff' (l₁ = l₂) ⋯
- Lists.Equiv.decidable ⟨false, l₁⟩ ⟨true, l₂⟩ = isFalse ⋯
- Lists.Equiv.decidable ⟨true, l₁⟩ ⟨false, l₂⟩ = isFalse ⋯
- Lists.Equiv.decidable ⟨true, l₁⟩ ⟨true, l₂⟩ = decidable_of_iff' (l₁ ⊆ l₂ ∧ l₂ ⊆ l₁) ⋯
Equations
- Lists.Subset.decidable Lists'.nil x = isTrue ⋯
- Lists.Subset.decidable (a.cons' l₁) x = decidable_of_iff' (⟨b, a⟩ ∈ x ∧ l₁ ⊆ x) ⋯
Equations
- Lists.mem.decidable x Lists'.nil = isFalse ⋯
- Lists.mem.decidable x (b_1.cons' l₂) = decidable_of_iff' (x.Equiv ⟨b, b_1⟩ ∨ x ∈ l₂) ⋯