|
1 | 1 | module |
2 | 2 |
|
3 | | -public import Foundation.FirstOrder.SetTheory.Z |
| 3 | +public import Foundation.FirstOrder.SetTheory.ZF |
4 | 4 |
|
5 | 5 | @[expose] public section |
6 | 6 | /-! |
@@ -402,6 +402,25 @@ lemma value_mem_range {f x : V} {X Y : V} (hf : f ∈ Y ^ X) (hx : x ∈ X) : f |
402 | 402 | constructor <;> intro h <;> grind |
403 | 403 | grind |
404 | 404 |
|
| 405 | +namespace IsFunction |
| 406 | + |
| 407 | +lemma value_eq_of_kpair_mem (f x y : V) [IsFunction f] (hxy : ⟨x, y⟩ₖ ∈ f) : |
| 408 | + f ‘ x = y := by |
| 409 | + ext z |
| 410 | + constructor |
| 411 | + · intro hz |
| 412 | + rcases show z ∈ ⋃ˢ range f ∧ ∃ y', z ∈ y' ∧ ⟨x, y'⟩ₖ ∈ f by |
| 413 | + simpa [value, mem_sep_iff] using hz with |
| 414 | + ⟨-, y', hzy', hxy'⟩ |
| 415 | + have : y' = y := IsFunction.unique hxy' hxy |
| 416 | + simpa [this] using hzy' |
| 417 | + · intro hzy |
| 418 | + have hyR : y ∈ range f := mem_range_of_kpair_mem hxy |
| 419 | + have hzU : z ∈ ⋃ˢ range f := mem_sUnion_iff.mpr ⟨y, hyR, hzy⟩ |
| 420 | + exact mem_sep_iff.mpr ⟨hzU, y, hzy, hxy⟩ |
| 421 | + |
| 422 | +end IsFunction |
| 423 | + |
405 | 424 | /-- Restricting the domain of a relation -/ |
406 | 425 | noncomputable def restrict (R A : V) : V := R ∩ (A ×ˢ range R) |
407 | 426 |
|
@@ -472,15 +491,37 @@ lemma domain_restrict_eq (R A : V) : domain (R ↾ A) = domain R ∩ A := by |
472 | 491 | ⟨x, y⟩ₖ ∈ (R ↾ A) ↔ ⟨x, y⟩ₖ ∈ R ∧ x ∈ A := by |
473 | 492 | simp [mem_restrict_iff] |
474 | 493 |
|
475 | | -lemma restrict_restrict_of_subset {R A B : V} (h : B ⊆ A) : (R ↾ A) ↾ B = R ↾ B := by |
| 494 | +lemma restrict_restrict_eq_restrict_inter (R A B : V) : (R ↾ A) ↾ B = R ↾ (A ∩ B) := by |
476 | 495 | ext p |
477 | | - simp only [mem_restrict_iff] |
| 496 | + simp only [mem_restrict_iff, mem_inter_iff] |
478 | 497 | constructor |
479 | | - · rintro ⟨⟨hpR, x, _, y, rfl⟩, x', hx'B, y', hxy⟩ |
| 498 | + · rintro ⟨⟨hpR, x, hxA, y, rfl⟩, x', hx'B, y', hxy⟩ |
480 | 499 | rcases kpair_inj hxy with ⟨rfl, rfl⟩ |
481 | | - exact ⟨hpR, x, hx'B, y, rfl⟩ |
482 | | - · rintro ⟨hpR, x, hxB, y, rfl⟩ |
483 | | - exact ⟨⟨hpR, x, h x hxB, y, rfl⟩, x, hxB, y, rfl⟩ |
| 500 | + exact ⟨hpR, x, ⟨hxA, hx'B⟩, y, rfl⟩ |
| 501 | + · rintro ⟨hpR, x, hxAB, y, rfl⟩ |
| 502 | + exact ⟨⟨hpR, x, hxAB.1, y, rfl⟩, x, hxAB.2, y, rfl⟩ |
| 503 | + |
| 504 | +lemma restrict_restrict_of_subset {R A B : V} (h : B ⊆ A) : (R ↾ A) ↾ B = R ↾ B := by |
| 505 | + simpa [inter_eq_right_of_subset h] using restrict_restrict_eq_restrict_inter R A B |
| 506 | + |
| 507 | +/-- |
| 508 | +Restricting an inserted relation to a set that does not contain the inserted first coordinate |
| 509 | +recovers the original restriction. |
| 510 | +-/ |
| 511 | +lemma restrict_insert_kpair_eq_restrict_of_not_mem |
| 512 | + {f x y A : V} (hxA : x ∉ A) : |
| 513 | + (insert ⟨x, y⟩ₖ f) ↾ A = f ↾ A := by |
| 514 | + ext p |
| 515 | + constructor |
| 516 | + · intro hp |
| 517 | + rcases mem_restrict_iff.mp hp with ⟨hp', a, haA, b, rfl⟩ |
| 518 | + rcases show ⟨a, b⟩ₖ = ⟨x, y⟩ₖ ∨ ⟨a, b⟩ₖ ∈ f by simpa using hp' with (hxy | hf) |
| 519 | + · rcases kpair_inj hxy with ⟨rfl, rfl⟩ |
| 520 | + exact (hxA haA).elim |
| 521 | + · exact mem_restrict_iff.mpr ⟨hf, a, haA, b, rfl⟩ |
| 522 | + · intro hp |
| 523 | + rcases mem_restrict_iff.mp hp with ⟨hf, a, haA, b, rfl⟩ |
| 524 | + exact mem_restrict_iff.mpr ⟨by simp [hf], a, haA, b, rfl⟩ |
484 | 525 |
|
485 | 526 | /-- Image of a set under a relation -/ |
486 | 527 | noncomputable def image (R A : V) : V := range (restrict R A) |
@@ -563,6 +604,26 @@ lemma replacement_graph_exists_on [V ⊧ₘ* 𝗭𝗙] (X : V) (R : V → V → |
563 | 604 | exact (hfun x hxX).unique hR₁ hR₀ |
564 | 605 | refine ⟨f, IsFunction.of_mem hfunc_mem, hdomain, hgraph⟩ |
565 | 606 |
|
| 607 | +/-- |
| 608 | +Graph construction from a definable unary function on a fixed set `X`. |
| 609 | +-/ |
| 610 | +lemma replacement_graph_exists_on_of_definableFunction [V ⊧ₘ* 𝗭𝗙] |
| 611 | + (X : V) (F : V → V) (hFdef : ℒₛₑₜ-function₁[V] F) : |
| 612 | + ∃ f : V, IsFunction f ∧ domain f = X ∧ |
| 613 | + ∀ x ∈ X, ∀ y, ⟨x, y⟩ₖ ∈ f ↔ y = F x := by |
| 614 | + let R : V → V → Prop := fun x y ↦ Function.Graph F y x |
| 615 | + have hR : ℒₛₑₜ-relation[V] R := by |
| 616 | + letI : ℒₛₑₜ-function₁[V] F := hFdef |
| 617 | + change ℒₛₑₜ-relation[V] (fun x y ↦ Function.Graph F y x) |
| 618 | + definability |
| 619 | + have hfun : ∀ x : V, x ∈ X → ∃! y : V, R x y := by |
| 620 | + intro x _ |
| 621 | + simpa [R] using functionGraph_functionLike F x |
| 622 | + rcases replacement_graph_exists_on (X := X) R hR hfun with ⟨f, hf, hdf, hgraph⟩ |
| 623 | + refine ⟨f, hf, hdf, ?_⟩ |
| 624 | + intro x hx y |
| 625 | + simpa [R, Function.Graph] using hgraph x hx y |
| 626 | + |
566 | 627 | /-! ### Cardinality comparison -/ |
567 | 628 |
|
568 | 629 | @[simp] lemma kpair_mem_sUnion_iff {C x y : V} : |
|
0 commit comments