Аналіз I, Глава 3.1

У цій главі ми пропонуємо версію теорії множин Цермело-Франкеля (з атомами), яка намагається максимально точно наслідувати оригінальний тексту Аналізу I, Глава 3.1. Вся нумерація посилається на оригінальний текст.

Я (пр.перекл. Терренс Тао) намагався зробити переклад якомога точнішим перефразуванням оригінального тексту. Коли є вибір між більш ідіоматичним рішенням Lean та більш точним перекладом, я зазвичай обирав останній. Зокрема, будуть місця, де код Lean можна було б "підбуцнути", щоб зробити його більш елегантним та ідіоматичним, але я свідомо уникав цього вибору.

Основні конструкції та результати цього розділу:

Інші аксіоми теорії множин Цермело-Френкеля обговорюються в наступних розділах.

Деякі технічні зауваження:

namespace Chapter3

Деякі аксіоми теорії Цермело-Франкеля з атомами

class SetTheory where Set : Type -- Аксіома 3.1 Object : Type -- Аксіома 3.1 set_to_object : Set Object -- Аксіома 3.1 mem : Object Set Prop -- Аксіома 3.1 extensionality X Y : ( x, mem x X mem x Y) X = Y -- Аксіома 3.2 emptyset: Set -- Аксіома 3.3 emptyset_mem x : ¬ mem x emptyset -- Аксіома 3.3 singleton : Object Set -- Аксіома 3.4 singleton_axiom x y : mem x (singleton y) x = y -- Аксіома 3.4 union_pair : Set Set Set -- Аксіома 3.5 union_pair_axiom X Y x : mem x (union_pair X Y) (mem x X mem x Y) -- Аксіома 3.5 specify A (P: Subtype (mem . A) Prop) : Set -- Аксіома 3.6 specification_axiom A (P: Subtype (mem . A) Prop) : ( x, mem x (specify A P) mem x A) x, mem x.val (specify A P) P x -- Аксіома 3.6 replace A (P: Subtype (mem . A) Object Prop) (hP: x y y', P x y P x y' y = y') : Set -- Аксіома 3.7 replacement_axiom A (P: Subtype (mem . A) Object Prop) (hP: x y y', P x y P x y' y = y') : y, mem y (replace A P hP) x, P x y -- Аксіома 3.7 nat : Set -- Аксіома 3.8 nat_equiv : Subtype (mem . nat) -- Аксіома 3.8 regularity_axiom A (hA : x, mem x A) : x, mem x A S, x = set_to_object S ¬ y, mem y A mem y S -- Аксіома 3.9 pow : Set Set Set -- Аксіома 3.11 function_to_object (X: Set) (Y: Set) : (Subtype (mem . X) Subtype (mem . Y)) Object -- Аксіома 3.11 power_set_axiom (X: Set) (Y: Set) (F:Object) : mem F (pow X Y) f: Subtype (mem . Y) Subtype (mem . X), function_to_object Y X f = F -- Аксіома 3.11 union : Set Set -- Аксіома 3.12 union_axiom A x : mem x (union A) S, mem x S mem (set_to_object S) A -- Аксіома 3.12
export SetTheory (Set Object)-- Цей екземпляр неявно нав'язує (деякі) аксіоми теорії множин Цермело-Френкеля з атомами. variable [SetTheory]

Визначення 3.1.1 (об'єкти можуть бути елементами множин)

instance objects_mem_sets : Membership Object Set where mem X x := SetTheory.mem x X

Аксіома 3.1 (Множини це об'єкти)

instance sets_are_objects : Coe Set Object where coe X := SetTheory.set_to_object X
abbrev SetTheory.Set.toObject (X:Set) : Object := X

Аксіома 3.1 (Множини це об'єкти)

theorem SetTheory.Set.coe_eq {X Y:Set} (h: X.toObject = Y.toObject) : X = Y := SetTheory.set_to_object.inj' h

Аксіома 3.1 (Множини це об'єкти)

@[simp] theorem SetTheory.Set.coe_eq_iff (X Y:Set) : X.toObject = Y.toObject X = Y := inst✝:SetTheoryX:SetY:SetX.toObject = Y.toObject X = Y inst✝:SetTheoryX:SetY:SetX.toObject = Y.toObject X = Yinst✝:SetTheoryX:SetY:SetX = Y X.toObject = Y.toObject inst✝:SetTheoryX:SetY:SetX.toObject = Y.toObject X = Y All goals completed! 🐙 inst✝:SetTheoryX:SetY:Seth:X = YX.toObject = Y.toObject; inst✝:SetTheoryX:SetX.toObject = X.toObject; All goals completed! 🐙

Аксіома 3.2 (Рівність множин)

abbrev SetTheory.Set.ext {X Y:Set} (h: x, x X x Y) : X = Y := SetTheory.extensionality _ _ h

Аксіома 3.2 (Рівність множин)

theorem SetTheory.Set.ext_iff (X Y: Set) : X = Y x, x X x Y := inst✝:SetTheoryX:SetY:SetX = Y (x : Object), x X x Y inst✝:SetTheoryX:SetY:SetX = Y (x : Object), x X x Yinst✝:SetTheoryX:SetY:Set(∀ (x : Object), x X x Y) X = Y inst✝:SetTheoryX:SetY:SetX = Y (x : Object), x X x Y inst✝:SetTheoryX:SetY:Seth:X = Y (x : Object), x X x Y; inst✝:SetTheoryX:Set (x : Object), x X x X; All goals completed! 🐙 inst✝:SetTheoryX:SetY:Set(∀ (x : Object), x X x Y) X = Y inst✝:SetTheoryX:SetY:Seth: (x : Object), x X x YX = Y; inst✝:SetTheoryX:SetY:Seth: (x : Object), x X x Y (x : Object), x X x Y; All goals completed! 🐙
instance SetTheory.Set.instEmpty : EmptyCollection Set where emptyCollection := SetTheory.emptyset

Axiom 3.3 (порожня множина). Примітка: можливо, доведеться явно перетворити ∅ на Set через існуючу нотацію теорії множин Mathlib.

@[simp] theorem SetTheory.Set.not_mem_empty : x, x (:Set) := SetTheory.emptyset_mem

Порожня множина не має елементів

theorem declaration uses 'sorry'SetTheory.Set.eq_empty_iff_forall_notMem {X:Set} : X = ( x, x X) := inst✝:SetTheoryX:SetX = (x : Object), x X All goals completed! 🐙

Порожня множина унікальна

theorem declaration uses 'sorry'SetTheory.Set.empty_unique : ∃! (X:Set), x, x X := inst✝:SetTheory∃! X, (x : Object), x X All goals completed! 🐙

Лема 3.1.5 (Одиничний вибір)

lemma SetTheory.Set.nonempty_def {X:Set} (h: X ) : x, x X := inst✝:SetTheoryX:Seth:X x, x X -- цей доказ написан так, щоб співпадати із структурою орігінального тексту. inst✝:SetTheoryX:Seth:X this: (x : Object), x XFalse have claim (x:Object) : x X x (:Set) := inst✝:SetTheoryX:Seth:X x, x X All goals completed! 🐙 inst✝:SetTheoryX:Seth:X this: (x : Object), x Xclaim:X = False All goals completed! 🐙
theorem SetTheory.Set.nonempty_of_inhabited {X:Set} {x:Object} (h:x X) : X := inst✝:SetTheoryX:Setx:Objecth:x XX inst✝:SetTheoryX:Setx:Objecth:X = x X inst✝:SetTheoryX:Setx:Objecth: (x : Object), x Xx X All goals completed! 🐙instance SetTheory.Set.instSingleton : Singleton Object Set where singleton := SetTheory.singleton

Axiom 3.3(a) (сінглтон). Зверніть увагу, що, можливо, доведеться явно перетворити {a} на Set через існуючу нотацію теорії множин Mathlib.

@[simp] theorem SetTheory.Set.mem_singleton (x a:Object) : x ({a}:Set) x = a := inst✝:SetTheoryx:Objecta:Objectx {a} x = a All goals completed! 🐙
instance SetTheory.Set.instUnion : Union Set where union := SetTheory.union_pair

Аксіома 3.4 (Попарне об'єднання)

@[simp] theorem SetTheory.Set.mem_union (x:Object) (X Y:Set) : x (X Y) (x X x Y) := SetTheory.union_pair_axiom X Y x
instance SetTheory.Set.instInsert : Insert Object Set where insert x X := {x} X

Аксіома 3.3(b) (пара). Зверніть увагу, що часто доводиться перетворювати {a,b} на Set

theorem SetTheory.Set.pair_eq (a b:Object) : ({a,b}:Set) = {a} {b} := inst✝:SetTheorya:Objectb:Object{a, b} = {a} {b} All goals completed! 🐙

Аксіома 3.3(b) (пара). Зверніть увагу, що часто доводиться перетворювати {a,b} на Set

@[simp] theorem SetTheory.Set.mem_pair (x a b:Object) : x ({a,b}:Set) (x = a x = b) := inst✝:SetTheoryx:Objecta:Objectb:Objectx {a, b} x = a x = b All goals completed! 🐙
@[simp] theorem SetTheory.Set.mem_triple (x a b:Object) : x ({a,b,c}:Set) (x = a x = b x = c) := inst✝:SetTheoryc:Objectx:Objecta:Objectb:Objectx {a, b, c} x = a x = b x = c All goals completed! 🐙

Ремарка 3.1.8

theorem declaration uses 'sorry'SetTheory.Set.singleton_uniq (a:Object) : ∃! (X:Set), x, x X x = a := inst✝:SetTheorya:Object∃! X, (x : Object), x X x = a All goals completed! 🐙

Ремарка 3.1.8

theorem declaration uses 'sorry'SetTheory.Set.pair_uniq (a b:Object) : ∃! (X:Set), x, x X x = a x = b := inst✝:SetTheorya:Objectb:Object∃! X, (x : Object), x X x = a x = b All goals completed! 🐙

Ремарка 3.1.8

theorem declaration uses 'sorry'SetTheory.Set.pair_comm (a b:Object) : ({a,b}:Set) = {b,a} := inst✝:SetTheorya:Objectb:Object{a, b} = {b, a} All goals completed! 🐙

Ремарка 3.1.8

theorem declaration uses 'sorry'SetTheory.Set.pair_self (a:Object) : ({a,a}:Set) = {a} := inst✝:SetTheorya:Object{a, a} = {a} All goals completed! 🐙

Вправа 3.1.1

theorem declaration uses 'sorry'SetTheory.Set.pair_eq_pair {a b c d:Object} (h: ({a,b}:Set) = {c,d}) : a = c b = d a = d b = c := inst✝:SetTheorya:Objectb:Objectc:Objectd:Objecth:{a, b} = {c, d}a = c b = d a = d b = c All goals completed! 🐙
abbrev SetTheory.Set.empty : Set := abbrev SetTheory.Set.singleton_empty : Set := {empty.toObject}abbrev SetTheory.Set.pair_empty : Set := {empty.toObject, singleton_empty.toObject}

Вправа 3.1.2

theorem declaration uses 'sorry'SetTheory.Set.emptyset_neq_singleton : empty singleton_empty := inst✝:SetTheoryempty singleton_empty All goals completed! 🐙

Вправа 3.1.2

theorem declaration uses 'sorry'SetTheory.Set.emptyset_neq_pair : empty pair_empty := inst✝:SetTheoryempty pair_empty All goals completed! 🐙

Вправа 3.1.2

theorem declaration uses 'sorry'SetTheory.Set.singleton_empty_neq_pair : singleton_empty pair_empty := inst✝:SetTheorysingleton_empty pair_empty All goals completed! 🐙

Ремарка 3.1.11. (Ці результати можна довести або прямим переписуванням, або за допомогою екстенсіональності.)

theorem declaration uses 'sorry'SetTheory.Set.union_congr_left (A A' B:Set) (h: A = A') : A B = A' B := inst✝:SetTheoryA:SetA':SetB:Seth:A = A'A B = A' B All goals completed! 🐙

Ремарка 3.1.11. (Ці результати можна довести або прямим переписуванням, або за допомогою екстенсіональності.)

theorem declaration uses 'sorry'SetTheory.Set.union_congr_right (A B B':Set) (h: B = B') : A B = A B' := inst✝:SetTheoryA:SetB:SetB':Seth:B = B'A B = A B' All goals completed! 🐙

Лема 3.1.12 (Основні властивості об'єднань) / Вправа 3.1.3

theorem declaration uses 'sorry'SetTheory.Set.singleton_union_singleton (a b:Object) : ({a}:Set) ({b}:Set) = {a,b} := inst✝:SetTheorya:Objectb:Object{a} {b} = {a, b} All goals completed! 🐙

Лема 3.1.12 (Основні властивості об'єднань) / Вправа 3.1.3

theorem declaration uses 'sorry'SetTheory.Set.union_comm (A B:Set) : A B = B A := inst✝:SetTheoryA:SetB:SetA B = B A All goals completed! 🐙

Лема 3.1.12 (Основні властивості об'єднань) / Вправа 3.1.3

theorem declaration uses 'sorry'SetTheory.Set.union_assoc (A B C:Set) : (A B) C = A (B C) := inst✝:SetTheoryA:SetB:SetC:SetA B C = A (B C) -- цей доказ написан так, щоб співпадати із структурою орігінального тексту. inst✝:SetTheoryA:SetB:SetC:Set (x : Object), x A B C x A (B C) inst✝:SetTheoryA:SetB:SetC:Setx:Objectx A B C x A (B C) inst✝:SetTheoryA:SetB:SetC:Setx:Objectx A B C x A (B C)inst✝:SetTheoryA:SetB:SetC:Setx:Objectx A (B C) x A B C inst✝:SetTheoryA:SetB:SetC:Setx:Objectx A B C x A (B C) inst✝:SetTheoryA:SetB:SetC:Setx:Objecthx:x A B Cx A (B C) inst✝:SetTheoryA:SetB:SetC:Setx:Objecthx:x A B x Cx A (B C) inst✝:SetTheoryA:SetB:SetC:Setx:Objectcase1:x A Bx A (B C)inst✝:SetTheoryA:SetB:SetC:Setx:Objectcase2:x Cx A (B C) inst✝:SetTheoryA:SetB:SetC:Setx:Objectcase1:x A Bx A (B C) inst✝:SetTheoryA:SetB:SetC:Setx:Objectcase1:x A x Bx A (B C) inst✝:SetTheoryA:SetB:SetC:Setx:Objectcase1a:x Ax A (B C)inst✝:SetTheoryA:SetB:SetC:Setx:Objectcase1b:x Bx A (B C) inst✝:SetTheoryA:SetB:SetC:Setx:Objectcase1a:x Ax A (B C) inst✝:SetTheoryA:SetB:SetC:Setx:Objectcase1a:x Ax A x B C; All goals completed! 🐙 have : x B C := inst✝:SetTheoryA:SetB:SetC:SetA B C = A (B C) inst✝:SetTheoryA:SetB:SetC:Setx:Objectcase1b:x Bx B x C; All goals completed! 🐙 inst✝:SetTheoryA:SetB:SetC:Setx:Objectcase1b:x Bthis:x B Cx A x B C; All goals completed! 🐙 have : x B C := inst✝:SetTheoryA:SetB:SetC:SetA B C = A (B C) inst✝:SetTheoryA:SetB:SetC:Setx:Objectcase2:x Cx B x C; All goals completed! 🐙 inst✝:SetTheoryA:SetB:SetC:Setx:Objectcase2:x Cthis:x B Cx A x B C; All goals completed! 🐙 All goals completed! 🐙

Твердження 3.1.27(c)

theorem declaration uses 'sorry'SetTheory.Set.union_self (A:Set) : A A = A := inst✝:SetTheoryA:SetA A = A All goals completed! 🐙

Твердження 3.1.27(a)

theorem declaration uses 'sorry'SetTheory.Set.union_empty (A:Set) : A = A := inst✝:SetTheoryA:SetA = A All goals completed! 🐙

Твердження 3.1.27(a)

theorem declaration uses 'sorry'SetTheory.Set.empty_union (A:Set) : A = A := inst✝:SetTheoryA:Set A = A All goals completed! 🐙
theorem SetTheory.Set.triple_eq (a b c:Object) : {a,b,c} = ({a}:Set) {b,c} := inst✝:SetTheorya:Objectb:Objectc:Object{a, b, c} = {a} {b, c} All goals completed! 🐙

Приклад 3.1.10

theorem declaration uses 'sorry'SetTheory.Set.pair_union_pair (a b c:Object) : ({a,b}:Set) {b,c} = {a,b,c} := sorry

Визначення 3.1.14.

instance SetTheory.Set.instSubset : HasSubset Set where Subset X Y := x, x X x Y

Визначення 3.1.14. Зверніть увагу, що операція строгої підмножини в Mathlib позначається , а не .

instance SetTheory.Set.instSSubset : HasSSubset Set where SSubset X Y := X Y X Y

Визначення 3.1.14.

theorem SetTheory.Set.subset_def (X Y:Set) : X Y x, x X x Y := inst✝:SetTheoryX:SetY:SetX Y x X, x Y All goals completed! 🐙

Визначення 3.1.14. Зверніть увагу, що операція строгої підмножини в Mathlib позначається , а не .

theorem SetTheory.Set.ssubset_def (X Y:Set) : X Y (X Y X Y) := inst✝:SetTheoryX:SetY:SetX Y X Y X Y All goals completed! 🐙

Ремарка 3.1.15

theorem declaration uses 'sorry'SetTheory.Set.subset_congr_left {A A' B:Set} (hAA':A = A') (hAB: A B) : A' B := inst✝:SetTheoryA:SetA':SetB:SethAA':A = A'hAB:A BA' B All goals completed! 🐙

Приклади 3.1.16

theorem declaration uses 'sorry'SetTheory.Set.subset_self (A:Set) : A A := inst✝:SetTheoryA:SetA A All goals completed! 🐙

Приклади 3.1.16

theorem declaration uses 'sorry'SetTheory.Set.empty_subset (A:Set) : A := inst✝:SetTheoryA:Set A All goals completed! 🐙

Твердження 3.1.17 (Часткове впорядкування через підмножини)

theorem SetTheory.Set.subset_trans {A B C:Set} (hAB:A B) (hBC:B C) : A C := inst✝:SetTheoryA:SetB:SetC:SethAB:A BhBC:B CA C -- цей доказ написан так, щоб співпадати із структурою орігінального тексту. inst✝:SetTheoryA:SetB:SetC:SethAB:A BhBC:B C x A, x C inst✝:SetTheoryA:SetB:SetC:SethAB:A BhBC:B Cx:Objecthx:x Ax C inst✝:SetTheoryA:SetB:SetC:SethAB: x A, x BhBC:B Cx:Objecthx:x Ax C inst✝:SetTheoryA:SetB:SetC:SethAB: x A, x BhBC:B Cx:Objecthx:x Bx C inst✝:SetTheoryA:SetB:SetC:SethAB: x A, x BhBC:B Cx:Objecthx:x Cx C All goals completed! 🐙

Твердження 3.1.17 (Часткове впорядкування через підмножини)

theorem declaration uses 'sorry'SetTheory.Set.subset_antisymm (A B:Set) (hAB:A B) (hBA:B A) : A = B := inst✝:SetTheoryA:SetB:SethAB:A BhBA:B AA = B All goals completed! 🐙

Твердження 3.1.17 (Часткове впорядкування через підмножини)

theorem declaration uses 'sorry'SetTheory.Set.ssubset_trans (A B C:Set) (hAB:A B) (hBC:B C) : A C := inst✝:SetTheoryA:SetB:SetC:SethAB:A BhBC:B CA C All goals completed! 🐙

This defines the subtype unknown identifier 'A.toSubtype'A.toSubtype for any . To produce an element unknown identifier 'x''x' of this subtype, use invalid constructor ⟨...⟩, expected type must be an inductive type ?m.54738 x, hx , where and . The object unknown identifier 'x'x associated to a subtype element unknown identifier 'x''x' is recovered as unknown identifier 'x.val'x.val, and the property unknown identifier 'hx'hx that unknown identifier 'x'x belongs to unknown identifier 'A'A is recovered as unknown identifier 'x.property'x.property Це визначає підтип unknown identifier 'A.toSubtype'A.toSubtype для будь-якого . Щоб створити елемент unknown identifier 'x''x' цього підтипу, використовуйте invalid constructor ⟨...⟩, expected type must be an inductive type ?m.54738 x, hx , де та . Об'єкт unknown identifier 'x'x, пов'язаний з елементом підтипу unknown identifier 'x''x', відновлюється як unknown identifier 'x.val'x.val, а властивість unknown identifier 'hx'hx, що unknown identifier 'x'x належить unknown identifier 'A'A, відновлюється як unknown identifier 'x.property'x.property.

abbrev SetTheory.Set.toSubtype (A:Set) := Subtype (fun x x A)
instance : CoeSort (Set) (Type) where coe A := A.toSubtype

Елементи множини (неявно приведені до підтипу) також є елементами множини (щодо операції належності теорії множин).

lemma SetTheory.Set.subtype_property (A:Set) (x:A) : x.val A := x.property
lemma SetTheory.Set.subtype_coe (A:Set) (x:A) : x.val = x := rfllemma SetTheory.Set.coe_inj (A:Set) (x y:A) : x.val = y.val x = y := Subtype.coe_inj

Якщо є доказ unknown identifier 'hx'hx для unknown identifier 'x'sorry ∈ sorry : Propx unknown identifier 'A'A, тоді unknown identifier 'A.subtype_mk'A.subtype_mk hx зробить елемент unknown identifier 'A'A (розглядаємий як підтип) відповідним unknown identifier 'x'x.

def SetTheory.Set.subtype_mk (A:Set) {x:Object} (hx:x A) : A := x, hx
lemma SetTheory.Set.subtype_mk_coe {A:Set} {x:Object} (hx:x A) : A.subtype_mk hx = x := inst✝:SetTheoryA:Setx:Objecthx:x A(A.subtype_mk hx) = x All goals completed! 🐙abbrev SetTheory.Set.specify (A:Set) (P: A Prop) : Set := SetTheory.specify A P

Аксіома 3.6 (аксіома виділення)

theorem SetTheory.Set.specification_axiom {A:Set} {P: A Prop} {x:Object} (h: x A.specify P) : x A := (SetTheory.specification_axiom A P).1 x h

Аксіома 3.6 (аксіома виділення)

theorem SetTheory.Set.specification_axiom' {A:Set} (P: A Prop) (x:A.toSubtype) : x.val A.specify P P x := (SetTheory.specification_axiom A P).2 x

Аксіома 3.6 (аксіома виділення)

theorem SetTheory.Set.specification_axiom'' {A:Set} (P: A Prop) (x:Object) : x A.specify P h:x A, P x, h := inst✝:SetTheoryA:SetP:A.toSubtype Propx:Objectx A.specify P (h : x A), P x, h inst✝:SetTheoryA:SetP:A.toSubtype Propx:Objectx A.specify P (h : x A), P x, hinst✝:SetTheoryA:SetP:A.toSubtype Propx:Object(∃ (h : x A), P x, h) x A.specify P inst✝:SetTheoryA:SetP:A.toSubtype Propx:Objectx A.specify P (h : x A), P x, h inst✝:SetTheoryA:SetP:A.toSubtype Propx:Objecth:x A.specify P (h : x A), P x, h inst✝:SetTheoryA:SetP:A.toSubtype Propx:Objecth:x A.specify Ph':x A (h : x A), P x, h inst✝:SetTheoryA:SetP:A.toSubtype Propx:Objecth:x A.specify Ph':x AP x, h' inst✝:SetTheoryA:SetP:A.toSubtype Propx:Objecth:x A.specify Ph':x Ax, h' A.specify P All goals completed! 🐙 inst✝:SetTheoryA:SetP:A.toSubtype Propx:Objecth: (h : x A), P x, hx A.specify P inst✝:SetTheoryA:SetP:A.toSubtype Propx:Objecth:x AhP:P x, hx A.specify P inst✝:SetTheoryA:SetP:A.toSubtype Propx:Objecth:x AhP:x, h A.specify Px A.specify P inst✝:SetTheoryA:SetP:A.toSubtype Propx:Objecth:x AhP:x A.specify Px A.specify P; All goals completed! 🐙
theorem declaration uses 'sorry'SetTheory.Set.specify_subset {A:Set} (P: A Prop) : A.specify P A := inst✝:SetTheoryA:SetP:A.toSubtype PropA.specify P A All goals completed! 🐙

Ця вправа може вимагати певного розуміння того, як підтипи реалізовані в Lean.

theorem declaration uses 'sorry'SetTheory.Set.specify_congr {A A':Set} (hAA':A = A') {P: A Prop} {P': A' Prop} (hPP': (x:Object) (h:x A) (h':x A') P x, h P' x, h' ) : A.specify P = A'.specify P' := inst✝:SetTheoryA:SetA':SethAA':A = A'P:A.toSubtype PropP':A'.toSubtype ProphPP': (x : Object) (h : x A) (h' : x A'), P x, h P' x, h'A.specify P = A'.specify P' All goals completed! 🐙
instance SetTheory.Set.instIntersection : Inter Set where inter X Y := X.specify (fun x x.val Y)

Визначення 3.1.22 (Перетин)

@[simp] theorem SetTheory.Set.mem_inter (x:Object) (X Y:Set) : x (X Y) (x X x Y) := inst✝:SetTheoryx:ObjectX:SetY:Setx X Y x X x Y inst✝:SetTheoryx:ObjectX:SetY:Setx X Y x X x Yinst✝:SetTheoryx:ObjectX:SetY:Setx X x Y x X Y inst✝:SetTheoryx:ObjectX:SetY:Setx X Y x X x Y inst✝:SetTheoryx:ObjectX:SetY:Seth:x X Yx X x Y inst✝:SetTheoryx:ObjectX:SetY:Seth:x X Yh':x Xx X x Y inst✝:SetTheoryx:ObjectX:SetY:Seth:x X Yh':x Xx Y All goals completed! 🐙 inst✝:SetTheoryx:ObjectX:SetY:SethX:x XhY:x Yx X Y All goals completed! 🐙
instance SetTheory.Set.instSDiff : SDiff Set where sdiff X Y := X.specify (fun x x.val Y)

Визначення 3.1.26 (Різниця)

@[simp] theorem SetTheory.Set.mem_sdiff (x:Object) (X Y:Set) : x (X \ Y) (x X x Y) := inst✝:SetTheoryx:ObjectX:SetY:Setx X \ Y x X x Y inst✝:SetTheoryx:ObjectX:SetY:Setx X \ Y x X x Yinst✝:SetTheoryx:ObjectX:SetY:Setx X x Y x X \ Y inst✝:SetTheoryx:ObjectX:SetY:Setx X \ Y x X x Y inst✝:SetTheoryx:ObjectX:SetY:Seth:x X \ Yx X x Y inst✝:SetTheoryx:ObjectX:SetY:Seth:x X \ Yh':x Xx X x Y inst✝:SetTheoryx:ObjectX:SetY:Seth:x X \ Yh':x Xx Y All goals completed! 🐙 inst✝:SetTheoryx:ObjectX:SetY:SethX:x XhY:x Yx X \ Y All goals completed! 🐙

Твердження 3.1.27(d) / Вправа 3.1.6

theorem declaration uses 'sorry'SetTheory.Set.inter_comm (A B:Set) : A B = B A := inst✝:SetTheoryA:SetB:SetA B = B A All goals completed! 🐙

Твердження 3.1.27(b)

theorem declaration uses 'sorry'SetTheory.Set.subset_union {A X: Set} (hAX: A X) : A X = X := inst✝:SetTheoryA:SetX:SethAX:A XA X = X All goals completed! 🐙

Твердження 3.1.27(b)

theorem declaration uses 'sorry'SetTheory.Set.union_subset {A X: Set} (hAX: A X) : X A = X := inst✝:SetTheoryA:SetX:SethAX:A XX A = X All goals completed! 🐙

Твердження 3.1.27(c)

theorem declaration uses 'sorry'SetTheory.Set.inter_self (A:Set) : A A = A := inst✝:SetTheoryA:SetA A = A All goals completed! 🐙

Твердження 3.1.27(e)

theorem declaration uses 'sorry'SetTheory.Set.inter_assoc (A B C:Set) : (A B) C = A (B C) := inst✝:SetTheoryA:SetB:SetC:SetA B C = A (B C) All goals completed! 🐙

Твердження 3.1.27(f)

theorem declaration uses 'sorry'SetTheory.Set.inter_union_distrib_left (A B C:Set) : A (B C) = (A B) (A C) := sorry

Твердження 3.1.27(f)

theorem declaration uses 'sorry'SetTheory.Set.union_inter_distrib_left (A B C:Set) : A (B C) = (A B) (A C) := sorry

Твердження 3.1.27(f)

theorem declaration uses 'sorry'SetTheory.Set.union_compl {A X:Set} (hAX: A X) : A (X \ A) = X := inst✝:SetTheoryA:SetX:SethAX:A XA X \ A = X All goals completed! 🐙

Твердження 3.1.27(f)

theorem declaration uses 'sorry'SetTheory.Set.inter_compl {A X:Set} (hAX: A X) : A (X \ A) = := inst✝:SetTheoryA:SetX:SethAX:A XA (X \ A) = All goals completed! 🐙

Твердження 3.1.27(g)

theorem declaration uses 'sorry'SetTheory.Set.compl_union {A B X:Set} (hAX: A X) (hBX: B X) : X \ (A B) = (X \ A) (X \ B) := inst✝:SetTheoryA:SetB:SetX:SethAX:A XhBX:B XX \ (A B) = X \ A (X \ B) All goals completed! 🐙

Твердження 3.1.27(g)

theorem declaration uses 'sorry'SetTheory.Set.compl_inter {A B X:Set} (hAX: A X) (hBX: B X) : X \ (A B) = (X \ A) (X \ B) := inst✝:SetTheoryA:SetB:SetX:SethAX:A XhBX:B XX \ (A B) = X \ A X \ B All goals completed! 🐙

Не з підручника: множини утворюють дистрибутивну решітку.

instance declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'SetTheory.Set.instDistribLattice : DistribLattice Set where le := (· ·) le_refl := subset_self le_trans := fun _ _ _ subset_trans le_antisymm := subset_antisymm inf := (· ·) sup := (· ·) le_sup_left := inst✝:SetTheory (a b : Set), a a b All goals completed! 🐙 le_sup_right := inst✝:SetTheory (a b : Set), b a b All goals completed! 🐙 sup_le := inst✝:SetTheory (a b c : Set), a c b c a b c All goals completed! 🐙 inf_le_left := inst✝:SetTheory (a b : Set), a b a All goals completed! 🐙 inf_le_right := inst✝:SetTheory (a b : Set), a b b All goals completed! 🐙 le_inf := inst✝:SetTheory (a b c : Set), a b a c a b c All goals completed! 🐙 le_sup_inf := inst✝:SetTheory (x y z : Set), (x y) (x z) x y z inst✝:SetTheoryX:SetY:SetZ:Set(X Y) (X Z) X Y Z inst✝:SetTheoryX:SetY:SetZ:Set(X Y) (X Z) X Y Z inst✝:SetTheoryX:SetY:SetZ:SetX Y Z X Y Z All goals completed! 🐙

Множини мають мінімальний елемент.

instance SetTheory.Set.instOrderBot : OrderBot Set where bot := bot_le := empty_subset

Визначення неперетинності (з використанням попередніх прикладів)

theorem SetTheory.Set.disjoint_iff (A B:Set) : Disjoint A B A B = := inst✝:SetTheoryA:SetB:SetDisjoint A B A B = All goals completed! 🐙
abbrev SetTheory.Set.replace (A:Set) {P: A Object Prop} (hP : x y y', P x y P x y' y = y') : Set := SetTheory.replace A P hP

Аксіома 3.7 (Аксіомна схема підстановки)

theorem SetTheory.Set.replacement_axiom {A:Set} {P: A Object Prop} (hP: x y y', P x y P x y' y = y') (y:Object) : y A.replace hP x, P x y := SetTheory.replacement_axiom A P hP y
abbrev Nat := SetTheory.nat

Аксіома 3.8 (Аксіома нескінченності)

def SetTheory.Set.nat_equiv : Nat := SetTheory.nat_equiv
-- Нижче наведено деякі API для обробки приведень. Це може бути не оптимальним способом налаштування. instance SetTheory.Set.instOfNat {n:} : OfNat Nat n where ofNat := nat_equiv ninstance SetTheory.Set.instNatCast : NatCast Nat where natCast n := nat_equiv ninstance SetTheory.Set.toNat : Coe Nat where coe n := nat_equiv.symm ninstance SetTheory.Object.instNatCast : NatCast Object where natCast n := (n:Nat).valinstance SetTheory.Object.instOfNat {n:} : OfNat Object n where ofNat := ((n:Nat):Object)@[simp] lemma SetTheory.Object.ofnat_eq {n:} : ((n:Nat):Object) = (n:Object) := rfllemma SetTheory.Object.ofnat_eq' {n:} : (ofNat(n):Object) = (n:Object) := rfllemma SetTheory.Set.nat_coe_eq {n:} : (n:Nat) = OfNat.ofNat n := rfl@[simp] lemma SetTheory.Set.nat_equiv_inj (n m:) : (n:Nat) = (m:Nat) n=m := Equiv.apply_eq_iff_eq nat_equiv@[simp] lemma SetTheory.Set.nat_equiv_symm_inj (n m:Nat) : (n:) = (m:) n = m := Equiv.apply_eq_iff_eq nat_equiv.symm@[simp] theorem SetTheory.Set.ofNat_inj (n m:) : (ofNat(n) : Nat) = (ofNat(m) : Nat) ofNat(n) = ofNat(m) := inst✝:SetTheoryn:m:OfNat.ofNat n = OfNat.ofNat m OfNat.ofNat n = OfNat.ofNat m All goals completed! 🐙@[simp] theorem SetTheory.Set.ofNat_inj' (n m:) : (ofNat(n) : Object) = (ofNat(m) : Object) ofNat(n) = ofNat(m) := inst✝:SetTheoryn:m:OfNat.ofNat n = OfNat.ofNat m OfNat.ofNat n = OfNat.ofNat m inst✝:SetTheoryn:m:n = m OfNat.ofNat n = OfNat.ofNat m All goals completed! 🐙@[simp] theorem SetTheory.Object.natCast_inj (n m:) : (n : Object) = (m : Object) n = m := inst✝:SetTheoryn:m:n = m n = m All goals completed! 🐙@[simp] lemma SetTheory.Set.nat_equiv_coe_of_coe (n:) : ((n:Nat):) = n := Equiv.symm_apply_apply nat_equiv n@[simp] lemma SetTheory.Set.nat_equiv_coe_of_coe' (n:Nat) : ((n:):Nat) = n := Equiv.symm_apply_apply nat_equiv.symm nexample : (5:Nat) (3:Nat) := inst✝:SetTheory5 3 All goals completed! 🐙example : (5:Object) (3:Object) := inst✝:SetTheory5 3 All goals completed! 🐙

Приклад 3.1.16 (спрощений).

declaration uses 'sorry'example : ({3, 5}:Set) {1, 3, 5} := inst✝:SetTheory{3, 5} {1, 3, 5} All goals completed! 🐙

Приклад 3.1.17 (спрощений).

declaration uses 'sorry'example : ({3, 5}:Set).specify (fun x x.val 3) = {(5:Object)} := inst✝:SetTheory({3, 5}.specify fun x => x 3) = {5} All goals completed! 🐙

Приклад 3.1.24

declaration uses 'sorry'example : ({1, 2, 4}:Set) {2,3,4} = {2, 4} := inst✝:SetTheory{1, 2, 4} {2, 3, 4} = {2, 4} All goals completed! 🐙

Приклад 3.1.24

declaration uses 'sorry'example : ({1, 2}:Set) {3,4} = := inst✝:SetTheory{1, 2} {3, 4} = All goals completed! 🐙
declaration uses 'sorry'example : ¬ Disjoint ({1, 2, 3}:Set) {2,3,4} := inst✝:SetTheory¬Disjoint {1, 2, 3} {2, 3, 4} All goals completed! 🐙declaration uses 'sorry'example : Disjoint (:Set) := inst✝:SetTheoryDisjoint All goals completed! 🐙

Визначення 3.1.26 приклад

declaration uses 'sorry'example : ({1, 2, 3, 4}:Set) \ {2,4,6} = {1, 3} := inst✝:SetTheory{1, 2, 3, 4} \ {2, 4, 6} = {1, 3} All goals completed! 🐙

Приклад 3.1.30

declaration uses 'sorry'example : ({3,5,9}:Set).replace (P := fun x y (n:), x.val = n y = (n+1:)) (inst✝:SetTheory (x : {3, 5, 9}.toSubtype) (y y' : Object), (fun x y => n, x = n y = (n + 1)) x y (fun x y => n, x = n y = (n + 1)) x y' y = y' All goals completed! 🐙) = {4,6,10} := inst✝:SetTheory{3, 5, 9}.replace = {4, 6, 10} All goals completed! 🐙

Приклад 3.1.31

declaration uses 'sorry'example : ({3,5,9}:Set).replace (P := fun x y y=1) (inst✝:SetTheory (x : {3, 5, 9}.toSubtype) (y y' : Object), (fun x y => y = 1) x y (fun x y => y = 1) x y' y = y' All goals completed! 🐙) = {1} := inst✝:SetTheory{3, 5, 9}.replace = {1} All goals completed! 🐙

Вправа 3.1.5. Тут можна використовувати тактики unknown identifier 'tfae_have'tfae_have та unknown identifier 'tfae_finish'tfae_finish.

theorem declaration uses 'sorry'SetTheory.Set.subset_tfae (A B C:Set) : [A B, A B = B, A B = A].TFAE := inst✝:SetTheoryA:SetB:SetC:Set[A B, A B = B, A B = A].TFAE All goals completed! 🐙

Вправа 3.1.7

theorem declaration uses 'sorry'SetTheory.Set.inter_subset_left (A B:Set) : A B A := inst✝:SetTheoryA:SetB:SetA B A All goals completed! 🐙

Вправа 3.1.7

theorem declaration uses 'sorry'SetTheory.Set.inter_subset_right (A B:Set) : A B B := inst✝:SetTheoryA:SetB:SetA B B All goals completed! 🐙

Вправа 3.1.7

theorem declaration uses 'sorry'SetTheory.Set.subset_inter_iff (A B C:Set) : C A B C A C B := inst✝:SetTheoryA:SetB:SetC:SetC A B C A C B All goals completed! 🐙

Вправа 3.1.7

theorem declaration uses 'sorry'SetTheory.Set.subset_union_left (A B:Set) : A A B := inst✝:SetTheoryA:SetB:SetA A B All goals completed! 🐙

Вправа 3.1.7

theorem declaration uses 'sorry'SetTheory.Set.subset_union_right (A B:Set) : B A B := inst✝:SetTheoryA:SetB:SetB A B All goals completed! 🐙

Вправа 3.1.7

theorem declaration uses 'sorry'SetTheory.Set.union_subset_iff (A B C:Set) : A B C A C B C := inst✝:SetTheoryA:SetB:SetC:SetA B C A C B C All goals completed! 🐙

Вправа 3.1.8

theorem declaration uses 'sorry'SetTheory.Set.inter_union_cancel (A B:Set) : A (A B) = A := inst✝:SetTheoryA:SetB:SetA (A B) = A All goals completed! 🐙

Вправа 3.1.8

theorem declaration uses 'sorry'SetTheory.Set.union_inter_cancel (A B:Set) : A (A B) = A := inst✝:SetTheoryA:SetB:SetA A B = A All goals completed! 🐙

Вправа 3.1.9

theorem declaration uses 'sorry'SetTheory.Set.partition_left {A B X:Set} (h_union: A B = X) (h_inter: A B = ) : A = X \ B := inst✝:SetTheoryA:SetB:SetX:Seth_union:A B = Xh_inter:A B = A = X \ B All goals completed! 🐙

Вправа 3.1.9

theorem declaration uses 'sorry'SetTheory.Set.partition_right {A B X:Set} (h_union: A B = X) (h_inter: A B = ) : B = X \ A := inst✝:SetTheoryA:SetB:SetX:Seth_union:A B = Xh_inter:A B = B = X \ A All goals completed! 🐙

Вправа 3.1.10

theorem declaration uses 'sorry'SetTheory.Set.pairwise_disjoint (A B:Set) : Pairwise (Function.onFun Disjoint ![A \ B, A B, B \ A]) := inst✝:SetTheoryA:SetB:SetPairwise (Function.onFun Disjoint ![A \ B, A B, B \ A]) All goals completed! 🐙

Вправа 3.1.10

theorem declaration uses 'sorry'SetTheory.Set.union_eq_partition (A B:Set) : A B = (A \ B) (A B) (B \ A) := inst✝:SetTheoryA:SetB:SetA B = A \ B A B B \ A All goals completed! 🐙

Вправа 3.1.11. Завдання полягає в тому, щоб довести це без використання unknown constant 'Set.specify'Set.specify, unknown constant 'Set.specification_axiom'Set.specification_axiom або unknown constant 'Set.specification_axiom'Set.specification_axiom.

theorem declaration uses 'sorry'SetTheory.Set.specification_from_replacement {A:Set} {P: A Prop} : B, B A x, x.val B P x := inst✝:SetTheoryA:SetP:A.toSubtype Prop B A, (x : A.toSubtype), x B P x All goals completed! 🐙

Вправа 3.1.12.

theorem declaration uses 'sorry'SetTheory.Set.subset_union_subset {A B A' B':Set} (hA'A: A' A) (hB'B: B' B) : A' B' A B := inst✝:SetTheoryA:SetB:SetA':SetB':SethA'A:A' AhB'B:B' BA' B' A B All goals completed! 🐙

Вправа 3.1.12.

theorem declaration uses 'sorry'SetTheory.Set.subset_inter_subset {A B A' B':Set} (hA'A: A' A) (hB'B: B' B) : A' B' A B := inst✝:SetTheoryA:SetB:SetA':SetB':SethA'A:A' AhB'B:B' BA' B' A B All goals completed! 🐙

Вправа 3.1.12.

theorem declaration uses 'sorry'SetTheory.Set.subset_diff_subset_counter : (A B A' B':Set), (A' A) (B' B) ¬ (A' \ B') (A \ B) := inst✝:SetTheory A B A' B', A' A B' B ¬A' \ B' A \ B All goals completed! 🐙
/- Заключна частина Вправи 3.1.12: сформулюйте та доведіть обґрунтований позитивний результат заміни для вищенаведеної теореми, який включає різниці множин. -/

Вправа 3.1.13

theorem declaration uses 'sorry'SetTheory.Set.singleton_iff (A:Set) (hA: A ) : (¬ B A, B ) x, A = {x} := inst✝:SetTheoryA:SethA:A (¬ B A, B ) x, A = {x} All goals completed! 🐙
/- Тепер ми введемо зв'язки між цим поняттям множини та поняттям Mathlib. Вправа нижче ознайомить вас з API для множин Mathlib. -/ instance SetTheory.Set.inst_coe_set : Coe Set (_root_.Set Object) where coe X := { x | x X }

Ін'єктивність перетворення. Зауважте, однак, що ми НЕ стверджуємо, що перетворення є сюръєктивним (і насправді парадокс Рассела цьому перешкоджає).

@[simp] theorem SetTheory.Set.coe_inj' (X Y:Set) : (X : _root_.Set Object) = (Y : _root_.Set Object) X = Y := inst✝:SetTheoryX:SetY:Set{x | x X} = {x | x Y} X = Y inst✝:SetTheoryX:SetY:Set{x | x X} = {x | x Y} X = Yinst✝:SetTheoryX:SetY:SetX = Y {x | x X} = {x | x Y} inst✝:SetTheoryX:SetY:Set{x | x X} = {x | x Y} X = Y inst✝:SetTheoryX:SetY:Seth:{x | x X} = {x | x Y}X = Y; inst✝:SetTheoryX:SetY:Seth:{x | x X} = {x | x Y} (x : Object), x X x Y; inst✝:SetTheoryX:SetY:Seth:{x | x X} = {x | x Y}x:Objectx X x Y inst✝:SetTheoryX:SetY:Setx:Objecth:(x {x | x X}) = (x {x | x Y})x X x Y inst✝:SetTheoryX:SetY:Setx:Objecth:x X x Yx X x Y; All goals completed! 🐙 inst✝:SetTheoryX:SetY:Seth:X = Y{x | x X} = {x | x Y}; inst✝:SetTheoryX:Set{x | x X} = {x | x X}; All goals completed! 🐙

Сумісність операції належності ∈

theorem SetTheory.Set.mem_coe (X:Set) (x:Object) : x (X : _root_.Set Object) x X := inst✝:SetTheoryX:Setx:Objectx {x | x X} x X All goals completed! 🐙

Сумісність порожньої множини

theorem declaration uses 'sorry'SetTheory.Set.coe_empty : ((:Set) : _root_.Set Object) = := inst✝:SetTheory{x | x } = All goals completed! 🐙

Сумісність підмножини

theorem declaration uses 'sorry'SetTheory.Set.coe_subset (X Y:Set) : (X : _root_.Set Object) (Y : _root_.Set Object) X Y := inst✝:SetTheoryX:SetY:Set{x | x X} {x | x Y} X Y All goals completed! 🐙
theorem declaration uses 'sorry'SetTheory.Set.coe_ssubset (X Y:Set) : (X : _root_.Set Object) (Y : _root_.Set Object) X Y := inst✝:SetTheoryX:SetY:Set{x | x X} {x | x Y} X Y All goals completed! 🐙

Сумісність синглтона

theorem declaration uses 'sorry'SetTheory.Set.coe_singleton (x: Object) : ({x} : _root_.Set Object) = {x} := inst✝:SetTheoryx:Object{x} = {x} All goals completed! 🐙

Сумісність об'еднання

theorem declaration uses 'sorry'SetTheory.Set.coe_union (X Y: Set) : (X Y : _root_.Set Object) = (X : _root_.Set Object) (Y : _root_.Set Object) := inst✝:SetTheoryX:SetY:Set{x | x X} {x | x Y} = {x | x X} {x | x Y} All goals completed! 🐙

Сумісність пари

theorem declaration uses 'sorry'SetTheory.Set.coe_pair (x y: Object) : ({x, y} : _root_.Set Object) = {x, y} := inst✝:SetTheoryx:Objecty:Object{x, y} = {x, y} All goals completed! 🐙

Сумісність підтипу

theorem declaration uses 'sorry'SetTheory.Set.coe_subtype (X: Set) : (X : _root_.Set Object) = X.toSubtype := inst✝:SetTheoryX:Set{x | x X} = X.toSubtype All goals completed! 🐙

Сумісність перетину

theorem declaration uses 'sorry'SetTheory.Set.coe_intersection (X Y: Set) : (X Y : _root_.Set Object) = (X : _root_.Set Object) (Y : _root_.Set Object) := inst✝:SetTheoryX:SetY:Set{x | x X} {x | x Y} = {x | x X} {x | x Y} All goals completed! 🐙

Сумісність різниці множин

theorem declaration uses 'sorry'SetTheory.Set.coe_diff (X Y: Set) : (X \ Y : _root_.Set Object) = (X : _root_.Set Object) \ (Y : _root_.Set Object) := inst✝:SetTheoryX:SetY:Set{x | x X} \ {x | x Y} = {x | x X} \ {x | x Y} All goals completed! 🐙

Сумісність неперетинності

theorem declaration uses 'sorry'SetTheory.Set.coe_Disjoint (X Y: Set) : Disjoint (X : _root_.Set Object) (Y : _root_.Set Object) Disjoint X Y := inst✝:SetTheoryX:SetY:SetDisjoint {x | x X} {x | x Y} Disjoint X Y All goals completed! 🐙
end Chapter3