set_theory.lists

# 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 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' α ff: Atoms as ZFA prelists. Basically a copy of α.
• lists' α tt: 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.

## TODO #

The next step is to define ZFA sets as lists quotiented by lists.equiv. (

@[protected, instance]
def lists'.decidable_eq (α : Type u) [a : decidable_eq α] (ᾰ : bool) :
inductive lists' (α : Type u) :
boolType u
• atom : Π {α : Type u}, α → ff
• nil : Π {α : Type u}, tt
• cons' : Π {α : Type u} {b : bool}, b tt tt

Prelists, helper type to define lists. lists' α ff are the "atoms", a copy of α. lists' α tt 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.

def lists (α : Type u_1) :
Type u_1

Hereditarily finite list, aka ZFA list. A ZFA list is either an "atom" (b = ff), 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
@[protected, instance]
def lists'.inhabited {α : Type u_1} [inhabited α] (b : bool) :
Equations
def lists'.cons {α : Type u_1} :
tt tt

Appending a ZFA list to a proper ZFA prelist.

Equations
@[simp]
def lists'.to_list {α : Type u_1} {b : bool} :
blist (lists α)

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

Equations
@[simp]
theorem lists'.to_list_cons {α : Type u_1} (a : lists α) (l : tt) :
@[simp]
def lists'.of_list {α : Type u_1} :
list (lists α) tt

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

Equations
@[simp]
theorem lists'.to_of_list {α : Type u_1} (l : list (lists α)) :
= l
@[simp]
theorem lists'.of_to_list {α : Type u_1} (l : tt) :
@[protected, instance]
def lists'.has_subset {α : Type u_1} :
Equations
@[protected, instance]
def lists'.has_mem {α : Type u_1} {b : bool} :
has_mem (lists α) (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
theorem lists'.mem_def {α : Type u_1} {b : bool} {a : lists α} {l : b} :
a l ∃ (a' : lists α) (H : a' l.to_list), a.equiv a'
@[simp]
theorem lists'.mem_cons {α : Type u_1} {a y : lists α} {l : tt} :
a l a.equiv y a l
theorem lists'.cons_subset {α : Type u_1} {a : lists α} {l₁ l₂ : tt} :
l₁ l₂ a l₂ l₁ l₂
theorem lists'.of_list_subset {α : Type u_1} {l₁ l₂ : list (lists α)} (h : l₁ l₂) :
theorem lists'.subset_nil {α : Type u_1} {l : tt} :
theorem lists'.mem_of_subset' {α : Type u_1} {a : lists α} {l₁ l₂ : tt} (s : l₁ l₂) (h : a l₁.to_list) :
a l₂
theorem lists'.subset_def {α : Type u_1} {l₁ l₂ : tt} :
l₁ l₂ ∀ (a : lists α), a l₁.to_lista l₂
def lists.atom {α : Type u_1} (a : α) :

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

Equations
def lists.of' {α : Type u_1} (l : tt) :

Converts a proper ZFA prelist to a ZFA list.

Equations
@[simp]
def lists.to_list {α : Type u_1} :
list (lists α)

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

Equations
def lists.is_list {α : Type u_1} (l : lists α) :
Prop

Predicate stating that a ZFA list is proper.

Equations
def lists.of_list {α : Type u_1} (l : list (lists α)) :

Converts a list of ZFA lists to a ZFA list.

Equations
theorem lists.is_list_to_list {α : Type u_1} (l : list (lists α)) :
theorem lists.to_of_list {α : Type u_1} (l : list (lists α)) :
theorem lists.of_to_list {α : Type u_1} {l : lists α} :
l.is_list
@[protected, instance]
def lists.inhabited {α : Type u_1} :
Equations
@[protected, instance]
def lists.decidable_eq {α : Type u_1} [decidable_eq α] :
Equations
@[protected, instance]
def lists.has_sizeof {α : Type u_1} [has_sizeof α] :
Equations
def lists.induction_mut {α : Type u_1} (C : Sort u_2) (D : ttSort u_3) (C0 : Π (a : α), C (lists.atom a)) (C1 : Π (l : tt), D lC (lists.of' l)) (D0 : D lists'.nil) (D1 : Π (a : lists α) (l : tt), C aD lD l)) :
pprod (Π (l : lists α), C l) (Π (l : tt), D l)

A recursion principle for pairs of ZFA lists and proper ZFA prelists.

Equations
• C0 C1 D0 D1 = λ (_x : lists α), lists.induction_mut._match_2 C D (λ (b : bool) (l : b), lists'.rec (λ (a : α), C0 a, punit.star⟩) D0, D0⟩ (λ {b : bool} (a : b) (l : tt) (IH₁ : pprod (C b, a⟩) (lists.induction_mut._match_1 D b a)) (IH₂ : pprod (C tt, l⟩) (lists.induction_mut._match_1 D tt l)), C1 (a.cons' l) (D1 b, a⟩ l IH₁.fst IH₂.snd), D1 b, a⟩ l IH₁.fst IH₂.snd⟩) l) _x, λ (l : tt), ((λ (b : bool) (l : b), lists'.rec (λ (a : α), C0 a, punit.star⟩) D0, D0⟩ (λ {b : bool} (a : b) (l : tt) (IH₁ : pprod (C b, a⟩) (lists.induction_mut._match_1 D b a)) (IH₂ : pprod (C tt, l⟩) (lists.induction_mut._match_1 D tt l)), C1 (a.cons' l) (D1 b, a⟩ l IH₁.fst IH₂.snd), D1 b, a⟩ l IH₁.fst IH₂.snd⟩) l) tt l).snd
• lists.induction_mut._match_2 C D this b, l⟩ = (this l).fst
• lists.induction_mut._match_1 D tt l = D l
• lists.induction_mut._match_1 D ff l = punit
def lists.mem {α : Type u_1} (a : lists α) :
→ 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
@[protected, instance]
def lists.has_mem {α : Type u_1} :
has_mem (lists α) (lists α)
Equations
theorem lists.is_list_of_mem {α : Type u_1} {a l : lists α} :
a l → l.is_list
theorem lists.equiv_atom {α : Type u_1} {a : α} {l : lists α} :
(lists.atom a).equiv l = l
@[protected, instance]
def lists.setoid {α : Type u_1} :
Equations
theorem lists.sizeof_pos {α : Type u_1} {b : bool} (l : b) :
0 <
theorem lists.lt_sizeof_cons' {α : Type u_1} {b : bool} (a : b) (l : tt) :
sizeof b, a⟩ < sizeof (a.cons' l)
@[instance]
def lists.mem.decidable {α : Type u_1} [decidable_eq α] (a : lists α) (l : tt) :
Equations
@[instance]
def lists.subset.decidable {α : Type u_1} [decidable_eq α] (l₁ l₂ : tt) :
decidable (l₁ l₂)
Equations
theorem lists'.mem_equiv_left {α : Type u_1} {l : tt} {a a' : lists α} :
a.equiv a'(a l a' l)
theorem lists'.mem_of_subset {α : Type u_1} {a : lists α} {l₁ l₂ : tt} (s : l₁ l₂) :
a l₁a l₂
def finsets (α : Type u_1) :
Type u_1
Equations
@[protected, instance]
def finsets.has_emptyc {α : Type u_1} :
Equations
@[protected, instance]
def finsets.inhabited {α : Type u_1} :
Equations
@[protected, instance]
def finsets.decidable_eq {α : Type u_1} [decidable_eq α] :
Equations