@@ -404,9 +404,9 @@ def sum_equiv_sigma_bool (α β : Sort*) : α ⊕ β ≃ (Σ b: bool, cond b α
404
404
λ s, by cases s; refl,
405
405
λ s, by rcases s with ⟨_|_, _⟩; refl⟩
406
406
407
- def equiv_fib {α β : Type *} (f : α → β) :
408
- α ≃ Σ y : β, {x // f x = y} :=
409
- ⟨λ x, ⟨f x, x, rfl⟩, λ x, x. 2 . 1 , λ x, rfl, λ ⟨y, x, rfl⟩, rfl⟩
407
+ def sigma_preimage_equiv {α β : Type *} (f : α → β) :
408
+ ( Σ y : β, {x // f x = y}) ≃ α :=
409
+ ⟨λ x, x. 2 . 1 , λ x, ⟨f x, x, rfl⟩ , λ ⟨y, x, rfl⟩, rfl, λ x , rfl⟩
410
410
411
411
end
412
412
@@ -563,26 +563,68 @@ subtype_congr (equiv.refl α) (assume a, h ▸ iff.refl _)
563
563
def set_congr {α : Type *} {s t : set α} (h : s = t) : s ≃ t :=
564
564
subtype_congr_prop h
565
565
566
- def subtype_subtype_equiv_subtype {α : Type u} (p : α → Prop ) (q : subtype p → Prop ) :
566
+ def subtype_subtype_equiv_subtype_exists {α : Type u} (p : α → Prop ) (q : subtype p → Prop ) :
567
567
subtype q ≃ {a : α // ∃h:p a, q ⟨a, h⟩ } :=
568
568
⟨λ⟨⟨a, ha⟩, ha'⟩, ⟨a, ha, ha'⟩,
569
569
λ⟨a, ha⟩, ⟨⟨a, ha.cases_on $ assume h _, h⟩, by { cases ha, exact ha_h }⟩,
570
570
assume ⟨⟨a, ha⟩, h⟩, rfl, assume ⟨a, h₁, h₂⟩, rfl⟩
571
571
572
- /- A subtype of a sigma-type is a sigma-type over a subtype. -/
572
+ def subtype_subtype_equiv_subtype_inter {α : Type u} (p q : α → Prop ) :
573
+ {x : subtype p // q x.1 } ≃ subtype (λ x, p x ∧ q x) :=
574
+ (subtype_subtype_equiv_subtype_exists p _).trans $
575
+ subtype_congr_right $ λ x, exists_prop
576
+
577
+ /-- If the outer subtype has more restrictive predicate than the inner one,
578
+ then we can drop the latter. -/
579
+ def subtype_subtype_equiv_subtype {α : Type u} {p q : α → Prop } (h : ∀ {x}, q x → p x) :
580
+ {x : subtype p // q x.1 } ≃ subtype q :=
581
+ (subtype_subtype_equiv_subtype_inter p _).trans $
582
+ subtype_congr_right $
583
+ assume x,
584
+ ⟨and.right, λ h₁, ⟨h h₁, h₁⟩⟩
585
+
586
+ /-- If a proposition holds for all elements, then the subtype is
587
+ equivalent to the original type. -/
588
+ def subtype_univ_equiv {α : Type u} {p : α → Prop } (h : ∀ x, p x) :
589
+ subtype p ≃ α :=
590
+ ⟨λ x, x, λ x, ⟨x, h x⟩, λ x, subtype.eq rfl, λ x, rfl⟩
591
+
592
+ /-- A subtype of a sigma-type is a sigma-type over a subtype. -/
573
593
def subtype_sigma_equiv {α : Type u} (p : α → Type v) (q : α → Prop ) :
574
594
{ y : sigma p // q y.1 } ≃ Σ(x : subtype q), p x.1 :=
575
- begin
576
- fsplit,
577
- rintro ⟨⟨x, y⟩, z⟩, exact ⟨⟨x, z⟩, y⟩,
578
- rintro ⟨⟨x, y⟩, z⟩, exact ⟨⟨x, z⟩, y⟩,
579
- rintro ⟨⟨x, y⟩, z⟩, refl,
580
- rintro ⟨⟨x, y⟩, z⟩, refl,
581
- end
595
+ ⟨λ x, ⟨⟨x.1 .1 , x.2 ⟩, x.1 .2 ⟩,
596
+ λ x, ⟨⟨x.1 .1 , x.2 ⟩, x.1 .2 ⟩,
597
+ λ ⟨⟨x, h⟩, y⟩, rfl,
598
+ λ ⟨⟨x, y⟩, h⟩, rfl⟩
599
+
600
+ /-- A sigma type over a subtype is equivalent to the sigma set over the original type,
601
+ if the fiber is empty outside of the subset -/
602
+ def sigma_subtype_equiv_of_subset {α : Type u} (p : α → Type v) (q : α → Prop )
603
+ (h : ∀ x, p x → q x) :
604
+ (Σ x : subtype q, p x) ≃ Σ x : α, p x :=
605
+ (subtype_sigma_equiv p q).symm.trans $ subtype_univ_equiv $ λ x, h x.1 x.2
606
+
607
+ def sigma_subtype_preimage_equiv {α : Type u} {β : Type v} (f : α → β) (p : β → Prop )
608
+ (h : ∀ x, p (f x)) :
609
+ (Σ y : subtype p, {x : α // f x = y}) ≃ α :=
610
+ calc _ ≃ Σ y : β, {x : α // f x = y} : sigma_subtype_equiv_of_subset _ p (λ y ⟨x, h'⟩, h' ▸ h x)
611
+ ... ≃ α : sigma_preimage_equiv f
612
+
613
+ def sigma_subtype_preimage_equiv_subtype {α : Type u} {β : Type v} (f : α → β)
614
+ {p : α → Prop } {q : β → Prop } (h : ∀ x, p x ↔ q (f x)) :
615
+ (Σ y : subtype q, {x : α // f x = y}) ≃ subtype p :=
616
+ calc (Σ y : subtype q, {x : α // f x = y}) ≃
617
+ Σ y : subtype q, {x : subtype p // subtype.mk (f x) ((h x).1 x.2 ) = y} :
618
+ begin
619
+ apply sigma_congr_right,
620
+ assume y,
621
+ symmetry,
622
+ refine (subtype_subtype_equiv_subtype_exists _ _).trans (subtype_congr_right _),
623
+ assume x,
624
+ exact ⟨λ ⟨hp, h'⟩, congr_arg subtype.val h', λ h', ⟨(h x).2 (h'.symm ▸ y.2 ), subtype.eq h'⟩⟩
625
+ end
582
626
583
- /-- aka coimage -/
584
- def equiv_sigma_subtype {α : Type u} {β : Type v} (f : α → β) : α ≃ Σ b, {x : α // f x = b} :=
585
- ⟨λ x, ⟨f x, x, rfl⟩, λ x, x.2 .1 , λ x, rfl, λ ⟨b, x, H⟩, sigma.eq H $ eq.drec_on H $ subtype.eq rfl⟩
627
+ ... ≃ subtype p : sigma_preimage_equiv (λ x : subtype p, (⟨f x, (h x).1 x.property⟩ : subtype q))
586
628
587
629
def pi_equiv_subtype_sigma (ι : Type *) (π : ι → Type *) :
588
630
(Πi, π i) ≃ {f : ι → Σi, π i | ∀i, (f i).1 = i } :=
@@ -757,10 +799,7 @@ protected def congr {α β : Type*} (e : α ≃ β) : set α ≃ set β :=
757
799
758
800
protected def sep {α : Type u} (s : set α) (t : α → Prop ) :
759
801
({ x ∈ s | t x } : set α) ≃ { x : s | t x.1 } :=
760
- begin
761
- symmetry, apply (equiv.subtype_subtype_equiv_subtype _ _).trans _,
762
- simp only [mem_set_of_eq, exists_prop], refl
763
- end
802
+ (equiv.subtype_subtype_equiv_subtype_inter s t).symm
764
803
765
804
end set
766
805
0 commit comments