# 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 as Lists quotiented by Lists.Equiv, the extensional equivalence.
inductive Lists' (α : Type u) :
BoolType u

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} → α
• nil: {α : Type u} →
• cons': {α : Type u} → {b : Bool} → Lists' α b
Instances For
instance instDecidableEqLists' :
{α : Type u_2} → {a : Bool} → [inst : ] → DecidableEq (Lists' α a)
Equations
• instDecidableEqLists' = decEqLists'✝
def Lists (α : Type u_2) :
Type u_2

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.

Equations
Instances For
instance Lists'.instInhabited {α : Type u_1} [] (b : Bool) :
Equations
def Lists'.cons {α : Type u_1} :

Appending a ZFA list to a proper ZFA prelist.

Equations
• Lists'.cons x✝ x = match x✝, x with | fst, a, l => a.cons' l
Instances For
def Lists'.toList {α : Type u_1} {b : Bool} :
Lists' α bList ()

Converts a ZFA prelist to a List of ZFA lists. Atoms are sent to [].

Equations
• ().toList = []
• Lists'.nil.toList = []
• (a.cons' l).toList = b, a :: l.toList
Instances For
theorem Lists'.toList_cons {α : Type u_1} (a : ) (l : ) :
().toList = a :: l.toList
def Lists'.ofList {α : Type u_1} :
List ()

Converts a List of ZFA lists to a proper ZFA prelist.

Equations
Instances For
@[simp]
theorem Lists'.to_ofList {α : Type u_1} (l : List ()) :
().toList = l
@[simp]
theorem Lists'.of_toList {α : Type u_1} (l : ) :
Lists'.ofList l.toList = l
inductive Lists.Equiv {α : Type u_1} :
Prop

Equivalence of ZFA lists. Defined inductively.

• refl: ∀ {α : Type u_1} (l : ), l.Equiv l
• antisymm: ∀ {α : Type u_1} {l₁ l₂ : }, l₁.Subset l₂l₂.Subset l₁Lists.Equiv true, l₁ true, l₂
Instances For
inductive Lists'.Subset {α : Type u_1} :
Prop

Subset relation for ZFA lists. Defined inductively.

• nil: ∀ {α : Type u_1} {l : }, Lists'.nil.Subset l
• cons: ∀ {α : Type u_1} {a a' : } {l l' : }, a.Equiv a'a' l'.toListl.Subset l'().Subset l'
Instances For
instance Lists'.instHasSubsetTrue {α : Type u_1} :
Equations
• Lists'.instHasSubsetTrue = { Subset := Lists'.Subset }
instance Lists'.instMembershipLists {α : Type u_1} {b : Bool} :
Membership () (Lists' α b)

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.

Equations
• Lists'.instMembershipLists = { mem := fun (a : ) (l : Lists' α b) => a'l.toList, a.Equiv a' }
theorem Lists'.mem_def {α : Type u_1} {b : Bool} {a : } {l : Lists' α b} :
a l a'l.toList, a.Equiv a'
@[simp]
theorem Lists'.mem_cons {α : Type u_1} {a : } {y : } {l : } :
a a.Equiv y a l
theorem Lists'.cons_subset {α : Type u_1} {a : } {l₁ : } {l₂ : } :
Lists'.cons a l₁ l₂ a l₂ l₁ l₂
theorem Lists'.ofList_subset {α : Type u_1} {l₁ : List ()} {l₂ : List ()} (h : l₁ l₂) :
theorem Lists'.Subset.refl {α : Type u_1} {l : } :
l l
theorem Lists'.subset_nil {α : Type u_1} {l : } :
l Lists'.nill = Lists'.nil
theorem Lists'.mem_of_subset' {α : Type u_1} {a : } {l₁ : } {l₂ : } :
l₁ l₂a l₁.toLista l₂
theorem Lists'.subset_def {α : Type u_1} {l₁ : } {l₂ : } :
l₁ l₂ al₁.toList, a l₂
@[match_pattern]
def Lists.atom {α : Type u_1} (a : α) :

Sends a : α to the corresponding atom in Lists α.

Equations
Instances For
@[match_pattern]
def Lists.of' {α : Type u_1} (l : ) :

Converts a proper ZFA prelist to a ZFA list.

Equations
Instances For
def Lists.toList {α : Type u_1} :
List ()

Converts a ZFA list to a List of ZFA lists. Atoms are sent to [].

Equations
• x.toList = match x with | fst, l => l.toList
Instances For
def Lists.IsList {α : Type u_1} (l : ) :

Predicate stating that a ZFA list is proper.

Equations
Instances For
def Lists.ofList {α : Type u_1} (l : List ()) :

Converts a List of ZFA lists to a ZFA list.

Equations
Instances For
theorem Lists.isList_toList {α : Type u_1} (l : List ()) :
().IsList
theorem Lists.to_ofList {α : Type u_1} (l : List ()) :
().toList = l
theorem Lists.of_toList {α : Type u_1} {l : } :
l.IsListLists.ofList l.toList = l
instance Lists.instInhabited {α : Type u_1} :
Equations
• Lists.instInhabited = { default := Lists.of' Lists'.nil }
instance Lists.instDecidableEq {α : Type u_1} [] :
Equations
• Lists.instDecidableEq = id inferInstance
instance Lists.instSizeOf {α : Type u_1} [] :
Equations
• Lists.instSizeOf = id inferInstance
def Lists.inductionMut {α : Type u_1} (C : Sort u_2) (D : Sort u_3) (C0 : (a : α) → C ()) (C1 : (l : ) → D lC ()) (D0 : D Lists'.nil) (D1 : (a : ) → (l : ) → C aD lD ()) :
PProd ((l : ) → C l) ((l : ) → D l)

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
def Lists.mem {α : Type u_1} (a : ) :
Prop

Membership of ZFA list. A ZFA list belongs to a proper ZFA list if it belongs to the latter as a proper ZFA prelist. An atom has no members.

Equations
• a.mem x = match x with | false, snd => False | fst, l => a l
Instances For
instance Lists.instMembership {α : Type u_1} :
Equations
• Lists.instMembership = { mem := Lists.mem }
theorem Lists.isList_of_mem {α : Type u_1} {a : } {l : } :
a ll.IsList
theorem Lists.Equiv.antisymm_iff {α : Type u_1} {l₁ : } {l₂ : } :
().Equiv () l₁ l₂ l₂ l₁
theorem Lists.equiv_atom {α : Type u_1} {a : α} {l : } :
().Equiv l = l
theorem Lists.Equiv.symm {α : Type u_1} {l₁ : } {l₂ : } (h : l₁.Equiv l₂) :
l₂.Equiv l₁
theorem Lists.Equiv.trans {α : Type u_1} {l₁ : } {l₂ : } {l₃ : } :
l₁.Equiv l₂l₂.Equiv l₃l₁.Equiv l₃
instance Lists.instSetoidLists {α : Type u_1} :
Equations
• Lists.instSetoidLists = { r := fun (x x_1 : ) => x.Equiv x_1, iseqv := }
@[deprecated]
def Lists.Equiv.decidableMeas {α : Type u_1} :
(_ : ) ×' ⊕' (_ : ) ×' ⊕' (_ : ) ×'

Auxiliary function to prove termination of decidability checking

Equations
• One or more equations did not get rendered due to their size.
Instances For
theorem Lists.sizeof_pos {α : Type u_1} {b : Bool} (l : Lists' α b) :
0 <
theorem Lists.lt_sizeof_cons' {α : Type u_1} {b : Bool} (a : Lists' α b) (l : ) :
sizeOf b, a < sizeOf (a.cons' l)
instance Lists.Equiv.decidable {α : Type u_1} [] (l₁ : ) (l₂ : ) :
Decidable (l₁.Equiv l₂)
Equations
instance Lists.Subset.decidable {α : Type u_1} [] (l₁ : ) (l₂ : ) :
Decidable (l₁ l₂)
Equations
instance Lists.mem.decidable {α : Type u_1} [] (a : ) (l : ) :
Equations
theorem Lists'.mem_equiv_left {α : Type u_1} {l : } {a : } {a' : } :
a.Equiv a'(a l a' l)
theorem Lists'.mem_of_subset {α : Type u_1} {a : } {l₁ : } {l₂ : } (s : l₁ l₂) :
a l₁a l₂
theorem Lists'.Subset.trans {α : Type u_1} {l₁ : } {l₂ : } {l₃ : } (h₁ : l₁ l₂) (h₂ : l₂ l₃) :
l₁ l₃
def Finsets (α : Type u_2) :
Type u_2

Finsets are defined via equivalence classes of Lists

Equations
Instances For
instance Finsets.instEmptyCollection {α : Type u_1} :
Equations
• Finsets.instEmptyCollection = { emptyCollection := Lists.of' Lists'.nil }
instance Finsets.instInhabited {α : Type u_1} :
Equations
• Finsets.instInhabited = { default := }
instance Finsets.instDecidableEq {α : Type u_1} [] :
Equations
• Finsets.instDecidableEq = id Quotient.decidableEq