Context
stringlengths
57
85k
file_name
stringlengths
21
79
start
int64
14
2.42k
end
int64
18
2.43k
theorem
stringlengths
25
2.71k
proof
stringlengths
5
10.6k
import Mathlib.Data.Set.Image import Mathlib.Data.SProd #align_import data.set.prod from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4" open Function namespace Set section Prod variable {α β γ δ : Type*} {s s₁ s₂ : Set α} {t t₁ t₂ : Set β} {a : α} {b : β} theorem Subsingleton.prod (hs : s.Subsingleton) (ht : t.Subsingleton) : (s ×ˢ t).Subsingleton := fun _x hx _y hy ↦ Prod.ext (hs hx.1 hy.1) (ht hx.2 hy.2) noncomputable instance decidableMemProd [DecidablePred (· ∈ s)] [DecidablePred (· ∈ t)] : DecidablePred (· ∈ s ×ˢ t) := fun _ => And.decidable #align set.decidable_mem_prod Set.decidableMemProd @[gcongr] theorem prod_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : s₁ ×ˢ t₁ ⊆ s₂ ×ˢ t₂ := fun _ ⟨h₁, h₂⟩ => ⟨hs h₁, ht h₂⟩ #align set.prod_mono Set.prod_mono @[gcongr] theorem prod_mono_left (hs : s₁ ⊆ s₂) : s₁ ×ˢ t ⊆ s₂ ×ˢ t := prod_mono hs Subset.rfl #align set.prod_mono_left Set.prod_mono_left @[gcongr] theorem prod_mono_right (ht : t₁ ⊆ t₂) : s ×ˢ t₁ ⊆ s ×ˢ t₂ := prod_mono Subset.rfl ht #align set.prod_mono_right Set.prod_mono_right @[simp] theorem prod_self_subset_prod_self : s₁ ×ˢ s₁ ⊆ s₂ ×ˢ s₂ ↔ s₁ ⊆ s₂ := ⟨fun h _ hx => (h (mk_mem_prod hx hx)).1, fun h _ hx => ⟨h hx.1, h hx.2⟩⟩ #align set.prod_self_subset_prod_self Set.prod_self_subset_prod_self @[simp] theorem prod_self_ssubset_prod_self : s₁ ×ˢ s₁ ⊂ s₂ ×ˢ s₂ ↔ s₁ ⊂ s₂ := and_congr prod_self_subset_prod_self <| not_congr prod_self_subset_prod_self #align set.prod_self_ssubset_prod_self Set.prod_self_ssubset_prod_self theorem prod_subset_iff {P : Set (α × β)} : s ×ˢ t ⊆ P ↔ ∀ x ∈ s, ∀ y ∈ t, (x, y) ∈ P := ⟨fun h _ hx _ hy => h (mk_mem_prod hx hy), fun h ⟨_, _⟩ hp => h _ hp.1 _ hp.2⟩ #align set.prod_subset_iff Set.prod_subset_iff theorem forall_prod_set {p : α × β → Prop} : (∀ x ∈ s ×ˢ t, p x) ↔ ∀ x ∈ s, ∀ y ∈ t, p (x, y) := prod_subset_iff #align set.forall_prod_set Set.forall_prod_set theorem exists_prod_set {p : α × β → Prop} : (∃ x ∈ s ×ˢ t, p x) ↔ ∃ x ∈ s, ∃ y ∈ t, p (x, y) := by simp [and_assoc] #align set.exists_prod_set Set.exists_prod_set @[simp] theorem prod_empty : s ×ˢ (∅ : Set β) = ∅ := by ext exact and_false_iff _ #align set.prod_empty Set.prod_empty @[simp] theorem empty_prod : (∅ : Set α) ×ˢ t = ∅ := by ext exact false_and_iff _ #align set.empty_prod Set.empty_prod @[simp, mfld_simps] theorem univ_prod_univ : @univ α ×ˢ @univ β = univ := by ext exact true_and_iff _ #align set.univ_prod_univ Set.univ_prod_univ theorem univ_prod {t : Set β} : (univ : Set α) ×ˢ t = Prod.snd ⁻¹' t := by simp [prod_eq] #align set.univ_prod Set.univ_prod theorem prod_univ {s : Set α} : s ×ˢ (univ : Set β) = Prod.fst ⁻¹' s := by simp [prod_eq] #align set.prod_univ Set.prod_univ @[simp] lemma prod_eq_univ [Nonempty α] [Nonempty β] : s ×ˢ t = univ ↔ s = univ ∧ t = univ := by simp [eq_univ_iff_forall, forall_and] @[simp] theorem singleton_prod : ({a} : Set α) ×ˢ t = Prod.mk a '' t := by ext ⟨x, y⟩ simp [and_left_comm, eq_comm] #align set.singleton_prod Set.singleton_prod @[simp] theorem prod_singleton : s ×ˢ ({b} : Set β) = (fun a => (a, b)) '' s := by ext ⟨x, y⟩ simp [and_left_comm, eq_comm] #align set.prod_singleton Set.prod_singleton theorem singleton_prod_singleton : ({a} : Set α) ×ˢ ({b} : Set β) = {(a, b)} := by simp #align set.singleton_prod_singleton Set.singleton_prod_singleton @[simp] theorem union_prod : (s₁ ∪ s₂) ×ˢ t = s₁ ×ˢ t ∪ s₂ ×ˢ t := by ext ⟨x, y⟩ simp [or_and_right] #align set.union_prod Set.union_prod @[simp] theorem prod_union : s ×ˢ (t₁ ∪ t₂) = s ×ˢ t₁ ∪ s ×ˢ t₂ := by ext ⟨x, y⟩ simp [and_or_left] #align set.prod_union Set.prod_union theorem inter_prod : (s₁ ∩ s₂) ×ˢ t = s₁ ×ˢ t ∩ s₂ ×ˢ t := by ext ⟨x, y⟩ simp only [← and_and_right, mem_inter_iff, mem_prod] #align set.inter_prod Set.inter_prod theorem prod_inter : s ×ˢ (t₁ ∩ t₂) = s ×ˢ t₁ ∩ s ×ˢ t₂ := by ext ⟨x, y⟩ simp only [← and_and_left, mem_inter_iff, mem_prod] #align set.prod_inter Set.prod_inter @[mfld_simps] theorem prod_inter_prod : s₁ ×ˢ t₁ ∩ s₂ ×ˢ t₂ = (s₁ ∩ s₂) ×ˢ (t₁ ∩ t₂) := by ext ⟨x, y⟩ simp [and_assoc, and_left_comm] #align set.prod_inter_prod Set.prod_inter_prod lemma compl_prod_eq_union {α β : Type*} (s : Set α) (t : Set β) : (s ×ˢ t)ᶜ = (sᶜ ×ˢ univ) ∪ (univ ×ˢ tᶜ) := by ext p simp only [mem_compl_iff, mem_prod, not_and, mem_union, mem_univ, and_true, true_and] constructor <;> intro h · by_cases fst_in_s : p.fst ∈ s · exact Or.inr (h fst_in_s) · exact Or.inl fst_in_s · intro fst_in_s simpa only [fst_in_s, not_true, false_or] using h @[simp] theorem disjoint_prod : Disjoint (s₁ ×ˢ t₁) (s₂ ×ˢ t₂) ↔ Disjoint s₁ s₂ ∨ Disjoint t₁ t₂ := by simp_rw [disjoint_left, mem_prod, not_and_or, Prod.forall, and_imp, ← @forall_or_right α, ← @forall_or_left β, ← @forall_or_right (_ ∈ s₁), ← @forall_or_left (_ ∈ t₁)] #align set.disjoint_prod Set.disjoint_prod theorem Disjoint.set_prod_left (hs : Disjoint s₁ s₂) (t₁ t₂ : Set β) : Disjoint (s₁ ×ˢ t₁) (s₂ ×ˢ t₂) := disjoint_left.2 fun ⟨_a, _b⟩ ⟨ha₁, _⟩ ⟨ha₂, _⟩ => disjoint_left.1 hs ha₁ ha₂ #align set.disjoint.set_prod_left Set.Disjoint.set_prod_left theorem Disjoint.set_prod_right (ht : Disjoint t₁ t₂) (s₁ s₂ : Set α) : Disjoint (s₁ ×ˢ t₁) (s₂ ×ˢ t₂) := disjoint_left.2 fun ⟨_a, _b⟩ ⟨_, hb₁⟩ ⟨_, hb₂⟩ => disjoint_left.1 ht hb₁ hb₂ #align set.disjoint.set_prod_right Set.Disjoint.set_prod_right theorem insert_prod : insert a s ×ˢ t = Prod.mk a '' t ∪ s ×ˢ t := by ext ⟨x, y⟩ simp (config := { contextual := true }) [image, iff_def, or_imp] #align set.insert_prod Set.insert_prod theorem prod_insert : s ×ˢ insert b t = (fun a => (a, b)) '' s ∪ s ×ˢ t := by ext ⟨x, y⟩ -- porting note (#10745): -- was `simp (config := { contextual := true }) [image, iff_def, or_imp, Imp.swap]` simp only [mem_prod, mem_insert_iff, image, mem_union, mem_setOf_eq, Prod.mk.injEq] refine ⟨fun h => ?_, fun h => ?_⟩ · obtain ⟨hx, rfl|hy⟩ := h · exact Or.inl ⟨x, hx, rfl, rfl⟩ · exact Or.inr ⟨hx, hy⟩ · obtain ⟨x, hx, rfl, rfl⟩|⟨hx, hy⟩ := h · exact ⟨hx, Or.inl rfl⟩ · exact ⟨hx, Or.inr hy⟩ #align set.prod_insert Set.prod_insert theorem prod_preimage_eq {f : γ → α} {g : δ → β} : (f ⁻¹' s) ×ˢ (g ⁻¹' t) = (fun p : γ × δ => (f p.1, g p.2)) ⁻¹' s ×ˢ t := rfl #align set.prod_preimage_eq Set.prod_preimage_eq theorem prod_preimage_left {f : γ → α} : (f ⁻¹' s) ×ˢ t = (fun p : γ × β => (f p.1, p.2)) ⁻¹' s ×ˢ t := rfl #align set.prod_preimage_left Set.prod_preimage_left theorem prod_preimage_right {g : δ → β} : s ×ˢ (g ⁻¹' t) = (fun p : α × δ => (p.1, g p.2)) ⁻¹' s ×ˢ t := rfl #align set.prod_preimage_right Set.prod_preimage_right theorem preimage_prod_map_prod (f : α → β) (g : γ → δ) (s : Set β) (t : Set δ) : Prod.map f g ⁻¹' s ×ˢ t = (f ⁻¹' s) ×ˢ (g ⁻¹' t) := rfl #align set.preimage_prod_map_prod Set.preimage_prod_map_prod theorem mk_preimage_prod (f : γ → α) (g : γ → β) : (fun x => (f x, g x)) ⁻¹' s ×ˢ t = f ⁻¹' s ∩ g ⁻¹' t := rfl #align set.mk_preimage_prod Set.mk_preimage_prod @[simp] theorem mk_preimage_prod_left (hb : b ∈ t) : (fun a => (a, b)) ⁻¹' s ×ˢ t = s := by ext a simp [hb] #align set.mk_preimage_prod_left Set.mk_preimage_prod_left @[simp] theorem mk_preimage_prod_right (ha : a ∈ s) : Prod.mk a ⁻¹' s ×ˢ t = t := by ext b simp [ha] #align set.mk_preimage_prod_right Set.mk_preimage_prod_right @[simp] theorem mk_preimage_prod_left_eq_empty (hb : b ∉ t) : (fun a => (a, b)) ⁻¹' s ×ˢ t = ∅ := by ext a simp [hb] #align set.mk_preimage_prod_left_eq_empty Set.mk_preimage_prod_left_eq_empty @[simp] theorem mk_preimage_prod_right_eq_empty (ha : a ∉ s) : Prod.mk a ⁻¹' s ×ˢ t = ∅ := by ext b simp [ha] #align set.mk_preimage_prod_right_eq_empty Set.mk_preimage_prod_right_eq_empty theorem mk_preimage_prod_left_eq_if [DecidablePred (· ∈ t)] : (fun a => (a, b)) ⁻¹' s ×ˢ t = if b ∈ t then s else ∅ := by split_ifs with h <;> simp [h] #align set.mk_preimage_prod_left_eq_if Set.mk_preimage_prod_left_eq_if theorem mk_preimage_prod_right_eq_if [DecidablePred (· ∈ s)] : Prod.mk a ⁻¹' s ×ˢ t = if a ∈ s then t else ∅ := by split_ifs with h <;> simp [h] #align set.mk_preimage_prod_right_eq_if Set.mk_preimage_prod_right_eq_if theorem mk_preimage_prod_left_fn_eq_if [DecidablePred (· ∈ t)] (f : γ → α) : (fun a => (f a, b)) ⁻¹' s ×ˢ t = if b ∈ t then f ⁻¹' s else ∅ := by rw [← mk_preimage_prod_left_eq_if, prod_preimage_left, preimage_preimage] #align set.mk_preimage_prod_left_fn_eq_if Set.mk_preimage_prod_left_fn_eq_if theorem mk_preimage_prod_right_fn_eq_if [DecidablePred (· ∈ s)] (g : δ → β) : (fun b => (a, g b)) ⁻¹' s ×ˢ t = if a ∈ s then g ⁻¹' t else ∅ := by rw [← mk_preimage_prod_right_eq_if, prod_preimage_right, preimage_preimage] #align set.mk_preimage_prod_right_fn_eq_if Set.mk_preimage_prod_right_fn_eq_if @[simp] theorem preimage_swap_prod (s : Set α) (t : Set β) : Prod.swap ⁻¹' s ×ˢ t = t ×ˢ s := by ext ⟨x, y⟩ simp [and_comm] #align set.preimage_swap_prod Set.preimage_swap_prod @[simp] theorem image_swap_prod (s : Set α) (t : Set β) : Prod.swap '' s ×ˢ t = t ×ˢ s := by rw [image_swap_eq_preimage_swap, preimage_swap_prod] #align set.image_swap_prod Set.image_swap_prod theorem prod_image_image_eq {m₁ : α → γ} {m₂ : β → δ} : (m₁ '' s) ×ˢ (m₂ '' t) = (fun p : α × β => (m₁ p.1, m₂ p.2)) '' s ×ˢ t := ext <| by simp [-exists_and_right, exists_and_right.symm, and_left_comm, and_assoc, and_comm] #align set.prod_image_image_eq Set.prod_image_image_eq theorem prod_range_range_eq {m₁ : α → γ} {m₂ : β → δ} : range m₁ ×ˢ range m₂ = range fun p : α × β => (m₁ p.1, m₂ p.2) := ext <| by simp [range] #align set.prod_range_range_eq Set.prod_range_range_eq @[simp, mfld_simps] theorem range_prod_map {m₁ : α → γ} {m₂ : β → δ} : range (Prod.map m₁ m₂) = range m₁ ×ˢ range m₂ := prod_range_range_eq.symm #align set.range_prod_map Set.range_prod_map theorem prod_range_univ_eq {m₁ : α → γ} : range m₁ ×ˢ (univ : Set β) = range fun p : α × β => (m₁ p.1, p.2) := ext <| by simp [range] #align set.prod_range_univ_eq Set.prod_range_univ_eq theorem prod_univ_range_eq {m₂ : β → δ} : (univ : Set α) ×ˢ range m₂ = range fun p : α × β => (p.1, m₂ p.2) := ext <| by simp [range] #align set.prod_univ_range_eq Set.prod_univ_range_eq theorem range_pair_subset (f : α → β) (g : α → γ) : (range fun x => (f x, g x)) ⊆ range f ×ˢ range g := by have : (fun x => (f x, g x)) = Prod.map f g ∘ fun x => (x, x) := funext fun x => rfl rw [this, ← range_prod_map] apply range_comp_subset_range #align set.range_pair_subset Set.range_pair_subset theorem Nonempty.prod : s.Nonempty → t.Nonempty → (s ×ˢ t).Nonempty := fun ⟨x, hx⟩ ⟨y, hy⟩ => ⟨(x, y), ⟨hx, hy⟩⟩ #align set.nonempty.prod Set.Nonempty.prod theorem Nonempty.fst : (s ×ˢ t).Nonempty → s.Nonempty := fun ⟨x, hx⟩ => ⟨x.1, hx.1⟩ #align set.nonempty.fst Set.Nonempty.fst theorem Nonempty.snd : (s ×ˢ t).Nonempty → t.Nonempty := fun ⟨x, hx⟩ => ⟨x.2, hx.2⟩ #align set.nonempty.snd Set.Nonempty.snd @[simp] theorem prod_nonempty_iff : (s ×ˢ t).Nonempty ↔ s.Nonempty ∧ t.Nonempty := ⟨fun h => ⟨h.fst, h.snd⟩, fun h => h.1.prod h.2⟩ #align set.prod_nonempty_iff Set.prod_nonempty_iff @[simp] theorem prod_eq_empty_iff : s ×ˢ t = ∅ ↔ s = ∅ ∨ t = ∅ := by simp only [not_nonempty_iff_eq_empty.symm, prod_nonempty_iff, not_and_or] #align set.prod_eq_empty_iff Set.prod_eq_empty_iff theorem prod_sub_preimage_iff {W : Set γ} {f : α × β → γ} : s ×ˢ t ⊆ f ⁻¹' W ↔ ∀ a b, a ∈ s → b ∈ t → f (a, b) ∈ W := by simp [subset_def] #align set.prod_sub_preimage_iff Set.prod_sub_preimage_iff theorem image_prod_mk_subset_prod {f : α → β} {g : α → γ} {s : Set α} : (fun x => (f x, g x)) '' s ⊆ (f '' s) ×ˢ (g '' s) := by rintro _ ⟨x, hx, rfl⟩ exact mk_mem_prod (mem_image_of_mem f hx) (mem_image_of_mem g hx) #align set.image_prod_mk_subset_prod Set.image_prod_mk_subset_prod theorem image_prod_mk_subset_prod_left (hb : b ∈ t) : (fun a => (a, b)) '' s ⊆ s ×ˢ t := by rintro _ ⟨a, ha, rfl⟩ exact ⟨ha, hb⟩ #align set.image_prod_mk_subset_prod_left Set.image_prod_mk_subset_prod_left theorem image_prod_mk_subset_prod_right (ha : a ∈ s) : Prod.mk a '' t ⊆ s ×ˢ t := by rintro _ ⟨b, hb, rfl⟩ exact ⟨ha, hb⟩ #align set.image_prod_mk_subset_prod_right Set.image_prod_mk_subset_prod_right theorem prod_subset_preimage_fst (s : Set α) (t : Set β) : s ×ˢ t ⊆ Prod.fst ⁻¹' s := inter_subset_left #align set.prod_subset_preimage_fst Set.prod_subset_preimage_fst theorem fst_image_prod_subset (s : Set α) (t : Set β) : Prod.fst '' s ×ˢ t ⊆ s := image_subset_iff.2 <| prod_subset_preimage_fst s t #align set.fst_image_prod_subset Set.fst_image_prod_subset theorem fst_image_prod (s : Set β) {t : Set α} (ht : t.Nonempty) : Prod.fst '' s ×ˢ t = s := (fst_image_prod_subset _ _).antisymm fun y hy => let ⟨x, hx⟩ := ht ⟨(y, x), ⟨hy, hx⟩, rfl⟩ #align set.fst_image_prod Set.fst_image_prod theorem prod_subset_preimage_snd (s : Set α) (t : Set β) : s ×ˢ t ⊆ Prod.snd ⁻¹' t := inter_subset_right #align set.prod_subset_preimage_snd Set.prod_subset_preimage_snd theorem snd_image_prod_subset (s : Set α) (t : Set β) : Prod.snd '' s ×ˢ t ⊆ t := image_subset_iff.2 <| prod_subset_preimage_snd s t #align set.snd_image_prod_subset Set.snd_image_prod_subset theorem snd_image_prod {s : Set α} (hs : s.Nonempty) (t : Set β) : Prod.snd '' s ×ˢ t = t := (snd_image_prod_subset _ _).antisymm fun y y_in => let ⟨x, x_in⟩ := hs ⟨(x, y), ⟨x_in, y_in⟩, rfl⟩ #align set.snd_image_prod Set.snd_image_prod theorem prod_diff_prod : s ×ˢ t \ s₁ ×ˢ t₁ = s ×ˢ (t \ t₁) ∪ (s \ s₁) ×ˢ t := by ext x by_cases h₁ : x.1 ∈ s₁ <;> by_cases h₂ : x.2 ∈ t₁ <;> simp [*] #align set.prod_diff_prod Set.prod_diff_prod theorem prod_subset_prod_iff : s ×ˢ t ⊆ s₁ ×ˢ t₁ ↔ s ⊆ s₁ ∧ t ⊆ t₁ ∨ s = ∅ ∨ t = ∅ := by rcases (s ×ˢ t).eq_empty_or_nonempty with h | h · simp [h, prod_eq_empty_iff.1 h] have st : s.Nonempty ∧ t.Nonempty := by rwa [prod_nonempty_iff] at h refine ⟨fun H => Or.inl ⟨?_, ?_⟩, ?_⟩ · have := image_subset (Prod.fst : α × β → α) H rwa [fst_image_prod _ st.2, fst_image_prod _ (h.mono H).snd] at this · have := image_subset (Prod.snd : α × β → β) H rwa [snd_image_prod st.1, snd_image_prod (h.mono H).fst] at this · intro H simp only [st.1.ne_empty, st.2.ne_empty, or_false_iff] at H exact prod_mono H.1 H.2 #align set.prod_subset_prod_iff Set.prod_subset_prod_iff theorem prod_eq_prod_iff_of_nonempty (h : (s ×ˢ t).Nonempty) : s ×ˢ t = s₁ ×ˢ t₁ ↔ s = s₁ ∧ t = t₁ := by constructor · intro heq have h₁ : (s₁ ×ˢ t₁ : Set _).Nonempty := by rwa [← heq] rw [prod_nonempty_iff] at h h₁ rw [← fst_image_prod s h.2, ← fst_image_prod s₁ h₁.2, heq, eq_self_iff_true, true_and_iff, ← snd_image_prod h.1 t, ← snd_image_prod h₁.1 t₁, heq] · rintro ⟨rfl, rfl⟩ rfl #align set.prod_eq_prod_iff_of_nonempty Set.prod_eq_prod_iff_of_nonempty theorem prod_eq_prod_iff : s ×ˢ t = s₁ ×ˢ t₁ ↔ s = s₁ ∧ t = t₁ ∨ (s = ∅ ∨ t = ∅) ∧ (s₁ = ∅ ∨ t₁ = ∅) := by symm rcases eq_empty_or_nonempty (s ×ˢ t) with h | h · simp_rw [h, @eq_comm _ ∅, prod_eq_empty_iff, prod_eq_empty_iff.mp h, true_and_iff, or_iff_right_iff_imp] rintro ⟨rfl, rfl⟩ exact prod_eq_empty_iff.mp h rw [prod_eq_prod_iff_of_nonempty h] rw [nonempty_iff_ne_empty, Ne, prod_eq_empty_iff] at h simp_rw [h, false_and_iff, or_false_iff] #align set.prod_eq_prod_iff Set.prod_eq_prod_iff @[simp] theorem prod_eq_iff_eq (ht : t.Nonempty) : s ×ˢ t = s₁ ×ˢ t ↔ s = s₁ := by simp_rw [prod_eq_prod_iff, ht.ne_empty, and_true_iff, or_iff_left_iff_imp, or_false_iff] rintro ⟨rfl, rfl⟩ rfl #align set.prod_eq_iff_eq Set.prod_eq_iff_eq
Mathlib/Data/Set/Prod.lean
519
524
theorem range_const_eq_diagonal {α β : Type*} [hβ : Nonempty β] : range (const α) = {f : α → β | ∀ x y, f x = f y} := by
refine (range_eq_iff _ _).mpr ⟨fun _ _ _ ↦ rfl, fun f hf ↦ ?_⟩ rcases isEmpty_or_nonempty α with h|⟨⟨a⟩⟩ · exact hβ.elim fun b ↦ ⟨b, Subsingleton.elim _ _⟩ · exact ⟨f a, funext fun x ↦ hf _ _⟩
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Angle import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse #align_import analysis.special_functions.complex.arg from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1" open Filter Metric Set open scoped ComplexConjugate Real Topology namespace Complex variable {a x z : ℂ} noncomputable def arg (x : ℂ) : ℝ := if 0 ≤ x.re then Real.arcsin (x.im / abs x) else if 0 ≤ x.im then Real.arcsin ((-x).im / abs x) + π else Real.arcsin ((-x).im / abs x) - π #align complex.arg Complex.arg theorem sin_arg (x : ℂ) : Real.sin (arg x) = x.im / abs x := by unfold arg; split_ifs <;> simp [sub_eq_add_neg, arg, Real.sin_arcsin (abs_le.1 (abs_im_div_abs_le_one x)).1 (abs_le.1 (abs_im_div_abs_le_one x)).2, Real.sin_add, neg_div, Real.arcsin_neg, Real.sin_neg] #align complex.sin_arg Complex.sin_arg theorem cos_arg {x : ℂ} (hx : x ≠ 0) : Real.cos (arg x) = x.re / abs x := by rw [arg] split_ifs with h₁ h₂ · rw [Real.cos_arcsin] field_simp [Real.sqrt_sq, (abs.pos hx).le, *] · rw [Real.cos_add_pi, Real.cos_arcsin] field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs, _root_.abs_of_neg (not_le.1 h₁), *] · rw [Real.cos_sub_pi, Real.cos_arcsin] field_simp [Real.sqrt_div (sq_nonneg _), Real.sqrt_sq_eq_abs, _root_.abs_of_neg (not_le.1 h₁), *] #align complex.cos_arg Complex.cos_arg @[simp] theorem abs_mul_exp_arg_mul_I (x : ℂ) : ↑(abs x) * exp (arg x * I) = x := by rcases eq_or_ne x 0 with (rfl | hx) · simp · have : abs x ≠ 0 := abs.ne_zero hx apply Complex.ext <;> field_simp [sin_arg, cos_arg hx, this, mul_comm (abs x)] set_option linter.uppercaseLean3 false in #align complex.abs_mul_exp_arg_mul_I Complex.abs_mul_exp_arg_mul_I @[simp] theorem abs_mul_cos_add_sin_mul_I (x : ℂ) : (abs x * (cos (arg x) + sin (arg x) * I) : ℂ) = x := by rw [← exp_mul_I, abs_mul_exp_arg_mul_I] set_option linter.uppercaseLean3 false in #align complex.abs_mul_cos_add_sin_mul_I Complex.abs_mul_cos_add_sin_mul_I @[simp] lemma abs_mul_cos_arg (x : ℂ) : abs x * Real.cos (arg x) = x.re := by simpa [-abs_mul_cos_add_sin_mul_I] using congr_arg re (abs_mul_cos_add_sin_mul_I x) @[simp] lemma abs_mul_sin_arg (x : ℂ) : abs x * Real.sin (arg x) = x.im := by simpa [-abs_mul_cos_add_sin_mul_I] using congr_arg im (abs_mul_cos_add_sin_mul_I x) theorem abs_eq_one_iff (z : ℂ) : abs z = 1 ↔ ∃ θ : ℝ, exp (θ * I) = z := by refine ⟨fun hz => ⟨arg z, ?_⟩, ?_⟩ · calc exp (arg z * I) = abs z * exp (arg z * I) := by rw [hz, ofReal_one, one_mul] _ = z := abs_mul_exp_arg_mul_I z · rintro ⟨θ, rfl⟩ exact Complex.abs_exp_ofReal_mul_I θ #align complex.abs_eq_one_iff Complex.abs_eq_one_iff @[simp] theorem range_exp_mul_I : (Set.range fun x : ℝ => exp (x * I)) = Metric.sphere 0 1 := by ext x simp only [mem_sphere_zero_iff_norm, norm_eq_abs, abs_eq_one_iff, Set.mem_range] set_option linter.uppercaseLean3 false in #align complex.range_exp_mul_I Complex.range_exp_mul_I theorem arg_mul_cos_add_sin_mul_I {r : ℝ} (hr : 0 < r) {θ : ℝ} (hθ : θ ∈ Set.Ioc (-π) π) : arg (r * (cos θ + sin θ * I)) = θ := by simp only [arg, map_mul, abs_cos_add_sin_mul_I, abs_of_nonneg hr.le, mul_one] simp only [re_ofReal_mul, im_ofReal_mul, neg_im, ← ofReal_cos, ← ofReal_sin, ← mk_eq_add_mul_I, neg_div, mul_div_cancel_left₀ _ hr.ne', mul_nonneg_iff_right_nonneg_of_pos hr] by_cases h₁ : θ ∈ Set.Icc (-(π / 2)) (π / 2) · rw [if_pos] exacts [Real.arcsin_sin' h₁, Real.cos_nonneg_of_mem_Icc h₁] · rw [Set.mem_Icc, not_and_or, not_le, not_le] at h₁ cases' h₁ with h₁ h₁ · replace hθ := hθ.1 have hcos : Real.cos θ < 0 := by rw [← neg_pos, ← Real.cos_add_pi] refine Real.cos_pos_of_mem_Ioo ⟨?_, ?_⟩ <;> linarith have hsin : Real.sin θ < 0 := Real.sin_neg_of_neg_of_neg_pi_lt (by linarith) hθ rw [if_neg, if_neg, ← Real.sin_add_pi, Real.arcsin_sin, add_sub_cancel_right] <;> [linarith; linarith; exact hsin.not_le; exact hcos.not_le] · replace hθ := hθ.2 have hcos : Real.cos θ < 0 := Real.cos_neg_of_pi_div_two_lt_of_lt h₁ (by linarith) have hsin : 0 ≤ Real.sin θ := Real.sin_nonneg_of_mem_Icc ⟨by linarith, hθ⟩ rw [if_neg, if_pos, ← Real.sin_sub_pi, Real.arcsin_sin, sub_add_cancel] <;> [linarith; linarith; exact hsin; exact hcos.not_le] set_option linter.uppercaseLean3 false in #align complex.arg_mul_cos_add_sin_mul_I Complex.arg_mul_cos_add_sin_mul_I theorem arg_cos_add_sin_mul_I {θ : ℝ} (hθ : θ ∈ Set.Ioc (-π) π) : arg (cos θ + sin θ * I) = θ := by rw [← one_mul (_ + _), ← ofReal_one, arg_mul_cos_add_sin_mul_I zero_lt_one hθ] set_option linter.uppercaseLean3 false in #align complex.arg_cos_add_sin_mul_I Complex.arg_cos_add_sin_mul_I lemma arg_exp_mul_I (θ : ℝ) : arg (exp (θ * I)) = toIocMod (mul_pos two_pos Real.pi_pos) (-π) θ := by convert arg_cos_add_sin_mul_I (θ := toIocMod (mul_pos two_pos Real.pi_pos) (-π) θ) _ using 2 · rw [← exp_mul_I, eq_sub_of_add_eq $ toIocMod_add_toIocDiv_zsmul _ _ θ, ofReal_sub, ofReal_zsmul, ofReal_mul, ofReal_ofNat, exp_mul_I_periodic.sub_zsmul_eq] · convert toIocMod_mem_Ioc _ _ _ ring @[simp] theorem arg_zero : arg 0 = 0 := by simp [arg, le_refl] #align complex.arg_zero Complex.arg_zero theorem ext_abs_arg {x y : ℂ} (h₁ : abs x = abs y) (h₂ : x.arg = y.arg) : x = y := by rw [← abs_mul_exp_arg_mul_I x, ← abs_mul_exp_arg_mul_I y, h₁, h₂] #align complex.ext_abs_arg Complex.ext_abs_arg theorem ext_abs_arg_iff {x y : ℂ} : x = y ↔ abs x = abs y ∧ arg x = arg y := ⟨fun h => h ▸ ⟨rfl, rfl⟩, and_imp.2 ext_abs_arg⟩ #align complex.ext_abs_arg_iff Complex.ext_abs_arg_iff theorem arg_mem_Ioc (z : ℂ) : arg z ∈ Set.Ioc (-π) π := by have hπ : 0 < π := Real.pi_pos rcases eq_or_ne z 0 with (rfl | hz) · simp [hπ, hπ.le] rcases existsUnique_add_zsmul_mem_Ioc Real.two_pi_pos (arg z) (-π) with ⟨N, hN, -⟩ rw [two_mul, neg_add_cancel_left, ← two_mul, zsmul_eq_mul] at hN rw [← abs_mul_cos_add_sin_mul_I z, ← cos_add_int_mul_two_pi _ N, ← sin_add_int_mul_two_pi _ N] have := arg_mul_cos_add_sin_mul_I (abs.pos hz) hN push_cast at this rwa [this] #align complex.arg_mem_Ioc Complex.arg_mem_Ioc @[simp] theorem range_arg : Set.range arg = Set.Ioc (-π) π := (Set.range_subset_iff.2 arg_mem_Ioc).antisymm fun _ hx => ⟨_, arg_cos_add_sin_mul_I hx⟩ #align complex.range_arg Complex.range_arg theorem arg_le_pi (x : ℂ) : arg x ≤ π := (arg_mem_Ioc x).2 #align complex.arg_le_pi Complex.arg_le_pi theorem neg_pi_lt_arg (x : ℂ) : -π < arg x := (arg_mem_Ioc x).1 #align complex.neg_pi_lt_arg Complex.neg_pi_lt_arg theorem abs_arg_le_pi (z : ℂ) : |arg z| ≤ π := abs_le.2 ⟨(neg_pi_lt_arg z).le, arg_le_pi z⟩ #align complex.abs_arg_le_pi Complex.abs_arg_le_pi @[simp] theorem arg_nonneg_iff {z : ℂ} : 0 ≤ arg z ↔ 0 ≤ z.im := by rcases eq_or_ne z 0 with (rfl | h₀); · simp calc 0 ≤ arg z ↔ 0 ≤ Real.sin (arg z) := ⟨fun h => Real.sin_nonneg_of_mem_Icc ⟨h, arg_le_pi z⟩, by contrapose! intro h exact Real.sin_neg_of_neg_of_neg_pi_lt h (neg_pi_lt_arg _)⟩ _ ↔ _ := by rw [sin_arg, le_div_iff (abs.pos h₀), zero_mul] #align complex.arg_nonneg_iff Complex.arg_nonneg_iff @[simp] theorem arg_neg_iff {z : ℂ} : arg z < 0 ↔ z.im < 0 := lt_iff_lt_of_le_iff_le arg_nonneg_iff #align complex.arg_neg_iff Complex.arg_neg_iff theorem arg_real_mul (x : ℂ) {r : ℝ} (hr : 0 < r) : arg (r * x) = arg x := by rcases eq_or_ne x 0 with (rfl | hx); · rw [mul_zero] conv_lhs => rw [← abs_mul_cos_add_sin_mul_I x, ← mul_assoc, ← ofReal_mul, arg_mul_cos_add_sin_mul_I (mul_pos hr (abs.pos hx)) x.arg_mem_Ioc] #align complex.arg_real_mul Complex.arg_real_mul theorem arg_mul_real {r : ℝ} (hr : 0 < r) (x : ℂ) : arg (x * r) = arg x := mul_comm x r ▸ arg_real_mul x hr theorem arg_eq_arg_iff {x y : ℂ} (hx : x ≠ 0) (hy : y ≠ 0) : arg x = arg y ↔ (abs y / abs x : ℂ) * x = y := by simp only [ext_abs_arg_iff, map_mul, map_div₀, abs_ofReal, abs_abs, div_mul_cancel₀ _ (abs.ne_zero hx), eq_self_iff_true, true_and_iff] rw [← ofReal_div, arg_real_mul] exact div_pos (abs.pos hy) (abs.pos hx) #align complex.arg_eq_arg_iff Complex.arg_eq_arg_iff @[simp] theorem arg_one : arg 1 = 0 := by simp [arg, zero_le_one] #align complex.arg_one Complex.arg_one @[simp] theorem arg_neg_one : arg (-1) = π := by simp [arg, le_refl, not_le.2 (zero_lt_one' ℝ)] #align complex.arg_neg_one Complex.arg_neg_one @[simp] theorem arg_I : arg I = π / 2 := by simp [arg, le_refl] set_option linter.uppercaseLean3 false in #align complex.arg_I Complex.arg_I @[simp] theorem arg_neg_I : arg (-I) = -(π / 2) := by simp [arg, le_refl] set_option linter.uppercaseLean3 false in #align complex.arg_neg_I Complex.arg_neg_I @[simp] theorem tan_arg (x : ℂ) : Real.tan (arg x) = x.im / x.re := by by_cases h : x = 0 · simp only [h, zero_div, Complex.zero_im, Complex.arg_zero, Real.tan_zero, Complex.zero_re] rw [Real.tan_eq_sin_div_cos, sin_arg, cos_arg h, div_div_div_cancel_right _ (abs.ne_zero h)] #align complex.tan_arg Complex.tan_arg theorem arg_ofReal_of_nonneg {x : ℝ} (hx : 0 ≤ x) : arg x = 0 := by simp [arg, hx] #align complex.arg_of_real_of_nonneg Complex.arg_ofReal_of_nonneg @[simp, norm_cast] lemma natCast_arg {n : ℕ} : arg n = 0 := ofReal_natCast n ▸ arg_ofReal_of_nonneg n.cast_nonneg @[simp] lemma ofNat_arg {n : ℕ} [n.AtLeastTwo] : arg (no_index (OfNat.ofNat n)) = 0 := natCast_arg theorem arg_eq_zero_iff {z : ℂ} : arg z = 0 ↔ 0 ≤ z.re ∧ z.im = 0 := by refine ⟨fun h => ?_, ?_⟩ · rw [← abs_mul_cos_add_sin_mul_I z, h] simp [abs.nonneg] · cases' z with x y rintro ⟨h, rfl : y = 0⟩ exact arg_ofReal_of_nonneg h #align complex.arg_eq_zero_iff Complex.arg_eq_zero_iff open ComplexOrder in lemma arg_eq_zero_iff_zero_le {z : ℂ} : arg z = 0 ↔ 0 ≤ z := by rw [arg_eq_zero_iff, eq_comm, nonneg_iff] theorem arg_eq_pi_iff {z : ℂ} : arg z = π ↔ z.re < 0 ∧ z.im = 0 := by by_cases h₀ : z = 0 · simp [h₀, lt_irrefl, Real.pi_ne_zero.symm] constructor · intro h rw [← abs_mul_cos_add_sin_mul_I z, h] simp [h₀] · cases' z with x y rintro ⟨h : x < 0, rfl : y = 0⟩ rw [← arg_neg_one, ← arg_real_mul (-1) (neg_pos.2 h)] simp [← ofReal_def] #align complex.arg_eq_pi_iff Complex.arg_eq_pi_iff open ComplexOrder in lemma arg_eq_pi_iff_lt_zero {z : ℂ} : arg z = π ↔ z < 0 := arg_eq_pi_iff theorem arg_lt_pi_iff {z : ℂ} : arg z < π ↔ 0 ≤ z.re ∨ z.im ≠ 0 := by rw [(arg_le_pi z).lt_iff_ne, not_iff_comm, not_or, not_le, Classical.not_not, arg_eq_pi_iff] #align complex.arg_lt_pi_iff Complex.arg_lt_pi_iff theorem arg_ofReal_of_neg {x : ℝ} (hx : x < 0) : arg x = π := arg_eq_pi_iff.2 ⟨hx, rfl⟩ #align complex.arg_of_real_of_neg Complex.arg_ofReal_of_neg theorem arg_eq_pi_div_two_iff {z : ℂ} : arg z = π / 2 ↔ z.re = 0 ∧ 0 < z.im := by by_cases h₀ : z = 0; · simp [h₀, lt_irrefl, Real.pi_div_two_pos.ne] constructor · intro h rw [← abs_mul_cos_add_sin_mul_I z, h] simp [h₀] · cases' z with x y rintro ⟨rfl : x = 0, hy : 0 < y⟩ rw [← arg_I, ← arg_real_mul I hy, ofReal_mul', I_re, I_im, mul_zero, mul_one] #align complex.arg_eq_pi_div_two_iff Complex.arg_eq_pi_div_two_iff theorem arg_eq_neg_pi_div_two_iff {z : ℂ} : arg z = -(π / 2) ↔ z.re = 0 ∧ z.im < 0 := by by_cases h₀ : z = 0; · simp [h₀, lt_irrefl, Real.pi_ne_zero] constructor · intro h rw [← abs_mul_cos_add_sin_mul_I z, h] simp [h₀] · cases' z with x y rintro ⟨rfl : x = 0, hy : y < 0⟩ rw [← arg_neg_I, ← arg_real_mul (-I) (neg_pos.2 hy), mk_eq_add_mul_I] simp #align complex.arg_eq_neg_pi_div_two_iff Complex.arg_eq_neg_pi_div_two_iff theorem arg_of_re_nonneg {x : ℂ} (hx : 0 ≤ x.re) : arg x = Real.arcsin (x.im / abs x) := if_pos hx #align complex.arg_of_re_nonneg Complex.arg_of_re_nonneg theorem arg_of_re_neg_of_im_nonneg {x : ℂ} (hx_re : x.re < 0) (hx_im : 0 ≤ x.im) : arg x = Real.arcsin ((-x).im / abs x) + π := by simp only [arg, hx_re.not_le, hx_im, if_true, if_false] #align complex.arg_of_re_neg_of_im_nonneg Complex.arg_of_re_neg_of_im_nonneg theorem arg_of_re_neg_of_im_neg {x : ℂ} (hx_re : x.re < 0) (hx_im : x.im < 0) : arg x = Real.arcsin ((-x).im / abs x) - π := by simp only [arg, hx_re.not_le, hx_im.not_le, if_false] #align complex.arg_of_re_neg_of_im_neg Complex.arg_of_re_neg_of_im_neg theorem arg_of_im_nonneg_of_ne_zero {z : ℂ} (h₁ : 0 ≤ z.im) (h₂ : z ≠ 0) : arg z = Real.arccos (z.re / abs z) := by rw [← cos_arg h₂, Real.arccos_cos (arg_nonneg_iff.2 h₁) (arg_le_pi _)] #align complex.arg_of_im_nonneg_of_ne_zero Complex.arg_of_im_nonneg_of_ne_zero theorem arg_of_im_pos {z : ℂ} (hz : 0 < z.im) : arg z = Real.arccos (z.re / abs z) := arg_of_im_nonneg_of_ne_zero hz.le fun h => hz.ne' <| h.symm ▸ rfl #align complex.arg_of_im_pos Complex.arg_of_im_pos theorem arg_of_im_neg {z : ℂ} (hz : z.im < 0) : arg z = -Real.arccos (z.re / abs z) := by have h₀ : z ≠ 0 := mt (congr_arg im) hz.ne rw [← cos_arg h₀, ← Real.cos_neg, Real.arccos_cos, neg_neg] exacts [neg_nonneg.2 (arg_neg_iff.2 hz).le, neg_le.2 (neg_pi_lt_arg z).le] #align complex.arg_of_im_neg Complex.arg_of_im_neg theorem arg_conj (x : ℂ) : arg (conj x) = if arg x = π then π else -arg x := by simp_rw [arg_eq_pi_iff, arg, neg_im, conj_im, conj_re, abs_conj, neg_div, neg_neg, Real.arcsin_neg] rcases lt_trichotomy x.re 0 with (hr | hr | hr) <;> rcases lt_trichotomy x.im 0 with (hi | hi | hi) · simp [hr, hr.not_le, hi.le, hi.ne, not_le.2 hi, add_comm] · simp [hr, hr.not_le, hi] · simp [hr, hr.not_le, hi.ne.symm, hi.le, not_le.2 hi, sub_eq_neg_add] · simp [hr] · simp [hr] · simp [hr] · simp [hr, hr.le, hi.ne] · simp [hr, hr.le, hr.le.not_lt] · simp [hr, hr.le, hr.le.not_lt] #align complex.arg_conj Complex.arg_conj
Mathlib/Analysis/SpecialFunctions/Complex/Arg.lean
349
353
theorem arg_inv (x : ℂ) : arg x⁻¹ = if arg x = π then π else -arg x := by
rw [← arg_conj, inv_def, mul_comm] by_cases hx : x = 0 · simp [hx] · exact arg_real_mul (conj x) (by simp [hx])
import Mathlib.Control.Functor.Multivariate import Mathlib.Data.PFunctor.Multivariate.Basic import Mathlib.Data.PFunctor.Multivariate.M import Mathlib.Data.QPF.Multivariate.Basic #align_import data.qpf.multivariate.constructions.cofix from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" universe u open MvFunctor namespace MvQPF open TypeVec MvPFunctor open MvFunctor (LiftP LiftR) variable {n : ℕ} {F : TypeVec.{u} (n + 1) → Type u} [mvf : MvFunctor F] [q : MvQPF F] def corecF {α : TypeVec n} {β : Type u} (g : β → F (α.append1 β)) : β → q.P.M α := M.corec _ fun x => repr (g x) set_option linter.uppercaseLean3 false in #align mvqpf.corecF MvQPF.corecF theorem corecF_eq {α : TypeVec n} {β : Type u} (g : β → F (α.append1 β)) (x : β) : M.dest q.P (corecF g x) = appendFun id (corecF g) <$$> repr (g x) := by rw [corecF, M.dest_corec] set_option linter.uppercaseLean3 false in #align mvqpf.corecF_eq MvQPF.corecF_eq def IsPrecongr {α : TypeVec n} (r : q.P.M α → q.P.M α → Prop) : Prop := ∀ ⦃x y⦄, r x y → abs (appendFun id (Quot.mk r) <$$> M.dest q.P x) = abs (appendFun id (Quot.mk r) <$$> M.dest q.P y) #align mvqpf.is_precongr MvQPF.IsPrecongr def Mcongr {α : TypeVec n} (x y : q.P.M α) : Prop := ∃ r, IsPrecongr r ∧ r x y set_option linter.uppercaseLean3 false in #align mvqpf.Mcongr MvQPF.Mcongr def Cofix (F : TypeVec (n + 1) → Type u) [MvFunctor F] [q : MvQPF F] (α : TypeVec n) := Quot (@Mcongr _ F _ q α) #align mvqpf.cofix MvQPF.Cofix instance {α : TypeVec n} [Inhabited q.P.A] [∀ i : Fin2 n, Inhabited (α i)] : Inhabited (Cofix F α) := ⟨Quot.mk _ default⟩ def mRepr {α : TypeVec n} : q.P.M α → q.P.M α := corecF (abs ∘ M.dest q.P) set_option linter.uppercaseLean3 false in #align mvqpf.Mrepr MvQPF.mRepr def Cofix.map {α β : TypeVec n} (g : α ⟹ β) : Cofix F α → Cofix F β := Quot.lift (fun x : q.P.M α => Quot.mk Mcongr (g <$$> x)) (by rintro aa₁ aa₂ ⟨r, pr, ra₁a₂⟩; apply Quot.sound let r' b₁ b₂ := ∃ a₁ a₂ : q.P.M α, r a₁ a₂ ∧ b₁ = g <$$> a₁ ∧ b₂ = g <$$> a₂ use r'; constructor · show IsPrecongr r' rintro b₁ b₂ ⟨a₁, a₂, ra₁a₂, b₁eq, b₂eq⟩ let u : Quot r → Quot r' := Quot.lift (fun x : q.P.M α => Quot.mk r' (g <$$> x)) (by intro a₁ a₂ ra₁a₂ apply Quot.sound exact ⟨a₁, a₂, ra₁a₂, rfl, rfl⟩) have hu : (Quot.mk r' ∘ fun x : q.P.M α => g <$$> x) = u ∘ Quot.mk r := by ext x rfl rw [b₁eq, b₂eq, M.dest_map, M.dest_map, ← q.P.comp_map, ← q.P.comp_map] rw [← appendFun_comp, id_comp, hu, ← comp_id g, appendFun_comp] rw [q.P.comp_map, q.P.comp_map, abs_map, pr ra₁a₂, ← abs_map] show r' (g <$$> aa₁) (g <$$> aa₂); exact ⟨aa₁, aa₂, ra₁a₂, rfl, rfl⟩) #align mvqpf.cofix.map MvQPF.Cofix.map instance Cofix.mvfunctor : MvFunctor (Cofix F) where map := @Cofix.map _ _ _ _ #align mvqpf.cofix.mvfunctor MvQPF.Cofix.mvfunctor def Cofix.corec {α : TypeVec n} {β : Type u} (g : β → F (α.append1 β)) : β → Cofix F α := fun x => Quot.mk _ (corecF g x) #align mvqpf.cofix.corec MvQPF.Cofix.corec def Cofix.dest {α : TypeVec n} : Cofix F α → F (α.append1 (Cofix F α)) := Quot.lift (fun x => appendFun id (Quot.mk Mcongr) <$$> abs (M.dest q.P x)) (by rintro x y ⟨r, pr, rxy⟩ dsimp have : ∀ x y, r x y → Mcongr x y := by intro x y h exact ⟨r, pr, h⟩ rw [← Quot.factor_mk_eq _ _ this] conv => lhs rw [appendFun_comp_id, comp_map, ← abs_map, pr rxy, abs_map, ← comp_map, ← appendFun_comp_id]) #align mvqpf.cofix.dest MvQPF.Cofix.dest def Cofix.abs {α} : q.P.M α → Cofix F α := Quot.mk _ #align mvqpf.cofix.abs MvQPF.Cofix.abs def Cofix.repr {α} : Cofix F α → q.P.M α := M.corec _ <| q.repr ∘ Cofix.dest #align mvqpf.cofix.repr MvQPF.Cofix.repr def Cofix.corec'₁ {α : TypeVec n} {β : Type u} (g : ∀ {X}, (β → X) → F (α.append1 X)) (x : β) : Cofix F α := Cofix.corec (fun _ => g id) x #align mvqpf.cofix.corec'₁ MvQPF.Cofix.corec'₁ def Cofix.corec' {α : TypeVec n} {β : Type u} (g : β → F (α.append1 (Cofix F α ⊕ β))) (x : β) : Cofix F α := let f : (α ::: Cofix F α) ⟹ (α ::: (Cofix F α ⊕ β)) := id ::: Sum.inl Cofix.corec (Sum.elim (MvFunctor.map f ∘ Cofix.dest) g) (Sum.inr x : Cofix F α ⊕ β) #align mvqpf.cofix.corec' MvQPF.Cofix.corec' def Cofix.corec₁ {α : TypeVec n} {β : Type u} (g : ∀ {X}, (Cofix F α → X) → (β → X) → β → F (α ::: X)) (x : β) : Cofix F α := Cofix.corec' (fun x => g Sum.inl Sum.inr x) x #align mvqpf.cofix.corec₁ MvQPF.Cofix.corec₁ theorem Cofix.dest_corec {α : TypeVec n} {β : Type u} (g : β → F (α.append1 β)) (x : β) : Cofix.dest (Cofix.corec g x) = appendFun id (Cofix.corec g) <$$> g x := by conv => lhs rw [Cofix.dest, Cofix.corec]; dsimp rw [corecF_eq, abs_map, abs_repr, ← comp_map, ← appendFun_comp]; rfl #align mvqpf.cofix.dest_corec MvQPF.Cofix.dest_corec def Cofix.mk {α : TypeVec n} : F (α.append1 <| Cofix F α) → Cofix F α := Cofix.corec fun x => (appendFun id fun i : Cofix F α => Cofix.dest.{u} i) <$$> x #align mvqpf.cofix.mk MvQPF.Cofix.mk private theorem Cofix.bisim_aux {α : TypeVec n} (r : Cofix F α → Cofix F α → Prop) (h' : ∀ x, r x x) (h : ∀ x y, r x y → appendFun id (Quot.mk r) <$$> Cofix.dest x = appendFun id (Quot.mk r) <$$> Cofix.dest y) : ∀ x y, r x y → x = y := by intro x rcases x; clear x; rename M (P F) α => x; intro y rcases y; clear y; rename M (P F) α => y; intro rxy apply Quot.sound let r' := fun x y => r (Quot.mk _ x) (Quot.mk _ y) have hr' : r' = fun x y => r (Quot.mk _ x) (Quot.mk _ y) := rfl have : IsPrecongr r' := by intro a b r'ab have h₀ : appendFun id (Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest q.P a) = appendFun id (Quot.mk r ∘ Quot.mk Mcongr) <$$> MvQPF.abs (M.dest q.P b) := by rw [appendFun_comp_id, comp_map, comp_map]; exact h _ _ r'ab have h₁ : ∀ u v : q.P.M α, Mcongr u v → Quot.mk r' u = Quot.mk r' v := by intro u v cuv apply Quot.sound dsimp [r', hr'] rw [Quot.sound cuv] apply h' let f : Quot r → Quot r' := Quot.lift (Quot.lift (Quot.mk r') h₁) (by intro c apply Quot.inductionOn (motive := fun c => ∀b, r c b → Quot.lift (Quot.mk r') h₁ c = Quot.lift (Quot.mk r') h₁ b) c clear c intro c d apply Quot.inductionOn (motive := fun d => r (Quot.mk Mcongr c) d → Quot.lift (Quot.mk r') h₁ (Quot.mk Mcongr c) = Quot.lift (Quot.mk r') h₁ d) d clear d intro d rcd; apply Quot.sound; apply rcd) have : f ∘ Quot.mk r ∘ Quot.mk Mcongr = Quot.mk r' := rfl rw [← this, appendFun_comp_id, q.P.comp_map, q.P.comp_map, abs_map, abs_map, abs_map, abs_map, h₀] exact ⟨r', this, rxy⟩ theorem Cofix.bisim_rel {α : TypeVec n} (r : Cofix F α → Cofix F α → Prop) (h : ∀ x y, r x y → appendFun id (Quot.mk r) <$$> Cofix.dest x = appendFun id (Quot.mk r) <$$> Cofix.dest y) : ∀ x y, r x y → x = y := by let r' (x y) := x = y ∨ r x y intro x y rxy apply Cofix.bisim_aux r' · intro x left rfl · intro x y r'xy cases r'xy with | inl h => rw [h] | inr r'xy => have : ∀ x y, r x y → r' x y := fun x y h => Or.inr h rw [← Quot.factor_mk_eq _ _ this] dsimp [r'] rw [appendFun_comp_id] rw [@comp_map _ _ _ q _ _ _ (appendFun id (Quot.mk r)), @comp_map _ _ _ q _ _ _ (appendFun id (Quot.mk r))] rw [h _ _ r'xy] right; exact rxy #align mvqpf.cofix.bisim_rel MvQPF.Cofix.bisim_rel theorem Cofix.bisim {α : TypeVec n} (r : Cofix F α → Cofix F α → Prop) (h : ∀ x y, r x y → LiftR (RelLast α r (i := _)) (Cofix.dest x) (Cofix.dest y)) : ∀ x y, r x y → x = y := by apply Cofix.bisim_rel intro x y rxy rcases (liftR_iff (fun a b => RelLast α r a b) (dest x) (dest y)).mp (h x y rxy) with ⟨a, f₀, f₁, dxeq, dyeq, h'⟩ rw [dxeq, dyeq, ← abs_map, ← abs_map, MvPFunctor.map_eq, MvPFunctor.map_eq] rw [← split_dropFun_lastFun f₀, ← split_dropFun_lastFun f₁] rw [appendFun_comp_splitFun, appendFun_comp_splitFun] rw [id_comp, id_comp] congr 2 with (i j); cases' i with _ i · apply Quot.sound apply h' _ j · change f₀ _ j = f₁ _ j apply h' _ j #align mvqpf.cofix.bisim MvQPF.Cofix.bisim open MvFunctor theorem Cofix.bisim₂ {α : TypeVec n} (r : Cofix F α → Cofix F α → Prop) (h : ∀ x y, r x y → LiftR' (RelLast' α r) (Cofix.dest x) (Cofix.dest y)) : ∀ x y, r x y → x = y := Cofix.bisim r <| by intros; rw [← LiftR_RelLast_iff]; apply h; assumption #align mvqpf.cofix.bisim₂ MvQPF.Cofix.bisim₂ theorem Cofix.bisim' {α : TypeVec n} {β : Type*} (Q : β → Prop) (u v : β → Cofix F α) (h : ∀ x, Q x → ∃ a f' f₀ f₁, Cofix.dest (u x) = q.abs ⟨a, q.P.appendContents f' f₀⟩ ∧ Cofix.dest (v x) = q.abs ⟨a, q.P.appendContents f' f₁⟩ ∧ ∀ i, ∃ x', Q x' ∧ f₀ i = u x' ∧ f₁ i = v x') : ∀ x, Q x → u x = v x := fun x Qx => let R := fun w z : Cofix F α => ∃ x', Q x' ∧ w = u x' ∧ z = v x' Cofix.bisim R (fun x y ⟨x', Qx', xeq, yeq⟩ => by rcases h x' Qx' with ⟨a, f', f₀, f₁, ux'eq, vx'eq, h'⟩ rw [liftR_iff] refine ⟨a, q.P.appendContents f' f₀, q.P.appendContents f' f₁, xeq.symm ▸ ux'eq, yeq.symm ▸ vx'eq, ?_⟩ intro i; cases i · apply h' · intro j apply Eq.refl) _ _ ⟨x, Qx, rfl, rfl⟩ #align mvqpf.cofix.bisim' MvQPF.Cofix.bisim' theorem Cofix.mk_dest {α : TypeVec n} (x : Cofix F α) : Cofix.mk (Cofix.dest x) = x := by apply Cofix.bisim_rel (fun x y : Cofix F α => x = Cofix.mk (Cofix.dest y)) _ _ _ rfl; dsimp intro x y h rw [h] conv => lhs congr rfl rw [Cofix.mk] rw [Cofix.dest_corec] rw [← comp_map, ← appendFun_comp, id_comp] rw [← comp_map, ← appendFun_comp, id_comp, ← Cofix.mk] congr apply congrArg funext x apply Quot.sound; rfl #align mvqpf.cofix.mk_dest MvQPF.Cofix.mk_dest theorem Cofix.dest_mk {α : TypeVec n} (x : F (α.append1 <| Cofix F α)) : Cofix.dest (Cofix.mk x) = x := by have : Cofix.mk ∘ Cofix.dest = @_root_.id (Cofix F α) := funext Cofix.mk_dest rw [Cofix.mk, Cofix.dest_corec, ← comp_map, ← Cofix.mk, ← appendFun_comp, this, id_comp, appendFun_id_id, MvFunctor.id_map] #align mvqpf.cofix.dest_mk MvQPF.Cofix.dest_mk
Mathlib/Data/QPF/Multivariate/Constructions/Cofix.lean
362
363
theorem Cofix.ext {α : TypeVec n} (x y : Cofix F α) (h : x.dest = y.dest) : x = y := by
rw [← Cofix.mk_dest x, h, Cofix.mk_dest]
import Mathlib.Order.Filter.Basic import Mathlib.Topology.Bases import Mathlib.Data.Set.Accumulate import Mathlib.Topology.Bornology.Basic import Mathlib.Topology.LocallyFinite open Set Filter Topology TopologicalSpace Classical Function universe u v variable {X : Type u} {Y : Type v} {ι : Type*} variable [TopologicalSpace X] [TopologicalSpace Y] {s t : Set X} -- compact sets section Compact lemma IsCompact.exists_clusterPt (hs : IsCompact s) {f : Filter X} [NeBot f] (hf : f ≤ 𝓟 s) : ∃ x ∈ s, ClusterPt x f := hs hf lemma IsCompact.exists_mapClusterPt {ι : Type*} (hs : IsCompact s) {f : Filter ι} [NeBot f] {u : ι → X} (hf : Filter.map u f ≤ 𝓟 s) : ∃ x ∈ s, MapClusterPt x f u := hs hf theorem IsCompact.compl_mem_sets (hs : IsCompact s) {f : Filter X} (hf : ∀ x ∈ s, sᶜ ∈ 𝓝 x ⊓ f) : sᶜ ∈ f := by contrapose! hf simp only [not_mem_iff_inf_principal_compl, compl_compl, inf_assoc] at hf ⊢ exact @hs _ hf inf_le_right #align is_compact.compl_mem_sets IsCompact.compl_mem_sets theorem IsCompact.compl_mem_sets_of_nhdsWithin (hs : IsCompact s) {f : Filter X} (hf : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, tᶜ ∈ f) : sᶜ ∈ f := by refine hs.compl_mem_sets fun x hx => ?_ rcases hf x hx with ⟨t, ht, hst⟩ replace ht := mem_inf_principal.1 ht apply mem_inf_of_inter ht hst rintro x ⟨h₁, h₂⟩ hs exact h₂ (h₁ hs) #align is_compact.compl_mem_sets_of_nhds_within IsCompact.compl_mem_sets_of_nhdsWithin @[elab_as_elim] theorem IsCompact.induction_on (hs : IsCompact s) {p : Set X → Prop} (he : p ∅) (hmono : ∀ ⦃s t⦄, s ⊆ t → p t → p s) (hunion : ∀ ⦃s t⦄, p s → p t → p (s ∪ t)) (hnhds : ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, p t) : p s := by let f : Filter X := comk p he (fun _t ht _s hsub ↦ hmono hsub ht) (fun _s hs _t ht ↦ hunion hs ht) have : sᶜ ∈ f := hs.compl_mem_sets_of_nhdsWithin (by simpa [f] using hnhds) rwa [← compl_compl s] #align is_compact.induction_on IsCompact.induction_on theorem IsCompact.inter_right (hs : IsCompact s) (ht : IsClosed t) : IsCompact (s ∩ t) := by intro f hnf hstf obtain ⟨x, hsx, hx⟩ : ∃ x ∈ s, ClusterPt x f := hs (le_trans hstf (le_principal_iff.2 inter_subset_left)) have : x ∈ t := ht.mem_of_nhdsWithin_neBot <| hx.mono <| le_trans hstf (le_principal_iff.2 inter_subset_right) exact ⟨x, ⟨hsx, this⟩, hx⟩ #align is_compact.inter_right IsCompact.inter_right theorem IsCompact.inter_left (ht : IsCompact t) (hs : IsClosed s) : IsCompact (s ∩ t) := inter_comm t s ▸ ht.inter_right hs #align is_compact.inter_left IsCompact.inter_left theorem IsCompact.diff (hs : IsCompact s) (ht : IsOpen t) : IsCompact (s \ t) := hs.inter_right (isClosed_compl_iff.mpr ht) #align is_compact.diff IsCompact.diff theorem IsCompact.of_isClosed_subset (hs : IsCompact s) (ht : IsClosed t) (h : t ⊆ s) : IsCompact t := inter_eq_self_of_subset_right h ▸ hs.inter_right ht #align is_compact_of_is_closed_subset IsCompact.of_isClosed_subset theorem IsCompact.image_of_continuousOn {f : X → Y} (hs : IsCompact s) (hf : ContinuousOn f s) : IsCompact (f '' s) := by intro l lne ls have : NeBot (l.comap f ⊓ 𝓟 s) := comap_inf_principal_neBot_of_image_mem lne (le_principal_iff.1 ls) obtain ⟨x, hxs, hx⟩ : ∃ x ∈ s, ClusterPt x (l.comap f ⊓ 𝓟 s) := @hs _ this inf_le_right haveI := hx.neBot use f x, mem_image_of_mem f hxs have : Tendsto f (𝓝 x ⊓ (comap f l ⊓ 𝓟 s)) (𝓝 (f x) ⊓ l) := by convert (hf x hxs).inf (@tendsto_comap _ _ f l) using 1 rw [nhdsWithin] ac_rfl exact this.neBot #align is_compact.image_of_continuous_on IsCompact.image_of_continuousOn theorem IsCompact.image {f : X → Y} (hs : IsCompact s) (hf : Continuous f) : IsCompact (f '' s) := hs.image_of_continuousOn hf.continuousOn #align is_compact.image IsCompact.image theorem IsCompact.adherence_nhdset {f : Filter X} (hs : IsCompact s) (hf₂ : f ≤ 𝓟 s) (ht₁ : IsOpen t) (ht₂ : ∀ x ∈ s, ClusterPt x f → x ∈ t) : t ∈ f := Classical.by_cases mem_of_eq_bot fun (this : f ⊓ 𝓟 tᶜ ≠ ⊥) => let ⟨x, hx, (hfx : ClusterPt x <| f ⊓ 𝓟 tᶜ)⟩ := @hs _ ⟨this⟩ <| inf_le_of_left_le hf₂ have : x ∈ t := ht₂ x hx hfx.of_inf_left have : tᶜ ∩ t ∈ 𝓝[tᶜ] x := inter_mem_nhdsWithin _ (IsOpen.mem_nhds ht₁ this) have A : 𝓝[tᶜ] x = ⊥ := empty_mem_iff_bot.1 <| compl_inter_self t ▸ this have : 𝓝[tᶜ] x ≠ ⊥ := hfx.of_inf_right.ne absurd A this #align is_compact.adherence_nhdset IsCompact.adherence_nhdset theorem isCompact_iff_ultrafilter_le_nhds : IsCompact s ↔ ∀ f : Ultrafilter X, ↑f ≤ 𝓟 s → ∃ x ∈ s, ↑f ≤ 𝓝 x := by refine (forall_neBot_le_iff ?_).trans ?_ · rintro f g hle ⟨x, hxs, hxf⟩ exact ⟨x, hxs, hxf.mono hle⟩ · simp only [Ultrafilter.clusterPt_iff] #align is_compact_iff_ultrafilter_le_nhds isCompact_iff_ultrafilter_le_nhds alias ⟨IsCompact.ultrafilter_le_nhds, _⟩ := isCompact_iff_ultrafilter_le_nhds #align is_compact.ultrafilter_le_nhds IsCompact.ultrafilter_le_nhds theorem isCompact_iff_ultrafilter_le_nhds' : IsCompact s ↔ ∀ f : Ultrafilter X, s ∈ f → ∃ x ∈ s, ↑f ≤ 𝓝 x := by simp only [isCompact_iff_ultrafilter_le_nhds, le_principal_iff, Ultrafilter.mem_coe] alias ⟨IsCompact.ultrafilter_le_nhds', _⟩ := isCompact_iff_ultrafilter_le_nhds' lemma IsCompact.le_nhds_of_unique_clusterPt (hs : IsCompact s) {l : Filter X} {y : X} (hmem : s ∈ l) (h : ∀ x ∈ s, ClusterPt x l → x = y) : l ≤ 𝓝 y := by refine le_iff_ultrafilter.2 fun f hf ↦ ?_ rcases hs.ultrafilter_le_nhds' f (hf hmem) with ⟨x, hxs, hx⟩ convert ← hx exact h x hxs (.mono (.of_le_nhds hx) hf) lemma IsCompact.tendsto_nhds_of_unique_mapClusterPt {l : Filter Y} {y : X} {f : Y → X} (hs : IsCompact s) (hmem : ∀ᶠ x in l, f x ∈ s) (h : ∀ x ∈ s, MapClusterPt x l f → x = y) : Tendsto f l (𝓝 y) := hs.le_nhds_of_unique_clusterPt (mem_map.2 hmem) h theorem IsCompact.elim_directed_cover {ι : Type v} [hι : Nonempty ι] (hs : IsCompact s) (U : ι → Set X) (hUo : ∀ i, IsOpen (U i)) (hsU : s ⊆ ⋃ i, U i) (hdU : Directed (· ⊆ ·) U) : ∃ i, s ⊆ U i := hι.elim fun i₀ => IsCompact.induction_on hs ⟨i₀, empty_subset _⟩ (fun _ _ hs ⟨i, hi⟩ => ⟨i, hs.trans hi⟩) (fun _ _ ⟨i, hi⟩ ⟨j, hj⟩ => let ⟨k, hki, hkj⟩ := hdU i j ⟨k, union_subset (Subset.trans hi hki) (Subset.trans hj hkj)⟩) fun _x hx => let ⟨i, hi⟩ := mem_iUnion.1 (hsU hx) ⟨U i, mem_nhdsWithin_of_mem_nhds (IsOpen.mem_nhds (hUo i) hi), i, Subset.refl _⟩ #align is_compact.elim_directed_cover IsCompact.elim_directed_cover theorem IsCompact.elim_finite_subcover {ι : Type v} (hs : IsCompact s) (U : ι → Set X) (hUo : ∀ i, IsOpen (U i)) (hsU : s ⊆ ⋃ i, U i) : ∃ t : Finset ι, s ⊆ ⋃ i ∈ t, U i := hs.elim_directed_cover _ (fun _ => isOpen_biUnion fun i _ => hUo i) (iUnion_eq_iUnion_finset U ▸ hsU) (directed_of_isDirected_le fun _ _ h => biUnion_subset_biUnion_left h) #align is_compact.elim_finite_subcover IsCompact.elim_finite_subcover lemma IsCompact.elim_nhds_subcover_nhdsSet' (hs : IsCompact s) (U : ∀ x ∈ s, Set X) (hU : ∀ x hx, U x hx ∈ 𝓝 x) : ∃ t : Finset s, (⋃ x ∈ t, U x.1 x.2) ∈ 𝓝ˢ s := by rcases hs.elim_finite_subcover (fun x : s ↦ interior (U x x.2)) (fun _ ↦ isOpen_interior) fun x hx ↦ mem_iUnion.2 ⟨⟨x, hx⟩, mem_interior_iff_mem_nhds.2 <| hU _ _⟩ with ⟨t, hst⟩ refine ⟨t, mem_nhdsSet_iff_forall.2 fun x hx ↦ ?_⟩ rcases mem_iUnion₂.1 (hst hx) with ⟨y, hyt, hy⟩ refine mem_of_superset ?_ (subset_biUnion_of_mem hyt) exact mem_interior_iff_mem_nhds.1 hy lemma IsCompact.elim_nhds_subcover_nhdsSet (hs : IsCompact s) {U : X → Set X} (hU : ∀ x ∈ s, U x ∈ 𝓝 x) : ∃ t : Finset X, (∀ x ∈ t, x ∈ s) ∧ (⋃ x ∈ t, U x) ∈ 𝓝ˢ s := let ⟨t, ht⟩ := hs.elim_nhds_subcover_nhdsSet' (fun x _ => U x) hU ⟨t.image (↑), fun x hx => let ⟨y, _, hyx⟩ := Finset.mem_image.1 hx hyx ▸ y.2, by rwa [Finset.set_biUnion_finset_image]⟩ theorem IsCompact.elim_nhds_subcover' (hs : IsCompact s) (U : ∀ x ∈ s, Set X) (hU : ∀ x (hx : x ∈ s), U x ‹x ∈ s› ∈ 𝓝 x) : ∃ t : Finset s, s ⊆ ⋃ x ∈ t, U (x : s) x.2 := (hs.elim_nhds_subcover_nhdsSet' U hU).imp fun _ ↦ subset_of_mem_nhdsSet #align is_compact.elim_nhds_subcover' IsCompact.elim_nhds_subcover' theorem IsCompact.elim_nhds_subcover (hs : IsCompact s) (U : X → Set X) (hU : ∀ x ∈ s, U x ∈ 𝓝 x) : ∃ t : Finset X, (∀ x ∈ t, x ∈ s) ∧ s ⊆ ⋃ x ∈ t, U x := (hs.elim_nhds_subcover_nhdsSet hU).imp fun _ h ↦ h.imp_right subset_of_mem_nhdsSet #align is_compact.elim_nhds_subcover IsCompact.elim_nhds_subcover theorem IsCompact.disjoint_nhdsSet_left {l : Filter X} (hs : IsCompact s) : Disjoint (𝓝ˢ s) l ↔ ∀ x ∈ s, Disjoint (𝓝 x) l := by refine ⟨fun h x hx => h.mono_left <| nhds_le_nhdsSet hx, fun H => ?_⟩ choose! U hxU hUl using fun x hx => (nhds_basis_opens x).disjoint_iff_left.1 (H x hx) choose hxU hUo using hxU rcases hs.elim_nhds_subcover U fun x hx => (hUo x hx).mem_nhds (hxU x hx) with ⟨t, hts, hst⟩ refine (hasBasis_nhdsSet _).disjoint_iff_left.2 ⟨⋃ x ∈ t, U x, ⟨isOpen_biUnion fun x hx => hUo x (hts x hx), hst⟩, ?_⟩ rw [compl_iUnion₂, biInter_finset_mem] exact fun x hx => hUl x (hts x hx) #align is_compact.disjoint_nhds_set_left IsCompact.disjoint_nhdsSet_left theorem IsCompact.disjoint_nhdsSet_right {l : Filter X} (hs : IsCompact s) : Disjoint l (𝓝ˢ s) ↔ ∀ x ∈ s, Disjoint l (𝓝 x) := by simpa only [disjoint_comm] using hs.disjoint_nhdsSet_left #align is_compact.disjoint_nhds_set_right IsCompact.disjoint_nhdsSet_right -- Porting note (#11215): TODO: reformulate using `Disjoint` theorem IsCompact.elim_directed_family_closed {ι : Type v} [hι : Nonempty ι] (hs : IsCompact s) (t : ι → Set X) (htc : ∀ i, IsClosed (t i)) (hst : (s ∩ ⋂ i, t i) = ∅) (hdt : Directed (· ⊇ ·) t) : ∃ i : ι, s ∩ t i = ∅ := let ⟨t, ht⟩ := hs.elim_directed_cover (compl ∘ t) (fun i => (htc i).isOpen_compl) (by simpa only [subset_def, not_forall, eq_empty_iff_forall_not_mem, mem_iUnion, exists_prop, mem_inter_iff, not_and, iff_self_iff, mem_iInter, mem_compl_iff] using hst) (hdt.mono_comp _ fun _ _ => compl_subset_compl.mpr) ⟨t, by simpa only [subset_def, not_forall, eq_empty_iff_forall_not_mem, mem_iUnion, exists_prop, mem_inter_iff, not_and, iff_self_iff, mem_iInter, mem_compl_iff] using ht⟩ #align is_compact.elim_directed_family_closed IsCompact.elim_directed_family_closed -- Porting note (#11215): TODO: reformulate using `Disjoint` theorem IsCompact.elim_finite_subfamily_closed {ι : Type v} (hs : IsCompact s) (t : ι → Set X) (htc : ∀ i, IsClosed (t i)) (hst : (s ∩ ⋂ i, t i) = ∅) : ∃ u : Finset ι, (s ∩ ⋂ i ∈ u, t i) = ∅ := hs.elim_directed_family_closed _ (fun t ↦ isClosed_biInter fun _ _ ↦ htc _) (by rwa [← iInter_eq_iInter_finset]) (directed_of_isDirected_le fun _ _ h ↦ biInter_subset_biInter_left h) #align is_compact.elim_finite_subfamily_closed IsCompact.elim_finite_subfamily_closed theorem LocallyFinite.finite_nonempty_inter_compact {f : ι → Set X} (hf : LocallyFinite f) (hs : IsCompact s) : { i | (f i ∩ s).Nonempty }.Finite := by choose U hxU hUf using hf rcases hs.elim_nhds_subcover U fun x _ => hxU x with ⟨t, -, hsU⟩ refine (t.finite_toSet.biUnion fun x _ => hUf x).subset ?_ rintro i ⟨x, hx⟩ rcases mem_iUnion₂.1 (hsU hx.2) with ⟨c, hct, hcx⟩ exact mem_biUnion hct ⟨x, hx.1, hcx⟩ #align locally_finite.finite_nonempty_inter_compact LocallyFinite.finite_nonempty_inter_compact theorem IsCompact.inter_iInter_nonempty {ι : Type v} (hs : IsCompact s) (t : ι → Set X) (htc : ∀ i, IsClosed (t i)) (hst : ∀ u : Finset ι, (s ∩ ⋂ i ∈ u, t i).Nonempty) : (s ∩ ⋂ i, t i).Nonempty := by contrapose! hst exact hs.elim_finite_subfamily_closed t htc hst #align is_compact.inter_Inter_nonempty IsCompact.inter_iInter_nonempty theorem IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed {ι : Type v} [hι : Nonempty ι] (t : ι → Set X) (htd : Directed (· ⊇ ·) t) (htn : ∀ i, (t i).Nonempty) (htc : ∀ i, IsCompact (t i)) (htcl : ∀ i, IsClosed (t i)) : (⋂ i, t i).Nonempty := by let i₀ := hι.some suffices (t i₀ ∩ ⋂ i, t i).Nonempty by rwa [inter_eq_right.mpr (iInter_subset _ i₀)] at this simp only [nonempty_iff_ne_empty] at htn ⊢ apply mt ((htc i₀).elim_directed_family_closed t htcl) push_neg simp only [← nonempty_iff_ne_empty] at htn ⊢ refine ⟨htd, fun i => ?_⟩ rcases htd i₀ i with ⟨j, hji₀, hji⟩ exact (htn j).mono (subset_inter hji₀ hji) #align is_compact.nonempty_Inter_of_directed_nonempty_compact_closed IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed @[deprecated (since := "2024-02-28")] alias IsCompact.nonempty_iInter_of_directed_nonempty_compact_closed := IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed
Mathlib/Topology/Compactness/Compact.lean
312
317
theorem IsCompact.nonempty_sInter_of_directed_nonempty_isCompact_isClosed {S : Set (Set X)} [hS : Nonempty S] (hSd : DirectedOn (· ⊇ ·) S) (hSn : ∀ U ∈ S, U.Nonempty) (hSc : ∀ U ∈ S, IsCompact U) (hScl : ∀ U ∈ S, IsClosed U) : (⋂₀ S).Nonempty := by
rw [sInter_eq_iInter] exact IsCompact.nonempty_iInter_of_directed_nonempty_isCompact_isClosed _ (DirectedOn.directed_val hSd) (fun i ↦ hSn i i.2) (fun i ↦ hSc i i.2) (fun i ↦ hScl i i.2)
import Mathlib.CategoryTheory.Abelian.Opposite import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Kernels import Mathlib.CategoryTheory.Preadditive.LeftExact import Mathlib.CategoryTheory.Adjunction.Limits import Mathlib.Algebra.Homology.Exact import Mathlib.Tactic.TFAE #align_import category_theory.abelian.exact from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" universe v₁ v₂ u₁ u₂ noncomputable section open CategoryTheory Limits Preadditive variable {C : Type u₁} [Category.{v₁} C] [Abelian C] namespace CategoryTheory namespace Abelian variable {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) attribute [local instance] hasEqualizers_of_hasKernels theorem exact_iff_image_eq_kernel : Exact f g ↔ imageSubobject f = kernelSubobject g := by constructor · intro h have : IsIso (imageToKernel f g h.w) := have := h.epi; isIso_of_mono_of_epi _ refine Subobject.eq_of_comm (asIso (imageToKernel _ _ h.w)) ?_ simp · apply exact_of_image_eq_kernel #align category_theory.abelian.exact_iff_image_eq_kernel CategoryTheory.Abelian.exact_iff_image_eq_kernel theorem exact_iff : Exact f g ↔ f ≫ g = 0 ∧ kernel.ι g ≫ cokernel.π f = 0 := by constructor · exact fun h ↦ ⟨h.1, kernel_comp_cokernel f g h⟩ · refine fun h ↦ ⟨h.1, ?_⟩ suffices hl : IsLimit (KernelFork.ofι (imageSubobject f).arrow (imageSubobject_arrow_comp_eq_zero h.1)) by have : imageToKernel f g h.1 = (hl.conePointUniqueUpToIso (limit.isLimit _)).hom ≫ (kernelSubobjectIso _).inv := by ext; simp rw [this] infer_instance refine KernelFork.IsLimit.ofι _ _ (fun u hu ↦ ?_) ?_ (fun _ _ _ h ↦ ?_) · refine kernel.lift (cokernel.π f) u ?_ ≫ (imageIsoImage f).hom ≫ (imageSubobjectIso _).inv rw [← kernel.lift_ι g u hu, Category.assoc, h.2, comp_zero] · aesop_cat · rw [← cancel_mono (imageSubobject f).arrow, h] simp #align category_theory.abelian.exact_iff CategoryTheory.Abelian.exact_iff theorem exact_iff' {cg : KernelFork g} (hg : IsLimit cg) {cf : CokernelCofork f} (hf : IsColimit cf) : Exact f g ↔ f ≫ g = 0 ∧ cg.ι ≫ cf.π = 0 := by constructor · intro h exact ⟨h.1, fork_ι_comp_cofork_π f g h cg cf⟩ · rw [exact_iff] refine fun h => ⟨h.1, ?_⟩ apply zero_of_epi_comp (IsLimit.conePointUniqueUpToIso hg (limit.isLimit _)).hom apply zero_of_comp_mono (IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) hf).hom simp [h.2] #align category_theory.abelian.exact_iff' CategoryTheory.Abelian.exact_iff' open List in theorem exact_tfae : TFAE [Exact f g, f ≫ g = 0 ∧ kernel.ι g ≫ cokernel.π f = 0, imageSubobject f = kernelSubobject g] := by tfae_have 1 ↔ 2; · apply exact_iff tfae_have 1 ↔ 3; · apply exact_iff_image_eq_kernel tfae_finish #align category_theory.abelian.exact_tfae CategoryTheory.Abelian.exact_tfae nonrec theorem IsEquivalence.exact_iff {D : Type u₁} [Category.{v₁} D] [Abelian D] (F : C ⥤ D) [F.IsEquivalence] : Exact (F.map f) (F.map g) ↔ Exact f g := by simp only [exact_iff, ← F.map_eq_zero_iff, F.map_comp, Category.assoc, ← kernelComparison_comp_ι g F, ← π_comp_cokernelComparison f F] rw [IsIso.comp_left_eq_zero (kernelComparison g F), ← Category.assoc, IsIso.comp_right_eq_zero _ (cokernelComparison f F)] #align category_theory.abelian.is_equivalence.exact_iff CategoryTheory.Abelian.IsEquivalence.exact_iff theorem exact_epi_comp_iff {W : C} (h : W ⟶ X) [Epi h] : Exact (h ≫ f) g ↔ Exact f g := by refine ⟨fun hfg => ?_, fun h => exact_epi_comp h⟩ let hc := isCokernelOfComp _ _ (colimit.isColimit (parallelPair (h ≫ f) 0)) (by rw [← cancel_epi h, ← Category.assoc, CokernelCofork.condition, comp_zero]) rfl refine (exact_iff' _ _ (limit.isLimit _) hc).2 ⟨?_, ((exact_iff _ _).1 hfg).2⟩ exact zero_of_epi_comp h (by rw [← hfg.1, Category.assoc]) #align category_theory.abelian.exact_epi_comp_iff CategoryTheory.Abelian.exact_epi_comp_iff def isLimitImage (h : Exact f g) : IsLimit (KernelFork.ofι (Abelian.image.ι f) (image_ι_comp_eq_zero h.1) : KernelFork g) := by rw [exact_iff] at h exact KernelFork.IsLimit.ofι _ _ (fun u hu ↦ kernel.lift (cokernel.π f) u (by rw [← kernel.lift_ι g u hu, Category.assoc, h.2, comp_zero])) (by aesop_cat) (fun _ _ _ hm => by rw [← cancel_mono (image.ι f), hm, kernel.lift_ι]) #align category_theory.abelian.is_limit_image CategoryTheory.Abelian.isLimitImage def isLimitImage' (h : Exact f g) : IsLimit (KernelFork.ofι (Limits.image.ι f) (Limits.image_ι_comp_eq_zero h.1)) := IsKernel.isoKernel _ _ (isLimitImage f g h) (imageIsoImage f).symm <| IsImage.lift_fac _ _ #align category_theory.abelian.is_limit_image' CategoryTheory.Abelian.isLimitImage' def isColimitCoimage (h : Exact f g) : IsColimit (CokernelCofork.ofπ (Abelian.coimage.π g) (Abelian.comp_coimage_π_eq_zero h.1) : CokernelCofork f) := by rw [exact_iff] at h refine CokernelCofork.IsColimit.ofπ _ _ (fun u hu => cokernel.desc (kernel.ι g) u (by rw [← cokernel.π_desc f u hu, ← Category.assoc, h.2, zero_comp])) (by aesop_cat) ?_ intros _ _ _ _ hm ext rw [hm, cokernel.π_desc] #align category_theory.abelian.is_colimit_coimage CategoryTheory.Abelian.isColimitCoimage def isColimitImage (h : Exact f g) : IsColimit (CokernelCofork.ofπ (Limits.factorThruImage g) (comp_factorThruImage_eq_zero h.1)) := IsCokernel.cokernelIso _ _ (isColimitCoimage f g h) (coimageIsoImage' g) <| (cancel_mono (Limits.image.ι g)).1 <| by simp #align category_theory.abelian.is_colimit_image CategoryTheory.Abelian.isColimitImage theorem exact_cokernel : Exact f (cokernel.π f) := by rw [exact_iff] aesop_cat #align category_theory.abelian.exact_cokernel CategoryTheory.Abelian.exact_cokernel -- Porting note: this can no longer be an instance in Lean4 lemma mono_cokernel_desc_of_exact (h : Exact f g) : Mono (cokernel.desc f g h.w) := suffices h : cokernel.desc f g h.w = (IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) (isColimitImage f g h)).hom ≫ Limits.image.ι g from h.symm ▸ mono_comp _ _ (cancel_epi (cokernel.π f)).1 <| by simp -- Porting note: this can no longer be an instance in Lean4 lemma isIso_cokernel_desc_of_exact_of_epi (ex : Exact f g) [Epi g] : IsIso (cokernel.desc f g ex.w) := have := mono_cokernel_desc_of_exact _ _ ex isIso_of_mono_of_epi (Limits.cokernel.desc f g ex.w) -- Porting note: removed the simp attribute because the lemma may never apply automatically @[reassoc (attr := nolint unusedHavesSuffices)] theorem cokernel.desc.inv [Epi g] (ex : Exact f g) : have := isIso_cokernel_desc_of_exact_of_epi _ _ ex g ≫ inv (cokernel.desc _ _ ex.w) = cokernel.π _ := by have := isIso_cokernel_desc_of_exact_of_epi _ _ ex simp #align category_theory.abelian.cokernel.desc.inv CategoryTheory.Abelian.cokernel.desc.inv -- Porting note: this can no longer be an instance in Lean4 lemma isIso_kernel_lift_of_exact_of_mono (ex : Exact f g) [Mono f] : IsIso (kernel.lift g f ex.w) := have := ex.epi_kernel_lift isIso_of_mono_of_epi (Limits.kernel.lift g f ex.w) -- Porting note: removed the simp attribute because the lemma may never apply automatically @[reassoc (attr := nolint unusedHavesSuffices)] theorem kernel.lift.inv [Mono f] (ex : Exact f g) : have := isIso_kernel_lift_of_exact_of_mono _ _ ex inv (kernel.lift _ _ ex.w) ≫ f = kernel.ι g := by have := isIso_kernel_lift_of_exact_of_mono _ _ ex simp #align category_theory.abelian.kernel.lift.inv CategoryTheory.Abelian.kernel.lift.inv def isColimitOfExactOfEpi [Epi g] (h : Exact f g) : IsColimit (CokernelCofork.ofπ _ h.w) := IsColimit.ofIsoColimit (colimit.isColimit _) <| Cocones.ext ⟨cokernel.desc _ _ h.w, epiDesc g (cokernel.π f) ((exact_iff _ _).1 h).2, (cancel_epi (cokernel.π f)).1 (by aesop_cat), (cancel_epi g).1 (by aesop_cat)⟩ (by rintro (_|_) <;> simp [h.w]) #align category_theory.abelian.is_colimit_of_exact_of_epi CategoryTheory.Abelian.isColimitOfExactOfEpi def isLimitOfExactOfMono [Mono f] (h : Exact f g) : IsLimit (KernelFork.ofι _ h.w) := IsLimit.ofIsoLimit (limit.isLimit _) <| Cones.ext ⟨monoLift f (kernel.ι g) ((exact_iff _ _).1 h).2, kernel.lift _ _ h.w, (cancel_mono (kernel.ι g)).1 (by aesop_cat), (cancel_mono f).1 (by aesop_cat)⟩ fun j => by cases j <;> simp #align category_theory.abelian.is_limit_of_exact_of_mono CategoryTheory.Abelian.isLimitOfExactOfMono theorem exact_of_is_cokernel (w : f ≫ g = 0) (h : IsColimit (CokernelCofork.ofπ _ w)) : Exact f g := by refine (exact_iff _ _).2 ⟨w, ?_⟩ have := h.fac (CokernelCofork.ofπ _ (cokernel.condition f)) WalkingParallelPair.one simp only [Cofork.ofπ_ι_app] at this rw [← this, ← Category.assoc, kernel.condition, zero_comp] #align category_theory.abelian.exact_of_is_cokernel CategoryTheory.Abelian.exact_of_is_cokernel theorem exact_of_is_kernel (w : f ≫ g = 0) (h : IsLimit (KernelFork.ofι _ w)) : Exact f g := by refine (exact_iff _ _).2 ⟨w, ?_⟩ have := h.fac (KernelFork.ofι _ (kernel.condition g)) WalkingParallelPair.zero simp only [Fork.ofι_π_app] at this rw [← this, Category.assoc, cokernel.condition, comp_zero] #align category_theory.abelian.exact_of_is_kernel CategoryTheory.Abelian.exact_of_is_kernel theorem exact_iff_exact_image_ι : Exact f g ↔ Exact (Abelian.image.ι f) g := by conv_lhs => rw [← Abelian.image.fac f] rw [exact_epi_comp_iff] #align category_theory.abelian.exact_iff_exact_image_ι CategoryTheory.Abelian.exact_iff_exact_image_ι theorem exact_iff_exact_coimage_π : Exact f g ↔ Exact f (coimage.π g) := by conv_lhs => rw [← Abelian.coimage.fac g] rw [exact_comp_mono_iff] #align category_theory.abelian.exact_iff_exact_coimage_π CategoryTheory.Abelian.exact_iff_exact_coimage_π section variable (Z) open List in
Mathlib/CategoryTheory/Abelian/Exact.lean
253
261
theorem tfae_mono : TFAE [Mono f, kernel.ι f = 0, Exact (0 : Z ⟶ X) f] := by
tfae_have 3 → 2 · exact kernel_ι_eq_zero_of_exact_zero_left Z tfae_have 1 → 3 · intros exact exact_zero_left_of_mono Z tfae_have 2 → 1 · exact mono_of_kernel_ι_eq_zero _ tfae_finish
import Mathlib.Logic.Relation import Mathlib.Data.Option.Basic import Mathlib.Data.Seq.Seq #align_import data.seq.wseq from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad" namespace Stream' open Function universe u v w def WSeq (α) := Seq (Option α) #align stream.wseq Stream'.WSeq namespace WSeq variable {α : Type u} {β : Type v} {γ : Type w} @[coe] def ofSeq : Seq α → WSeq α := (· <$> ·) some #align stream.wseq.of_seq Stream'.WSeq.ofSeq @[coe] def ofList (l : List α) : WSeq α := ofSeq l #align stream.wseq.of_list Stream'.WSeq.ofList @[coe] def ofStream (l : Stream' α) : WSeq α := ofSeq l #align stream.wseq.of_stream Stream'.WSeq.ofStream instance coeSeq : Coe (Seq α) (WSeq α) := ⟨ofSeq⟩ #align stream.wseq.coe_seq Stream'.WSeq.coeSeq instance coeList : Coe (List α) (WSeq α) := ⟨ofList⟩ #align stream.wseq.coe_list Stream'.WSeq.coeList instance coeStream : Coe (Stream' α) (WSeq α) := ⟨ofStream⟩ #align stream.wseq.coe_stream Stream'.WSeq.coeStream def nil : WSeq α := Seq.nil #align stream.wseq.nil Stream'.WSeq.nil instance inhabited : Inhabited (WSeq α) := ⟨nil⟩ #align stream.wseq.inhabited Stream'.WSeq.inhabited def cons (a : α) : WSeq α → WSeq α := Seq.cons (some a) #align stream.wseq.cons Stream'.WSeq.cons def think : WSeq α → WSeq α := Seq.cons none #align stream.wseq.think Stream'.WSeq.think def destruct : WSeq α → Computation (Option (α × WSeq α)) := Computation.corec fun s => match Seq.destruct s with | none => Sum.inl none | some (none, s') => Sum.inr s' | some (some a, s') => Sum.inl (some (a, s')) #align stream.wseq.destruct Stream'.WSeq.destruct def recOn {C : WSeq α → Sort v} (s : WSeq α) (h1 : C nil) (h2 : ∀ x s, C (cons x s)) (h3 : ∀ s, C (think s)) : C s := Seq.recOn s h1 fun o => Option.recOn o h3 h2 #align stream.wseq.rec_on Stream'.WSeq.recOn protected def Mem (a : α) (s : WSeq α) := Seq.Mem (some a) s #align stream.wseq.mem Stream'.WSeq.Mem instance membership : Membership α (WSeq α) := ⟨WSeq.Mem⟩ #align stream.wseq.has_mem Stream'.WSeq.membership theorem not_mem_nil (a : α) : a ∉ @nil α := Seq.not_mem_nil (some a) #align stream.wseq.not_mem_nil Stream'.WSeq.not_mem_nil def head (s : WSeq α) : Computation (Option α) := Computation.map (Prod.fst <$> ·) (destruct s) #align stream.wseq.head Stream'.WSeq.head def flatten : Computation (WSeq α) → WSeq α := Seq.corec fun c => match Computation.destruct c with | Sum.inl s => Seq.omap (return ·) (Seq.destruct s) | Sum.inr c' => some (none, c') #align stream.wseq.flatten Stream'.WSeq.flatten def tail (s : WSeq α) : WSeq α := flatten <| (fun o => Option.recOn o nil Prod.snd) <$> destruct s #align stream.wseq.tail Stream'.WSeq.tail def drop (s : WSeq α) : ℕ → WSeq α | 0 => s | n + 1 => tail (drop s n) #align stream.wseq.drop Stream'.WSeq.drop def get? (s : WSeq α) (n : ℕ) : Computation (Option α) := head (drop s n) #align stream.wseq.nth Stream'.WSeq.get? def toList (s : WSeq α) : Computation (List α) := @Computation.corec (List α) (List α × WSeq α) (fun ⟨l, s⟩ => match Seq.destruct s with | none => Sum.inl l.reverse | some (none, s') => Sum.inr (l, s') | some (some a, s') => Sum.inr (a::l, s')) ([], s) #align stream.wseq.to_list Stream'.WSeq.toList def length (s : WSeq α) : Computation ℕ := @Computation.corec ℕ (ℕ × WSeq α) (fun ⟨n, s⟩ => match Seq.destruct s with | none => Sum.inl n | some (none, s') => Sum.inr (n, s') | some (some _, s') => Sum.inr (n + 1, s')) (0, s) #align stream.wseq.length Stream'.WSeq.length class IsFinite (s : WSeq α) : Prop where out : (toList s).Terminates #align stream.wseq.is_finite Stream'.WSeq.IsFinite instance toList_terminates (s : WSeq α) [h : IsFinite s] : (toList s).Terminates := h.out #align stream.wseq.to_list_terminates Stream'.WSeq.toList_terminates def get (s : WSeq α) [IsFinite s] : List α := (toList s).get #align stream.wseq.get Stream'.WSeq.get class Productive (s : WSeq α) : Prop where get?_terminates : ∀ n, (get? s n).Terminates #align stream.wseq.productive Stream'.WSeq.Productive #align stream.wseq.productive.nth_terminates Stream'.WSeq.Productive.get?_terminates theorem productive_iff (s : WSeq α) : Productive s ↔ ∀ n, (get? s n).Terminates := ⟨fun h => h.1, fun h => ⟨h⟩⟩ #align stream.wseq.productive_iff Stream'.WSeq.productive_iff instance get?_terminates (s : WSeq α) [h : Productive s] : ∀ n, (get? s n).Terminates := h.get?_terminates #align stream.wseq.nth_terminates Stream'.WSeq.get?_terminates instance head_terminates (s : WSeq α) [Productive s] : (head s).Terminates := s.get?_terminates 0 #align stream.wseq.head_terminates Stream'.WSeq.head_terminates def updateNth (s : WSeq α) (n : ℕ) (a : α) : WSeq α := @Seq.corec (Option α) (ℕ × WSeq α) (fun ⟨n, s⟩ => match Seq.destruct s, n with | none, _ => none | some (none, s'), n => some (none, n, s') | some (some a', s'), 0 => some (some a', 0, s') | some (some _, s'), 1 => some (some a, 0, s') | some (some a', s'), n + 2 => some (some a', n + 1, s')) (n + 1, s) #align stream.wseq.update_nth Stream'.WSeq.updateNth def removeNth (s : WSeq α) (n : ℕ) : WSeq α := @Seq.corec (Option α) (ℕ × WSeq α) (fun ⟨n, s⟩ => match Seq.destruct s, n with | none, _ => none | some (none, s'), n => some (none, n, s') | some (some a', s'), 0 => some (some a', 0, s') | some (some _, s'), 1 => some (none, 0, s') | some (some a', s'), n + 2 => some (some a', n + 1, s')) (n + 1, s) #align stream.wseq.remove_nth Stream'.WSeq.removeNth def filterMap (f : α → Option β) : WSeq α → WSeq β := Seq.corec fun s => match Seq.destruct s with | none => none | some (none, s') => some (none, s') | some (some a, s') => some (f a, s') #align stream.wseq.filter_map Stream'.WSeq.filterMap def filter (p : α → Prop) [DecidablePred p] : WSeq α → WSeq α := filterMap fun a => if p a then some a else none #align stream.wseq.filter Stream'.WSeq.filter -- example of infinite list manipulations def find (p : α → Prop) [DecidablePred p] (s : WSeq α) : Computation (Option α) := head <| filter p s #align stream.wseq.find Stream'.WSeq.find def zipWith (f : α → β → γ) (s1 : WSeq α) (s2 : WSeq β) : WSeq γ := @Seq.corec (Option γ) (WSeq α × WSeq β) (fun ⟨s1, s2⟩ => match Seq.destruct s1, Seq.destruct s2 with | some (none, s1'), some (none, s2') => some (none, s1', s2') | some (some _, _), some (none, s2') => some (none, s1, s2') | some (none, s1'), some (some _, _) => some (none, s1', s2) | some (some a1, s1'), some (some a2, s2') => some (some (f a1 a2), s1', s2') | _, _ => none) (s1, s2) #align stream.wseq.zip_with Stream'.WSeq.zipWith def zip : WSeq α → WSeq β → WSeq (α × β) := zipWith Prod.mk #align stream.wseq.zip Stream'.WSeq.zip def findIndexes (p : α → Prop) [DecidablePred p] (s : WSeq α) : WSeq ℕ := (zip s (Stream'.nats : WSeq ℕ)).filterMap fun ⟨a, n⟩ => if p a then some n else none #align stream.wseq.find_indexes Stream'.WSeq.findIndexes def findIndex (p : α → Prop) [DecidablePred p] (s : WSeq α) : Computation ℕ := (fun o => Option.getD o 0) <$> head (findIndexes p s) #align stream.wseq.find_index Stream'.WSeq.findIndex def indexOf [DecidableEq α] (a : α) : WSeq α → Computation ℕ := findIndex (Eq a) #align stream.wseq.index_of Stream'.WSeq.indexOf def indexesOf [DecidableEq α] (a : α) : WSeq α → WSeq ℕ := findIndexes (Eq a) #align stream.wseq.indexes_of Stream'.WSeq.indexesOf def union (s1 s2 : WSeq α) : WSeq α := @Seq.corec (Option α) (WSeq α × WSeq α) (fun ⟨s1, s2⟩ => match Seq.destruct s1, Seq.destruct s2 with | none, none => none | some (a1, s1'), none => some (a1, s1', nil) | none, some (a2, s2') => some (a2, nil, s2') | some (none, s1'), some (none, s2') => some (none, s1', s2') | some (some a1, s1'), some (none, s2') => some (some a1, s1', s2') | some (none, s1'), some (some a2, s2') => some (some a2, s1', s2') | some (some a1, s1'), some (some a2, s2') => some (some a1, cons a2 s1', s2')) (s1, s2) #align stream.wseq.union Stream'.WSeq.union def isEmpty (s : WSeq α) : Computation Bool := Computation.map Option.isNone <| head s #align stream.wseq.is_empty Stream'.WSeq.isEmpty def compute (s : WSeq α) : WSeq α := match Seq.destruct s with | some (none, s') => s' | _ => s #align stream.wseq.compute Stream'.WSeq.compute def take (s : WSeq α) (n : ℕ) : WSeq α := @Seq.corec (Option α) (ℕ × WSeq α) (fun ⟨n, s⟩ => match n, Seq.destruct s with | 0, _ => none | _ + 1, none => none | m + 1, some (none, s') => some (none, m + 1, s') | m + 1, some (some a, s') => some (some a, m, s')) (n, s) #align stream.wseq.take Stream'.WSeq.take def splitAt (s : WSeq α) (n : ℕ) : Computation (List α × WSeq α) := @Computation.corec (List α × WSeq α) (ℕ × List α × WSeq α) (fun ⟨n, l, s⟩ => match n, Seq.destruct s with | 0, _ => Sum.inl (l.reverse, s) | _ + 1, none => Sum.inl (l.reverse, s) | _ + 1, some (none, s') => Sum.inr (n, l, s') | m + 1, some (some a, s') => Sum.inr (m, a::l, s')) (n, [], s) #align stream.wseq.split_at Stream'.WSeq.splitAt def any (s : WSeq α) (p : α → Bool) : Computation Bool := Computation.corec (fun s : WSeq α => match Seq.destruct s with | none => Sum.inl false | some (none, s') => Sum.inr s' | some (some a, s') => if p a then Sum.inl true else Sum.inr s') s #align stream.wseq.any Stream'.WSeq.any def all (s : WSeq α) (p : α → Bool) : Computation Bool := Computation.corec (fun s : WSeq α => match Seq.destruct s with | none => Sum.inl true | some (none, s') => Sum.inr s' | some (some a, s') => if p a then Sum.inr s' else Sum.inl false) s #align stream.wseq.all Stream'.WSeq.all def scanl (f : α → β → α) (a : α) (s : WSeq β) : WSeq α := cons a <| @Seq.corec (Option α) (α × WSeq β) (fun ⟨a, s⟩ => match Seq.destruct s with | none => none | some (none, s') => some (none, a, s') | some (some b, s') => let a' := f a b some (some a', a', s')) (a, s) #align stream.wseq.scanl Stream'.WSeq.scanl def inits (s : WSeq α) : WSeq (List α) := cons [] <| @Seq.corec (Option (List α)) (Batteries.DList α × WSeq α) (fun ⟨l, s⟩ => match Seq.destruct s with | none => none | some (none, s') => some (none, l, s') | some (some a, s') => let l' := l.push a some (some l'.toList, l', s')) (Batteries.DList.empty, s) #align stream.wseq.inits Stream'.WSeq.inits def collect (s : WSeq α) (n : ℕ) : List α := (Seq.take n s).filterMap id #align stream.wseq.collect Stream'.WSeq.collect def append : WSeq α → WSeq α → WSeq α := Seq.append #align stream.wseq.append Stream'.WSeq.append def map (f : α → β) : WSeq α → WSeq β := Seq.map (Option.map f) #align stream.wseq.map Stream'.WSeq.map def join (S : WSeq (WSeq α)) : WSeq α := Seq.join ((fun o : Option (WSeq α) => match o with | none => Seq1.ret none | some s => (none, s)) <$> S) #align stream.wseq.join Stream'.WSeq.join def bind (s : WSeq α) (f : α → WSeq β) : WSeq β := join (map f s) #align stream.wseq.bind Stream'.WSeq.bind @[simp] def LiftRelO (R : α → β → Prop) (C : WSeq α → WSeq β → Prop) : Option (α × WSeq α) → Option (β × WSeq β) → Prop | none, none => True | some (a, s), some (b, t) => R a b ∧ C s t | _, _ => False #align stream.wseq.lift_rel_o Stream'.WSeq.LiftRelO theorem LiftRelO.imp {R S : α → β → Prop} {C D : WSeq α → WSeq β → Prop} (H1 : ∀ a b, R a b → S a b) (H2 : ∀ s t, C s t → D s t) : ∀ {o p}, LiftRelO R C o p → LiftRelO S D o p | none, none, _ => trivial | some (_, _), some (_, _), h => And.imp (H1 _ _) (H2 _ _) h | none, some _, h => False.elim h | some (_, _), none, h => False.elim h #align stream.wseq.lift_rel_o.imp Stream'.WSeq.LiftRelO.imp theorem LiftRelO.imp_right (R : α → β → Prop) {C D : WSeq α → WSeq β → Prop} (H : ∀ s t, C s t → D s t) {o p} : LiftRelO R C o p → LiftRelO R D o p := LiftRelO.imp (fun _ _ => id) H #align stream.wseq.lift_rel_o.imp_right Stream'.WSeq.LiftRelO.imp_right @[simp] def BisimO (R : WSeq α → WSeq α → Prop) : Option (α × WSeq α) → Option (α × WSeq α) → Prop := LiftRelO (· = ·) R #align stream.wseq.bisim_o Stream'.WSeq.BisimO theorem BisimO.imp {R S : WSeq α → WSeq α → Prop} (H : ∀ s t, R s t → S s t) {o p} : BisimO R o p → BisimO S o p := LiftRelO.imp_right _ H #align stream.wseq.bisim_o.imp Stream'.WSeq.BisimO.imp def LiftRel (R : α → β → Prop) (s : WSeq α) (t : WSeq β) : Prop := ∃ C : WSeq α → WSeq β → Prop, C s t ∧ ∀ {s t}, C s t → Computation.LiftRel (LiftRelO R C) (destruct s) (destruct t) #align stream.wseq.lift_rel Stream'.WSeq.LiftRel def Equiv : WSeq α → WSeq α → Prop := LiftRel (· = ·) #align stream.wseq.equiv Stream'.WSeq.Equiv theorem liftRel_destruct {R : α → β → Prop} {s : WSeq α} {t : WSeq β} : LiftRel R s t → Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t) | ⟨R, h1, h2⟩ => by refine Computation.LiftRel.imp ?_ _ _ (h2 h1) apply LiftRelO.imp_right exact fun s' t' h' => ⟨R, h', @h2⟩ #align stream.wseq.lift_rel_destruct Stream'.WSeq.liftRel_destruct theorem liftRel_destruct_iff {R : α → β → Prop} {s : WSeq α} {t : WSeq β} : LiftRel R s t ↔ Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t) := ⟨liftRel_destruct, fun h => ⟨fun s t => LiftRel R s t ∨ Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t), Or.inr h, fun {s t} h => by have h : Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t) := by cases' h with h h · exact liftRel_destruct h · assumption apply Computation.LiftRel.imp _ _ _ h intro a b apply LiftRelO.imp_right intro s t apply Or.inl⟩⟩ #align stream.wseq.lift_rel_destruct_iff Stream'.WSeq.liftRel_destruct_iff -- Porting note: To avoid ambiguous notation, `~` became `~ʷ`. infixl:50 " ~ʷ " => Equiv theorem destruct_congr {s t : WSeq α} : s ~ʷ t → Computation.LiftRel (BisimO (· ~ʷ ·)) (destruct s) (destruct t) := liftRel_destruct #align stream.wseq.destruct_congr Stream'.WSeq.destruct_congr theorem destruct_congr_iff {s t : WSeq α} : s ~ʷ t ↔ Computation.LiftRel (BisimO (· ~ʷ ·)) (destruct s) (destruct t) := liftRel_destruct_iff #align stream.wseq.destruct_congr_iff Stream'.WSeq.destruct_congr_iff theorem LiftRel.refl (R : α → α → Prop) (H : Reflexive R) : Reflexive (LiftRel R) := fun s => by refine ⟨(· = ·), rfl, fun {s t} (h : s = t) => ?_⟩ rw [← h] apply Computation.LiftRel.refl intro a cases' a with a · simp · cases a simp only [LiftRelO, and_true] apply H #align stream.wseq.lift_rel.refl Stream'.WSeq.LiftRel.refl theorem LiftRelO.swap (R : α → β → Prop) (C) : swap (LiftRelO R C) = LiftRelO (swap R) (swap C) := by funext x y rcases x with ⟨⟩ | ⟨hx, jx⟩ <;> rcases y with ⟨⟩ | ⟨hy, jy⟩ <;> rfl #align stream.wseq.lift_rel_o.swap Stream'.WSeq.LiftRelO.swap theorem LiftRel.swap_lem {R : α → β → Prop} {s1 s2} (h : LiftRel R s1 s2) : LiftRel (swap R) s2 s1 := by refine ⟨swap (LiftRel R), h, fun {s t} (h : LiftRel R t s) => ?_⟩ rw [← LiftRelO.swap, Computation.LiftRel.swap] apply liftRel_destruct h #align stream.wseq.lift_rel.swap_lem Stream'.WSeq.LiftRel.swap_lem theorem LiftRel.swap (R : α → β → Prop) : swap (LiftRel R) = LiftRel (swap R) := funext fun _ => funext fun _ => propext ⟨LiftRel.swap_lem, LiftRel.swap_lem⟩ #align stream.wseq.lift_rel.swap Stream'.WSeq.LiftRel.swap theorem LiftRel.symm (R : α → α → Prop) (H : Symmetric R) : Symmetric (LiftRel R) := fun s1 s2 (h : Function.swap (LiftRel R) s2 s1) => by rwa [LiftRel.swap, H.swap_eq] at h #align stream.wseq.lift_rel.symm Stream'.WSeq.LiftRel.symm theorem LiftRel.trans (R : α → α → Prop) (H : Transitive R) : Transitive (LiftRel R) := fun s t u h1 h2 => by refine ⟨fun s u => ∃ t, LiftRel R s t ∧ LiftRel R t u, ⟨t, h1, h2⟩, fun {s u} h => ?_⟩ rcases h with ⟨t, h1, h2⟩ have h1 := liftRel_destruct h1 have h2 := liftRel_destruct h2 refine Computation.liftRel_def.2 ⟨(Computation.terminates_of_liftRel h1).trans (Computation.terminates_of_liftRel h2), fun {a c} ha hc => ?_⟩ rcases h1.left ha with ⟨b, hb, t1⟩ have t2 := Computation.rel_of_liftRel h2 hb hc cases' a with a <;> cases' c with c · trivial · cases b · cases t2 · cases t1 · cases a cases' b with b · cases t1 · cases b cases t2 · cases' a with a s cases' b with b · cases t1 cases' b with b t cases' c with c u cases' t1 with ab st cases' t2 with bc tu exact ⟨H ab bc, t, st, tu⟩ #align stream.wseq.lift_rel.trans Stream'.WSeq.LiftRel.trans theorem LiftRel.equiv (R : α → α → Prop) : Equivalence R → Equivalence (LiftRel R) | ⟨refl, symm, trans⟩ => ⟨LiftRel.refl R refl, @(LiftRel.symm R @symm), @(LiftRel.trans R @trans)⟩ #align stream.wseq.lift_rel.equiv Stream'.WSeq.LiftRel.equiv @[refl] theorem Equiv.refl : ∀ s : WSeq α, s ~ʷ s := LiftRel.refl (· = ·) Eq.refl #align stream.wseq.equiv.refl Stream'.WSeq.Equiv.refl @[symm] theorem Equiv.symm : ∀ {s t : WSeq α}, s ~ʷ t → t ~ʷ s := @(LiftRel.symm (· = ·) (@Eq.symm _)) #align stream.wseq.equiv.symm Stream'.WSeq.Equiv.symm @[trans] theorem Equiv.trans : ∀ {s t u : WSeq α}, s ~ʷ t → t ~ʷ u → s ~ʷ u := @(LiftRel.trans (· = ·) (@Eq.trans _)) #align stream.wseq.equiv.trans Stream'.WSeq.Equiv.trans theorem Equiv.equivalence : Equivalence (@Equiv α) := ⟨@Equiv.refl _, @Equiv.symm _, @Equiv.trans _⟩ #align stream.wseq.equiv.equivalence Stream'.WSeq.Equiv.equivalence open Computation @[simp] theorem destruct_nil : destruct (nil : WSeq α) = Computation.pure none := Computation.destruct_eq_pure rfl #align stream.wseq.destruct_nil Stream'.WSeq.destruct_nil @[simp] theorem destruct_cons (a : α) (s) : destruct (cons a s) = Computation.pure (some (a, s)) := Computation.destruct_eq_pure <| by simp [destruct, cons, Computation.rmap] #align stream.wseq.destruct_cons Stream'.WSeq.destruct_cons @[simp] theorem destruct_think (s : WSeq α) : destruct (think s) = (destruct s).think := Computation.destruct_eq_think <| by simp [destruct, think, Computation.rmap] #align stream.wseq.destruct_think Stream'.WSeq.destruct_think @[simp] theorem seq_destruct_nil : Seq.destruct (nil : WSeq α) = none := Seq.destruct_nil #align stream.wseq.seq_destruct_nil Stream'.WSeq.seq_destruct_nil @[simp] theorem seq_destruct_cons (a : α) (s) : Seq.destruct (cons a s) = some (some a, s) := Seq.destruct_cons _ _ #align stream.wseq.seq_destruct_cons Stream'.WSeq.seq_destruct_cons @[simp] theorem seq_destruct_think (s : WSeq α) : Seq.destruct (think s) = some (none, s) := Seq.destruct_cons _ _ #align stream.wseq.seq_destruct_think Stream'.WSeq.seq_destruct_think @[simp] theorem head_nil : head (nil : WSeq α) = Computation.pure none := by simp [head] #align stream.wseq.head_nil Stream'.WSeq.head_nil @[simp] theorem head_cons (a : α) (s) : head (cons a s) = Computation.pure (some a) := by simp [head] #align stream.wseq.head_cons Stream'.WSeq.head_cons @[simp] theorem head_think (s : WSeq α) : head (think s) = (head s).think := by simp [head] #align stream.wseq.head_think Stream'.WSeq.head_think @[simp] theorem flatten_pure (s : WSeq α) : flatten (Computation.pure s) = s := by refine Seq.eq_of_bisim (fun s1 s2 => flatten (Computation.pure s2) = s1) ?_ rfl intro s' s h rw [← h] simp only [Seq.BisimO, flatten, Seq.omap, pure_def, Seq.corec_eq, destruct_pure] cases Seq.destruct s with | none => simp | some val => cases' val with o s' simp #align stream.wseq.flatten_ret Stream'.WSeq.flatten_pure @[simp] theorem flatten_think (c : Computation (WSeq α)) : flatten c.think = think (flatten c) := Seq.destruct_eq_cons <| by simp [flatten, think] #align stream.wseq.flatten_think Stream'.WSeq.flatten_think @[simp]
Mathlib/Data/Seq/WSeq.lean
685
697
theorem destruct_flatten (c : Computation (WSeq α)) : destruct (flatten c) = c >>= destruct := by
refine Computation.eq_of_bisim (fun c1 c2 => c1 = c2 ∨ ∃ c, c1 = destruct (flatten c) ∧ c2 = Computation.bind c destruct) ?_ (Or.inr ⟨c, rfl, rfl⟩) intro c1 c2 h exact match c1, c2, h with | c, _, Or.inl rfl => by cases c.destruct <;> simp | _, _, Or.inr ⟨c, rfl, rfl⟩ => by induction' c using Computation.recOn with a c' <;> simp · cases (destruct a).destruct <;> simp · exact Or.inr ⟨c', rfl, rfl⟩
import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.Orientation import Mathlib.Data.Complex.Orientation import Mathlib.Tactic.LinearCombination #align_import analysis.inner_product_space.two_dim from "leanprover-community/mathlib"@"cd8fafa2fac98e1a67097e8a91ad9901cfde48af" noncomputable section open scoped RealInnerProductSpace ComplexConjugate open FiniteDimensional lemma FiniteDimensional.of_fact_finrank_eq_two {K V : Type*} [DivisionRing K] [AddCommGroup V] [Module K V] [Fact (finrank K V = 2)] : FiniteDimensional K V := .of_fact_finrank_eq_succ 1 attribute [local instance] FiniteDimensional.of_fact_finrank_eq_two @[deprecated (since := "2024-02-02")] alias FiniteDimensional.finiteDimensional_of_fact_finrank_eq_two := FiniteDimensional.of_fact_finrank_eq_two variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [Fact (finrank ℝ E = 2)] (o : Orientation ℝ E (Fin 2)) namespace Orientation irreducible_def areaForm : E →ₗ[ℝ] E →ₗ[ℝ] ℝ := by let z : E [⋀^Fin 0]→ₗ[ℝ] ℝ ≃ₗ[ℝ] ℝ := AlternatingMap.constLinearEquivOfIsEmpty.symm let y : E [⋀^Fin 1]→ₗ[ℝ] ℝ →ₗ[ℝ] E →ₗ[ℝ] ℝ := LinearMap.llcomp ℝ E (E [⋀^Fin 0]→ₗ[ℝ] ℝ) ℝ z ∘ₗ AlternatingMap.curryLeftLinearMap exact y ∘ₗ AlternatingMap.curryLeftLinearMap (R' := ℝ) o.volumeForm #align orientation.area_form Orientation.areaForm local notation "ω" => o.areaForm theorem areaForm_to_volumeForm (x y : E) : ω x y = o.volumeForm ![x, y] := by simp [areaForm] #align orientation.area_form_to_volume_form Orientation.areaForm_to_volumeForm @[simp] theorem areaForm_apply_self (x : E) : ω x x = 0 := by rw [areaForm_to_volumeForm] refine o.volumeForm.map_eq_zero_of_eq ![x, x] ?_ (?_ : (0 : Fin 2) ≠ 1) · simp · norm_num #align orientation.area_form_apply_self Orientation.areaForm_apply_self theorem areaForm_swap (x y : E) : ω x y = -ω y x := by simp only [areaForm_to_volumeForm] convert o.volumeForm.map_swap ![y, x] (_ : (0 : Fin 2) ≠ 1) · ext i fin_cases i <;> rfl · norm_num #align orientation.area_form_swap Orientation.areaForm_swap @[simp] theorem areaForm_neg_orientation : (-o).areaForm = -o.areaForm := by ext x y simp [areaForm_to_volumeForm] #align orientation.area_form_neg_orientation Orientation.areaForm_neg_orientation def areaForm' : E →L[ℝ] E →L[ℝ] ℝ := LinearMap.toContinuousLinearMap (↑(LinearMap.toContinuousLinearMap : (E →ₗ[ℝ] ℝ) ≃ₗ[ℝ] E →L[ℝ] ℝ) ∘ₗ o.areaForm) #align orientation.area_form' Orientation.areaForm' @[simp] theorem areaForm'_apply (x : E) : o.areaForm' x = LinearMap.toContinuousLinearMap (o.areaForm x) := rfl #align orientation.area_form'_apply Orientation.areaForm'_apply theorem abs_areaForm_le (x y : E) : |ω x y| ≤ ‖x‖ * ‖y‖ := by simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.abs_volumeForm_apply_le ![x, y] #align orientation.abs_area_form_le Orientation.abs_areaForm_le theorem areaForm_le (x y : E) : ω x y ≤ ‖x‖ * ‖y‖ := by simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.volumeForm_apply_le ![x, y] #align orientation.area_form_le Orientation.areaForm_le theorem abs_areaForm_of_orthogonal {x y : E} (h : ⟪x, y⟫ = 0) : |ω x y| = ‖x‖ * ‖y‖ := by rw [o.areaForm_to_volumeForm, o.abs_volumeForm_apply_of_pairwise_orthogonal] · simp [Fin.prod_univ_succ] intro i j hij fin_cases i <;> fin_cases j · simp_all · simpa using h · simpa [real_inner_comm] using h · simp_all #align orientation.abs_area_form_of_orthogonal Orientation.abs_areaForm_of_orthogonal theorem areaForm_map {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] [hF : Fact (finrank ℝ F = 2)] (φ : E ≃ₗᵢ[ℝ] F) (x y : F) : (Orientation.map (Fin 2) φ.toLinearEquiv o).areaForm x y = o.areaForm (φ.symm x) (φ.symm y) := by have : φ.symm ∘ ![x, y] = ![φ.symm x, φ.symm y] := by ext i fin_cases i <;> rfl simp [areaForm_to_volumeForm, volumeForm_map, this] #align orientation.area_form_map Orientation.areaForm_map theorem areaForm_comp_linearIsometryEquiv (φ : E ≃ₗᵢ[ℝ] E) (hφ : 0 < LinearMap.det (φ.toLinearEquiv : E →ₗ[ℝ] E)) (x y : E) : o.areaForm (φ x) (φ y) = o.areaForm x y := by convert o.areaForm_map φ (φ x) (φ y) · symm rwa [← o.map_eq_iff_det_pos φ.toLinearEquiv] at hφ rw [@Fact.out (finrank ℝ E = 2), Fintype.card_fin] · simp · simp #align orientation.area_form_comp_linear_isometry_equiv Orientation.areaForm_comp_linearIsometryEquiv irreducible_def rightAngleRotationAux₁ : E →ₗ[ℝ] E := let to_dual : E ≃ₗ[ℝ] E →ₗ[ℝ] ℝ := (InnerProductSpace.toDual ℝ E).toLinearEquiv ≪≫ₗ LinearMap.toContinuousLinearMap.symm ↑to_dual.symm ∘ₗ ω #align orientation.right_angle_rotation_aux₁ Orientation.rightAngleRotationAux₁ @[simp] theorem inner_rightAngleRotationAux₁_left (x y : E) : ⟪o.rightAngleRotationAux₁ x, y⟫ = ω x y := by -- Porting note: split `simp only` for greater proof control simp only [rightAngleRotationAux₁, LinearEquiv.trans_symm, LinearIsometryEquiv.toLinearEquiv_symm, LinearMap.coe_comp, LinearEquiv.coe_coe, Function.comp_apply, LinearEquiv.trans_apply, LinearIsometryEquiv.coe_toLinearEquiv] rw [InnerProductSpace.toDual_symm_apply] norm_cast #align orientation.inner_right_angle_rotation_aux₁_left Orientation.inner_rightAngleRotationAux₁_left @[simp] theorem inner_rightAngleRotationAux₁_right (x y : E) : ⟪x, o.rightAngleRotationAux₁ y⟫ = -ω x y := by rw [real_inner_comm] simp [o.areaForm_swap y x] #align orientation.inner_right_angle_rotation_aux₁_right Orientation.inner_rightAngleRotationAux₁_right def rightAngleRotationAux₂ : E →ₗᵢ[ℝ] E := { o.rightAngleRotationAux₁ with norm_map' := fun x => by dsimp refine le_antisymm ?_ ?_ · cases' eq_or_lt_of_le (norm_nonneg (o.rightAngleRotationAux₁ x)) with h h · rw [← h] positivity refine le_of_mul_le_mul_right ?_ h rw [← real_inner_self_eq_norm_mul_norm, o.inner_rightAngleRotationAux₁_left] exact o.areaForm_le x (o.rightAngleRotationAux₁ x) · let K : Submodule ℝ E := ℝ ∙ x have : Nontrivial Kᗮ := by apply @FiniteDimensional.nontrivial_of_finrank_pos ℝ have : finrank ℝ K ≤ Finset.card {x} := by rw [← Set.toFinset_singleton] exact finrank_span_le_card ({x} : Set E) have : Finset.card {x} = 1 := Finset.card_singleton x have : finrank ℝ K + finrank ℝ Kᗮ = finrank ℝ E := K.finrank_add_finrank_orthogonal have : finrank ℝ E = 2 := Fact.out linarith obtain ⟨w, hw₀⟩ : ∃ w : Kᗮ, w ≠ 0 := exists_ne 0 have hw' : ⟪x, (w : E)⟫ = 0 := Submodule.mem_orthogonal_singleton_iff_inner_right.mp w.2 have hw : (w : E) ≠ 0 := fun h => hw₀ (Submodule.coe_eq_zero.mp h) refine le_of_mul_le_mul_right ?_ (by rwa [norm_pos_iff] : 0 < ‖(w : E)‖) rw [← o.abs_areaForm_of_orthogonal hw'] rw [← o.inner_rightAngleRotationAux₁_left x w] exact abs_real_inner_le_norm (o.rightAngleRotationAux₁ x) w } #align orientation.right_angle_rotation_aux₂ Orientation.rightAngleRotationAux₂ @[simp] theorem rightAngleRotationAux₁_rightAngleRotationAux₁ (x : E) : o.rightAngleRotationAux₁ (o.rightAngleRotationAux₁ x) = -x := by apply ext_inner_left ℝ intro y have : ⟪o.rightAngleRotationAux₁ y, o.rightAngleRotationAux₁ x⟫ = ⟪y, x⟫ := LinearIsometry.inner_map_map o.rightAngleRotationAux₂ y x rw [o.inner_rightAngleRotationAux₁_right, ← o.inner_rightAngleRotationAux₁_left, this, inner_neg_right] #align orientation.right_angle_rotation_aux₁_right_angle_rotation_aux₁ Orientation.rightAngleRotationAux₁_rightAngleRotationAux₁ irreducible_def rightAngleRotation : E ≃ₗᵢ[ℝ] E := LinearIsometryEquiv.ofLinearIsometry o.rightAngleRotationAux₂ (-o.rightAngleRotationAux₁) (by ext; simp [rightAngleRotationAux₂]) (by ext; simp [rightAngleRotationAux₂]) #align orientation.right_angle_rotation Orientation.rightAngleRotation local notation "J" => o.rightAngleRotation @[simp] theorem inner_rightAngleRotation_left (x y : E) : ⟪J x, y⟫ = ω x y := by rw [rightAngleRotation] exact o.inner_rightAngleRotationAux₁_left x y #align orientation.inner_right_angle_rotation_left Orientation.inner_rightAngleRotation_left @[simp] theorem inner_rightAngleRotation_right (x y : E) : ⟪x, J y⟫ = -ω x y := by rw [rightAngleRotation] exact o.inner_rightAngleRotationAux₁_right x y #align orientation.inner_right_angle_rotation_right Orientation.inner_rightAngleRotation_right @[simp] theorem rightAngleRotation_rightAngleRotation (x : E) : J (J x) = -x := by rw [rightAngleRotation] exact o.rightAngleRotationAux₁_rightAngleRotationAux₁ x #align orientation.right_angle_rotation_right_angle_rotation Orientation.rightAngleRotation_rightAngleRotation @[simp] theorem rightAngleRotation_symm : LinearIsometryEquiv.symm J = LinearIsometryEquiv.trans J (LinearIsometryEquiv.neg ℝ) := by rw [rightAngleRotation] exact LinearIsometryEquiv.toLinearIsometry_injective rfl #align orientation.right_angle_rotation_symm Orientation.rightAngleRotation_symm -- @[simp] -- Porting note (#10618): simp already proves this theorem inner_rightAngleRotation_self (x : E) : ⟪J x, x⟫ = 0 := by simp #align orientation.inner_right_angle_rotation_self Orientation.inner_rightAngleRotation_self theorem inner_rightAngleRotation_swap (x y : E) : ⟪x, J y⟫ = -⟪J x, y⟫ := by simp #align orientation.inner_right_angle_rotation_swap Orientation.inner_rightAngleRotation_swap theorem inner_rightAngleRotation_swap' (x y : E) : ⟪J x, y⟫ = -⟪x, J y⟫ := by simp [o.inner_rightAngleRotation_swap x y] #align orientation.inner_right_angle_rotation_swap' Orientation.inner_rightAngleRotation_swap' theorem inner_comp_rightAngleRotation (x y : E) : ⟪J x, J y⟫ = ⟪x, y⟫ := LinearIsometryEquiv.inner_map_map J x y #align orientation.inner_comp_right_angle_rotation Orientation.inner_comp_rightAngleRotation @[simp] theorem areaForm_rightAngleRotation_left (x y : E) : ω (J x) y = -⟪x, y⟫ := by rw [← o.inner_comp_rightAngleRotation, o.inner_rightAngleRotation_right, neg_neg] #align orientation.area_form_right_angle_rotation_left Orientation.areaForm_rightAngleRotation_left @[simp] theorem areaForm_rightAngleRotation_right (x y : E) : ω x (J y) = ⟪x, y⟫ := by rw [← o.inner_rightAngleRotation_left, o.inner_comp_rightAngleRotation] #align orientation.area_form_right_angle_rotation_right Orientation.areaForm_rightAngleRotation_right -- @[simp] -- Porting note (#10618): simp already proves this theorem areaForm_comp_rightAngleRotation (x y : E) : ω (J x) (J y) = ω x y := by simp #align orientation.area_form_comp_right_angle_rotation Orientation.areaForm_comp_rightAngleRotation @[simp] theorem rightAngleRotation_trans_rightAngleRotation : LinearIsometryEquiv.trans J J = LinearIsometryEquiv.neg ℝ := by ext; simp #align orientation.right_angle_rotation_trans_right_angle_rotation Orientation.rightAngleRotation_trans_rightAngleRotation theorem rightAngleRotation_neg_orientation (x : E) : (-o).rightAngleRotation x = -o.rightAngleRotation x := by apply ext_inner_right ℝ intro y rw [inner_rightAngleRotation_left] simp #align orientation.right_angle_rotation_neg_orientation Orientation.rightAngleRotation_neg_orientation @[simp] theorem rightAngleRotation_trans_neg_orientation : (-o).rightAngleRotation = o.rightAngleRotation.trans (LinearIsometryEquiv.neg ℝ) := LinearIsometryEquiv.ext <| o.rightAngleRotation_neg_orientation #align orientation.right_angle_rotation_trans_neg_orientation Orientation.rightAngleRotation_trans_neg_orientation theorem rightAngleRotation_map {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] [hF : Fact (finrank ℝ F = 2)] (φ : E ≃ₗᵢ[ℝ] F) (x : F) : (Orientation.map (Fin 2) φ.toLinearEquiv o).rightAngleRotation x = φ (o.rightAngleRotation (φ.symm x)) := by apply ext_inner_right ℝ intro y rw [inner_rightAngleRotation_left] trans ⟪J (φ.symm x), φ.symm y⟫ · simp [o.areaForm_map] trans ⟪φ (J (φ.symm x)), φ (φ.symm y)⟫ · rw [φ.inner_map_map] · simp #align orientation.right_angle_rotation_map Orientation.rightAngleRotation_map theorem linearIsometryEquiv_comp_rightAngleRotation (φ : E ≃ₗᵢ[ℝ] E) (hφ : 0 < LinearMap.det (φ.toLinearEquiv : E →ₗ[ℝ] E)) (x : E) : φ (J x) = J (φ x) := by convert (o.rightAngleRotation_map φ (φ x)).symm · simp · symm rwa [← o.map_eq_iff_det_pos φ.toLinearEquiv] at hφ rw [@Fact.out (finrank ℝ E = 2), Fintype.card_fin] #align orientation.linear_isometry_equiv_comp_right_angle_rotation Orientation.linearIsometryEquiv_comp_rightAngleRotation theorem rightAngleRotation_map' {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] [Fact (finrank ℝ F = 2)] (φ : E ≃ₗᵢ[ℝ] F) : (Orientation.map (Fin 2) φ.toLinearEquiv o).rightAngleRotation = (φ.symm.trans o.rightAngleRotation).trans φ := LinearIsometryEquiv.ext <| o.rightAngleRotation_map φ #align orientation.right_angle_rotation_map' Orientation.rightAngleRotation_map' theorem linearIsometryEquiv_comp_rightAngleRotation' (φ : E ≃ₗᵢ[ℝ] E) (hφ : 0 < LinearMap.det (φ.toLinearEquiv : E →ₗ[ℝ] E)) : LinearIsometryEquiv.trans J φ = φ.trans J := LinearIsometryEquiv.ext <| o.linearIsometryEquiv_comp_rightAngleRotation φ hφ #align orientation.linear_isometry_equiv_comp_right_angle_rotation' Orientation.linearIsometryEquiv_comp_rightAngleRotation' def basisRightAngleRotation (x : E) (hx : x ≠ 0) : Basis (Fin 2) ℝ E := @basisOfLinearIndependentOfCardEqFinrank ℝ _ _ _ _ _ _ _ ![x, J x] (linearIndependent_of_ne_zero_of_inner_eq_zero (fun i => by fin_cases i <;> simp [hx]) (by intro i j hij fin_cases i <;> fin_cases j <;> simp_all)) (@Fact.out (finrank ℝ E = 2)).symm #align orientation.basis_right_angle_rotation Orientation.basisRightAngleRotation @[simp] theorem coe_basisRightAngleRotation (x : E) (hx : x ≠ 0) : ⇑(o.basisRightAngleRotation x hx) = ![x, J x] := coe_basisOfLinearIndependentOfCardEqFinrank _ _ #align orientation.coe_basis_right_angle_rotation Orientation.coe_basisRightAngleRotation theorem inner_mul_inner_add_areaForm_mul_areaForm' (a x : E) : ⟪a, x⟫ • innerₛₗ ℝ a + ω a x • ω a = ‖a‖ ^ 2 • innerₛₗ ℝ x := by by_cases ha : a = 0 · simp [ha] apply (o.basisRightAngleRotation a ha).ext intro i fin_cases i · simp only [Fin.mk_zero, coe_basisRightAngleRotation, Matrix.cons_val_zero, LinearMap.add_apply, LinearMap.smul_apply, innerₛₗ_apply, real_inner_self_eq_norm_sq, smul_eq_mul, areaForm_apply_self, mul_zero, add_zero, Real.rpow_two, real_inner_comm] ring · simp only [Fin.mk_one, coe_basisRightAngleRotation, Matrix.cons_val_one, Matrix.head_cons, LinearMap.add_apply, LinearMap.smul_apply, innerₛₗ_apply, inner_rightAngleRotation_right, areaForm_apply_self, neg_zero, smul_eq_mul, mul_zero, areaForm_rightAngleRotation_right, real_inner_self_eq_norm_sq, zero_add, Real.rpow_two, mul_neg] rw [o.areaForm_swap] ring #align orientation.inner_mul_inner_add_area_form_mul_area_form' Orientation.inner_mul_inner_add_areaForm_mul_areaForm' theorem inner_mul_inner_add_areaForm_mul_areaForm (a x y : E) : ⟪a, x⟫ * ⟪a, y⟫ + ω a x * ω a y = ‖a‖ ^ 2 * ⟪x, y⟫ := congr_arg (fun f : E →ₗ[ℝ] ℝ => f y) (o.inner_mul_inner_add_areaForm_mul_areaForm' a x) #align orientation.inner_mul_inner_add_area_form_mul_area_form Orientation.inner_mul_inner_add_areaForm_mul_areaForm theorem inner_sq_add_areaForm_sq (a b : E) : ⟪a, b⟫ ^ 2 + ω a b ^ 2 = ‖a‖ ^ 2 * ‖b‖ ^ 2 := by simpa [sq, real_inner_self_eq_norm_sq] using o.inner_mul_inner_add_areaForm_mul_areaForm a b b #align orientation.inner_sq_add_area_form_sq Orientation.inner_sq_add_areaForm_sq theorem inner_mul_areaForm_sub' (a x : E) : ⟪a, x⟫ • ω a - ω a x • innerₛₗ ℝ a = ‖a‖ ^ 2 • ω x := by by_cases ha : a = 0 · simp [ha] apply (o.basisRightAngleRotation a ha).ext intro i fin_cases i · simp only [o.areaForm_swap a x, neg_smul, sub_neg_eq_add, Fin.mk_zero, coe_basisRightAngleRotation, Matrix.cons_val_zero, LinearMap.add_apply, LinearMap.smul_apply, areaForm_apply_self, smul_eq_mul, mul_zero, innerₛₗ_apply, real_inner_self_eq_norm_sq, zero_add, Real.rpow_two] ring · simp only [Fin.mk_one, coe_basisRightAngleRotation, Matrix.cons_val_one, Matrix.head_cons, LinearMap.sub_apply, LinearMap.smul_apply, areaForm_rightAngleRotation_right, real_inner_self_eq_norm_sq, smul_eq_mul, innerₛₗ_apply, inner_rightAngleRotation_right, areaForm_apply_self, neg_zero, mul_zero, sub_zero, Real.rpow_two, real_inner_comm] ring #align orientation.inner_mul_area_form_sub' Orientation.inner_mul_areaForm_sub' theorem inner_mul_areaForm_sub (a x y : E) : ⟪a, x⟫ * ω a y - ω a x * ⟪a, y⟫ = ‖a‖ ^ 2 * ω x y := congr_arg (fun f : E →ₗ[ℝ] ℝ => f y) (o.inner_mul_areaForm_sub' a x) #align orientation.inner_mul_area_form_sub Orientation.inner_mul_areaForm_sub theorem nonneg_inner_and_areaForm_eq_zero_iff_sameRay (x y : E) : 0 ≤ ⟪x, y⟫ ∧ ω x y = 0 ↔ SameRay ℝ x y := by by_cases hx : x = 0 · simp [hx] constructor · let a : ℝ := (o.basisRightAngleRotation x hx).repr y 0 let b : ℝ := (o.basisRightAngleRotation x hx).repr y 1 suffices ↑0 ≤ a * ‖x‖ ^ 2 ∧ b * ‖x‖ ^ 2 = 0 → SameRay ℝ x (a • x + b • J x) by rw [← (o.basisRightAngleRotation x hx).sum_repr y] simp only [Fin.sum_univ_succ, coe_basisRightAngleRotation, Matrix.cons_val_zero, Fin.succ_zero_eq_one', Finset.univ_eq_empty, Finset.sum_empty, areaForm_apply_self, map_smul, map_add, real_inner_smul_right, inner_add_right, Matrix.cons_val_one, Matrix.head_cons, Algebra.id.smul_eq_mul, areaForm_rightAngleRotation_right, mul_zero, add_zero, zero_add, neg_zero, inner_rightAngleRotation_right, real_inner_self_eq_norm_sq, zero_smul, one_smul] exact this rintro ⟨ha, hb⟩ have hx' : 0 < ‖x‖ := by simpa using hx have ha' : 0 ≤ a := nonneg_of_mul_nonneg_left ha (by positivity) have hb' : b = 0 := eq_zero_of_ne_zero_of_mul_right_eq_zero (pow_ne_zero 2 hx'.ne') hb exact (SameRay.sameRay_nonneg_smul_right x ha').add_right $ by simp [hb'] · intro h obtain ⟨r, hr, rfl⟩ := h.exists_nonneg_left hx simp only [inner_smul_right, real_inner_self_eq_norm_sq, LinearMap.map_smulₛₗ, areaForm_apply_self, Algebra.id.smul_eq_mul, mul_zero, eq_self_iff_true, and_true_iff] positivity #align orientation.nonneg_inner_and_area_form_eq_zero_iff_same_ray Orientation.nonneg_inner_and_areaForm_eq_zero_iff_sameRay def kahler : E →ₗ[ℝ] E →ₗ[ℝ] ℂ := LinearMap.llcomp ℝ E ℝ ℂ Complex.ofRealCLM ∘ₗ innerₛₗ ℝ + LinearMap.llcomp ℝ E ℝ ℂ ((LinearMap.lsmul ℝ ℂ).flip Complex.I) ∘ₗ ω #align orientation.kahler Orientation.kahler theorem kahler_apply_apply (x y : E) : o.kahler x y = ⟪x, y⟫ + ω x y • Complex.I := rfl #align orientation.kahler_apply_apply Orientation.kahler_apply_apply theorem kahler_swap (x y : E) : o.kahler x y = conj (o.kahler y x) := by have : ∀ r : ℝ, Complex.ofReal' r = @RCLike.ofReal ℂ _ r := fun r => rfl simp only [kahler_apply_apply] rw [real_inner_comm, areaForm_swap] simp [this] #align orientation.kahler_swap Orientation.kahler_swap @[simp] theorem kahler_apply_self (x : E) : o.kahler x x = ‖x‖ ^ 2 := by simp [kahler_apply_apply, real_inner_self_eq_norm_sq] #align orientation.kahler_apply_self Orientation.kahler_apply_self @[simp] theorem kahler_rightAngleRotation_left (x y : E) : o.kahler (J x) y = -Complex.I * o.kahler x y := by simp only [o.areaForm_rightAngleRotation_left, o.inner_rightAngleRotation_left, o.kahler_apply_apply, Complex.ofReal_neg, Complex.real_smul] linear_combination ω x y * Complex.I_sq #align orientation.kahler_right_angle_rotation_left Orientation.kahler_rightAngleRotation_left @[simp] theorem kahler_rightAngleRotation_right (x y : E) : o.kahler x (J y) = Complex.I * o.kahler x y := by simp only [o.areaForm_rightAngleRotation_right, o.inner_rightAngleRotation_right, o.kahler_apply_apply, Complex.ofReal_neg, Complex.real_smul] linear_combination -ω x y * Complex.I_sq #align orientation.kahler_right_angle_rotation_right Orientation.kahler_rightAngleRotation_right -- @[simp] -- Porting note: simp normal form is `kahler_comp_rightAngleRotation'` theorem kahler_comp_rightAngleRotation (x y : E) : o.kahler (J x) (J y) = o.kahler x y := by simp only [kahler_rightAngleRotation_left, kahler_rightAngleRotation_right] linear_combination -o.kahler x y * Complex.I_sq #align orientation.kahler_comp_right_angle_rotation Orientation.kahler_comp_rightAngleRotation theorem kahler_comp_rightAngleRotation' (x y : E) : -(Complex.I * (Complex.I * o.kahler x y)) = o.kahler x y := by linear_combination -o.kahler x y * Complex.I_sq @[simp] theorem kahler_neg_orientation (x y : E) : (-o).kahler x y = conj (o.kahler x y) := by have : ∀ r : ℝ, Complex.ofReal' r = @RCLike.ofReal ℂ _ r := fun r => rfl simp [kahler_apply_apply, this] #align orientation.kahler_neg_orientation Orientation.kahler_neg_orientation theorem kahler_mul (a x y : E) : o.kahler x a * o.kahler a y = ‖a‖ ^ 2 * o.kahler x y := by trans ((‖a‖ ^ 2 :) : ℂ) * o.kahler x y · apply Complex.ext · simp only [o.kahler_apply_apply, Complex.add_im, Complex.add_re, Complex.I_im, Complex.I_re, Complex.mul_im, Complex.mul_re, Complex.ofReal_im, Complex.ofReal_re, Complex.real_smul] rw [real_inner_comm a x, o.areaForm_swap x a] linear_combination o.inner_mul_inner_add_areaForm_mul_areaForm a x y · simp only [o.kahler_apply_apply, Complex.add_im, Complex.add_re, Complex.I_im, Complex.I_re, Complex.mul_im, Complex.mul_re, Complex.ofReal_im, Complex.ofReal_re, Complex.real_smul] rw [real_inner_comm a x, o.areaForm_swap x a] linear_combination o.inner_mul_areaForm_sub a x y · norm_cast #align orientation.kahler_mul Orientation.kahler_mul theorem normSq_kahler (x y : E) : Complex.normSq (o.kahler x y) = ‖x‖ ^ 2 * ‖y‖ ^ 2 := by simpa [kahler_apply_apply, Complex.normSq, sq] using o.inner_sq_add_areaForm_sq x y #align orientation.norm_sq_kahler Orientation.normSq_kahler theorem abs_kahler (x y : E) : Complex.abs (o.kahler x y) = ‖x‖ * ‖y‖ := by rw [← sq_eq_sq, Complex.sq_abs] · linear_combination o.normSq_kahler x y · positivity · positivity #align orientation.abs_kahler Orientation.abs_kahler theorem norm_kahler (x y : E) : ‖o.kahler x y‖ = ‖x‖ * ‖y‖ := by simpa using o.abs_kahler x y #align orientation.norm_kahler Orientation.norm_kahler theorem eq_zero_or_eq_zero_of_kahler_eq_zero {x y : E} (hx : o.kahler x y = 0) : x = 0 ∨ y = 0 := by have : ‖x‖ * ‖y‖ = 0 := by simpa [hx] using (o.norm_kahler x y).symm cases' eq_zero_or_eq_zero_of_mul_eq_zero this with h h · left simpa using h · right simpa using h #align orientation.eq_zero_or_eq_zero_of_kahler_eq_zero Orientation.eq_zero_or_eq_zero_of_kahler_eq_zero
Mathlib/Analysis/InnerProductSpace/TwoDim.lean
568
570
theorem kahler_eq_zero_iff (x y : E) : o.kahler x y = 0 ↔ x = 0 ∨ y = 0 := by
refine ⟨o.eq_zero_or_eq_zero_of_kahler_eq_zero, ?_⟩ rintro (rfl | rfl) <;> simp
import Mathlib.Probability.Kernel.MeasurableIntegral #align_import probability.kernel.composition from "leanprover-community/mathlib"@"3b92d54a05ee592aa2c6181a4e76b1bb7cc45d0b" open MeasureTheory open scoped ENNReal namespace ProbabilityTheory namespace kernel variable {α β ι : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β} section CompositionProduct variable {γ : Type*} {mγ : MeasurableSpace γ} {s : Set (β × γ)} noncomputable def compProdFun (κ : kernel α β) (η : kernel (α × β) γ) (a : α) (s : Set (β × γ)) : ℝ≥0∞ := ∫⁻ b, η (a, b) {c | (b, c) ∈ s} ∂κ a #align probability_theory.kernel.comp_prod_fun ProbabilityTheory.kernel.compProdFun theorem compProdFun_empty (κ : kernel α β) (η : kernel (α × β) γ) (a : α) : compProdFun κ η a ∅ = 0 := by simp only [compProdFun, Set.mem_empty_iff_false, Set.setOf_false, measure_empty, MeasureTheory.lintegral_const, zero_mul] #align probability_theory.kernel.comp_prod_fun_empty ProbabilityTheory.kernel.compProdFun_empty theorem compProdFun_iUnion (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel η] (a : α) (f : ℕ → Set (β × γ)) (hf_meas : ∀ i, MeasurableSet (f i)) (hf_disj : Pairwise (Disjoint on f)) : compProdFun κ η a (⋃ i, f i) = ∑' i, compProdFun κ η a (f i) := by have h_Union : (fun b => η (a, b) {c : γ | (b, c) ∈ ⋃ i, f i}) = fun b => η (a, b) (⋃ i, {c : γ | (b, c) ∈ f i}) := by ext1 b congr with c simp only [Set.mem_iUnion, Set.iSup_eq_iUnion, Set.mem_setOf_eq] rw [compProdFun, h_Union] have h_tsum : (fun b => η (a, b) (⋃ i, {c : γ | (b, c) ∈ f i})) = fun b => ∑' i, η (a, b) {c : γ | (b, c) ∈ f i} := by ext1 b rw [measure_iUnion] · intro i j hij s hsi hsj c hcs have hbci : {(b, c)} ⊆ f i := by rw [Set.singleton_subset_iff]; exact hsi hcs have hbcj : {(b, c)} ⊆ f j := by rw [Set.singleton_subset_iff]; exact hsj hcs simpa only [Set.bot_eq_empty, Set.le_eq_subset, Set.singleton_subset_iff, Set.mem_empty_iff_false] using hf_disj hij hbci hbcj · -- Porting note: behavior of `@` changed relative to lean 3, was -- exact fun i => (@measurable_prod_mk_left β γ _ _ b) _ (hf_meas i) exact fun i => (@measurable_prod_mk_left β γ _ _ b) (hf_meas i) rw [h_tsum, lintegral_tsum] · rfl · intro i have hm : MeasurableSet {p : (α × β) × γ | (p.1.2, p.2) ∈ f i} := measurable_fst.snd.prod_mk measurable_snd (hf_meas i) exact ((measurable_kernel_prod_mk_left hm).comp measurable_prod_mk_left).aemeasurable #align probability_theory.kernel.comp_prod_fun_Union ProbabilityTheory.kernel.compProdFun_iUnion theorem compProdFun_tsum_right (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel η] (a : α) (hs : MeasurableSet s) : compProdFun κ η a s = ∑' n, compProdFun κ (seq η n) a s := by simp_rw [compProdFun, (measure_sum_seq η _).symm] have : ∫⁻ b, Measure.sum (fun n => seq η n (a, b)) {c : γ | (b, c) ∈ s} ∂κ a = ∫⁻ b, ∑' n, seq η n (a, b) {c : γ | (b, c) ∈ s} ∂κ a := by congr ext1 b rw [Measure.sum_apply] exact measurable_prod_mk_left hs rw [this, lintegral_tsum] exact fun n => ((measurable_kernel_prod_mk_left (κ := (seq η n)) ((measurable_fst.snd.prod_mk measurable_snd) hs)).comp measurable_prod_mk_left).aemeasurable #align probability_theory.kernel.comp_prod_fun_tsum_right ProbabilityTheory.kernel.compProdFun_tsum_right theorem compProdFun_tsum_left (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel κ] (a : α) (s : Set (β × γ)) : compProdFun κ η a s = ∑' n, compProdFun (seq κ n) η a s := by simp_rw [compProdFun, (measure_sum_seq κ _).symm, lintegral_sum_measure] #align probability_theory.kernel.comp_prod_fun_tsum_left ProbabilityTheory.kernel.compProdFun_tsum_left theorem compProdFun_eq_tsum (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ) [IsSFiniteKernel η] (a : α) (hs : MeasurableSet s) : compProdFun κ η a s = ∑' (n) (m), compProdFun (seq κ n) (seq η m) a s := by simp_rw [compProdFun_tsum_left κ η a s, compProdFun_tsum_right _ η a hs] #align probability_theory.kernel.comp_prod_fun_eq_tsum ProbabilityTheory.kernel.compProdFun_eq_tsum theorem measurable_compProdFun_of_finite (κ : kernel α β) [IsFiniteKernel κ] (η : kernel (α × β) γ) [IsFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by simp only [compProdFun] have h_meas : Measurable (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) := by have : (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) = fun p => η p {c : γ | (p.2, c) ∈ s} := by ext1 p rw [Function.uncurry_apply_pair] rw [this] exact measurable_kernel_prod_mk_left (measurable_fst.snd.prod_mk measurable_snd hs) exact h_meas.lintegral_kernel_prod_right #align probability_theory.kernel.measurable_comp_prod_fun_of_finite ProbabilityTheory.kernel.measurable_compProdFun_of_finite theorem measurable_compProdFun (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ) [IsSFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by simp_rw [compProdFun_tsum_right κ η _ hs] refine Measurable.ennreal_tsum fun n => ?_ simp only [compProdFun] have h_meas : Measurable (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) := by have : (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) = fun p => seq η n p {c : γ | (p.2, c) ∈ s} := by ext1 p rw [Function.uncurry_apply_pair] rw [this] exact measurable_kernel_prod_mk_left (measurable_fst.snd.prod_mk measurable_snd hs) exact h_meas.lintegral_kernel_prod_right #align probability_theory.kernel.measurable_comp_prod_fun ProbabilityTheory.kernel.measurable_compProdFun open scoped Classical noncomputable def compProd (κ : kernel α β) (η : kernel (α × β) γ) : kernel α (β × γ) := if h : IsSFiniteKernel κ ∧ IsSFiniteKernel η then { val := fun a ↦ Measure.ofMeasurable (fun s _ => compProdFun κ η a s) (compProdFun_empty κ η a) (@compProdFun_iUnion _ _ _ _ _ _ κ η h.2 a) property := by have : IsSFiniteKernel κ := h.1 have : IsSFiniteKernel η := h.2 refine Measure.measurable_of_measurable_coe _ fun s hs => ?_ have : (fun a => Measure.ofMeasurable (fun s _ => compProdFun κ η a s) (compProdFun_empty κ η a) (compProdFun_iUnion κ η a) s) = fun a => compProdFun κ η a s := by ext1 a; rwa [Measure.ofMeasurable_apply] rw [this] exact measurable_compProdFun κ η hs } else 0 #align probability_theory.kernel.comp_prod ProbabilityTheory.kernel.compProd scoped[ProbabilityTheory] infixl:100 " ⊗ₖ " => ProbabilityTheory.kernel.compProd theorem compProd_apply_eq_compProdFun (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ) [IsSFiniteKernel η] (a : α) (hs : MeasurableSet s) : (κ ⊗ₖ η) a s = compProdFun κ η a s := by rw [compProd, dif_pos] swap · constructor <;> infer_instance change Measure.ofMeasurable (fun s _ => compProdFun κ η a s) (compProdFun_empty κ η a) (compProdFun_iUnion κ η a) s = ∫⁻ b, η (a, b) {c | (b, c) ∈ s} ∂κ a rw [Measure.ofMeasurable_apply _ hs] rfl #align probability_theory.kernel.comp_prod_apply_eq_comp_prod_fun ProbabilityTheory.kernel.compProd_apply_eq_compProdFun
Mathlib/Probability/Kernel/Composition.lean
230
234
theorem compProd_of_not_isSFiniteKernel_left (κ : kernel α β) (η : kernel (α × β) γ) (h : ¬ IsSFiniteKernel κ) : κ ⊗ₖ η = 0 := by
rw [compProd, dif_neg] simp [h]
import Mathlib.Data.List.Infix #align_import data.list.rdrop from "leanprover-community/mathlib"@"26f081a2fb920140ed5bc5cc5344e84bcc7cb2b2" -- Make sure we don't import algebra assert_not_exists Monoid variable {α : Type*} (p : α → Bool) (l : List α) (n : ℕ) namespace List def rdrop : List α := l.take (l.length - n) #align list.rdrop List.rdrop @[simp] theorem rdrop_nil : rdrop ([] : List α) n = [] := by simp [rdrop] #align list.rdrop_nil List.rdrop_nil @[simp] theorem rdrop_zero : rdrop l 0 = l := by simp [rdrop] #align list.rdrop_zero List.rdrop_zero theorem rdrop_eq_reverse_drop_reverse : l.rdrop n = reverse (l.reverse.drop n) := by rw [rdrop] induction' l using List.reverseRecOn with xs x IH generalizing n · simp · cases n · simp [take_append] · simp [take_append_eq_append_take, IH] #align list.rdrop_eq_reverse_drop_reverse List.rdrop_eq_reverse_drop_reverse @[simp] theorem rdrop_concat_succ (x : α) : rdrop (l ++ [x]) (n + 1) = rdrop l n := by simp [rdrop_eq_reverse_drop_reverse] #align list.rdrop_concat_succ List.rdrop_concat_succ def rtake : List α := l.drop (l.length - n) #align list.rtake List.rtake @[simp] theorem rtake_nil : rtake ([] : List α) n = [] := by simp [rtake] #align list.rtake_nil List.rtake_nil @[simp] theorem rtake_zero : rtake l 0 = [] := by simp [rtake] #align list.rtake_zero List.rtake_zero theorem rtake_eq_reverse_take_reverse : l.rtake n = reverse (l.reverse.take n) := by rw [rtake] induction' l using List.reverseRecOn with xs x IH generalizing n · simp · cases n · exact drop_length _ · simp [drop_append_eq_append_drop, IH] #align list.rtake_eq_reverse_take_reverse List.rtake_eq_reverse_take_reverse @[simp] theorem rtake_concat_succ (x : α) : rtake (l ++ [x]) (n + 1) = rtake l n ++ [x] := by simp [rtake_eq_reverse_take_reverse] #align list.rtake_concat_succ List.rtake_concat_succ def rdropWhile : List α := reverse (l.reverse.dropWhile p) #align list.rdrop_while List.rdropWhile @[simp] theorem rdropWhile_nil : rdropWhile p ([] : List α) = [] := by simp [rdropWhile, dropWhile] #align list.rdrop_while_nil List.rdropWhile_nil theorem rdropWhile_concat (x : α) : rdropWhile p (l ++ [x]) = if p x then rdropWhile p l else l ++ [x] := by simp only [rdropWhile, dropWhile, reverse_append, reverse_singleton, singleton_append] split_ifs with h <;> simp [h] #align list.rdrop_while_concat List.rdropWhile_concat @[simp] theorem rdropWhile_concat_pos (x : α) (h : p x) : rdropWhile p (l ++ [x]) = rdropWhile p l := by rw [rdropWhile_concat, if_pos h] #align list.rdrop_while_concat_pos List.rdropWhile_concat_pos @[simp] theorem rdropWhile_concat_neg (x : α) (h : ¬p x) : rdropWhile p (l ++ [x]) = l ++ [x] := by rw [rdropWhile_concat, if_neg h] #align list.rdrop_while_concat_neg List.rdropWhile_concat_neg theorem rdropWhile_singleton (x : α) : rdropWhile p [x] = if p x then [] else [x] := by rw [← nil_append [x], rdropWhile_concat, rdropWhile_nil] #align list.rdrop_while_singleton List.rdropWhile_singleton theorem rdropWhile_last_not (hl : l.rdropWhile p ≠ []) : ¬p ((rdropWhile p l).getLast hl) := by simp_rw [rdropWhile] rw [getLast_reverse] exact dropWhile_nthLe_zero_not _ _ _ #align list.rdrop_while_last_not List.rdropWhile_last_not theorem rdropWhile_prefix : l.rdropWhile p <+: l := by rw [← reverse_suffix, rdropWhile, reverse_reverse] exact dropWhile_suffix _ #align list.rdrop_while_prefix List.rdropWhile_prefix variable {p} {l} @[simp] theorem rdropWhile_eq_nil_iff : rdropWhile p l = [] ↔ ∀ x ∈ l, p x := by simp [rdropWhile] #align list.rdrop_while_eq_nil_iff List.rdropWhile_eq_nil_iff -- it is in this file because it requires `List.Infix` @[simp] theorem dropWhile_eq_self_iff : dropWhile p l = l ↔ ∀ hl : 0 < l.length, ¬p (l.get ⟨0, hl⟩) := by cases' l with hd tl · simp only [dropWhile, true_iff] intro h by_contra rwa [length_nil, lt_self_iff_false] at h · rw [dropWhile] refine ⟨fun h => ?_, fun h => ?_⟩ · intro _ H rw [get] at H refine (cons_ne_self hd tl) (Sublist.antisymm ?_ (sublist_cons _ _)) rw [← h] simp only [H] exact List.IsSuffix.sublist (dropWhile_suffix p) · have := h (by simp only [length, Nat.succ_pos]) rw [get] at this simp_rw [this] #align list.drop_while_eq_self_iff List.dropWhile_eq_self_iff @[simp] theorem rdropWhile_eq_self_iff : rdropWhile p l = l ↔ ∀ hl : l ≠ [], ¬p (l.getLast hl) := by simp only [rdropWhile, reverse_eq_iff, dropWhile_eq_self_iff, getLast_eq_get] refine ⟨fun h hl => ?_, fun h hl => ?_⟩ · rw [← length_pos, ← length_reverse] at hl have := h hl rwa [get_reverse'] at this · rw [length_reverse, length_pos] at hl have := h hl rwa [get_reverse'] #align list.rdrop_while_eq_self_iff List.rdropWhile_eq_self_iff variable (p) (l)
Mathlib/Data/List/DropRight.lean
179
181
theorem dropWhile_idempotent : dropWhile p (dropWhile p l) = dropWhile p l := by
simp only [dropWhile_eq_self_iff] exact fun h => dropWhile_nthLe_zero_not p l h
import Mathlib.Algebra.Order.Ring.WithTop import Mathlib.Algebra.Order.Sub.WithTop import Mathlib.Data.Real.NNReal import Mathlib.Order.Interval.Set.WithBotTop #align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520" open Function Set NNReal variable {α : Type*} def ENNReal := WithTop ℝ≥0 deriving Zero, AddCommMonoidWithOne, SemilatticeSup, DistribLattice, Nontrivial #align ennreal ENNReal @[inherit_doc] scoped[ENNReal] notation "ℝ≥0∞" => ENNReal scoped[ENNReal] notation "∞" => (⊤ : ENNReal) namespace ENNReal instance : OrderBot ℝ≥0∞ := inferInstanceAs (OrderBot (WithTop ℝ≥0)) instance : BoundedOrder ℝ≥0∞ := inferInstanceAs (BoundedOrder (WithTop ℝ≥0)) instance : CharZero ℝ≥0∞ := inferInstanceAs (CharZero (WithTop ℝ≥0)) noncomputable instance : CanonicallyOrderedCommSemiring ℝ≥0∞ := inferInstanceAs (CanonicallyOrderedCommSemiring (WithTop ℝ≥0)) noncomputable instance : CompleteLinearOrder ℝ≥0∞ := inferInstanceAs (CompleteLinearOrder (WithTop ℝ≥0)) instance : DenselyOrdered ℝ≥0∞ := inferInstanceAs (DenselyOrdered (WithTop ℝ≥0)) noncomputable instance : CanonicallyLinearOrderedAddCommMonoid ℝ≥0∞ := inferInstanceAs (CanonicallyLinearOrderedAddCommMonoid (WithTop ℝ≥0)) noncomputable instance instSub : Sub ℝ≥0∞ := inferInstanceAs (Sub (WithTop ℝ≥0)) noncomputable instance : OrderedSub ℝ≥0∞ := inferInstanceAs (OrderedSub (WithTop ℝ≥0)) noncomputable instance : LinearOrderedAddCommMonoidWithTop ℝ≥0∞ := inferInstanceAs (LinearOrderedAddCommMonoidWithTop (WithTop ℝ≥0)) -- Porting note: rfc: redefine using pattern matching? noncomputable instance : Inv ℝ≥0∞ := ⟨fun a => sInf { b | 1 ≤ a * b }⟩ noncomputable instance : DivInvMonoid ℝ≥0∞ where variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0} -- Porting note: are these 2 instances still required in Lean 4? instance covariantClass_mul_le : CovariantClass ℝ≥0∞ ℝ≥0∞ (· * ·) (· ≤ ·) := inferInstance #align ennreal.covariant_class_mul_le ENNReal.covariantClass_mul_le instance covariantClass_add_le : CovariantClass ℝ≥0∞ ℝ≥0∞ (· + ·) (· ≤ ·) := inferInstance #align ennreal.covariant_class_add_le ENNReal.covariantClass_add_le -- Porting note (#11215): TODO: add a `WithTop` instance and use it here noncomputable instance : LinearOrderedCommMonoidWithZero ℝ≥0∞ := { inferInstanceAs (LinearOrderedAddCommMonoidWithTop ℝ≥0∞), inferInstanceAs (CommSemiring ℝ≥0∞) with mul_le_mul_left := fun _ _ => mul_le_mul_left' zero_le_one := zero_le 1 } noncomputable instance : Unique (AddUnits ℝ≥0∞) where default := 0 uniq a := AddUnits.ext <| le_zero_iff.1 <| by rw [← a.add_neg]; exact le_self_add instance : Inhabited ℝ≥0∞ := ⟨0⟩ @[coe, match_pattern] def ofNNReal : ℝ≥0 → ℝ≥0∞ := WithTop.some instance : Coe ℝ≥0 ℝ≥0∞ := ⟨ofNNReal⟩ @[elab_as_elim, induction_eliminator, cases_eliminator] def recTopCoe {C : ℝ≥0∞ → Sort*} (top : C ∞) (coe : ∀ x : ℝ≥0, C x) (x : ℝ≥0∞) : C x := WithTop.recTopCoe top coe x instance canLift : CanLift ℝ≥0∞ ℝ≥0 ofNNReal (· ≠ ∞) := WithTop.canLift #align ennreal.can_lift ENNReal.canLift @[simp] theorem none_eq_top : (none : ℝ≥0∞) = ∞ := rfl #align ennreal.none_eq_top ENNReal.none_eq_top @[simp] theorem some_eq_coe (a : ℝ≥0) : (Option.some a : ℝ≥0∞) = (↑a : ℝ≥0∞) := rfl #align ennreal.some_eq_coe ENNReal.some_eq_coe @[simp] theorem some_eq_coe' (a : ℝ≥0) : (WithTop.some a : ℝ≥0∞) = (↑a : ℝ≥0∞) := rfl lemma coe_injective : Injective ((↑) : ℝ≥0 → ℝ≥0∞) := WithTop.coe_injective @[simp, norm_cast] lemma coe_inj : (p : ℝ≥0∞) = q ↔ p = q := coe_injective.eq_iff #align ennreal.coe_eq_coe ENNReal.coe_inj lemma coe_ne_coe : (p : ℝ≥0∞) ≠ q ↔ p ≠ q := coe_inj.not theorem range_coe' : range ofNNReal = Iio ∞ := WithTop.range_coe theorem range_coe : range ofNNReal = {∞}ᶜ := (isCompl_range_some_none ℝ≥0).symm.compl_eq.symm protected def toNNReal : ℝ≥0∞ → ℝ≥0 := WithTop.untop' 0 #align ennreal.to_nnreal ENNReal.toNNReal protected def toReal (a : ℝ≥0∞) : Real := a.toNNReal #align ennreal.to_real ENNReal.toReal protected noncomputable def ofReal (r : Real) : ℝ≥0∞ := r.toNNReal #align ennreal.of_real ENNReal.ofReal @[simp, norm_cast] theorem toNNReal_coe : (r : ℝ≥0∞).toNNReal = r := rfl #align ennreal.to_nnreal_coe ENNReal.toNNReal_coe @[simp] theorem coe_toNNReal : ∀ {a : ℝ≥0∞}, a ≠ ∞ → ↑a.toNNReal = a | ofNNReal _, _ => rfl | ⊤, h => (h rfl).elim #align ennreal.coe_to_nnreal ENNReal.coe_toNNReal @[simp] theorem ofReal_toReal {a : ℝ≥0∞} (h : a ≠ ∞) : ENNReal.ofReal a.toReal = a := by simp [ENNReal.toReal, ENNReal.ofReal, h] #align ennreal.of_real_to_real ENNReal.ofReal_toReal @[simp] theorem toReal_ofReal {r : ℝ} (h : 0 ≤ r) : (ENNReal.ofReal r).toReal = r := max_eq_left h #align ennreal.to_real_of_real ENNReal.toReal_ofReal theorem toReal_ofReal' {r : ℝ} : (ENNReal.ofReal r).toReal = max r 0 := rfl #align ennreal.to_real_of_real' ENNReal.toReal_ofReal' theorem coe_toNNReal_le_self : ∀ {a : ℝ≥0∞}, ↑a.toNNReal ≤ a | ofNNReal r => by rw [toNNReal_coe] | ⊤ => le_top #align ennreal.coe_to_nnreal_le_self ENNReal.coe_toNNReal_le_self theorem coe_nnreal_eq (r : ℝ≥0) : (r : ℝ≥0∞) = ENNReal.ofReal r := by rw [ENNReal.ofReal, Real.toNNReal_coe] #align ennreal.coe_nnreal_eq ENNReal.coe_nnreal_eq theorem ofReal_eq_coe_nnreal {x : ℝ} (h : 0 ≤ x) : ENNReal.ofReal x = ofNNReal ⟨x, h⟩ := (coe_nnreal_eq ⟨x, h⟩).symm #align ennreal.of_real_eq_coe_nnreal ENNReal.ofReal_eq_coe_nnreal @[simp] theorem ofReal_coe_nnreal : ENNReal.ofReal p = p := (coe_nnreal_eq p).symm #align ennreal.of_real_coe_nnreal ENNReal.ofReal_coe_nnreal @[simp, norm_cast] theorem coe_zero : ↑(0 : ℝ≥0) = (0 : ℝ≥0∞) := rfl #align ennreal.coe_zero ENNReal.coe_zero @[simp, norm_cast] theorem coe_one : ↑(1 : ℝ≥0) = (1 : ℝ≥0∞) := rfl #align ennreal.coe_one ENNReal.coe_one @[simp] theorem toReal_nonneg {a : ℝ≥0∞} : 0 ≤ a.toReal := a.toNNReal.2 #align ennreal.to_real_nonneg ENNReal.toReal_nonneg @[simp] theorem top_toNNReal : ∞.toNNReal = 0 := rfl #align ennreal.top_to_nnreal ENNReal.top_toNNReal @[simp] theorem top_toReal : ∞.toReal = 0 := rfl #align ennreal.top_to_real ENNReal.top_toReal @[simp] theorem one_toReal : (1 : ℝ≥0∞).toReal = 1 := rfl #align ennreal.one_to_real ENNReal.one_toReal @[simp] theorem one_toNNReal : (1 : ℝ≥0∞).toNNReal = 1 := rfl #align ennreal.one_to_nnreal ENNReal.one_toNNReal @[simp] theorem coe_toReal (r : ℝ≥0) : (r : ℝ≥0∞).toReal = r := rfl #align ennreal.coe_to_real ENNReal.coe_toReal @[simp] theorem zero_toNNReal : (0 : ℝ≥0∞).toNNReal = 0 := rfl #align ennreal.zero_to_nnreal ENNReal.zero_toNNReal @[simp] theorem zero_toReal : (0 : ℝ≥0∞).toReal = 0 := rfl #align ennreal.zero_to_real ENNReal.zero_toReal @[simp] theorem ofReal_zero : ENNReal.ofReal (0 : ℝ) = 0 := by simp [ENNReal.ofReal] #align ennreal.of_real_zero ENNReal.ofReal_zero @[simp] theorem ofReal_one : ENNReal.ofReal (1 : ℝ) = (1 : ℝ≥0∞) := by simp [ENNReal.ofReal] #align ennreal.of_real_one ENNReal.ofReal_one theorem ofReal_toReal_le {a : ℝ≥0∞} : ENNReal.ofReal a.toReal ≤ a := if ha : a = ∞ then ha.symm ▸ le_top else le_of_eq (ofReal_toReal ha) #align ennreal.of_real_to_real_le ENNReal.ofReal_toReal_le theorem forall_ennreal {p : ℝ≥0∞ → Prop} : (∀ a, p a) ↔ (∀ r : ℝ≥0, p r) ∧ p ∞ := Option.forall.trans and_comm #align ennreal.forall_ennreal ENNReal.forall_ennreal theorem forall_ne_top {p : ℝ≥0∞ → Prop} : (∀ a, a ≠ ∞ → p a) ↔ ∀ r : ℝ≥0, p r := Option.ball_ne_none #align ennreal.forall_ne_top ENNReal.forall_ne_top theorem exists_ne_top {p : ℝ≥0∞ → Prop} : (∃ a ≠ ∞, p a) ↔ ∃ r : ℝ≥0, p r := Option.exists_ne_none #align ennreal.exists_ne_top ENNReal.exists_ne_top theorem toNNReal_eq_zero_iff (x : ℝ≥0∞) : x.toNNReal = 0 ↔ x = 0 ∨ x = ∞ := WithTop.untop'_eq_self_iff #align ennreal.to_nnreal_eq_zero_iff ENNReal.toNNReal_eq_zero_iff theorem toReal_eq_zero_iff (x : ℝ≥0∞) : x.toReal = 0 ↔ x = 0 ∨ x = ∞ := by simp [ENNReal.toReal, toNNReal_eq_zero_iff] #align ennreal.to_real_eq_zero_iff ENNReal.toReal_eq_zero_iff theorem toNNReal_ne_zero : a.toNNReal ≠ 0 ↔ a ≠ 0 ∧ a ≠ ∞ := a.toNNReal_eq_zero_iff.not.trans not_or #align ennreal.to_nnreal_ne_zero ENNReal.toNNReal_ne_zero theorem toReal_ne_zero : a.toReal ≠ 0 ↔ a ≠ 0 ∧ a ≠ ∞ := a.toReal_eq_zero_iff.not.trans not_or #align ennreal.to_real_ne_zero ENNReal.toReal_ne_zero theorem toNNReal_eq_one_iff (x : ℝ≥0∞) : x.toNNReal = 1 ↔ x = 1 := WithTop.untop'_eq_iff.trans <| by simp #align ennreal.to_nnreal_eq_one_iff ENNReal.toNNReal_eq_one_iff theorem toReal_eq_one_iff (x : ℝ≥0∞) : x.toReal = 1 ↔ x = 1 := by rw [ENNReal.toReal, NNReal.coe_eq_one, ENNReal.toNNReal_eq_one_iff] #align ennreal.to_real_eq_one_iff ENNReal.toReal_eq_one_iff theorem toNNReal_ne_one : a.toNNReal ≠ 1 ↔ a ≠ 1 := a.toNNReal_eq_one_iff.not #align ennreal.to_nnreal_ne_one ENNReal.toNNReal_ne_one theorem toReal_ne_one : a.toReal ≠ 1 ↔ a ≠ 1 := a.toReal_eq_one_iff.not #align ennreal.to_real_ne_one ENNReal.toReal_ne_one @[simp] theorem coe_ne_top : (r : ℝ≥0∞) ≠ ∞ := WithTop.coe_ne_top #align ennreal.coe_ne_top ENNReal.coe_ne_top @[simp] theorem top_ne_coe : ∞ ≠ (r : ℝ≥0∞) := WithTop.top_ne_coe #align ennreal.top_ne_coe ENNReal.top_ne_coe @[simp] theorem coe_lt_top : (r : ℝ≥0∞) < ∞ := WithTop.coe_lt_top r #align ennreal.coe_lt_top ENNReal.coe_lt_top @[simp] theorem ofReal_ne_top {r : ℝ} : ENNReal.ofReal r ≠ ∞ := coe_ne_top #align ennreal.of_real_ne_top ENNReal.ofReal_ne_top @[simp] theorem ofReal_lt_top {r : ℝ} : ENNReal.ofReal r < ∞ := coe_lt_top #align ennreal.of_real_lt_top ENNReal.ofReal_lt_top @[simp] theorem top_ne_ofReal {r : ℝ} : ∞ ≠ ENNReal.ofReal r := top_ne_coe #align ennreal.top_ne_of_real ENNReal.top_ne_ofReal @[simp] theorem ofReal_toReal_eq_iff : ENNReal.ofReal a.toReal = a ↔ a ≠ ⊤ := ⟨fun h => by rw [← h] exact ofReal_ne_top, ofReal_toReal⟩ #align ennreal.of_real_to_real_eq_iff ENNReal.ofReal_toReal_eq_iff @[simp] theorem toReal_ofReal_eq_iff {a : ℝ} : (ENNReal.ofReal a).toReal = a ↔ 0 ≤ a := ⟨fun h => by rw [← h] exact toReal_nonneg, toReal_ofReal⟩ #align ennreal.to_real_of_real_eq_iff ENNReal.toReal_ofReal_eq_iff @[simp] theorem zero_ne_top : 0 ≠ ∞ := coe_ne_top #align ennreal.zero_ne_top ENNReal.zero_ne_top @[simp] theorem top_ne_zero : ∞ ≠ 0 := top_ne_coe #align ennreal.top_ne_zero ENNReal.top_ne_zero @[simp] theorem one_ne_top : 1 ≠ ∞ := coe_ne_top #align ennreal.one_ne_top ENNReal.one_ne_top @[simp] theorem top_ne_one : ∞ ≠ 1 := top_ne_coe #align ennreal.top_ne_one ENNReal.top_ne_one @[simp] theorem zero_lt_top : 0 < ∞ := coe_lt_top @[simp, norm_cast] theorem coe_le_coe : (↑r : ℝ≥0∞) ≤ ↑q ↔ r ≤ q := WithTop.coe_le_coe #align ennreal.coe_le_coe ENNReal.coe_le_coe @[simp, norm_cast] theorem coe_lt_coe : (↑r : ℝ≥0∞) < ↑q ↔ r < q := WithTop.coe_lt_coe #align ennreal.coe_lt_coe ENNReal.coe_lt_coe -- Needed until `@[gcongr]` accepts iff statements alias ⟨_, coe_le_coe_of_le⟩ := coe_le_coe attribute [gcongr] ENNReal.coe_le_coe_of_le -- Needed until `@[gcongr]` accepts iff statements alias ⟨_, coe_lt_coe_of_lt⟩ := coe_lt_coe attribute [gcongr] ENNReal.coe_lt_coe_of_lt theorem coe_mono : Monotone ofNNReal := fun _ _ => coe_le_coe.2 #align ennreal.coe_mono ENNReal.coe_mono theorem coe_strictMono : StrictMono ofNNReal := fun _ _ => coe_lt_coe.2 @[simp, norm_cast] theorem coe_eq_zero : (↑r : ℝ≥0∞) = 0 ↔ r = 0 := coe_inj #align ennreal.coe_eq_zero ENNReal.coe_eq_zero @[simp, norm_cast] theorem zero_eq_coe : 0 = (↑r : ℝ≥0∞) ↔ 0 = r := coe_inj #align ennreal.zero_eq_coe ENNReal.zero_eq_coe @[simp, norm_cast] theorem coe_eq_one : (↑r : ℝ≥0∞) = 1 ↔ r = 1 := coe_inj #align ennreal.coe_eq_one ENNReal.coe_eq_one @[simp, norm_cast] theorem one_eq_coe : 1 = (↑r : ℝ≥0∞) ↔ 1 = r := coe_inj #align ennreal.one_eq_coe ENNReal.one_eq_coe @[simp, norm_cast] theorem coe_pos : 0 < (r : ℝ≥0∞) ↔ 0 < r := coe_lt_coe #align ennreal.coe_pos ENNReal.coe_pos theorem coe_ne_zero : (r : ℝ≥0∞) ≠ 0 ↔ r ≠ 0 := coe_eq_zero.not #align ennreal.coe_ne_zero ENNReal.coe_ne_zero lemma coe_ne_one : (r : ℝ≥0∞) ≠ 1 ↔ r ≠ 1 := coe_eq_one.not @[simp, norm_cast] lemma coe_add (x y : ℝ≥0) : (↑(x + y) : ℝ≥0∞) = x + y := rfl #align ennreal.coe_add ENNReal.coe_add @[simp, norm_cast] lemma coe_mul (x y : ℝ≥0) : (↑(x * y) : ℝ≥0∞) = x * y := rfl #align ennreal.coe_mul ENNReal.coe_mul @[norm_cast] lemma coe_nsmul (n : ℕ) (x : ℝ≥0) : (↑(n • x) : ℝ≥0∞) = n • x := rfl @[simp, norm_cast] lemma coe_pow (x : ℝ≥0) (n : ℕ) : (↑(x ^ n) : ℝ≥0∞) = x ^ n := rfl #noalign ennreal.coe_bit0 #noalign ennreal.coe_bit1 -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] -- Porting note (#10756): new theorem theorem coe_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℝ≥0) : ℝ≥0∞) = OfNat.ofNat n := rfl -- Porting note (#11215): TODO: add lemmas about `OfNat.ofNat` and `<`/`≤` theorem coe_two : ((2 : ℝ≥0) : ℝ≥0∞) = 2 := rfl #align ennreal.coe_two ENNReal.coe_two theorem toNNReal_eq_toNNReal_iff (x y : ℝ≥0∞) : x.toNNReal = y.toNNReal ↔ x = y ∨ x = 0 ∧ y = ⊤ ∨ x = ⊤ ∧ y = 0 := WithTop.untop'_eq_untop'_iff #align ennreal.to_nnreal_eq_to_nnreal_iff ENNReal.toNNReal_eq_toNNReal_iff theorem toReal_eq_toReal_iff (x y : ℝ≥0∞) : x.toReal = y.toReal ↔ x = y ∨ x = 0 ∧ y = ⊤ ∨ x = ⊤ ∧ y = 0 := by simp only [ENNReal.toReal, NNReal.coe_inj, toNNReal_eq_toNNReal_iff] #align ennreal.to_real_eq_to_real_iff ENNReal.toReal_eq_toReal_iff theorem toNNReal_eq_toNNReal_iff' {x y : ℝ≥0∞} (hx : x ≠ ⊤) (hy : y ≠ ⊤) : x.toNNReal = y.toNNReal ↔ x = y := by simp only [ENNReal.toNNReal_eq_toNNReal_iff x y, hx, hy, and_false, false_and, or_false] #align ennreal.to_nnreal_eq_to_nnreal_iff' ENNReal.toNNReal_eq_toNNReal_iff'
Mathlib/Data/ENNReal/Basic.lean
448
450
theorem toReal_eq_toReal_iff' {x y : ℝ≥0∞} (hx : x ≠ ⊤) (hy : y ≠ ⊤) : x.toReal = y.toReal ↔ x = y := by
simp only [ENNReal.toReal, NNReal.coe_inj, toNNReal_eq_toNNReal_iff' hx hy]
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic import Mathlib.Analysis.Normed.Group.AddCircle import Mathlib.Algebra.CharZero.Quotient import Mathlib.Topology.Instances.Sign #align_import analysis.special_functions.trigonometric.angle from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec" open Real noncomputable section namespace Real -- Porting note: can't derive `NormedAddCommGroup, Inhabited` def Angle : Type := AddCircle (2 * π) #align real.angle Real.Angle namespace Angle -- Porting note (#10754): added due to missing instances due to no deriving instance : NormedAddCommGroup Angle := inferInstanceAs (NormedAddCommGroup (AddCircle (2 * π))) -- Porting note (#10754): added due to missing instances due to no deriving instance : Inhabited Angle := inferInstanceAs (Inhabited (AddCircle (2 * π))) -- Porting note (#10754): added due to missing instances due to no deriving -- also, without this, a plain `QuotientAddGroup.mk` -- causes coerced terms to be of type `ℝ ⧸ AddSubgroup.zmultiples (2 * π)` @[coe] protected def coe (r : ℝ) : Angle := QuotientAddGroup.mk r instance : Coe ℝ Angle := ⟨Angle.coe⟩ instance : CircularOrder Real.Angle := QuotientAddGroup.circularOrder (hp' := ⟨by norm_num [pi_pos]⟩) @[continuity] theorem continuous_coe : Continuous ((↑) : ℝ → Angle) := continuous_quotient_mk' #align real.angle.continuous_coe Real.Angle.continuous_coe def coeHom : ℝ →+ Angle := QuotientAddGroup.mk' _ #align real.angle.coe_hom Real.Angle.coeHom @[simp] theorem coe_coeHom : (coeHom : ℝ → Angle) = ((↑) : ℝ → Angle) := rfl #align real.angle.coe_coe_hom Real.Angle.coe_coeHom @[elab_as_elim] protected theorem induction_on {p : Angle → Prop} (θ : Angle) (h : ∀ x : ℝ, p x) : p θ := Quotient.inductionOn' θ h #align real.angle.induction_on Real.Angle.induction_on @[simp] theorem coe_zero : ↑(0 : ℝ) = (0 : Angle) := rfl #align real.angle.coe_zero Real.Angle.coe_zero @[simp] theorem coe_add (x y : ℝ) : ↑(x + y : ℝ) = (↑x + ↑y : Angle) := rfl #align real.angle.coe_add Real.Angle.coe_add @[simp] theorem coe_neg (x : ℝ) : ↑(-x : ℝ) = -(↑x : Angle) := rfl #align real.angle.coe_neg Real.Angle.coe_neg @[simp] theorem coe_sub (x y : ℝ) : ↑(x - y : ℝ) = (↑x - ↑y : Angle) := rfl #align real.angle.coe_sub Real.Angle.coe_sub theorem coe_nsmul (n : ℕ) (x : ℝ) : ↑(n • x : ℝ) = n • (↑x : Angle) := rfl #align real.angle.coe_nsmul Real.Angle.coe_nsmul theorem coe_zsmul (z : ℤ) (x : ℝ) : ↑(z • x : ℝ) = z • (↑x : Angle) := rfl #align real.angle.coe_zsmul Real.Angle.coe_zsmul @[simp, norm_cast] theorem natCast_mul_eq_nsmul (x : ℝ) (n : ℕ) : ↑((n : ℝ) * x) = n • (↑x : Angle) := by simpa only [nsmul_eq_mul] using coeHom.map_nsmul x n #align real.angle.coe_nat_mul_eq_nsmul Real.Angle.natCast_mul_eq_nsmul @[simp, norm_cast] theorem intCast_mul_eq_zsmul (x : ℝ) (n : ℤ) : ↑((n : ℝ) * x : ℝ) = n • (↑x : Angle) := by simpa only [zsmul_eq_mul] using coeHom.map_zsmul x n #align real.angle.coe_int_mul_eq_zsmul Real.Angle.intCast_mul_eq_zsmul @[deprecated (since := "2024-05-25")] alias coe_nat_mul_eq_nsmul := natCast_mul_eq_nsmul @[deprecated (since := "2024-05-25")] alias coe_int_mul_eq_zsmul := intCast_mul_eq_zsmul theorem angle_eq_iff_two_pi_dvd_sub {ψ θ : ℝ} : (θ : Angle) = ψ ↔ ∃ k : ℤ, θ - ψ = 2 * π * k := by simp only [QuotientAddGroup.eq, AddSubgroup.zmultiples_eq_closure, AddSubgroup.mem_closure_singleton, zsmul_eq_mul', (sub_eq_neg_add _ _).symm, eq_comm] -- Porting note: added `rw`, `simp [Angle.coe, QuotientAddGroup.eq]` doesn't fire otherwise rw [Angle.coe, Angle.coe, QuotientAddGroup.eq] simp only [AddSubgroup.zmultiples_eq_closure, AddSubgroup.mem_closure_singleton, zsmul_eq_mul', (sub_eq_neg_add _ _).symm, eq_comm] #align real.angle.angle_eq_iff_two_pi_dvd_sub Real.Angle.angle_eq_iff_two_pi_dvd_sub @[simp] theorem coe_two_pi : ↑(2 * π : ℝ) = (0 : Angle) := angle_eq_iff_two_pi_dvd_sub.2 ⟨1, by rw [sub_zero, Int.cast_one, mul_one]⟩ #align real.angle.coe_two_pi Real.Angle.coe_two_pi @[simp] theorem neg_coe_pi : -(π : Angle) = π := by rw [← coe_neg, angle_eq_iff_two_pi_dvd_sub] use -1 simp [two_mul, sub_eq_add_neg] #align real.angle.neg_coe_pi Real.Angle.neg_coe_pi @[simp] theorem two_nsmul_coe_div_two (θ : ℝ) : (2 : ℕ) • (↑(θ / 2) : Angle) = θ := by rw [← coe_nsmul, two_nsmul, add_halves] #align real.angle.two_nsmul_coe_div_two Real.Angle.two_nsmul_coe_div_two @[simp] theorem two_zsmul_coe_div_two (θ : ℝ) : (2 : ℤ) • (↑(θ / 2) : Angle) = θ := by rw [← coe_zsmul, two_zsmul, add_halves] #align real.angle.two_zsmul_coe_div_two Real.Angle.two_zsmul_coe_div_two -- Porting note (#10618): @[simp] can prove it theorem two_nsmul_neg_pi_div_two : (2 : ℕ) • (↑(-π / 2) : Angle) = π := by rw [two_nsmul_coe_div_two, coe_neg, neg_coe_pi] #align real.angle.two_nsmul_neg_pi_div_two Real.Angle.two_nsmul_neg_pi_div_two -- Porting note (#10618): @[simp] can prove it theorem two_zsmul_neg_pi_div_two : (2 : ℤ) • (↑(-π / 2) : Angle) = π := by rw [two_zsmul, ← two_nsmul, two_nsmul_neg_pi_div_two] #align real.angle.two_zsmul_neg_pi_div_two Real.Angle.two_zsmul_neg_pi_div_two theorem sub_coe_pi_eq_add_coe_pi (θ : Angle) : θ - π = θ + π := by rw [sub_eq_add_neg, neg_coe_pi] #align real.angle.sub_coe_pi_eq_add_coe_pi Real.Angle.sub_coe_pi_eq_add_coe_pi @[simp] theorem two_nsmul_coe_pi : (2 : ℕ) • (π : Angle) = 0 := by simp [← natCast_mul_eq_nsmul] #align real.angle.two_nsmul_coe_pi Real.Angle.two_nsmul_coe_pi @[simp] theorem two_zsmul_coe_pi : (2 : ℤ) • (π : Angle) = 0 := by simp [← intCast_mul_eq_zsmul] #align real.angle.two_zsmul_coe_pi Real.Angle.two_zsmul_coe_pi @[simp] theorem coe_pi_add_coe_pi : (π : Real.Angle) + π = 0 := by rw [← two_nsmul, two_nsmul_coe_pi] #align real.angle.coe_pi_add_coe_pi Real.Angle.coe_pi_add_coe_pi theorem zsmul_eq_iff {ψ θ : Angle} {z : ℤ} (hz : z ≠ 0) : z • ψ = z • θ ↔ ∃ k : Fin z.natAbs, ψ = θ + (k : ℕ) • (2 * π / z : ℝ) := QuotientAddGroup.zmultiples_zsmul_eq_zsmul_iff hz #align real.angle.zsmul_eq_iff Real.Angle.zsmul_eq_iff theorem nsmul_eq_iff {ψ θ : Angle} {n : ℕ} (hz : n ≠ 0) : n • ψ = n • θ ↔ ∃ k : Fin n, ψ = θ + (k : ℕ) • (2 * π / n : ℝ) := QuotientAddGroup.zmultiples_nsmul_eq_nsmul_iff hz #align real.angle.nsmul_eq_iff Real.Angle.nsmul_eq_iff theorem two_zsmul_eq_iff {ψ θ : Angle} : (2 : ℤ) • ψ = (2 : ℤ) • θ ↔ ψ = θ ∨ ψ = θ + ↑π := by -- Porting note: no `Int.natAbs_bit0` anymore have : Int.natAbs 2 = 2 := rfl rw [zsmul_eq_iff two_ne_zero, this, Fin.exists_fin_two, Fin.val_zero, Fin.val_one, zero_smul, add_zero, one_smul, Int.cast_two, mul_div_cancel_left₀ (_ : ℝ) two_ne_zero] #align real.angle.two_zsmul_eq_iff Real.Angle.two_zsmul_eq_iff theorem two_nsmul_eq_iff {ψ θ : Angle} : (2 : ℕ) • ψ = (2 : ℕ) • θ ↔ ψ = θ ∨ ψ = θ + ↑π := by simp_rw [← natCast_zsmul, Nat.cast_ofNat, two_zsmul_eq_iff] #align real.angle.two_nsmul_eq_iff Real.Angle.two_nsmul_eq_iff theorem two_nsmul_eq_zero_iff {θ : Angle} : (2 : ℕ) • θ = 0 ↔ θ = 0 ∨ θ = π := by convert two_nsmul_eq_iff <;> simp #align real.angle.two_nsmul_eq_zero_iff Real.Angle.two_nsmul_eq_zero_iff theorem two_nsmul_ne_zero_iff {θ : Angle} : (2 : ℕ) • θ ≠ 0 ↔ θ ≠ 0 ∧ θ ≠ π := by rw [← not_or, ← two_nsmul_eq_zero_iff] #align real.angle.two_nsmul_ne_zero_iff Real.Angle.two_nsmul_ne_zero_iff theorem two_zsmul_eq_zero_iff {θ : Angle} : (2 : ℤ) • θ = 0 ↔ θ = 0 ∨ θ = π := by simp_rw [two_zsmul, ← two_nsmul, two_nsmul_eq_zero_iff] #align real.angle.two_zsmul_eq_zero_iff Real.Angle.two_zsmul_eq_zero_iff theorem two_zsmul_ne_zero_iff {θ : Angle} : (2 : ℤ) • θ ≠ 0 ↔ θ ≠ 0 ∧ θ ≠ π := by rw [← not_or, ← two_zsmul_eq_zero_iff] #align real.angle.two_zsmul_ne_zero_iff Real.Angle.two_zsmul_ne_zero_iff theorem eq_neg_self_iff {θ : Angle} : θ = -θ ↔ θ = 0 ∨ θ = π := by rw [← add_eq_zero_iff_eq_neg, ← two_nsmul, two_nsmul_eq_zero_iff] #align real.angle.eq_neg_self_iff Real.Angle.eq_neg_self_iff theorem ne_neg_self_iff {θ : Angle} : θ ≠ -θ ↔ θ ≠ 0 ∧ θ ≠ π := by rw [← not_or, ← eq_neg_self_iff.not] #align real.angle.ne_neg_self_iff Real.Angle.ne_neg_self_iff theorem neg_eq_self_iff {θ : Angle} : -θ = θ ↔ θ = 0 ∨ θ = π := by rw [eq_comm, eq_neg_self_iff] #align real.angle.neg_eq_self_iff Real.Angle.neg_eq_self_iff theorem neg_ne_self_iff {θ : Angle} : -θ ≠ θ ↔ θ ≠ 0 ∧ θ ≠ π := by rw [← not_or, ← neg_eq_self_iff.not] #align real.angle.neg_ne_self_iff Real.Angle.neg_ne_self_iff theorem two_nsmul_eq_pi_iff {θ : Angle} : (2 : ℕ) • θ = π ↔ θ = (π / 2 : ℝ) ∨ θ = (-π / 2 : ℝ) := by have h : (π : Angle) = ((2 : ℕ) • (π / 2 : ℝ) :) := by rw [two_nsmul, add_halves] nth_rw 1 [h] rw [coe_nsmul, two_nsmul_eq_iff] -- Porting note: `congr` didn't simplify the goal of iff of `Or`s convert Iff.rfl rw [add_comm, ← coe_add, ← sub_eq_zero, ← coe_sub, neg_div, ← neg_sub, sub_neg_eq_add, add_assoc, add_halves, ← two_mul, coe_neg, coe_two_pi, neg_zero] #align real.angle.two_nsmul_eq_pi_iff Real.Angle.two_nsmul_eq_pi_iff theorem two_zsmul_eq_pi_iff {θ : Angle} : (2 : ℤ) • θ = π ↔ θ = (π / 2 : ℝ) ∨ θ = (-π / 2 : ℝ) := by rw [two_zsmul, ← two_nsmul, two_nsmul_eq_pi_iff] #align real.angle.two_zsmul_eq_pi_iff Real.Angle.two_zsmul_eq_pi_iff theorem cos_eq_iff_coe_eq_or_eq_neg {θ ψ : ℝ} : cos θ = cos ψ ↔ (θ : Angle) = ψ ∨ (θ : Angle) = -ψ := by constructor · intro Hcos rw [← sub_eq_zero, cos_sub_cos, mul_eq_zero, mul_eq_zero, neg_eq_zero, eq_false (two_ne_zero' ℝ), false_or_iff, sin_eq_zero_iff, sin_eq_zero_iff] at Hcos rcases Hcos with (⟨n, hn⟩ | ⟨n, hn⟩) · right rw [eq_div_iff_mul_eq (two_ne_zero' ℝ), ← sub_eq_iff_eq_add] at hn rw [← hn, coe_sub, eq_neg_iff_add_eq_zero, sub_add_cancel, mul_assoc, intCast_mul_eq_zsmul, mul_comm, coe_two_pi, zsmul_zero] · left rw [eq_div_iff_mul_eq (two_ne_zero' ℝ), eq_sub_iff_add_eq] at hn rw [← hn, coe_add, mul_assoc, intCast_mul_eq_zsmul, mul_comm, coe_two_pi, zsmul_zero, zero_add] · rw [angle_eq_iff_two_pi_dvd_sub, ← coe_neg, angle_eq_iff_two_pi_dvd_sub] rintro (⟨k, H⟩ | ⟨k, H⟩) · rw [← sub_eq_zero, cos_sub_cos, H, mul_assoc 2 π k, mul_div_cancel_left₀ _ (two_ne_zero' ℝ), mul_comm π _, sin_int_mul_pi, mul_zero] rw [← sub_eq_zero, cos_sub_cos, ← sub_neg_eq_add, H, mul_assoc 2 π k, mul_div_cancel_left₀ _ (two_ne_zero' ℝ), mul_comm π _, sin_int_mul_pi, mul_zero, zero_mul] #align real.angle.cos_eq_iff_coe_eq_or_eq_neg Real.Angle.cos_eq_iff_coe_eq_or_eq_neg theorem sin_eq_iff_coe_eq_or_add_eq_pi {θ ψ : ℝ} : sin θ = sin ψ ↔ (θ : Angle) = ψ ∨ (θ : Angle) + ψ = π := by constructor · intro Hsin rw [← cos_pi_div_two_sub, ← cos_pi_div_two_sub] at Hsin cases' cos_eq_iff_coe_eq_or_eq_neg.mp Hsin with h h · left rw [coe_sub, coe_sub] at h exact sub_right_inj.1 h right rw [coe_sub, coe_sub, eq_neg_iff_add_eq_zero, add_sub, sub_add_eq_add_sub, ← coe_add, add_halves, sub_sub, sub_eq_zero] at h exact h.symm · rw [angle_eq_iff_two_pi_dvd_sub, ← eq_sub_iff_add_eq, ← coe_sub, angle_eq_iff_two_pi_dvd_sub] rintro (⟨k, H⟩ | ⟨k, H⟩) · rw [← sub_eq_zero, sin_sub_sin, H, mul_assoc 2 π k, mul_div_cancel_left₀ _ (two_ne_zero' ℝ), mul_comm π _, sin_int_mul_pi, mul_zero, zero_mul] have H' : θ + ψ = 2 * k * π + π := by rwa [← sub_add, sub_add_eq_add_sub, sub_eq_iff_eq_add, mul_assoc, mul_comm π _, ← mul_assoc] at H rw [← sub_eq_zero, sin_sub_sin, H', add_div, mul_assoc 2 _ π, mul_div_cancel_left₀ _ (two_ne_zero' ℝ), cos_add_pi_div_two, sin_int_mul_pi, neg_zero, mul_zero] #align real.angle.sin_eq_iff_coe_eq_or_add_eq_pi Real.Angle.sin_eq_iff_coe_eq_or_add_eq_pi theorem cos_sin_inj {θ ψ : ℝ} (Hcos : cos θ = cos ψ) (Hsin : sin θ = sin ψ) : (θ : Angle) = ψ := by cases' cos_eq_iff_coe_eq_or_eq_neg.mp Hcos with hc hc; · exact hc cases' sin_eq_iff_coe_eq_or_add_eq_pi.mp Hsin with hs hs; · exact hs rw [eq_neg_iff_add_eq_zero, hs] at hc obtain ⟨n, hn⟩ : ∃ n, n • _ = _ := QuotientAddGroup.leftRel_apply.mp (Quotient.exact' hc) rw [← neg_one_mul, add_zero, ← sub_eq_zero, zsmul_eq_mul, ← mul_assoc, ← sub_mul, mul_eq_zero, eq_false (ne_of_gt pi_pos), or_false_iff, sub_neg_eq_add, ← Int.cast_zero, ← Int.cast_one, ← Int.cast_ofNat, ← Int.cast_mul, ← Int.cast_add, Int.cast_inj] at hn have : (n * 2 + 1) % (2 : ℤ) = 0 % (2 : ℤ) := congr_arg (· % (2 : ℤ)) hn rw [add_comm, Int.add_mul_emod_self] at this exact absurd this one_ne_zero #align real.angle.cos_sin_inj Real.Angle.cos_sin_inj def sin (θ : Angle) : ℝ := sin_periodic.lift θ #align real.angle.sin Real.Angle.sin @[simp] theorem sin_coe (x : ℝ) : sin (x : Angle) = Real.sin x := rfl #align real.angle.sin_coe Real.Angle.sin_coe @[continuity] theorem continuous_sin : Continuous sin := Real.continuous_sin.quotient_liftOn' _ #align real.angle.continuous_sin Real.Angle.continuous_sin def cos (θ : Angle) : ℝ := cos_periodic.lift θ #align real.angle.cos Real.Angle.cos @[simp] theorem cos_coe (x : ℝ) : cos (x : Angle) = Real.cos x := rfl #align real.angle.cos_coe Real.Angle.cos_coe @[continuity] theorem continuous_cos : Continuous cos := Real.continuous_cos.quotient_liftOn' _ #align real.angle.continuous_cos Real.Angle.continuous_cos theorem cos_eq_real_cos_iff_eq_or_eq_neg {θ : Angle} {ψ : ℝ} : cos θ = Real.cos ψ ↔ θ = ψ ∨ θ = -ψ := by induction θ using Real.Angle.induction_on exact cos_eq_iff_coe_eq_or_eq_neg #align real.angle.cos_eq_real_cos_iff_eq_or_eq_neg Real.Angle.cos_eq_real_cos_iff_eq_or_eq_neg theorem cos_eq_iff_eq_or_eq_neg {θ ψ : Angle} : cos θ = cos ψ ↔ θ = ψ ∨ θ = -ψ := by induction ψ using Real.Angle.induction_on exact cos_eq_real_cos_iff_eq_or_eq_neg #align real.angle.cos_eq_iff_eq_or_eq_neg Real.Angle.cos_eq_iff_eq_or_eq_neg theorem sin_eq_real_sin_iff_eq_or_add_eq_pi {θ : Angle} {ψ : ℝ} : sin θ = Real.sin ψ ↔ θ = ψ ∨ θ + ψ = π := by induction θ using Real.Angle.induction_on exact sin_eq_iff_coe_eq_or_add_eq_pi #align real.angle.sin_eq_real_sin_iff_eq_or_add_eq_pi Real.Angle.sin_eq_real_sin_iff_eq_or_add_eq_pi theorem sin_eq_iff_eq_or_add_eq_pi {θ ψ : Angle} : sin θ = sin ψ ↔ θ = ψ ∨ θ + ψ = π := by induction ψ using Real.Angle.induction_on exact sin_eq_real_sin_iff_eq_or_add_eq_pi #align real.angle.sin_eq_iff_eq_or_add_eq_pi Real.Angle.sin_eq_iff_eq_or_add_eq_pi @[simp] theorem sin_zero : sin (0 : Angle) = 0 := by rw [← coe_zero, sin_coe, Real.sin_zero] #align real.angle.sin_zero Real.Angle.sin_zero -- Porting note (#10618): @[simp] can prove it theorem sin_coe_pi : sin (π : Angle) = 0 := by rw [sin_coe, Real.sin_pi] #align real.angle.sin_coe_pi Real.Angle.sin_coe_pi theorem sin_eq_zero_iff {θ : Angle} : sin θ = 0 ↔ θ = 0 ∨ θ = π := by nth_rw 1 [← sin_zero] rw [sin_eq_iff_eq_or_add_eq_pi] simp #align real.angle.sin_eq_zero_iff Real.Angle.sin_eq_zero_iff theorem sin_ne_zero_iff {θ : Angle} : sin θ ≠ 0 ↔ θ ≠ 0 ∧ θ ≠ π := by rw [← not_or, ← sin_eq_zero_iff] #align real.angle.sin_ne_zero_iff Real.Angle.sin_ne_zero_iff @[simp] theorem sin_neg (θ : Angle) : sin (-θ) = -sin θ := by induction θ using Real.Angle.induction_on exact Real.sin_neg _ #align real.angle.sin_neg Real.Angle.sin_neg theorem sin_antiperiodic : Function.Antiperiodic sin (π : Angle) := by intro θ induction θ using Real.Angle.induction_on exact Real.sin_antiperiodic _ #align real.angle.sin_antiperiodic Real.Angle.sin_antiperiodic @[simp] theorem sin_add_pi (θ : Angle) : sin (θ + π) = -sin θ := sin_antiperiodic θ #align real.angle.sin_add_pi Real.Angle.sin_add_pi @[simp] theorem sin_sub_pi (θ : Angle) : sin (θ - π) = -sin θ := sin_antiperiodic.sub_eq θ #align real.angle.sin_sub_pi Real.Angle.sin_sub_pi @[simp] theorem cos_zero : cos (0 : Angle) = 1 := by rw [← coe_zero, cos_coe, Real.cos_zero] #align real.angle.cos_zero Real.Angle.cos_zero -- Porting note (#10618): @[simp] can prove it theorem cos_coe_pi : cos (π : Angle) = -1 := by rw [cos_coe, Real.cos_pi] #align real.angle.cos_coe_pi Real.Angle.cos_coe_pi @[simp] theorem cos_neg (θ : Angle) : cos (-θ) = cos θ := by induction θ using Real.Angle.induction_on exact Real.cos_neg _ #align real.angle.cos_neg Real.Angle.cos_neg theorem cos_antiperiodic : Function.Antiperiodic cos (π : Angle) := by intro θ induction θ using Real.Angle.induction_on exact Real.cos_antiperiodic _ #align real.angle.cos_antiperiodic Real.Angle.cos_antiperiodic @[simp] theorem cos_add_pi (θ : Angle) : cos (θ + π) = -cos θ := cos_antiperiodic θ #align real.angle.cos_add_pi Real.Angle.cos_add_pi @[simp] theorem cos_sub_pi (θ : Angle) : cos (θ - π) = -cos θ := cos_antiperiodic.sub_eq θ #align real.angle.cos_sub_pi Real.Angle.cos_sub_pi theorem cos_eq_zero_iff {θ : Angle} : cos θ = 0 ↔ θ = (π / 2 : ℝ) ∨ θ = (-π / 2 : ℝ) := by rw [← cos_pi_div_two, ← cos_coe, cos_eq_iff_eq_or_eq_neg, ← coe_neg, ← neg_div] #align real.angle.cos_eq_zero_iff Real.Angle.cos_eq_zero_iff theorem sin_add (θ₁ θ₂ : Real.Angle) : sin (θ₁ + θ₂) = sin θ₁ * cos θ₂ + cos θ₁ * sin θ₂ := by induction θ₁ using Real.Angle.induction_on induction θ₂ using Real.Angle.induction_on exact Real.sin_add _ _ #align real.angle.sin_add Real.Angle.sin_add theorem cos_add (θ₁ θ₂ : Real.Angle) : cos (θ₁ + θ₂) = cos θ₁ * cos θ₂ - sin θ₁ * sin θ₂ := by induction θ₂ using Real.Angle.induction_on induction θ₁ using Real.Angle.induction_on exact Real.cos_add _ _ #align real.angle.cos_add Real.Angle.cos_add @[simp] theorem cos_sq_add_sin_sq (θ : Real.Angle) : cos θ ^ 2 + sin θ ^ 2 = 1 := by induction θ using Real.Angle.induction_on exact Real.cos_sq_add_sin_sq _ #align real.angle.cos_sq_add_sin_sq Real.Angle.cos_sq_add_sin_sq theorem sin_add_pi_div_two (θ : Angle) : sin (θ + ↑(π / 2)) = cos θ := by induction θ using Real.Angle.induction_on exact Real.sin_add_pi_div_two _ #align real.angle.sin_add_pi_div_two Real.Angle.sin_add_pi_div_two theorem sin_sub_pi_div_two (θ : Angle) : sin (θ - ↑(π / 2)) = -cos θ := by induction θ using Real.Angle.induction_on exact Real.sin_sub_pi_div_two _ #align real.angle.sin_sub_pi_div_two Real.Angle.sin_sub_pi_div_two theorem sin_pi_div_two_sub (θ : Angle) : sin (↑(π / 2) - θ) = cos θ := by induction θ using Real.Angle.induction_on exact Real.sin_pi_div_two_sub _ #align real.angle.sin_pi_div_two_sub Real.Angle.sin_pi_div_two_sub theorem cos_add_pi_div_two (θ : Angle) : cos (θ + ↑(π / 2)) = -sin θ := by induction θ using Real.Angle.induction_on exact Real.cos_add_pi_div_two _ #align real.angle.cos_add_pi_div_two Real.Angle.cos_add_pi_div_two theorem cos_sub_pi_div_two (θ : Angle) : cos (θ - ↑(π / 2)) = sin θ := by induction θ using Real.Angle.induction_on exact Real.cos_sub_pi_div_two _ #align real.angle.cos_sub_pi_div_two Real.Angle.cos_sub_pi_div_two theorem cos_pi_div_two_sub (θ : Angle) : cos (↑(π / 2) - θ) = sin θ := by induction θ using Real.Angle.induction_on exact Real.cos_pi_div_two_sub _ #align real.angle.cos_pi_div_two_sub Real.Angle.cos_pi_div_two_sub theorem abs_sin_eq_of_two_nsmul_eq {θ ψ : Angle} (h : (2 : ℕ) • θ = (2 : ℕ) • ψ) : |sin θ| = |sin ψ| := by rw [two_nsmul_eq_iff] at h rcases h with (rfl | rfl) · rfl · rw [sin_add_pi, abs_neg] #align real.angle.abs_sin_eq_of_two_nsmul_eq Real.Angle.abs_sin_eq_of_two_nsmul_eq theorem abs_sin_eq_of_two_zsmul_eq {θ ψ : Angle} (h : (2 : ℤ) • θ = (2 : ℤ) • ψ) : |sin θ| = |sin ψ| := by simp_rw [two_zsmul, ← two_nsmul] at h exact abs_sin_eq_of_two_nsmul_eq h #align real.angle.abs_sin_eq_of_two_zsmul_eq Real.Angle.abs_sin_eq_of_two_zsmul_eq theorem abs_cos_eq_of_two_nsmul_eq {θ ψ : Angle} (h : (2 : ℕ) • θ = (2 : ℕ) • ψ) : |cos θ| = |cos ψ| := by rw [two_nsmul_eq_iff] at h rcases h with (rfl | rfl) · rfl · rw [cos_add_pi, abs_neg] #align real.angle.abs_cos_eq_of_two_nsmul_eq Real.Angle.abs_cos_eq_of_two_nsmul_eq theorem abs_cos_eq_of_two_zsmul_eq {θ ψ : Angle} (h : (2 : ℤ) • θ = (2 : ℤ) • ψ) : |cos θ| = |cos ψ| := by simp_rw [two_zsmul, ← two_nsmul] at h exact abs_cos_eq_of_two_nsmul_eq h #align real.angle.abs_cos_eq_of_two_zsmul_eq Real.Angle.abs_cos_eq_of_two_zsmul_eq @[simp] theorem coe_toIcoMod (θ ψ : ℝ) : ↑(toIcoMod two_pi_pos ψ θ) = (θ : Angle) := by rw [angle_eq_iff_two_pi_dvd_sub] refine ⟨-toIcoDiv two_pi_pos ψ θ, ?_⟩ rw [toIcoMod_sub_self, zsmul_eq_mul, mul_comm] #align real.angle.coe_to_Ico_mod Real.Angle.coe_toIcoMod @[simp] theorem coe_toIocMod (θ ψ : ℝ) : ↑(toIocMod two_pi_pos ψ θ) = (θ : Angle) := by rw [angle_eq_iff_two_pi_dvd_sub] refine ⟨-toIocDiv two_pi_pos ψ θ, ?_⟩ rw [toIocMod_sub_self, zsmul_eq_mul, mul_comm] #align real.angle.coe_to_Ioc_mod Real.Angle.coe_toIocMod def toReal (θ : Angle) : ℝ := (toIocMod_periodic two_pi_pos (-π)).lift θ #align real.angle.to_real Real.Angle.toReal theorem toReal_coe (θ : ℝ) : (θ : Angle).toReal = toIocMod two_pi_pos (-π) θ := rfl #align real.angle.to_real_coe Real.Angle.toReal_coe theorem toReal_coe_eq_self_iff {θ : ℝ} : (θ : Angle).toReal = θ ↔ -π < θ ∧ θ ≤ π := by rw [toReal_coe, toIocMod_eq_self two_pi_pos] ring_nf rfl #align real.angle.to_real_coe_eq_self_iff Real.Angle.toReal_coe_eq_self_iff theorem toReal_coe_eq_self_iff_mem_Ioc {θ : ℝ} : (θ : Angle).toReal = θ ↔ θ ∈ Set.Ioc (-π) π := by rw [toReal_coe_eq_self_iff, ← Set.mem_Ioc] #align real.angle.to_real_coe_eq_self_iff_mem_Ioc Real.Angle.toReal_coe_eq_self_iff_mem_Ioc theorem toReal_injective : Function.Injective toReal := by intro θ ψ h induction θ using Real.Angle.induction_on induction ψ using Real.Angle.induction_on simpa [toReal_coe, toIocMod_eq_toIocMod, zsmul_eq_mul, mul_comm _ (2 * π), ← angle_eq_iff_two_pi_dvd_sub, eq_comm] using h #align real.angle.to_real_injective Real.Angle.toReal_injective @[simp] theorem toReal_inj {θ ψ : Angle} : θ.toReal = ψ.toReal ↔ θ = ψ := toReal_injective.eq_iff #align real.angle.to_real_inj Real.Angle.toReal_inj @[simp] theorem coe_toReal (θ : Angle) : (θ.toReal : Angle) = θ := by induction θ using Real.Angle.induction_on exact coe_toIocMod _ _ #align real.angle.coe_to_real Real.Angle.coe_toReal theorem neg_pi_lt_toReal (θ : Angle) : -π < θ.toReal := by induction θ using Real.Angle.induction_on exact left_lt_toIocMod _ _ _ #align real.angle.neg_pi_lt_to_real Real.Angle.neg_pi_lt_toReal theorem toReal_le_pi (θ : Angle) : θ.toReal ≤ π := by induction θ using Real.Angle.induction_on convert toIocMod_le_right two_pi_pos _ _ ring #align real.angle.to_real_le_pi Real.Angle.toReal_le_pi theorem abs_toReal_le_pi (θ : Angle) : |θ.toReal| ≤ π := abs_le.2 ⟨(neg_pi_lt_toReal _).le, toReal_le_pi _⟩ #align real.angle.abs_to_real_le_pi Real.Angle.abs_toReal_le_pi theorem toReal_mem_Ioc (θ : Angle) : θ.toReal ∈ Set.Ioc (-π) π := ⟨neg_pi_lt_toReal _, toReal_le_pi _⟩ #align real.angle.to_real_mem_Ioc Real.Angle.toReal_mem_Ioc @[simp] theorem toIocMod_toReal (θ : Angle) : toIocMod two_pi_pos (-π) θ.toReal = θ.toReal := by induction θ using Real.Angle.induction_on rw [toReal_coe] exact toIocMod_toIocMod _ _ _ _ #align real.angle.to_Ioc_mod_to_real Real.Angle.toIocMod_toReal @[simp] theorem toReal_zero : (0 : Angle).toReal = 0 := by rw [← coe_zero, toReal_coe_eq_self_iff] exact ⟨Left.neg_neg_iff.2 Real.pi_pos, Real.pi_pos.le⟩ #align real.angle.to_real_zero Real.Angle.toReal_zero @[simp] theorem toReal_eq_zero_iff {θ : Angle} : θ.toReal = 0 ↔ θ = 0 := by nth_rw 1 [← toReal_zero] exact toReal_inj #align real.angle.to_real_eq_zero_iff Real.Angle.toReal_eq_zero_iff @[simp]
Mathlib/Analysis/SpecialFunctions/Trigonometric/Angle.lean
598
600
theorem toReal_pi : (π : Angle).toReal = π := by
rw [toReal_coe_eq_self_iff] exact ⟨Left.neg_lt_self Real.pi_pos, le_refl _⟩
import Mathlib.Data.Set.Basic open Function universe u v namespace Set section Nontrivial variable {α : Type u} {a : α} {s t : Set α} protected def Nontrivial (s : Set α) : Prop := ∃ x ∈ s, ∃ y ∈ s, x ≠ y #align set.nontrivial Set.Nontrivial theorem nontrivial_of_mem_mem_ne {x y} (hx : x ∈ s) (hy : y ∈ s) (hxy : x ≠ y) : s.Nontrivial := ⟨x, hx, y, hy, hxy⟩ #align set.nontrivial_of_mem_mem_ne Set.nontrivial_of_mem_mem_ne -- Porting note: following the pattern for `Exists`, we have renamed `some` to `choose`. protected noncomputable def Nontrivial.choose (hs : s.Nontrivial) : α × α := (Exists.choose hs, hs.choose_spec.right.choose) #align set.nontrivial.some Set.Nontrivial.choose protected theorem Nontrivial.choose_fst_mem (hs : s.Nontrivial) : hs.choose.fst ∈ s := hs.choose_spec.left #align set.nontrivial.some_fst_mem Set.Nontrivial.choose_fst_mem protected theorem Nontrivial.choose_snd_mem (hs : s.Nontrivial) : hs.choose.snd ∈ s := hs.choose_spec.right.choose_spec.left #align set.nontrivial.some_snd_mem Set.Nontrivial.choose_snd_mem protected theorem Nontrivial.choose_fst_ne_choose_snd (hs : s.Nontrivial) : hs.choose.fst ≠ hs.choose.snd := hs.choose_spec.right.choose_spec.right #align set.nontrivial.some_fst_ne_some_snd Set.Nontrivial.choose_fst_ne_choose_snd theorem Nontrivial.mono (hs : s.Nontrivial) (hst : s ⊆ t) : t.Nontrivial := let ⟨x, hx, y, hy, hxy⟩ := hs ⟨x, hst hx, y, hst hy, hxy⟩ #align set.nontrivial.mono Set.Nontrivial.mono theorem nontrivial_pair {x y} (hxy : x ≠ y) : ({x, y} : Set α).Nontrivial := ⟨x, mem_insert _ _, y, mem_insert_of_mem _ (mem_singleton _), hxy⟩ #align set.nontrivial_pair Set.nontrivial_pair theorem nontrivial_of_pair_subset {x y} (hxy : x ≠ y) (h : {x, y} ⊆ s) : s.Nontrivial := (nontrivial_pair hxy).mono h #align set.nontrivial_of_pair_subset Set.nontrivial_of_pair_subset theorem Nontrivial.pair_subset (hs : s.Nontrivial) : ∃ x y, x ≠ y ∧ {x, y} ⊆ s := let ⟨x, hx, y, hy, hxy⟩ := hs ⟨x, y, hxy, insert_subset hx <| singleton_subset_iff.2 hy⟩ #align set.nontrivial.pair_subset Set.Nontrivial.pair_subset theorem nontrivial_iff_pair_subset : s.Nontrivial ↔ ∃ x y, x ≠ y ∧ {x, y} ⊆ s := ⟨Nontrivial.pair_subset, fun H => let ⟨_, _, hxy, h⟩ := H nontrivial_of_pair_subset hxy h⟩ #align set.nontrivial_iff_pair_subset Set.nontrivial_iff_pair_subset theorem nontrivial_of_exists_ne {x} (hx : x ∈ s) (h : ∃ y ∈ s, y ≠ x) : s.Nontrivial := let ⟨y, hy, hyx⟩ := h ⟨y, hy, x, hx, hyx⟩ #align set.nontrivial_of_exists_ne Set.nontrivial_of_exists_ne theorem Nontrivial.exists_ne (hs : s.Nontrivial) (z) : ∃ x ∈ s, x ≠ z := by by_contra! H rcases hs with ⟨x, hx, y, hy, hxy⟩ rw [H x hx, H y hy] at hxy exact hxy rfl #align set.nontrivial.exists_ne Set.Nontrivial.exists_ne theorem nontrivial_iff_exists_ne {x} (hx : x ∈ s) : s.Nontrivial ↔ ∃ y ∈ s, y ≠ x := ⟨fun H => H.exists_ne _, nontrivial_of_exists_ne hx⟩ #align set.nontrivial_iff_exists_ne Set.nontrivial_iff_exists_ne theorem nontrivial_of_lt [Preorder α] {x y} (hx : x ∈ s) (hy : y ∈ s) (hxy : x < y) : s.Nontrivial := ⟨x, hx, y, hy, ne_of_lt hxy⟩ #align set.nontrivial_of_lt Set.nontrivial_of_lt theorem nontrivial_of_exists_lt [Preorder α] (H : ∃ᵉ (x ∈ s) (y ∈ s), x < y) : s.Nontrivial := let ⟨_, hx, _, hy, hxy⟩ := H nontrivial_of_lt hx hy hxy #align set.nontrivial_of_exists_lt Set.nontrivial_of_exists_lt theorem Nontrivial.exists_lt [LinearOrder α] (hs : s.Nontrivial) : ∃ᵉ (x ∈ s) (y ∈ s), x < y := let ⟨x, hx, y, hy, hxy⟩ := hs Or.elim (lt_or_gt_of_ne hxy) (fun H => ⟨x, hx, y, hy, H⟩) fun H => ⟨y, hy, x, hx, H⟩ #align set.nontrivial.exists_lt Set.Nontrivial.exists_lt theorem nontrivial_iff_exists_lt [LinearOrder α] : s.Nontrivial ↔ ∃ᵉ (x ∈ s) (y ∈ s), x < y := ⟨Nontrivial.exists_lt, nontrivial_of_exists_lt⟩ #align set.nontrivial_iff_exists_lt Set.nontrivial_iff_exists_lt protected theorem Nontrivial.nonempty (hs : s.Nontrivial) : s.Nonempty := let ⟨x, hx, _⟩ := hs ⟨x, hx⟩ #align set.nontrivial.nonempty Set.Nontrivial.nonempty protected theorem Nontrivial.ne_empty (hs : s.Nontrivial) : s ≠ ∅ := hs.nonempty.ne_empty #align set.nontrivial.ne_empty Set.Nontrivial.ne_empty theorem Nontrivial.not_subset_empty (hs : s.Nontrivial) : ¬s ⊆ ∅ := hs.nonempty.not_subset_empty #align set.nontrivial.not_subset_empty Set.Nontrivial.not_subset_empty @[simp] theorem not_nontrivial_empty : ¬(∅ : Set α).Nontrivial := fun h => h.ne_empty rfl #align set.not_nontrivial_empty Set.not_nontrivial_empty @[simp] theorem not_nontrivial_singleton {x} : ¬({x} : Set α).Nontrivial := fun H => by rw [nontrivial_iff_exists_ne (mem_singleton x)] at H let ⟨y, hy, hya⟩ := H exact hya (mem_singleton_iff.1 hy) #align set.not_nontrivial_singleton Set.not_nontrivial_singleton theorem Nontrivial.ne_singleton {x} (hs : s.Nontrivial) : s ≠ {x} := fun H => by rw [H] at hs exact not_nontrivial_singleton hs #align set.nontrivial.ne_singleton Set.Nontrivial.ne_singleton theorem Nontrivial.not_subset_singleton {x} (hs : s.Nontrivial) : ¬s ⊆ {x} := (not_congr subset_singleton_iff_eq).2 (not_or_of_not hs.ne_empty hs.ne_singleton) #align set.nontrivial.not_subset_singleton Set.Nontrivial.not_subset_singleton theorem nontrivial_univ [Nontrivial α] : (univ : Set α).Nontrivial := let ⟨x, y, hxy⟩ := exists_pair_ne α ⟨x, mem_univ _, y, mem_univ _, hxy⟩ #align set.nontrivial_univ Set.nontrivial_univ theorem nontrivial_of_univ_nontrivial (h : (univ : Set α).Nontrivial) : Nontrivial α := let ⟨x, _, y, _, hxy⟩ := h ⟨⟨x, y, hxy⟩⟩ #align set.nontrivial_of_univ_nontrivial Set.nontrivial_of_univ_nontrivial @[simp] theorem nontrivial_univ_iff : (univ : Set α).Nontrivial ↔ Nontrivial α := ⟨nontrivial_of_univ_nontrivial, fun h => @nontrivial_univ _ h⟩ #align set.nontrivial_univ_iff Set.nontrivial_univ_iff theorem nontrivial_of_nontrivial (hs : s.Nontrivial) : Nontrivial α := let ⟨x, _, y, _, hxy⟩ := hs ⟨⟨x, y, hxy⟩⟩ #align set.nontrivial_of_nontrivial Set.nontrivial_of_nontrivial -- Porting note: simp_rw broken here -- Perhaps review after https://github.com/leanprover/lean4/issues/1937? @[simp, norm_cast]
Mathlib/Data/Set/Subsingleton.lean
283
291
theorem nontrivial_coe_sort {s : Set α} : Nontrivial s ↔ s.Nontrivial := by
-- simp_rw [← nontrivial_univ_iff, Set.Nontrivial, mem_univ, exists_true_left, SetCoe.exists, -- Subtype.mk_eq_mk] rw [← nontrivial_univ_iff, Set.Nontrivial, Set.Nontrivial] apply Iff.intro · rintro ⟨x, _, y, _, hxy⟩ exact ⟨x, Subtype.prop x, y, Subtype.prop y, fun h => hxy (Subtype.coe_injective h)⟩ · rintro ⟨x, hx, y, hy, hxy⟩ exact ⟨⟨x, hx⟩, mem_univ _, ⟨y, hy⟩, mem_univ _, Subtype.mk_eq_mk.not.mpr hxy⟩
import Mathlib.Algebra.Polynomial.FieldDivision import Mathlib.FieldTheory.Minpoly.Basic import Mathlib.RingTheory.Algebraic #align_import field_theory.minpoly.field from "leanprover-community/mathlib"@"cbdf7b565832144d024caa5a550117c6df0204a5" open scoped Classical open Polynomial Set Function minpoly namespace minpoly variable {A B : Type*} variable (A) [Field A] section Ring variable [Ring B] [Algebra A B] (x : B) theorem degree_le_of_ne_zero {p : A[X]} (pnz : p ≠ 0) (hp : Polynomial.aeval x p = 0) : degree (minpoly A x) ≤ degree p := calc degree (minpoly A x) ≤ degree (p * C (leadingCoeff p)⁻¹) := min A x (monic_mul_leadingCoeff_inv pnz) (by simp [hp]) _ = degree p := degree_mul_leadingCoeff_inv p pnz #align minpoly.degree_le_of_ne_zero minpoly.degree_le_of_ne_zero theorem ne_zero_of_finite (e : B) [FiniteDimensional A B] : minpoly A e ≠ 0 := minpoly.ne_zero <| .of_finite A _ #align minpoly.ne_zero_of_finite_field_extension minpoly.ne_zero_of_finite theorem unique {p : A[X]} (pmonic : p.Monic) (hp : Polynomial.aeval x p = 0) (pmin : ∀ q : A[X], q.Monic → Polynomial.aeval x q = 0 → degree p ≤ degree q) : p = minpoly A x := by have hx : IsIntegral A x := ⟨p, pmonic, hp⟩ symm; apply eq_of_sub_eq_zero by_contra hnz apply degree_le_of_ne_zero A x hnz (by simp [hp]) |>.not_lt apply degree_sub_lt _ (minpoly.ne_zero hx) · rw [(monic hx).leadingCoeff, pmonic.leadingCoeff] · exact le_antisymm (min A x pmonic hp) (pmin (minpoly A x) (monic hx) (aeval A x)) #align minpoly.unique minpoly.unique theorem dvd {p : A[X]} (hp : Polynomial.aeval x p = 0) : minpoly A x ∣ p := by by_cases hp0 : p = 0 · simp only [hp0, dvd_zero] have hx : IsIntegral A x := IsAlgebraic.isIntegral ⟨p, hp0, hp⟩ rw [← modByMonic_eq_zero_iff_dvd (monic hx)] by_contra hnz apply degree_le_of_ne_zero A x hnz ((aeval_modByMonic_eq_self_of_root (monic hx) (aeval _ _)).trans hp) |>.not_lt exact degree_modByMonic_lt _ (monic hx) #align minpoly.dvd minpoly.dvd variable {A x} in lemma dvd_iff {p : A[X]} : minpoly A x ∣ p ↔ Polynomial.aeval x p = 0 := ⟨fun ⟨q, hq⟩ ↦ by rw [hq, map_mul, aeval, zero_mul], minpoly.dvd A x⟩ theorem isRadical [IsReduced B] : IsRadical (minpoly A x) := fun n p dvd ↦ by rw [dvd_iff] at dvd ⊢; rw [map_pow] at dvd; exact IsReduced.eq_zero _ ⟨n, dvd⟩
Mathlib/FieldTheory/Minpoly/Field.lean
86
90
theorem dvd_map_of_isScalarTower (A K : Type*) {R : Type*} [CommRing A] [Field K] [CommRing R] [Algebra A K] [Algebra A R] [Algebra K R] [IsScalarTower A K R] (x : R) : minpoly K x ∣ (minpoly A x).map (algebraMap A K) := by
refine minpoly.dvd K x ?_ rw [aeval_map_algebraMap, minpoly.aeval]
import Mathlib.Data.Nat.Choose.Basic import Mathlib.Data.List.Perm import Mathlib.Data.List.Range #align_import data.list.sublists from "leanprover-community/mathlib"@"ccad6d5093bd2f5c6ca621fc74674cce51355af6" universe u v w variable {α : Type u} {β : Type v} {γ : Type w} open Nat namespace List @[simp] theorem sublists'_nil : sublists' (@nil α) = [[]] := rfl #align list.sublists'_nil List.sublists'_nil @[simp] theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] := rfl #align list.sublists'_singleton List.sublists'_singleton #noalign list.map_sublists'_aux #noalign list.sublists'_aux_append #noalign list.sublists'_aux_eq_sublists' -- Porting note: Not the same as `sublists'_aux` from Lean3 def sublists'Aux (a : α) (r₁ r₂ : List (List α)) : List (List α) := r₁.foldl (init := r₂) fun r l => r ++ [a :: l] #align list.sublists'_aux List.sublists'Aux theorem sublists'Aux_eq_array_foldl (a : α) : ∀ (r₁ r₂ : List (List α)), sublists'Aux a r₁ r₂ = ((r₁.toArray).foldl (init := r₂.toArray) (fun r l => r.push (a :: l))).toList := by intro r₁ r₂ rw [sublists'Aux, Array.foldl_eq_foldl_data] have := List.foldl_hom Array.toList (fun r l => r.push (a :: l)) (fun r l => r ++ [a :: l]) r₁ r₂.toArray (by simp) simpa using this theorem sublists'_eq_sublists'Aux (l : List α) : sublists' l = l.foldr (fun a r => sublists'Aux a r r) [[]] := by simp only [sublists', sublists'Aux_eq_array_foldl] rw [← List.foldr_hom Array.toList] · rfl · intros _ _; congr <;> simp theorem sublists'Aux_eq_map (a : α) (r₁ : List (List α)) : ∀ (r₂ : List (List α)), sublists'Aux a r₁ r₂ = r₂ ++ map (cons a) r₁ := List.reverseRecOn r₁ (fun _ => by simp [sublists'Aux]) fun r₁ l ih r₂ => by rw [map_append, map_singleton, ← append_assoc, ← ih, sublists'Aux, foldl_append, foldl] simp [sublists'Aux] -- Porting note: simp can prove `sublists'_singleton` @[simp 900] theorem sublists'_cons (a : α) (l : List α) : sublists' (a :: l) = sublists' l ++ map (cons a) (sublists' l) := by simp [sublists'_eq_sublists'Aux, foldr_cons, sublists'Aux_eq_map] #align list.sublists'_cons List.sublists'_cons @[simp] theorem mem_sublists' {s t : List α} : s ∈ sublists' t ↔ s <+ t := by induction' t with a t IH generalizing s · simp only [sublists'_nil, mem_singleton] exact ⟨fun h => by rw [h], eq_nil_of_sublist_nil⟩ simp only [sublists'_cons, mem_append, IH, mem_map] constructor <;> intro h · rcases h with (h | ⟨s, h, rfl⟩) · exact sublist_cons_of_sublist _ h · exact h.cons_cons _ · cases' h with _ _ _ h s _ _ h · exact Or.inl h · exact Or.inr ⟨s, h, rfl⟩ #align list.mem_sublists' List.mem_sublists' @[simp] theorem length_sublists' : ∀ l : List α, length (sublists' l) = 2 ^ length l | [] => rfl | a :: l => by simp_arith only [sublists'_cons, length_append, length_sublists' l, length_map, length, Nat.pow_succ'] #align list.length_sublists' List.length_sublists' @[simp] theorem sublists_nil : sublists (@nil α) = [[]] := rfl #align list.sublists_nil List.sublists_nil @[simp] theorem sublists_singleton (a : α) : sublists [a] = [[], [a]] := rfl #align list.sublists_singleton List.sublists_singleton -- Porting note: Not the same as `sublists_aux` from Lean3 def sublistsAux (a : α) (r : List (List α)) : List (List α) := r.foldl (init := []) fun r l => r ++ [l, a :: l] #align list.sublists_aux List.sublistsAux theorem sublistsAux_eq_array_foldl : sublistsAux = fun (a : α) (r : List (List α)) => (r.toArray.foldl (init := #[]) fun r l => (r.push l).push (a :: l)).toList := by funext a r simp only [sublistsAux, Array.foldl_eq_foldl_data, Array.mkEmpty] have := foldl_hom Array.toList (fun r l => (r.push l).push (a :: l)) (fun (r : List (List α)) l => r ++ [l, a :: l]) r #[] (by simp) simpa using this theorem sublistsAux_eq_bind : sublistsAux = fun (a : α) (r : List (List α)) => r.bind fun l => [l, a :: l] := funext fun a => funext fun r => List.reverseRecOn r (by simp [sublistsAux]) (fun r l ih => by rw [append_bind, ← ih, bind_singleton, sublistsAux, foldl_append] simp [sublistsAux]) @[csimp] theorem sublists_eq_sublistsFast : @sublists = @sublistsFast := by ext α l : 2 trans l.foldr sublistsAux [[]] · rw [sublistsAux_eq_bind, sublists] · simp only [sublistsFast, sublistsAux_eq_array_foldl, Array.foldr_eq_foldr_data] rw [← foldr_hom Array.toList] · rfl · intros _ _; congr <;> simp #noalign list.sublists_aux₁_eq_sublists_aux #noalign list.sublists_aux_cons_eq_sublists_aux₁ #noalign list.sublists_aux_eq_foldr.aux #noalign list.sublists_aux_eq_foldr #noalign list.sublists_aux_cons_cons #noalign list.sublists_aux₁_append #noalign list.sublists_aux₁_concat #noalign list.sublists_aux₁_bind #noalign list.sublists_aux_cons_append theorem sublists_append (l₁ l₂ : List α) : sublists (l₁ ++ l₂) = (sublists l₂) >>= (fun x => (sublists l₁).map (· ++ x)) := by simp only [sublists, foldr_append] induction l₁ with | nil => simp | cons a l₁ ih => rw [foldr_cons, ih] simp [List.bind, join_join, Function.comp] #align list.sublists_append List.sublists_append -- Porting note (#10756): new theorem theorem sublists_cons (a : α) (l : List α) : sublists (a :: l) = sublists l >>= (fun x => [x, a :: x]) := show sublists ([a] ++ l) = _ by rw [sublists_append] simp only [sublists_singleton, map_cons, bind_eq_bind, nil_append, cons_append, map_nil] @[simp] theorem sublists_concat (l : List α) (a : α) : sublists (l ++ [a]) = sublists l ++ map (fun x => x ++ [a]) (sublists l) := by rw [sublists_append, sublists_singleton, bind_eq_bind, cons_bind, cons_bind, nil_bind, map_id'' append_nil, append_nil] #align list.sublists_concat List.sublists_concat theorem sublists_reverse (l : List α) : sublists (reverse l) = map reverse (sublists' l) := by induction' l with hd tl ih <;> [rfl; simp only [reverse_cons, sublists_append, sublists'_cons, map_append, ih, sublists_singleton, map_eq_map, bind_eq_bind, map_map, cons_bind, append_nil, nil_bind, (· ∘ ·)]] #align list.sublists_reverse List.sublists_reverse theorem sublists_eq_sublists' (l : List α) : sublists l = map reverse (sublists' (reverse l)) := by rw [← sublists_reverse, reverse_reverse] #align list.sublists_eq_sublists' List.sublists_eq_sublists' theorem sublists'_reverse (l : List α) : sublists' (reverse l) = map reverse (sublists l) := by simp only [sublists_eq_sublists', map_map, map_id'' reverse_reverse, Function.comp] #align list.sublists'_reverse List.sublists'_reverse theorem sublists'_eq_sublists (l : List α) : sublists' l = map reverse (sublists (reverse l)) := by rw [← sublists'_reverse, reverse_reverse] #align list.sublists'_eq_sublists List.sublists'_eq_sublists #noalign list.sublists_aux_ne_nil @[simp] theorem mem_sublists {s t : List α} : s ∈ sublists t ↔ s <+ t := by rw [← reverse_sublist, ← mem_sublists', sublists'_reverse, mem_map_of_injective reverse_injective] #align list.mem_sublists List.mem_sublists @[simp] theorem length_sublists (l : List α) : length (sublists l) = 2 ^ length l := by simp only [sublists_eq_sublists', length_map, length_sublists', length_reverse] #align list.length_sublists List.length_sublists theorem map_pure_sublist_sublists (l : List α) : map pure l <+ sublists l := by induction' l using reverseRecOn with l a ih <;> simp only [map, map_append, sublists_concat] · simp only [sublists_nil, sublist_cons] exact ((append_sublist_append_left _).2 <| singleton_sublist.2 <| mem_map.2 ⟨[], mem_sublists.2 (nil_sublist _), by rfl⟩).trans ((append_sublist_append_right _).2 ih) #align list.map_ret_sublist_sublists List.map_pure_sublist_sublists set_option linter.deprecated false in @[deprecated map_pure_sublist_sublists (since := "2024-03-24")] theorem map_ret_sublist_sublists (l : List α) : map List.ret l <+ sublists l := map_pure_sublist_sublists l def sublistsLenAux : ℕ → List α → (List α → β) → List β → List β | 0, _, f, r => f [] :: r | _ + 1, [], _, r => r | n + 1, a :: l, f, r => sublistsLenAux (n + 1) l f (sublistsLenAux n l (f ∘ List.cons a) r) #align list.sublists_len_aux List.sublistsLenAux def sublistsLen (n : ℕ) (l : List α) : List (List α) := sublistsLenAux n l id [] #align list.sublists_len List.sublistsLen theorem sublistsLenAux_append : ∀ (n : ℕ) (l : List α) (f : List α → β) (g : β → γ) (r : List β) (s : List γ), sublistsLenAux n l (g ∘ f) (r.map g ++ s) = (sublistsLenAux n l f r).map g ++ s | 0, l, f, g, r, s => by unfold sublistsLenAux; simp | n + 1, [], f, g, r, s => rfl | n + 1, a :: l, f, g, r, s => by unfold sublistsLenAux simp only [show (g ∘ f) ∘ List.cons a = g ∘ f ∘ List.cons a by rfl, sublistsLenAux_append, sublistsLenAux_append] #align list.sublists_len_aux_append List.sublistsLenAux_append theorem sublistsLenAux_eq (l : List α) (n) (f : List α → β) (r) : sublistsLenAux n l f r = (sublistsLen n l).map f ++ r := by rw [sublistsLen, ← sublistsLenAux_append]; rfl #align list.sublists_len_aux_eq List.sublistsLenAux_eq theorem sublistsLenAux_zero (l : List α) (f : List α → β) (r) : sublistsLenAux 0 l f r = f [] :: r := by cases l <;> rfl #align list.sublists_len_aux_zero List.sublistsLenAux_zero @[simp] theorem sublistsLen_zero (l : List α) : sublistsLen 0 l = [[]] := sublistsLenAux_zero _ _ _ #align list.sublists_len_zero List.sublistsLen_zero @[simp] theorem sublistsLen_succ_nil (n) : sublistsLen (n + 1) (@nil α) = [] := rfl #align list.sublists_len_succ_nil List.sublistsLen_succ_nil @[simp]
Mathlib/Data/List/Sublists.lean
276
279
theorem sublistsLen_succ_cons (n) (a : α) (l) : sublistsLen (n + 1) (a :: l) = sublistsLen (n + 1) l ++ (sublistsLen n l).map (cons a) := by
rw [sublistsLen, sublistsLenAux, sublistsLenAux_eq, sublistsLenAux_eq, map_id, append_nil]; rfl
import Mathlib.MeasureTheory.Integral.Lebesgue open Set hiding restrict restrict_apply open Filter ENNReal NNReal MeasureTheory.Measure namespace MeasureTheory variable {α : Type*} {m0 : MeasurableSpace α} {μ : Measure α} noncomputable def Measure.withDensity {m : MeasurableSpace α} (μ : Measure α) (f : α → ℝ≥0∞) : Measure α := Measure.ofMeasurable (fun s _ => ∫⁻ a in s, f a ∂μ) (by simp) fun s hs hd => lintegral_iUnion hs hd _ #align measure_theory.measure.with_density MeasureTheory.Measure.withDensity @[simp] theorem withDensity_apply (f : α → ℝ≥0∞) {s : Set α} (hs : MeasurableSet s) : μ.withDensity f s = ∫⁻ a in s, f a ∂μ := Measure.ofMeasurable_apply s hs #align measure_theory.with_density_apply MeasureTheory.withDensity_apply theorem withDensity_apply_le (f : α → ℝ≥0∞) (s : Set α) : ∫⁻ a in s, f a ∂μ ≤ μ.withDensity f s := by let t := toMeasurable (μ.withDensity f) s calc ∫⁻ a in s, f a ∂μ ≤ ∫⁻ a in t, f a ∂μ := lintegral_mono_set (subset_toMeasurable (withDensity μ f) s) _ = μ.withDensity f t := (withDensity_apply f (measurableSet_toMeasurable (withDensity μ f) s)).symm _ = μ.withDensity f s := measure_toMeasurable s theorem withDensity_apply' [SFinite μ] (f : α → ℝ≥0∞) (s : Set α) : μ.withDensity f s = ∫⁻ a in s, f a ∂μ := by apply le_antisymm ?_ (withDensity_apply_le f s) let t := toMeasurable μ s calc μ.withDensity f s ≤ μ.withDensity f t := measure_mono (subset_toMeasurable μ s) _ = ∫⁻ a in t, f a ∂μ := withDensity_apply f (measurableSet_toMeasurable μ s) _ = ∫⁻ a in s, f a ∂μ := by congr 1; exact restrict_toMeasurable_of_sFinite s @[simp] lemma withDensity_zero_left (f : α → ℝ≥0∞) : (0 : Measure α).withDensity f = 0 := by ext s hs rw [withDensity_apply _ hs] simp theorem withDensity_congr_ae {f g : α → ℝ≥0∞} (h : f =ᵐ[μ] g) : μ.withDensity f = μ.withDensity g := by refine Measure.ext fun s hs => ?_ rw [withDensity_apply _ hs, withDensity_apply _ hs] exact lintegral_congr_ae (ae_restrict_of_ae h) #align measure_theory.with_density_congr_ae MeasureTheory.withDensity_congr_ae lemma withDensity_mono {f g : α → ℝ≥0∞} (hfg : f ≤ᵐ[μ] g) : μ.withDensity f ≤ μ.withDensity g := by refine le_iff.2 fun s hs ↦ ?_ rw [withDensity_apply _ hs, withDensity_apply _ hs] refine set_lintegral_mono_ae' hs ?_ filter_upwards [hfg] with x h_le using fun _ ↦ h_le theorem withDensity_add_left {f : α → ℝ≥0∞} (hf : Measurable f) (g : α → ℝ≥0∞) : μ.withDensity (f + g) = μ.withDensity f + μ.withDensity g := by refine Measure.ext fun s hs => ?_ rw [withDensity_apply _ hs, Measure.add_apply, withDensity_apply _ hs, withDensity_apply _ hs, ← lintegral_add_left hf] simp only [Pi.add_apply] #align measure_theory.with_density_add_left MeasureTheory.withDensity_add_left theorem withDensity_add_right (f : α → ℝ≥0∞) {g : α → ℝ≥0∞} (hg : Measurable g) : μ.withDensity (f + g) = μ.withDensity f + μ.withDensity g := by simpa only [add_comm] using withDensity_add_left hg f #align measure_theory.with_density_add_right MeasureTheory.withDensity_add_right theorem withDensity_add_measure {m : MeasurableSpace α} (μ ν : Measure α) (f : α → ℝ≥0∞) : (μ + ν).withDensity f = μ.withDensity f + ν.withDensity f := by ext1 s hs simp only [withDensity_apply f hs, restrict_add, lintegral_add_measure, Measure.add_apply] #align measure_theory.with_density_add_measure MeasureTheory.withDensity_add_measure theorem withDensity_sum {ι : Type*} {m : MeasurableSpace α} (μ : ι → Measure α) (f : α → ℝ≥0∞) : (sum μ).withDensity f = sum fun n => (μ n).withDensity f := by ext1 s hs simp_rw [sum_apply _ hs, withDensity_apply f hs, restrict_sum μ hs, lintegral_sum_measure] #align measure_theory.with_density_sum MeasureTheory.withDensity_sum theorem withDensity_smul (r : ℝ≥0∞) {f : α → ℝ≥0∞} (hf : Measurable f) : μ.withDensity (r • f) = r • μ.withDensity f := by refine Measure.ext fun s hs => ?_ rw [withDensity_apply _ hs, Measure.coe_smul, Pi.smul_apply, withDensity_apply _ hs, smul_eq_mul, ← lintegral_const_mul r hf] simp only [Pi.smul_apply, smul_eq_mul] #align measure_theory.with_density_smul MeasureTheory.withDensity_smul theorem withDensity_smul' (r : ℝ≥0∞) (f : α → ℝ≥0∞) (hr : r ≠ ∞) : μ.withDensity (r • f) = r • μ.withDensity f := by refine Measure.ext fun s hs => ?_ rw [withDensity_apply _ hs, Measure.coe_smul, Pi.smul_apply, withDensity_apply _ hs, smul_eq_mul, ← lintegral_const_mul' r f hr] simp only [Pi.smul_apply, smul_eq_mul] #align measure_theory.with_density_smul' MeasureTheory.withDensity_smul' theorem withDensity_smul_measure (r : ℝ≥0∞) (f : α → ℝ≥0∞) : (r • μ).withDensity f = r • μ.withDensity f := by ext s hs rw [withDensity_apply _ hs, Measure.coe_smul, Pi.smul_apply, withDensity_apply _ hs, smul_eq_mul, set_lintegral_smul_measure] theorem isFiniteMeasure_withDensity {f : α → ℝ≥0∞} (hf : ∫⁻ a, f a ∂μ ≠ ∞) : IsFiniteMeasure (μ.withDensity f) := { measure_univ_lt_top := by rwa [withDensity_apply _ MeasurableSet.univ, Measure.restrict_univ, lt_top_iff_ne_top] } #align measure_theory.is_finite_measure_with_density MeasureTheory.isFiniteMeasure_withDensity theorem withDensity_absolutelyContinuous {m : MeasurableSpace α} (μ : Measure α) (f : α → ℝ≥0∞) : μ.withDensity f ≪ μ := by refine AbsolutelyContinuous.mk fun s hs₁ hs₂ => ?_ rw [withDensity_apply _ hs₁] exact set_lintegral_measure_zero _ _ hs₂ #align measure_theory.with_density_absolutely_continuous MeasureTheory.withDensity_absolutelyContinuous @[simp] theorem withDensity_zero : μ.withDensity 0 = 0 := by ext1 s hs simp [withDensity_apply _ hs] #align measure_theory.with_density_zero MeasureTheory.withDensity_zero @[simp] theorem withDensity_one : μ.withDensity 1 = μ := by ext1 s hs simp [withDensity_apply _ hs] #align measure_theory.with_density_one MeasureTheory.withDensity_one @[simp] theorem withDensity_const (c : ℝ≥0∞) : μ.withDensity (fun _ ↦ c) = c • μ := by ext1 s hs simp [withDensity_apply _ hs] theorem withDensity_tsum {f : ℕ → α → ℝ≥0∞} (h : ∀ i, Measurable (f i)) : μ.withDensity (∑' n, f n) = sum fun n => μ.withDensity (f n) := by ext1 s hs simp_rw [sum_apply _ hs, withDensity_apply _ hs] change ∫⁻ x in s, (∑' n, f n) x ∂μ = ∑' i : ℕ, ∫⁻ x, f i x ∂μ.restrict s rw [← lintegral_tsum fun i => (h i).aemeasurable] exact lintegral_congr fun x => tsum_apply (Pi.summable.2 fun _ => ENNReal.summable) #align measure_theory.with_density_tsum MeasureTheory.withDensity_tsum theorem withDensity_indicator {s : Set α} (hs : MeasurableSet s) (f : α → ℝ≥0∞) : μ.withDensity (s.indicator f) = (μ.restrict s).withDensity f := by ext1 t ht rw [withDensity_apply _ ht, lintegral_indicator _ hs, restrict_comm hs, ← withDensity_apply _ ht] #align measure_theory.with_density_indicator MeasureTheory.withDensity_indicator theorem withDensity_indicator_one {s : Set α} (hs : MeasurableSet s) : μ.withDensity (s.indicator 1) = μ.restrict s := by rw [withDensity_indicator hs, withDensity_one] #align measure_theory.with_density_indicator_one MeasureTheory.withDensity_indicator_one theorem withDensity_ofReal_mutuallySingular {f : α → ℝ} (hf : Measurable f) : (μ.withDensity fun x => ENNReal.ofReal <| f x) ⟂ₘ μ.withDensity fun x => ENNReal.ofReal <| -f x := by set S : Set α := { x | f x < 0 } have hS : MeasurableSet S := measurableSet_lt hf measurable_const refine ⟨S, hS, ?_, ?_⟩ · rw [withDensity_apply _ hS, lintegral_eq_zero_iff hf.ennreal_ofReal, EventuallyEq] exact (ae_restrict_mem hS).mono fun x hx => ENNReal.ofReal_eq_zero.2 (le_of_lt hx) · rw [withDensity_apply _ hS.compl, lintegral_eq_zero_iff hf.neg.ennreal_ofReal, EventuallyEq] exact (ae_restrict_mem hS.compl).mono fun x hx => ENNReal.ofReal_eq_zero.2 (not_lt.1 <| mt neg_pos.1 hx) #align measure_theory.with_density_of_real_mutually_singular MeasureTheory.withDensity_ofReal_mutuallySingular theorem restrict_withDensity {s : Set α} (hs : MeasurableSet s) (f : α → ℝ≥0∞) : (μ.withDensity f).restrict s = (μ.restrict s).withDensity f := by ext1 t ht rw [restrict_apply ht, withDensity_apply _ ht, withDensity_apply _ (ht.inter hs), restrict_restrict ht] #align measure_theory.restrict_with_density MeasureTheory.restrict_withDensity theorem restrict_withDensity' [SFinite μ] (s : Set α) (f : α → ℝ≥0∞) : (μ.withDensity f).restrict s = (μ.restrict s).withDensity f := by ext1 t ht rw [restrict_apply ht, withDensity_apply _ ht, withDensity_apply' _ (t ∩ s), restrict_restrict ht] lemma trim_withDensity {m m0 : MeasurableSpace α} {μ : Measure α} (hm : m ≤ m0) {f : α → ℝ≥0∞} (hf : Measurable[m] f) : (μ.withDensity f).trim hm = (μ.trim hm).withDensity f := by refine @Measure.ext _ m _ _ (fun s hs ↦ ?_) rw [withDensity_apply _ hs, restrict_trim _ _ hs, lintegral_trim _ hf, trim_measurableSet_eq _ hs, withDensity_apply _ (hm s hs)] lemma Measure.MutuallySingular.withDensity {ν : Measure α} {f : α → ℝ≥0∞} (h : μ ⟂ₘ ν) : μ.withDensity f ⟂ₘ ν := MutuallySingular.mono_ac h (withDensity_absolutelyContinuous _ _) AbsolutelyContinuous.rfl theorem withDensity_eq_zero {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) (h : μ.withDensity f = 0) : f =ᵐ[μ] 0 := by rw [← lintegral_eq_zero_iff' hf, ← set_lintegral_univ, ← withDensity_apply _ MeasurableSet.univ, h, Measure.coe_zero, Pi.zero_apply] #align measure_theory.with_density_eq_zero MeasureTheory.withDensity_eq_zero @[simp] theorem withDensity_eq_zero_iff {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) : μ.withDensity f = 0 ↔ f =ᵐ[μ] 0 := ⟨withDensity_eq_zero hf, fun h => withDensity_zero (μ := μ) ▸ withDensity_congr_ae h⟩ theorem withDensity_apply_eq_zero' {f : α → ℝ≥0∞} {s : Set α} (hf : AEMeasurable f μ) : μ.withDensity f s = 0 ↔ μ ({ x | f x ≠ 0 } ∩ s) = 0 := by constructor · intro hs let t := toMeasurable (μ.withDensity f) s apply measure_mono_null (inter_subset_inter_right _ (subset_toMeasurable (μ.withDensity f) s)) have A : μ.withDensity f t = 0 := by rw [measure_toMeasurable, hs] rw [withDensity_apply f (measurableSet_toMeasurable _ s), lintegral_eq_zero_iff' (AEMeasurable.restrict hf), EventuallyEq, ae_restrict_iff'₀, ae_iff] at A swap · simp only [measurableSet_toMeasurable, MeasurableSet.nullMeasurableSet] simp only [Pi.zero_apply, mem_setOf_eq, Filter.mem_mk] at A convert A using 2 ext x simp only [and_comm, exists_prop, mem_inter_iff, iff_self_iff, mem_setOf_eq, mem_compl_iff, not_forall] · intro hs let t := toMeasurable μ ({ x | f x ≠ 0 } ∩ s) have A : s ⊆ t ∪ { x | f x = 0 } := by intro x hx rcases eq_or_ne (f x) 0 with (fx | fx) · simp only [fx, mem_union, mem_setOf_eq, eq_self_iff_true, or_true_iff] · left apply subset_toMeasurable _ _ exact ⟨fx, hx⟩ apply measure_mono_null A (measure_union_null _ _) · apply withDensity_absolutelyContinuous rwa [measure_toMeasurable] rcases hf with ⟨g, hg, hfg⟩ have t : {x | f x = 0} =ᵐ[μ.withDensity f] {x | g x = 0} := by apply withDensity_absolutelyContinuous filter_upwards [hfg] with a ha rw [eq_iff_iff] exact ⟨fun h ↦ by rw [h] at ha; exact ha.symm, fun h ↦ by rw [h] at ha; exact ha⟩ rw [measure_congr t, withDensity_congr_ae hfg] have M : MeasurableSet { x : α | g x = 0 } := hg (measurableSet_singleton _) rw [withDensity_apply _ M, lintegral_eq_zero_iff hg] filter_upwards [ae_restrict_mem M] simp only [imp_self, Pi.zero_apply, imp_true_iff] theorem withDensity_apply_eq_zero {f : α → ℝ≥0∞} {s : Set α} (hf : Measurable f) : μ.withDensity f s = 0 ↔ μ ({ x | f x ≠ 0 } ∩ s) = 0 := withDensity_apply_eq_zero' <| hf.aemeasurable #align measure_theory.with_density_apply_eq_zero MeasureTheory.withDensity_apply_eq_zero theorem ae_withDensity_iff' {p : α → Prop} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) : (∀ᵐ x ∂μ.withDensity f, p x) ↔ ∀ᵐ x ∂μ, f x ≠ 0 → p x := by rw [ae_iff, ae_iff, withDensity_apply_eq_zero' hf, iff_iff_eq] congr ext x simp only [exists_prop, mem_inter_iff, iff_self_iff, mem_setOf_eq, not_forall] theorem ae_withDensity_iff {p : α → Prop} {f : α → ℝ≥0∞} (hf : Measurable f) : (∀ᵐ x ∂μ.withDensity f, p x) ↔ ∀ᵐ x ∂μ, f x ≠ 0 → p x := ae_withDensity_iff' <| hf.aemeasurable #align measure_theory.ae_with_density_iff MeasureTheory.ae_withDensity_iff theorem ae_withDensity_iff_ae_restrict' {p : α → Prop} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) : (∀ᵐ x ∂μ.withDensity f, p x) ↔ ∀ᵐ x ∂μ.restrict { x | f x ≠ 0 }, p x := by rw [ae_withDensity_iff' hf, ae_restrict_iff'₀] · simp only [mem_setOf] · rcases hf with ⟨g, hg, hfg⟩ have nonneg_eq_ae : {x | g x ≠ 0} =ᵐ[μ] {x | f x ≠ 0} := by filter_upwards [hfg] with a ha simp only [eq_iff_iff] exact ⟨fun (h : g a ≠ 0) ↦ by rwa [← ha] at h, fun (h : f a ≠ 0) ↦ by rwa [ha] at h⟩ exact NullMeasurableSet.congr (MeasurableSet.nullMeasurableSet <| hg (measurableSet_singleton _)).compl nonneg_eq_ae theorem ae_withDensity_iff_ae_restrict {p : α → Prop} {f : α → ℝ≥0∞} (hf : Measurable f) : (∀ᵐ x ∂μ.withDensity f, p x) ↔ ∀ᵐ x ∂μ.restrict { x | f x ≠ 0 }, p x := ae_withDensity_iff_ae_restrict' <| hf.aemeasurable #align measure_theory.ae_with_density_iff_ae_restrict MeasureTheory.ae_withDensity_iff_ae_restrict theorem aemeasurable_withDensity_ennreal_iff' {f : α → ℝ≥0} (hf : AEMeasurable f μ) {g : α → ℝ≥0∞} : AEMeasurable g (μ.withDensity fun x => (f x : ℝ≥0∞)) ↔ AEMeasurable (fun x => (f x : ℝ≥0∞) * g x) μ := by have t : ∃ f', Measurable f' ∧ f =ᵐ[μ] f' := hf rcases t with ⟨f', hf'_m, hf'_ae⟩ constructor · rintro ⟨g', g'meas, hg'⟩ have A : MeasurableSet {x | f' x ≠ 0} := hf'_m (measurableSet_singleton _).compl refine ⟨fun x => f' x * g' x, hf'_m.coe_nnreal_ennreal.smul g'meas, ?_⟩ apply ae_of_ae_restrict_of_ae_restrict_compl { x | f' x ≠ 0 } · rw [EventuallyEq, ae_withDensity_iff' hf.coe_nnreal_ennreal] at hg' rw [ae_restrict_iff' A] filter_upwards [hg', hf'_ae] with a ha h'a h_a_nonneg have : (f' a : ℝ≥0∞) ≠ 0 := by simpa only [Ne, ENNReal.coe_eq_zero] using h_a_nonneg rw [← h'a] at this ⊢ rw [ha this] · rw [ae_restrict_iff' A.compl] filter_upwards [hf'_ae] with a ha ha_null have ha_null : f' a = 0 := Function.nmem_support.mp ha_null rw [ha_null] at ha ⊢ rw [ha] simp only [ENNReal.coe_zero, zero_mul] · rintro ⟨g', g'meas, hg'⟩ refine ⟨fun x => ((f' x)⁻¹ : ℝ≥0∞) * g' x, hf'_m.coe_nnreal_ennreal.inv.smul g'meas, ?_⟩ rw [EventuallyEq, ae_withDensity_iff' hf.coe_nnreal_ennreal] filter_upwards [hg', hf'_ae] with a hfga hff'a h'a rw [hff'a] at hfga h'a rw [← hfga, ← mul_assoc, ENNReal.inv_mul_cancel h'a ENNReal.coe_ne_top, one_mul] theorem aemeasurable_withDensity_ennreal_iff {f : α → ℝ≥0} (hf : Measurable f) {g : α → ℝ≥0∞} : AEMeasurable g (μ.withDensity fun x => (f x : ℝ≥0∞)) ↔ AEMeasurable (fun x => (f x : ℝ≥0∞) * g x) μ := aemeasurable_withDensity_ennreal_iff' <| hf.aemeasurable #align measure_theory.ae_measurable_with_density_ennreal_iff MeasureTheory.aemeasurable_withDensity_ennreal_iff open MeasureTheory.SimpleFunc theorem lintegral_withDensity_eq_lintegral_mul (μ : Measure α) {f : α → ℝ≥0∞} (h_mf : Measurable f) : ∀ {g : α → ℝ≥0∞}, Measurable g → ∫⁻ a, g a ∂μ.withDensity f = ∫⁻ a, (f * g) a ∂μ := by apply Measurable.ennreal_induction · intro c s h_ms simp [*, mul_comm _ c, ← indicator_mul_right] · intro g h _ h_mea_g _ h_ind_g h_ind_h simp [mul_add, *, Measurable.mul] · intro g h_mea_g h_mono_g h_ind have : Monotone fun n a => f a * g n a := fun m n hmn x => mul_le_mul_left' (h_mono_g hmn x) _ simp [lintegral_iSup, ENNReal.mul_iSup, h_mf.mul (h_mea_g _), *] #align measure_theory.lintegral_with_density_eq_lintegral_mul MeasureTheory.lintegral_withDensity_eq_lintegral_mul
Mathlib/MeasureTheory/Measure/WithDensity.lean
384
387
theorem set_lintegral_withDensity_eq_set_lintegral_mul (μ : Measure α) {f g : α → ℝ≥0∞} (hf : Measurable f) (hg : Measurable g) {s : Set α} (hs : MeasurableSet s) : ∫⁻ x in s, g x ∂μ.withDensity f = ∫⁻ x in s, (f * g) x ∂μ := by
rw [restrict_withDensity hs, lintegral_withDensity_eq_lintegral_mul _ hf hg]
import Mathlib.SetTheory.Game.Basic import Mathlib.Tactic.NthRewrite #align_import set_theory.game.impartial from "leanprover-community/mathlib"@"2e0975f6a25dd3fbfb9e41556a77f075f6269748" universe u namespace SetTheory open scoped PGame namespace PGame def ImpartialAux : PGame → Prop | G => (G ≈ -G) ∧ (∀ i, ImpartialAux (G.moveLeft i)) ∧ ∀ j, ImpartialAux (G.moveRight j) termination_by G => G -- Porting note: Added `termination_by` #align pgame.impartial_aux SetTheory.PGame.ImpartialAux
Mathlib/SetTheory/Game/Impartial.lean
35
38
theorem impartialAux_def {G : PGame} : G.ImpartialAux ↔ (G ≈ -G) ∧ (∀ i, ImpartialAux (G.moveLeft i)) ∧ ∀ j, ImpartialAux (G.moveRight j) := by
rw [ImpartialAux]
import Mathlib.Analysis.Analytic.Composition #align_import analysis.analytic.inverse from "leanprover-community/mathlib"@"284fdd2962e67d2932fa3a79ce19fcf92d38e228" open scoped Classical Topology open Finset Filter namespace FormalMultilinearSeries variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] noncomputable def leftInv (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) : FormalMultilinearSeries 𝕜 F E | 0 => 0 | 1 => (continuousMultilinearCurryFin1 𝕜 F E).symm i.symm | n + 2 => -∑ c : { c : Composition (n + 2) // c.length < n + 2 }, (leftInv p i (c : Composition (n + 2)).length).compAlongComposition (p.compContinuousLinearMap i.symm) c #align formal_multilinear_series.left_inv FormalMultilinearSeries.leftInv @[simp] theorem leftInv_coeff_zero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) : p.leftInv i 0 = 0 := by rw [leftInv] #align formal_multilinear_series.left_inv_coeff_zero FormalMultilinearSeries.leftInv_coeff_zero @[simp] theorem leftInv_coeff_one (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) : p.leftInv i 1 = (continuousMultilinearCurryFin1 𝕜 F E).symm i.symm := by rw [leftInv] #align formal_multilinear_series.left_inv_coeff_one FormalMultilinearSeries.leftInv_coeff_one theorem leftInv_removeZero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) : p.removeZero.leftInv i = p.leftInv i := by ext1 n induction' n using Nat.strongRec' with n IH match n with | 0 => simp -- if one replaces `simp` with `refl`, the proof times out in the kernel. | 1 => simp -- TODO: why? | n + 2 => simp only [leftInv, neg_inj] refine Finset.sum_congr rfl fun c cuniv => ?_ rcases c with ⟨c, hc⟩ ext v dsimp simp [IH _ hc] #align formal_multilinear_series.left_inv_remove_zero FormalMultilinearSeries.leftInv_removeZero theorem leftInv_comp (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (h : p 1 = (continuousMultilinearCurryFin1 𝕜 E F).symm i) : (leftInv p i).comp p = id 𝕜 E := by ext (n v) match n with | 0 => simp only [leftInv_coeff_zero, ContinuousMultilinearMap.zero_apply, id_apply_ne_one, Ne, not_false_iff, zero_ne_one, comp_coeff_zero'] | 1 => simp only [leftInv_coeff_one, comp_coeff_one, h, id_apply_one, ContinuousLinearEquiv.coe_apply, ContinuousLinearEquiv.symm_apply_apply, continuousMultilinearCurryFin1_symm_apply] | n + 2 => have A : (Finset.univ : Finset (Composition (n + 2))) = {c | Composition.length c < n + 2}.toFinset ∪ {Composition.ones (n + 2)} := by refine Subset.antisymm (fun c _ => ?_) (subset_univ _) by_cases h : c.length < n + 2 · simp [h, Set.mem_toFinset (s := {c | Composition.length c < n + 2})] · simp [Composition.eq_ones_iff_le_length.2 (not_lt.1 h)] have B : Disjoint ({c | Composition.length c < n + 2} : Set (Composition (n + 2))).toFinset {Composition.ones (n + 2)} := by simp [Set.mem_toFinset (s := {c | Composition.length c < n + 2})] have C : ((p.leftInv i (Composition.ones (n + 2)).length) fun j : Fin (Composition.ones n.succ.succ).length => p 1 fun _ => v ((Fin.castLE (Composition.length_le _)) j)) = p.leftInv i (n + 2) fun j : Fin (n + 2) => p 1 fun _ => v j := by apply FormalMultilinearSeries.congr _ (Composition.ones_length _) fun j hj1 hj2 => ?_ exact FormalMultilinearSeries.congr _ rfl fun k _ _ => by congr have D : (p.leftInv i (n + 2) fun j : Fin (n + 2) => p 1 fun _ => v j) = -∑ c ∈ {c : Composition (n + 2) | c.length < n + 2}.toFinset, (p.leftInv i c.length) (p.applyComposition c v) := by simp only [leftInv, ContinuousMultilinearMap.neg_apply, neg_inj, ContinuousMultilinearMap.sum_apply] convert (sum_toFinset_eq_subtype (fun c : Composition (n + 2) => c.length < n + 2) (fun c : Composition (n + 2) => (ContinuousMultilinearMap.compAlongComposition (p.compContinuousLinearMap (i.symm : F →L[𝕜] E)) c (p.leftInv i c.length)) fun j : Fin (n + 2) => p 1 fun _ : Fin 1 => v j)).symm.trans _ simp only [compContinuousLinearMap_applyComposition, ContinuousMultilinearMap.compAlongComposition_apply] congr ext c congr ext k simp [h, Function.comp] simp [FormalMultilinearSeries.comp, show n + 2 ≠ 1 by omega, A, Finset.sum_union B, applyComposition_ones, C, D, -Set.toFinset_setOf] #align formal_multilinear_series.left_inv_comp FormalMultilinearSeries.leftInv_comp noncomputable def rightInv (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) : FormalMultilinearSeries 𝕜 F E | 0 => 0 | 1 => (continuousMultilinearCurryFin1 𝕜 F E).symm i.symm | n + 2 => let q : FormalMultilinearSeries 𝕜 F E := fun k => if k < n + 2 then rightInv p i k else 0; -(i.symm : F →L[𝕜] E).compContinuousMultilinearMap ((p.comp q) (n + 2)) #align formal_multilinear_series.right_inv FormalMultilinearSeries.rightInv @[simp] theorem rightInv_coeff_zero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) : p.rightInv i 0 = 0 := by rw [rightInv] #align formal_multilinear_series.right_inv_coeff_zero FormalMultilinearSeries.rightInv_coeff_zero @[simp] theorem rightInv_coeff_one (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) : p.rightInv i 1 = (continuousMultilinearCurryFin1 𝕜 F E).symm i.symm := by rw [rightInv] #align formal_multilinear_series.right_inv_coeff_one FormalMultilinearSeries.rightInv_coeff_one theorem rightInv_removeZero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) : p.removeZero.rightInv i = p.rightInv i := by ext1 n induction' n using Nat.strongRec' with n IH match n with | 0 => simp only [rightInv_coeff_zero] | 1 => simp only [rightInv_coeff_one] | n + 2 => simp only [rightInv, neg_inj] rw [removeZero_comp_of_pos _ _ (add_pos_of_nonneg_of_pos n.zero_le zero_lt_two)] congr (config := { closePost := false }) 2 with k by_cases hk : k < n + 2 <;> simp [hk, IH] #align formal_multilinear_series.right_inv_remove_zero FormalMultilinearSeries.rightInv_removeZero theorem comp_rightInv_aux1 {n : ℕ} (hn : 0 < n) (p : FormalMultilinearSeries 𝕜 E F) (q : FormalMultilinearSeries 𝕜 F E) (v : Fin n → F) : p.comp q n v = ∑ c ∈ {c : Composition n | 1 < c.length}.toFinset, p c.length (q.applyComposition c v) + p 1 fun _ => q n v := by have A : (Finset.univ : Finset (Composition n)) = {c | 1 < Composition.length c}.toFinset ∪ {Composition.single n hn} := by refine Subset.antisymm (fun c _ => ?_) (subset_univ _) by_cases h : 1 < c.length · simp [h, Set.mem_toFinset (s := {c | 1 < Composition.length c})] · have : c.length = 1 := by refine (eq_iff_le_not_lt.2 ⟨?_, h⟩).symm; exact c.length_pos_of_pos hn rw [← Composition.eq_single_iff_length hn] at this simp [this] have B : Disjoint ({c | 1 < Composition.length c} : Set (Composition n)).toFinset {Composition.single n hn} := by simp [Set.mem_toFinset (s := {c | 1 < Composition.length c})] have C : p (Composition.single n hn).length (q.applyComposition (Composition.single n hn) v) = p 1 fun _ : Fin 1 => q n v := by apply p.congr (Composition.single_length hn) fun j hj1 _ => ?_ simp [applyComposition_single] simp [FormalMultilinearSeries.comp, A, Finset.sum_union B, C, -Set.toFinset_setOf, -add_right_inj, -Composition.single_length] #align formal_multilinear_series.comp_right_inv_aux1 FormalMultilinearSeries.comp_rightInv_aux1 theorem comp_rightInv_aux2 (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (n : ℕ) (v : Fin (n + 2) → F) : ∑ c ∈ {c : Composition (n + 2) | 1 < c.length}.toFinset, p c.length (applyComposition (fun k : ℕ => ite (k < n + 2) (p.rightInv i k) 0) c v) = ∑ c ∈ {c : Composition (n + 2) | 1 < c.length}.toFinset, p c.length ((p.rightInv i).applyComposition c v) := by have N : 0 < n + 2 := by norm_num refine sum_congr rfl fun c hc => p.congr rfl fun j hj1 hj2 => ?_ have : ∀ k, c.blocksFun k < n + 2 := by simp only [Set.mem_toFinset (s := {c : Composition (n + 2) | 1 < c.length}), Set.mem_setOf_eq] at hc simp [← Composition.ne_single_iff N, Composition.eq_single_iff_length, ne_of_gt hc] simp [applyComposition, this] #align formal_multilinear_series.comp_right_inv_aux2 FormalMultilinearSeries.comp_rightInv_aux2 theorem comp_rightInv (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (h : p 1 = (continuousMultilinearCurryFin1 𝕜 E F).symm i) (h0 : p 0 = 0) : p.comp (rightInv p i) = id 𝕜 F := by ext (n v) match n with | 0 => simp only [h0, ContinuousMultilinearMap.zero_apply, id_apply_ne_one, Ne, not_false_iff, zero_ne_one, comp_coeff_zero'] | 1 => simp only [comp_coeff_one, h, rightInv_coeff_one, ContinuousLinearEquiv.apply_symm_apply, id_apply_one, ContinuousLinearEquiv.coe_apply, continuousMultilinearCurryFin1_symm_apply] | n + 2 => have N : 0 < n + 2 := by norm_num simp [comp_rightInv_aux1 N, h, rightInv, lt_irrefl n, show n + 2 ≠ 1 by omega, ← sub_eq_add_neg, sub_eq_zero, comp_rightInv_aux2, -Set.toFinset_setOf] #align formal_multilinear_series.comp_right_inv FormalMultilinearSeries.comp_rightInv
Mathlib/Analysis/Analytic/Inverse.lean
265
279
theorem rightInv_coeff (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) (n : ℕ) (hn : 2 ≤ n) : p.rightInv i n = -(i.symm : F →L[𝕜] E).compContinuousMultilinearMap (∑ c ∈ ({c | 1 < Composition.length c}.toFinset : Finset (Composition n)), p.compAlongComposition (p.rightInv i) c) := by
match n with | 0 => exact False.elim (zero_lt_two.not_le hn) | 1 => exact False.elim (one_lt_two.not_le hn) | n + 2 => simp only [rightInv, neg_inj] congr (config := { closePost := false }) 1 ext v have N : 0 < n + 2 := by norm_num have : ((p 1) fun i : Fin 1 => 0) = 0 := ContinuousMultilinearMap.map_zero _ simp [comp_rightInv_aux1 N, lt_irrefl n, this, comp_rightInv_aux2, -Set.toFinset_setOf]
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.BigOperators import Mathlib.LinearAlgebra.AffineSpace.AffineMap import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace import Mathlib.LinearAlgebra.Finsupp import Mathlib.Tactic.FinCases #align_import linear_algebra.affine_space.combination from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" noncomputable section open Affine namespace Finset theorem univ_fin2 : (univ : Finset (Fin 2)) = {0, 1} := by ext x fin_cases x <;> simp #align finset.univ_fin2 Finset.univ_fin2 variable {k : Type*} {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V] variable [S : AffineSpace V P] variable {ι : Type*} (s : Finset ι) variable {ι₂ : Type*} (s₂ : Finset ι₂) def weightedVSubOfPoint (p : ι → P) (b : P) : (ι → k) →ₗ[k] V := ∑ i ∈ s, (LinearMap.proj i : (ι → k) →ₗ[k] k).smulRight (p i -ᵥ b) #align finset.weighted_vsub_of_point Finset.weightedVSubOfPoint @[simp] theorem weightedVSubOfPoint_apply (w : ι → k) (p : ι → P) (b : P) : s.weightedVSubOfPoint p b w = ∑ i ∈ s, w i • (p i -ᵥ b) := by simp [weightedVSubOfPoint, LinearMap.sum_apply] #align finset.weighted_vsub_of_point_apply Finset.weightedVSubOfPoint_apply @[simp (high)] theorem weightedVSubOfPoint_apply_const (w : ι → k) (p : P) (b : P) : s.weightedVSubOfPoint (fun _ => p) b w = (∑ i ∈ s, w i) • (p -ᵥ b) := by rw [weightedVSubOfPoint_apply, sum_smul] #align finset.weighted_vsub_of_point_apply_const Finset.weightedVSubOfPoint_apply_const theorem weightedVSubOfPoint_congr {w₁ w₂ : ι → k} (hw : ∀ i ∈ s, w₁ i = w₂ i) {p₁ p₂ : ι → P} (hp : ∀ i ∈ s, p₁ i = p₂ i) (b : P) : s.weightedVSubOfPoint p₁ b w₁ = s.weightedVSubOfPoint p₂ b w₂ := by simp_rw [weightedVSubOfPoint_apply] refine sum_congr rfl fun i hi => ?_ rw [hw i hi, hp i hi] #align finset.weighted_vsub_of_point_congr Finset.weightedVSubOfPoint_congr theorem weightedVSubOfPoint_eq_of_weights_eq (p : ι → P) (j : ι) (w₁ w₂ : ι → k) (hw : ∀ i, i ≠ j → w₁ i = w₂ i) : s.weightedVSubOfPoint p (p j) w₁ = s.weightedVSubOfPoint p (p j) w₂ := by simp only [Finset.weightedVSubOfPoint_apply] congr ext i rcases eq_or_ne i j with h | h · simp [h] · simp [hw i h] #align finset.weighted_vsub_of_point_eq_of_weights_eq Finset.weightedVSubOfPoint_eq_of_weights_eq theorem weightedVSubOfPoint_eq_of_sum_eq_zero (w : ι → k) (p : ι → P) (h : ∑ i ∈ s, w i = 0) (b₁ b₂ : P) : s.weightedVSubOfPoint p b₁ w = s.weightedVSubOfPoint p b₂ w := by apply eq_of_sub_eq_zero rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, ← sum_sub_distrib] conv_lhs => congr · skip · ext rw [← smul_sub, vsub_sub_vsub_cancel_left] rw [← sum_smul, h, zero_smul] #align finset.weighted_vsub_of_point_eq_of_sum_eq_zero Finset.weightedVSubOfPoint_eq_of_sum_eq_zero theorem weightedVSubOfPoint_vadd_eq_of_sum_eq_one (w : ι → k) (p : ι → P) (h : ∑ i ∈ s, w i = 1) (b₁ b₂ : P) : s.weightedVSubOfPoint p b₁ w +ᵥ b₁ = s.weightedVSubOfPoint p b₂ w +ᵥ b₂ := by erw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, ← @vsub_eq_zero_iff_eq V, vadd_vsub_assoc, vsub_vadd_eq_vsub_sub, ← add_sub_assoc, add_comm, add_sub_assoc, ← sum_sub_distrib] conv_lhs => congr · skip · congr · skip · ext rw [← smul_sub, vsub_sub_vsub_cancel_left] rw [← sum_smul, h, one_smul, vsub_add_vsub_cancel, vsub_self] #align finset.weighted_vsub_of_point_vadd_eq_of_sum_eq_one Finset.weightedVSubOfPoint_vadd_eq_of_sum_eq_one @[simp (high)] theorem weightedVSubOfPoint_erase [DecidableEq ι] (w : ι → k) (p : ι → P) (i : ι) : (s.erase i).weightedVSubOfPoint p (p i) w = s.weightedVSubOfPoint p (p i) w := by rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply] apply sum_erase rw [vsub_self, smul_zero] #align finset.weighted_vsub_of_point_erase Finset.weightedVSubOfPoint_erase @[simp (high)] theorem weightedVSubOfPoint_insert [DecidableEq ι] (w : ι → k) (p : ι → P) (i : ι) : (insert i s).weightedVSubOfPoint p (p i) w = s.weightedVSubOfPoint p (p i) w := by rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply] apply sum_insert_zero rw [vsub_self, smul_zero] #align finset.weighted_vsub_of_point_insert Finset.weightedVSubOfPoint_insert theorem weightedVSubOfPoint_indicator_subset (w : ι → k) (p : ι → P) (b : P) {s₁ s₂ : Finset ι} (h : s₁ ⊆ s₂) : s₁.weightedVSubOfPoint p b w = s₂.weightedVSubOfPoint p b (Set.indicator (↑s₁) w) := by rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply] exact Eq.symm <| sum_indicator_subset_of_eq_zero w (fun i wi => wi • (p i -ᵥ b : V)) h fun i => zero_smul k _ #align finset.weighted_vsub_of_point_indicator_subset Finset.weightedVSubOfPoint_indicator_subset theorem weightedVSubOfPoint_map (e : ι₂ ↪ ι) (w : ι → k) (p : ι → P) (b : P) : (s₂.map e).weightedVSubOfPoint p b w = s₂.weightedVSubOfPoint (p ∘ e) b (w ∘ e) := by simp_rw [weightedVSubOfPoint_apply] exact Finset.sum_map _ _ _ #align finset.weighted_vsub_of_point_map Finset.weightedVSubOfPoint_map theorem sum_smul_vsub_eq_weightedVSubOfPoint_sub (w : ι → k) (p₁ p₂ : ι → P) (b : P) : (∑ i ∈ s, w i • (p₁ i -ᵥ p₂ i)) = s.weightedVSubOfPoint p₁ b w - s.weightedVSubOfPoint p₂ b w := by simp_rw [weightedVSubOfPoint_apply, ← sum_sub_distrib, ← smul_sub, vsub_sub_vsub_cancel_right] #align finset.sum_smul_vsub_eq_weighted_vsub_of_point_sub Finset.sum_smul_vsub_eq_weightedVSubOfPoint_sub theorem sum_smul_vsub_const_eq_weightedVSubOfPoint_sub (w : ι → k) (p₁ : ι → P) (p₂ b : P) : (∑ i ∈ s, w i • (p₁ i -ᵥ p₂)) = s.weightedVSubOfPoint p₁ b w - (∑ i ∈ s, w i) • (p₂ -ᵥ b) := by rw [sum_smul_vsub_eq_weightedVSubOfPoint_sub, weightedVSubOfPoint_apply_const] #align finset.sum_smul_vsub_const_eq_weighted_vsub_of_point_sub Finset.sum_smul_vsub_const_eq_weightedVSubOfPoint_sub theorem sum_smul_const_vsub_eq_sub_weightedVSubOfPoint (w : ι → k) (p₂ : ι → P) (p₁ b : P) : (∑ i ∈ s, w i • (p₁ -ᵥ p₂ i)) = (∑ i ∈ s, w i) • (p₁ -ᵥ b) - s.weightedVSubOfPoint p₂ b w := by rw [sum_smul_vsub_eq_weightedVSubOfPoint_sub, weightedVSubOfPoint_apply_const] #align finset.sum_smul_const_vsub_eq_sub_weighted_vsub_of_point Finset.sum_smul_const_vsub_eq_sub_weightedVSubOfPoint theorem weightedVSubOfPoint_sdiff [DecidableEq ι] {s₂ : Finset ι} (h : s₂ ⊆ s) (w : ι → k) (p : ι → P) (b : P) : (s \ s₂).weightedVSubOfPoint p b w + s₂.weightedVSubOfPoint p b w = s.weightedVSubOfPoint p b w := by simp_rw [weightedVSubOfPoint_apply, sum_sdiff h] #align finset.weighted_vsub_of_point_sdiff Finset.weightedVSubOfPoint_sdiff theorem weightedVSubOfPoint_sdiff_sub [DecidableEq ι] {s₂ : Finset ι} (h : s₂ ⊆ s) (w : ι → k) (p : ι → P) (b : P) : (s \ s₂).weightedVSubOfPoint p b w - s₂.weightedVSubOfPoint p b (-w) = s.weightedVSubOfPoint p b w := by rw [map_neg, sub_neg_eq_add, s.weightedVSubOfPoint_sdiff h] #align finset.weighted_vsub_of_point_sdiff_sub Finset.weightedVSubOfPoint_sdiff_sub theorem weightedVSubOfPoint_subtype_eq_filter (w : ι → k) (p : ι → P) (b : P) (pred : ι → Prop) [DecidablePred pred] : ((s.subtype pred).weightedVSubOfPoint (fun i => p i) b fun i => w i) = (s.filter pred).weightedVSubOfPoint p b w := by rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, ← sum_subtype_eq_sum_filter] #align finset.weighted_vsub_of_point_subtype_eq_filter Finset.weightedVSubOfPoint_subtype_eq_filter theorem weightedVSubOfPoint_filter_of_ne (w : ι → k) (p : ι → P) (b : P) {pred : ι → Prop} [DecidablePred pred] (h : ∀ i ∈ s, w i ≠ 0 → pred i) : (s.filter pred).weightedVSubOfPoint p b w = s.weightedVSubOfPoint p b w := by rw [weightedVSubOfPoint_apply, weightedVSubOfPoint_apply, sum_filter_of_ne] intro i hi hne refine h i hi ?_ intro hw simp [hw] at hne #align finset.weighted_vsub_of_point_filter_of_ne Finset.weightedVSubOfPoint_filter_of_ne theorem weightedVSubOfPoint_const_smul (w : ι → k) (p : ι → P) (b : P) (c : k) : s.weightedVSubOfPoint p b (c • w) = c • s.weightedVSubOfPoint p b w := by simp_rw [weightedVSubOfPoint_apply, smul_sum, Pi.smul_apply, smul_smul, smul_eq_mul] #align finset.weighted_vsub_of_point_const_smul Finset.weightedVSubOfPoint_const_smul def weightedVSub (p : ι → P) : (ι → k) →ₗ[k] V := s.weightedVSubOfPoint p (Classical.choice S.nonempty) #align finset.weighted_vsub Finset.weightedVSub theorem weightedVSub_apply (w : ι → k) (p : ι → P) : s.weightedVSub p w = ∑ i ∈ s, w i • (p i -ᵥ Classical.choice S.nonempty) := by simp [weightedVSub, LinearMap.sum_apply] #align finset.weighted_vsub_apply Finset.weightedVSub_apply theorem weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero (w : ι → k) (p : ι → P) (h : ∑ i ∈ s, w i = 0) (b : P) : s.weightedVSub p w = s.weightedVSubOfPoint p b w := s.weightedVSubOfPoint_eq_of_sum_eq_zero w p h _ _ #align finset.weighted_vsub_eq_weighted_vsub_of_point_of_sum_eq_zero Finset.weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero @[simp] theorem weightedVSub_apply_const (w : ι → k) (p : P) (h : ∑ i ∈ s, w i = 0) : s.weightedVSub (fun _ => p) w = 0 := by rw [weightedVSub, weightedVSubOfPoint_apply_const, h, zero_smul] #align finset.weighted_vsub_apply_const Finset.weightedVSub_apply_const @[simp] theorem weightedVSub_empty (w : ι → k) (p : ι → P) : (∅ : Finset ι).weightedVSub p w = (0 : V) := by simp [weightedVSub_apply] #align finset.weighted_vsub_empty Finset.weightedVSub_empty theorem weightedVSub_congr {w₁ w₂ : ι → k} (hw : ∀ i ∈ s, w₁ i = w₂ i) {p₁ p₂ : ι → P} (hp : ∀ i ∈ s, p₁ i = p₂ i) : s.weightedVSub p₁ w₁ = s.weightedVSub p₂ w₂ := s.weightedVSubOfPoint_congr hw hp _ #align finset.weighted_vsub_congr Finset.weightedVSub_congr theorem weightedVSub_indicator_subset (w : ι → k) (p : ι → P) {s₁ s₂ : Finset ι} (h : s₁ ⊆ s₂) : s₁.weightedVSub p w = s₂.weightedVSub p (Set.indicator (↑s₁) w) := weightedVSubOfPoint_indicator_subset _ _ _ h #align finset.weighted_vsub_indicator_subset Finset.weightedVSub_indicator_subset theorem weightedVSub_map (e : ι₂ ↪ ι) (w : ι → k) (p : ι → P) : (s₂.map e).weightedVSub p w = s₂.weightedVSub (p ∘ e) (w ∘ e) := s₂.weightedVSubOfPoint_map _ _ _ _ #align finset.weighted_vsub_map Finset.weightedVSub_map theorem sum_smul_vsub_eq_weightedVSub_sub (w : ι → k) (p₁ p₂ : ι → P) : (∑ i ∈ s, w i • (p₁ i -ᵥ p₂ i)) = s.weightedVSub p₁ w - s.weightedVSub p₂ w := s.sum_smul_vsub_eq_weightedVSubOfPoint_sub _ _ _ _ #align finset.sum_smul_vsub_eq_weighted_vsub_sub Finset.sum_smul_vsub_eq_weightedVSub_sub theorem sum_smul_vsub_const_eq_weightedVSub (w : ι → k) (p₁ : ι → P) (p₂ : P) (h : ∑ i ∈ s, w i = 0) : (∑ i ∈ s, w i • (p₁ i -ᵥ p₂)) = s.weightedVSub p₁ w := by rw [sum_smul_vsub_eq_weightedVSub_sub, s.weightedVSub_apply_const _ _ h, sub_zero] #align finset.sum_smul_vsub_const_eq_weighted_vsub Finset.sum_smul_vsub_const_eq_weightedVSub theorem sum_smul_const_vsub_eq_neg_weightedVSub (w : ι → k) (p₂ : ι → P) (p₁ : P) (h : ∑ i ∈ s, w i = 0) : (∑ i ∈ s, w i • (p₁ -ᵥ p₂ i)) = -s.weightedVSub p₂ w := by rw [sum_smul_vsub_eq_weightedVSub_sub, s.weightedVSub_apply_const _ _ h, zero_sub] #align finset.sum_smul_const_vsub_eq_neg_weighted_vsub Finset.sum_smul_const_vsub_eq_neg_weightedVSub theorem weightedVSub_sdiff [DecidableEq ι] {s₂ : Finset ι} (h : s₂ ⊆ s) (w : ι → k) (p : ι → P) : (s \ s₂).weightedVSub p w + s₂.weightedVSub p w = s.weightedVSub p w := s.weightedVSubOfPoint_sdiff h _ _ _ #align finset.weighted_vsub_sdiff Finset.weightedVSub_sdiff theorem weightedVSub_sdiff_sub [DecidableEq ι] {s₂ : Finset ι} (h : s₂ ⊆ s) (w : ι → k) (p : ι → P) : (s \ s₂).weightedVSub p w - s₂.weightedVSub p (-w) = s.weightedVSub p w := s.weightedVSubOfPoint_sdiff_sub h _ _ _ #align finset.weighted_vsub_sdiff_sub Finset.weightedVSub_sdiff_sub theorem weightedVSub_subtype_eq_filter (w : ι → k) (p : ι → P) (pred : ι → Prop) [DecidablePred pred] : ((s.subtype pred).weightedVSub (fun i => p i) fun i => w i) = (s.filter pred).weightedVSub p w := s.weightedVSubOfPoint_subtype_eq_filter _ _ _ _ #align finset.weighted_vsub_subtype_eq_filter Finset.weightedVSub_subtype_eq_filter theorem weightedVSub_filter_of_ne (w : ι → k) (p : ι → P) {pred : ι → Prop} [DecidablePred pred] (h : ∀ i ∈ s, w i ≠ 0 → pred i) : (s.filter pred).weightedVSub p w = s.weightedVSub p w := s.weightedVSubOfPoint_filter_of_ne _ _ _ h #align finset.weighted_vsub_filter_of_ne Finset.weightedVSub_filter_of_ne theorem weightedVSub_const_smul (w : ι → k) (p : ι → P) (c : k) : s.weightedVSub p (c • w) = c • s.weightedVSub p w := s.weightedVSubOfPoint_const_smul _ _ _ _ #align finset.weighted_vsub_const_smul Finset.weightedVSub_const_smul instance : AffineSpace (ι → k) (ι → k) := Pi.instAddTorsor variable (k) def affineCombination (p : ι → P) : (ι → k) →ᵃ[k] P where toFun w := s.weightedVSubOfPoint p (Classical.choice S.nonempty) w +ᵥ Classical.choice S.nonempty linear := s.weightedVSub p map_vadd' w₁ w₂ := by simp_rw [vadd_vadd, weightedVSub, vadd_eq_add, LinearMap.map_add] #align finset.affine_combination Finset.affineCombination @[simp] theorem affineCombination_linear (p : ι → P) : (s.affineCombination k p).linear = s.weightedVSub p := rfl #align finset.affine_combination_linear Finset.affineCombination_linear variable {k} theorem affineCombination_apply (w : ι → k) (p : ι → P) : (s.affineCombination k p) w = s.weightedVSubOfPoint p (Classical.choice S.nonempty) w +ᵥ Classical.choice S.nonempty := rfl #align finset.affine_combination_apply Finset.affineCombination_apply @[simp] theorem affineCombination_apply_const (w : ι → k) (p : P) (h : ∑ i ∈ s, w i = 1) : s.affineCombination k (fun _ => p) w = p := by rw [affineCombination_apply, s.weightedVSubOfPoint_apply_const, h, one_smul, vsub_vadd] #align finset.affine_combination_apply_const Finset.affineCombination_apply_const theorem affineCombination_congr {w₁ w₂ : ι → k} (hw : ∀ i ∈ s, w₁ i = w₂ i) {p₁ p₂ : ι → P} (hp : ∀ i ∈ s, p₁ i = p₂ i) : s.affineCombination k p₁ w₁ = s.affineCombination k p₂ w₂ := by simp_rw [affineCombination_apply, s.weightedVSubOfPoint_congr hw hp] #align finset.affine_combination_congr Finset.affineCombination_congr theorem affineCombination_eq_weightedVSubOfPoint_vadd_of_sum_eq_one (w : ι → k) (p : ι → P) (h : ∑ i ∈ s, w i = 1) (b : P) : s.affineCombination k p w = s.weightedVSubOfPoint p b w +ᵥ b := s.weightedVSubOfPoint_vadd_eq_of_sum_eq_one w p h _ _ #align finset.affine_combination_eq_weighted_vsub_of_point_vadd_of_sum_eq_one Finset.affineCombination_eq_weightedVSubOfPoint_vadd_of_sum_eq_one theorem weightedVSub_vadd_affineCombination (w₁ w₂ : ι → k) (p : ι → P) : s.weightedVSub p w₁ +ᵥ s.affineCombination k p w₂ = s.affineCombination k p (w₁ + w₂) := by rw [← vadd_eq_add, AffineMap.map_vadd, affineCombination_linear] #align finset.weighted_vsub_vadd_affine_combination Finset.weightedVSub_vadd_affineCombination theorem affineCombination_vsub (w₁ w₂ : ι → k) (p : ι → P) : s.affineCombination k p w₁ -ᵥ s.affineCombination k p w₂ = s.weightedVSub p (w₁ - w₂) := by rw [← AffineMap.linearMap_vsub, affineCombination_linear, vsub_eq_sub] #align finset.affine_combination_vsub Finset.affineCombination_vsub theorem attach_affineCombination_of_injective [DecidableEq P] (s : Finset P) (w : P → k) (f : s → P) (hf : Function.Injective f) : s.attach.affineCombination k f (w ∘ f) = (image f univ).affineCombination k id w := by simp only [affineCombination, weightedVSubOfPoint_apply, id, vadd_right_cancel_iff, Function.comp_apply, AffineMap.coe_mk] let g₁ : s → V := fun i => w (f i) • (f i -ᵥ Classical.choice S.nonempty) let g₂ : P → V := fun i => w i • (i -ᵥ Classical.choice S.nonempty) change univ.sum g₁ = (image f univ).sum g₂ have hgf : g₁ = g₂ ∘ f := by ext simp rw [hgf, sum_image] · simp only [Function.comp_apply] · exact fun _ _ _ _ hxy => hf hxy #align finset.attach_affine_combination_of_injective Finset.attach_affineCombination_of_injective theorem attach_affineCombination_coe (s : Finset P) (w : P → k) : s.attach.affineCombination k ((↑) : s → P) (w ∘ (↑)) = s.affineCombination k id w := by classical rw [attach_affineCombination_of_injective s w ((↑) : s → P) Subtype.coe_injective, univ_eq_attach, attach_image_val] #align finset.attach_affine_combination_coe Finset.attach_affineCombination_coe @[simp] theorem weightedVSub_eq_linear_combination {ι} (s : Finset ι) {w : ι → k} {p : ι → V} (hw : s.sum w = 0) : s.weightedVSub p w = ∑ i ∈ s, w i • p i := by simp [s.weightedVSub_apply, vsub_eq_sub, smul_sub, ← Finset.sum_smul, hw] #align finset.weighted_vsub_eq_linear_combination Finset.weightedVSub_eq_linear_combination @[simp] theorem affineCombination_eq_linear_combination (s : Finset ι) (p : ι → V) (w : ι → k) (hw : ∑ i ∈ s, w i = 1) : s.affineCombination k p w = ∑ i ∈ s, w i • p i := by simp [s.affineCombination_eq_weightedVSubOfPoint_vadd_of_sum_eq_one w p hw 0] #align finset.affine_combination_eq_linear_combination Finset.affineCombination_eq_linear_combination @[simp] theorem affineCombination_of_eq_one_of_eq_zero (w : ι → k) (p : ι → P) {i : ι} (his : i ∈ s) (hwi : w i = 1) (hw0 : ∀ i2 ∈ s, i2 ≠ i → w i2 = 0) : s.affineCombination k p w = p i := by have h1 : ∑ i ∈ s, w i = 1 := hwi ▸ sum_eq_single i hw0 fun h => False.elim (h his) rw [s.affineCombination_eq_weightedVSubOfPoint_vadd_of_sum_eq_one w p h1 (p i), weightedVSubOfPoint_apply] convert zero_vadd V (p i) refine sum_eq_zero ?_ intro i2 hi2 by_cases h : i2 = i · simp [h] · simp [hw0 i2 hi2 h] #align finset.affine_combination_of_eq_one_of_eq_zero Finset.affineCombination_of_eq_one_of_eq_zero theorem affineCombination_indicator_subset (w : ι → k) (p : ι → P) {s₁ s₂ : Finset ι} (h : s₁ ⊆ s₂) : s₁.affineCombination k p w = s₂.affineCombination k p (Set.indicator (↑s₁) w) := by rw [affineCombination_apply, affineCombination_apply, weightedVSubOfPoint_indicator_subset _ _ _ h] #align finset.affine_combination_indicator_subset Finset.affineCombination_indicator_subset theorem affineCombination_map (e : ι₂ ↪ ι) (w : ι → k) (p : ι → P) : (s₂.map e).affineCombination k p w = s₂.affineCombination k (p ∘ e) (w ∘ e) := by simp_rw [affineCombination_apply, weightedVSubOfPoint_map] #align finset.affine_combination_map Finset.affineCombination_map theorem sum_smul_vsub_eq_affineCombination_vsub (w : ι → k) (p₁ p₂ : ι → P) : (∑ i ∈ s, w i • (p₁ i -ᵥ p₂ i)) = s.affineCombination k p₁ w -ᵥ s.affineCombination k p₂ w := by simp_rw [affineCombination_apply, vadd_vsub_vadd_cancel_right] exact s.sum_smul_vsub_eq_weightedVSubOfPoint_sub _ _ _ _ #align finset.sum_smul_vsub_eq_affine_combination_vsub Finset.sum_smul_vsub_eq_affineCombination_vsub theorem sum_smul_vsub_const_eq_affineCombination_vsub (w : ι → k) (p₁ : ι → P) (p₂ : P) (h : ∑ i ∈ s, w i = 1) : (∑ i ∈ s, w i • (p₁ i -ᵥ p₂)) = s.affineCombination k p₁ w -ᵥ p₂ := by rw [sum_smul_vsub_eq_affineCombination_vsub, affineCombination_apply_const _ _ _ h] #align finset.sum_smul_vsub_const_eq_affine_combination_vsub Finset.sum_smul_vsub_const_eq_affineCombination_vsub theorem sum_smul_const_vsub_eq_vsub_affineCombination (w : ι → k) (p₂ : ι → P) (p₁ : P) (h : ∑ i ∈ s, w i = 1) : (∑ i ∈ s, w i • (p₁ -ᵥ p₂ i)) = p₁ -ᵥ s.affineCombination k p₂ w := by rw [sum_smul_vsub_eq_affineCombination_vsub, affineCombination_apply_const _ _ _ h] #align finset.sum_smul_const_vsub_eq_vsub_affine_combination Finset.sum_smul_const_vsub_eq_vsub_affineCombination
Mathlib/LinearAlgebra/AffineSpace/Combination.lean
526
530
theorem affineCombination_sdiff_sub [DecidableEq ι] {s₂ : Finset ι} (h : s₂ ⊆ s) (w : ι → k) (p : ι → P) : (s \ s₂).affineCombination k p w -ᵥ s₂.affineCombination k p (-w) = s.weightedVSub p w := by
simp_rw [affineCombination_apply, vadd_vsub_vadd_cancel_right] exact s.weightedVSub_sdiff_sub h _ _
import Mathlib.LinearAlgebra.Finsupp import Mathlib.Algebra.MonoidAlgebra.Support import Mathlib.Algebra.DirectSum.Internal import Mathlib.RingTheory.GradedAlgebra.Basic #align_import algebra.monoid_algebra.grading from "leanprover-community/mathlib"@"feb99064803fd3108e37c18b0f77d0a8344677a3" noncomputable section namespace AddMonoidAlgebra variable {M : Type*} {ι : Type*} {R : Type*} section variable (R) [CommSemiring R] abbrev gradeBy (f : M → ι) (i : ι) : Submodule R R[M] where carrier := { a | ∀ m, m ∈ a.support → f m = i } zero_mem' m h := by cases h add_mem' {a b} ha hb m h := by classical exact (Finset.mem_union.mp (Finsupp.support_add h)).elim (ha m) (hb m) smul_mem' a m h := Set.Subset.trans Finsupp.support_smul h #align add_monoid_algebra.grade_by AddMonoidAlgebra.gradeBy abbrev grade (m : M) : Submodule R R[M] := gradeBy R id m #align add_monoid_algebra.grade AddMonoidAlgebra.grade theorem gradeBy_id : gradeBy R (id : M → M) = grade R := rfl #align add_monoid_algebra.grade_by_id AddMonoidAlgebra.gradeBy_id theorem mem_gradeBy_iff (f : M → ι) (i : ι) (a : R[M]) : a ∈ gradeBy R f i ↔ (a.support : Set M) ⊆ f ⁻¹' {i} := by rfl #align add_monoid_algebra.mem_grade_by_iff AddMonoidAlgebra.mem_gradeBy_iff theorem mem_grade_iff (m : M) (a : R[M]) : a ∈ grade R m ↔ a.support ⊆ {m} := by rw [← Finset.coe_subset, Finset.coe_singleton] rfl #align add_monoid_algebra.mem_grade_iff AddMonoidAlgebra.mem_grade_iff theorem mem_grade_iff' (m : M) (a : R[M]) : a ∈ grade R m ↔ a ∈ (LinearMap.range (Finsupp.lsingle m : R →ₗ[R] M →₀ R) : Submodule R R[M]) := by rw [mem_grade_iff, Finsupp.support_subset_singleton'] apply exists_congr intro r constructor <;> exact Eq.symm #align add_monoid_algebra.mem_grade_iff' AddMonoidAlgebra.mem_grade_iff' theorem grade_eq_lsingle_range (m : M) : grade R m = LinearMap.range (Finsupp.lsingle m : R →ₗ[R] M →₀ R) := Submodule.ext (mem_grade_iff' R m) #align add_monoid_algebra.grade_eq_lsingle_range AddMonoidAlgebra.grade_eq_lsingle_range theorem single_mem_gradeBy {R} [CommSemiring R] (f : M → ι) (m : M) (r : R) : Finsupp.single m r ∈ gradeBy R f (f m) := by intro x hx rw [Finset.mem_singleton.mp (Finsupp.support_single_subset hx)] #align add_monoid_algebra.single_mem_grade_by AddMonoidAlgebra.single_mem_gradeBy theorem single_mem_grade {R} [CommSemiring R] (i : M) (r : R) : Finsupp.single i r ∈ grade R i := single_mem_gradeBy _ _ _ #align add_monoid_algebra.single_mem_grade AddMonoidAlgebra.single_mem_grade end open DirectSum instance gradeBy.gradedMonoid [AddMonoid M] [AddMonoid ι] [CommSemiring R] (f : M →+ ι) : SetLike.GradedMonoid (gradeBy R f : ι → Submodule R R[M]) where one_mem m h := by rw [one_def] at h obtain rfl : m = 0 := Finset.mem_singleton.1 <| Finsupp.support_single_subset h apply map_zero mul_mem i j a b ha hb c hc := by classical obtain ⟨ma, hma, mb, hmb, rfl⟩ : ∃ y ∈ a.support, ∃ z ∈ b.support, y + z = c := Finset.mem_add.1 <| support_mul a b hc rw [map_add, ha ma hma, hb mb hmb] #align add_monoid_algebra.grade_by.graded_monoid AddMonoidAlgebra.gradeBy.gradedMonoid instance grade.gradedMonoid [AddMonoid M] [CommSemiring R] : SetLike.GradedMonoid (grade R : M → Submodule R R[M]) := by apply gradeBy.gradedMonoid (AddMonoidHom.id _) #align add_monoid_algebra.grade.graded_monoid AddMonoidAlgebra.grade.gradedMonoid variable [AddMonoid M] [DecidableEq ι] [AddMonoid ι] [CommSemiring R] (f : M →+ ι) def decomposeAux : R[M] →ₐ[R] ⨁ i : ι, gradeBy R f i := AddMonoidAlgebra.lift R M _ { toFun := fun m => DirectSum.of (fun i : ι => gradeBy R f i) (f (Multiplicative.toAdd m)) ⟨Finsupp.single (Multiplicative.toAdd m) 1, single_mem_gradeBy _ _ _⟩ map_one' := DirectSum.of_eq_of_gradedMonoid_eq (by congr 2 <;> simp) map_mul' := fun i j => by symm dsimp only [toAdd_one, Eq.ndrec, Set.mem_setOf_eq, ne_eq, OneHom.toFun_eq_coe, OneHom.coe_mk, toAdd_mul] convert DirectSum.of_mul_of (A := (fun i : ι => gradeBy R f i)) _ _ repeat { rw [ AddMonoidHom.map_add] } simp only [SetLike.coe_gMul] exact Eq.trans (by rw [one_mul]) single_mul_single.symm } #align add_monoid_algebra.decompose_aux AddMonoidAlgebra.decomposeAux theorem decomposeAux_single (m : M) (r : R) : decomposeAux f (Finsupp.single m r) = DirectSum.of (fun i : ι => gradeBy R f i) (f m) ⟨Finsupp.single m r, single_mem_gradeBy _ _ _⟩ := by refine (lift_single _ _ _).trans ?_ refine (DirectSum.of_smul R _ _ _).symm.trans ?_ apply DirectSum.of_eq_of_gradedMonoid_eq refine Sigma.subtype_ext rfl ?_ refine (Finsupp.smul_single' _ _ _).trans ?_ rw [mul_one] rfl #align add_monoid_algebra.decompose_aux_single AddMonoidAlgebra.decomposeAux_single
Mathlib/Algebra/MonoidAlgebra/Grading.lean
153
177
theorem decomposeAux_coe {i : ι} (x : gradeBy R f i) : decomposeAux f ↑x = DirectSum.of (fun i => gradeBy R f i) i x := by
classical obtain ⟨x, hx⟩ := x revert hx refine Finsupp.induction x ?_ ?_ · intro hx symm exact AddMonoidHom.map_zero _ · intro m b y hmy hb ih hmby have : Disjoint (Finsupp.single m b).support y.support := by simpa only [Finsupp.support_single_ne_zero _ hb, Finset.disjoint_singleton_left] rw [mem_gradeBy_iff, Finsupp.support_add_eq this, Finset.coe_union, Set.union_subset_iff] at hmby cases' hmby with h1 h2 have : f m = i := by rwa [Finsupp.support_single_ne_zero _ hb, Finset.coe_singleton, Set.singleton_subset_iff] at h1 subst this simp only [AlgHom.map_add, Submodule.coe_mk, decomposeAux_single f m] let ih' := ih h2 dsimp at ih' rw [ih', ← AddMonoidHom.map_add] apply DirectSum.of_eq_of_gradedMonoid_eq congr 2
import Mathlib.Data.Finset.Pointwise #align_import combinatorics.additive.e_transform from "leanprover-community/mathlib"@"207c92594599a06e7c134f8d00a030a83e6c7259" open MulOpposite open Pointwise variable {α : Type*} [DecidableEq α] namespace Finset section Group variable [Group α] (e : α) (x : Finset α × Finset α) @[to_additive (attr := simps) "An **e-transform**. Turns `(s, t)` into `(s ∩ s +ᵥ e, t ∪ -e +ᵥ t)`. This reduces the sum of the two sets."] def mulETransformLeft : Finset α × Finset α := (x.1 ∩ op e • x.1, x.2 ∪ e⁻¹ • x.2) #align finset.mul_e_transform_left Finset.mulETransformLeft #align finset.add_e_transform_left Finset.addETransformLeft @[to_additive (attr := simps) "An **e-transform**. Turns `(s, t)` into `(s ∪ s +ᵥ e, t ∩ -e +ᵥ t)`. This reduces the sum of the two sets."] def mulETransformRight : Finset α × Finset α := (x.1 ∪ op e • x.1, x.2 ∩ e⁻¹ • x.2) #align finset.mul_e_transform_right Finset.mulETransformRight #align finset.add_e_transform_right Finset.addETransformRight @[to_additive (attr := simp)] theorem mulETransformLeft_one : mulETransformLeft 1 x = x := by simp [mulETransformLeft] #align finset.mul_e_transform_left_one Finset.mulETransformLeft_one #align finset.add_e_transform_left_zero Finset.addETransformLeft_zero @[to_additive (attr := simp)] theorem mulETransformRight_one : mulETransformRight 1 x = x := by simp [mulETransformRight] #align finset.mul_e_transform_right_one Finset.mulETransformRight_one #align finset.add_e_transform_right_zero Finset.addETransformRight_zero @[to_additive]
Mathlib/Combinatorics/Additive/ETransform.lean
142
145
theorem mulETransformLeft.fst_mul_snd_subset : (mulETransformLeft e x).1 * (mulETransformLeft e x).2 ⊆ x.1 * x.2 := by
refine inter_mul_union_subset_union.trans (union_subset Subset.rfl ?_) rw [op_smul_finset_mul_eq_mul_smul_finset, smul_inv_smul]
import Mathlib.RingTheory.IntegralClosure import Mathlib.RingTheory.FractionalIdeal.Basic #align_import ring_theory.fractional_ideal from "leanprover-community/mathlib"@"ed90a7d327c3a5caf65a6faf7e8a0d63c4605df7" open IsLocalization Pointwise nonZeroDivisors namespace FractionalIdeal open Set Submodule variable {R : Type*} [CommRing R] {S : Submonoid R} {P : Type*} [CommRing P] variable [Algebra R P] [loc : IsLocalization S P] section variable {P' : Type*} [CommRing P'] [Algebra R P'] [loc' : IsLocalization S P'] variable {P'' : Type*} [CommRing P''] [Algebra R P''] [loc'' : IsLocalization S P''] theorem _root_.IsFractional.map (g : P →ₐ[R] P') {I : Submodule R P} : IsFractional S I → IsFractional S (Submodule.map g.toLinearMap I) | ⟨a, a_nonzero, hI⟩ => ⟨a, a_nonzero, fun b hb => by obtain ⟨b', b'_mem, hb'⟩ := Submodule.mem_map.mp hb rw [AlgHom.toLinearMap_apply] at hb' obtain ⟨x, hx⟩ := hI b' b'_mem use x rw [← g.commutes, hx, g.map_smul, hb']⟩ #align is_fractional.map IsFractional.map def map (g : P →ₐ[R] P') : FractionalIdeal S P → FractionalIdeal S P' := fun I => ⟨Submodule.map g.toLinearMap I, I.isFractional.map g⟩ #align fractional_ideal.map FractionalIdeal.map @[simp, norm_cast] theorem coe_map (g : P →ₐ[R] P') (I : FractionalIdeal S P) : ↑(map g I) = Submodule.map g.toLinearMap I := rfl #align fractional_ideal.coe_map FractionalIdeal.coe_map @[simp] theorem mem_map {I : FractionalIdeal S P} {g : P →ₐ[R] P'} {y : P'} : y ∈ I.map g ↔ ∃ x, x ∈ I ∧ g x = y := Submodule.mem_map #align fractional_ideal.mem_map FractionalIdeal.mem_map variable (I J : FractionalIdeal S P) (g : P →ₐ[R] P') @[simp] theorem map_id : I.map (AlgHom.id _ _) = I := coeToSubmodule_injective (Submodule.map_id (I : Submodule R P)) #align fractional_ideal.map_id FractionalIdeal.map_id @[simp] theorem map_comp (g' : P' →ₐ[R] P'') : I.map (g'.comp g) = (I.map g).map g' := coeToSubmodule_injective (Submodule.map_comp g.toLinearMap g'.toLinearMap I) #align fractional_ideal.map_comp FractionalIdeal.map_comp @[simp, norm_cast] theorem map_coeIdeal (I : Ideal R) : (I : FractionalIdeal S P).map g = I := by ext x simp only [mem_coeIdeal] constructor · rintro ⟨_, ⟨y, hy, rfl⟩, rfl⟩ exact ⟨y, hy, (g.commutes y).symm⟩ · rintro ⟨y, hy, rfl⟩ exact ⟨_, ⟨y, hy, rfl⟩, g.commutes y⟩ #align fractional_ideal.map_coe_ideal FractionalIdeal.map_coeIdeal @[simp] theorem map_one : (1 : FractionalIdeal S P).map g = 1 := map_coeIdeal g ⊤ #align fractional_ideal.map_one FractionalIdeal.map_one @[simp] theorem map_zero : (0 : FractionalIdeal S P).map g = 0 := map_coeIdeal g 0 #align fractional_ideal.map_zero FractionalIdeal.map_zero @[simp] theorem map_add : (I + J).map g = I.map g + J.map g := coeToSubmodule_injective (Submodule.map_sup _ _ _) #align fractional_ideal.map_add FractionalIdeal.map_add @[simp] theorem map_mul : (I * J).map g = I.map g * J.map g := by simp only [mul_def] exact coeToSubmodule_injective (Submodule.map_mul _ _ _) #align fractional_ideal.map_mul FractionalIdeal.map_mul @[simp] theorem map_map_symm (g : P ≃ₐ[R] P') : (I.map (g : P →ₐ[R] P')).map (g.symm : P' →ₐ[R] P) = I := by rw [← map_comp, g.symm_comp, map_id] #align fractional_ideal.map_map_symm FractionalIdeal.map_map_symm @[simp] theorem map_symm_map (I : FractionalIdeal S P') (g : P ≃ₐ[R] P') : (I.map (g.symm : P' →ₐ[R] P)).map (g : P →ₐ[R] P') = I := by rw [← map_comp, g.comp_symm, map_id] #align fractional_ideal.map_symm_map FractionalIdeal.map_symm_map theorem map_mem_map {f : P →ₐ[R] P'} (h : Function.Injective f) {x : P} {I : FractionalIdeal S P} : f x ∈ map f I ↔ x ∈ I := mem_map.trans ⟨fun ⟨_, hx', x'_eq⟩ => h x'_eq ▸ hx', fun h => ⟨x, h, rfl⟩⟩ #align fractional_ideal.map_mem_map FractionalIdeal.map_mem_map theorem map_injective (f : P →ₐ[R] P') (h : Function.Injective f) : Function.Injective (map f : FractionalIdeal S P → FractionalIdeal S P') := fun _ _ hIJ => ext fun _ => (map_mem_map h).symm.trans (hIJ.symm ▸ map_mem_map h) #align fractional_ideal.map_injective FractionalIdeal.map_injective def mapEquiv (g : P ≃ₐ[R] P') : FractionalIdeal S P ≃+* FractionalIdeal S P' where toFun := map g invFun := map g.symm map_add' I J := map_add I J _ map_mul' I J := map_mul I J _ left_inv I := by rw [← map_comp, AlgEquiv.symm_comp, map_id] right_inv I := by rw [← map_comp, AlgEquiv.comp_symm, map_id] #align fractional_ideal.map_equiv FractionalIdeal.mapEquiv @[simp] theorem coeFun_mapEquiv (g : P ≃ₐ[R] P') : (mapEquiv g : FractionalIdeal S P → FractionalIdeal S P') = map g := rfl #align fractional_ideal.coe_fun_map_equiv FractionalIdeal.coeFun_mapEquiv @[simp] theorem mapEquiv_apply (g : P ≃ₐ[R] P') (I : FractionalIdeal S P) : mapEquiv g I = map (↑g) I := rfl #align fractional_ideal.map_equiv_apply FractionalIdeal.mapEquiv_apply @[simp] theorem mapEquiv_symm (g : P ≃ₐ[R] P') : ((mapEquiv g).symm : FractionalIdeal S P' ≃+* _) = mapEquiv g.symm := rfl #align fractional_ideal.map_equiv_symm FractionalIdeal.mapEquiv_symm @[simp] theorem mapEquiv_refl : mapEquiv AlgEquiv.refl = RingEquiv.refl (FractionalIdeal S P) := RingEquiv.ext fun x => by simp #align fractional_ideal.map_equiv_refl FractionalIdeal.mapEquiv_refl theorem isFractional_span_iff {s : Set P} : IsFractional S (span R s) ↔ ∃ a ∈ S, ∀ b : P, b ∈ s → IsInteger R (a • b) := ⟨fun ⟨a, a_mem, h⟩ => ⟨a, a_mem, fun b hb => h b (subset_span hb)⟩, fun ⟨a, a_mem, h⟩ => ⟨a, a_mem, fun b hb => span_induction hb h (by rw [smul_zero] exact isInteger_zero) (fun x y hx hy => by rw [smul_add] exact isInteger_add hx hy) fun s x hx => by rw [smul_comm] exact isInteger_smul hx⟩⟩ #align fractional_ideal.is_fractional_span_iff FractionalIdeal.isFractional_span_iff theorem isFractional_of_fg {I : Submodule R P} (hI : I.FG) : IsFractional S I := by rcases hI with ⟨I, rfl⟩ rcases exist_integer_multiples_of_finset S I with ⟨⟨s, hs1⟩, hs⟩ rw [isFractional_span_iff] exact ⟨s, hs1, hs⟩ #align fractional_ideal.is_fractional_of_fg FractionalIdeal.isFractional_of_fg theorem mem_span_mul_finite_of_mem_mul {I J : FractionalIdeal S P} {x : P} (hx : x ∈ I * J) : ∃ T T' : Finset P, (T : Set P) ⊆ I ∧ (T' : Set P) ⊆ J ∧ x ∈ span R (T * T' : Set P) := Submodule.mem_span_mul_finite_of_mem_mul (by simpa using mem_coe.mpr hx) #align fractional_ideal.mem_span_mul_finite_of_mem_mul FractionalIdeal.mem_span_mul_finite_of_mem_mul variable (S) theorem coeIdeal_fg (inj : Function.Injective (algebraMap R P)) (I : Ideal R) : FG ((I : FractionalIdeal S P) : Submodule R P) ↔ I.FG := coeSubmodule_fg _ inj _ #align fractional_ideal.coe_ideal_fg FractionalIdeal.coeIdeal_fg variable {S} theorem fg_unit (I : (FractionalIdeal S P)ˣ) : FG (I : Submodule R P) := Submodule.fg_unit <| Units.map (coeSubmoduleHom S P).toMonoidHom I #align fractional_ideal.fg_unit FractionalIdeal.fg_unit theorem fg_of_isUnit (I : FractionalIdeal S P) (h : IsUnit I) : FG (I : Submodule R P) := fg_unit h.unit #align fractional_ideal.fg_of_is_unit FractionalIdeal.fg_of_isUnit theorem _root_.Ideal.fg_of_isUnit (inj : Function.Injective (algebraMap R P)) (I : Ideal R) (h : IsUnit (I : FractionalIdeal S P)) : I.FG := by rw [← coeIdeal_fg S inj I] exact FractionalIdeal.fg_of_isUnit I h #align ideal.fg_of_is_unit Ideal.fg_of_isUnit variable (S P P') noncomputable irreducible_def canonicalEquiv : FractionalIdeal S P ≃+* FractionalIdeal S P' := mapEquiv { ringEquivOfRingEquiv P P' (RingEquiv.refl R) (show S.map _ = S by rw [RingEquiv.toMonoidHom_refl, Submonoid.map_id]) with commutes' := fun r => ringEquivOfRingEquiv_eq _ _ } #align fractional_ideal.canonical_equiv FractionalIdeal.canonicalEquiv @[simp] theorem mem_canonicalEquiv_apply {I : FractionalIdeal S P} {x : P'} : x ∈ canonicalEquiv S P P' I ↔ ∃ y ∈ I, IsLocalization.map P' (RingHom.id R) (fun y (hy : y ∈ S) => show RingHom.id R y ∈ S from hy) (y : P) = x := by rw [canonicalEquiv, mapEquiv_apply, mem_map] exact ⟨fun ⟨y, mem, Eq⟩ => ⟨y, mem, Eq⟩, fun ⟨y, mem, Eq⟩ => ⟨y, mem, Eq⟩⟩ #align fractional_ideal.mem_canonical_equiv_apply FractionalIdeal.mem_canonicalEquiv_apply @[simp] theorem canonicalEquiv_symm : (canonicalEquiv S P P').symm = canonicalEquiv S P' P := RingEquiv.ext fun I => SetLike.ext_iff.mpr fun x => by rw [mem_canonicalEquiv_apply, canonicalEquiv, mapEquiv_symm, mapEquiv_apply, mem_map] exact ⟨fun ⟨y, mem, Eq⟩ => ⟨y, mem, Eq⟩, fun ⟨y, mem, Eq⟩ => ⟨y, mem, Eq⟩⟩ #align fractional_ideal.canonical_equiv_symm FractionalIdeal.canonicalEquiv_symm theorem canonicalEquiv_flip (I) : canonicalEquiv S P P' (canonicalEquiv S P' P I) = I := by rw [← canonicalEquiv_symm]; erw [RingEquiv.apply_symm_apply] #align fractional_ideal.canonical_equiv_flip FractionalIdeal.canonicalEquiv_flip @[simp] theorem canonicalEquiv_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P''] [IsLocalization S P''] (I : FractionalIdeal S P) : canonicalEquiv S P' P'' (canonicalEquiv S P P' I) = canonicalEquiv S P P'' I := by ext simp only [IsLocalization.map_map, RingHomInvPair.comp_eq₂, mem_canonicalEquiv_apply, exists_prop, exists_exists_and_eq_and] #align fractional_ideal.canonical_equiv_canonical_equiv FractionalIdeal.canonicalEquiv_canonicalEquiv theorem canonicalEquiv_trans_canonicalEquiv (P'' : Type*) [CommRing P''] [Algebra R P''] [IsLocalization S P''] : (canonicalEquiv S P P').trans (canonicalEquiv S P' P'') = canonicalEquiv S P P'' := RingEquiv.ext (canonicalEquiv_canonicalEquiv S P P' P'') #align fractional_ideal.canonical_equiv_trans_canonical_equiv FractionalIdeal.canonicalEquiv_trans_canonicalEquiv @[simp] theorem canonicalEquiv_coeIdeal (I : Ideal R) : canonicalEquiv S P P' I = I := by ext simp [IsLocalization.map_eq] #align fractional_ideal.canonical_equiv_coe_ideal FractionalIdeal.canonicalEquiv_coeIdeal @[simp] theorem canonicalEquiv_self : canonicalEquiv S P P = RingEquiv.refl _ := by rw [← canonicalEquiv_trans_canonicalEquiv S P P] convert (canonicalEquiv S P P).symm_trans_self exact (canonicalEquiv_symm S P P).symm #align fractional_ideal.canonical_equiv_self FractionalIdeal.canonicalEquiv_self end section PrincipalIdeal variable {R₁ : Type*} [CommRing R₁] {K : Type*} [Field K] variable [Algebra R₁ K] [IsFractionRing R₁ K] open scoped Classical variable (R₁) -- Porting note: `@[simps]` generated a `Subtype.val` coercion instead of a -- `FractionalIdeal.coeToSubmodule` coercion def spanFinset {ι : Type*} (s : Finset ι) (f : ι → K) : FractionalIdeal R₁⁰ K := ⟨Submodule.span R₁ (f '' s), by obtain ⟨a', ha'⟩ := IsLocalization.exist_integer_multiples R₁⁰ s f refine ⟨a', a'.2, fun x hx => Submodule.span_induction hx ?_ ?_ ?_ ?_⟩ · rintro _ ⟨i, hi, rfl⟩ exact ha' i hi · rw [smul_zero] exact IsLocalization.isInteger_zero · intro x y hx hy rw [smul_add] exact IsLocalization.isInteger_add hx hy · intro c x hx rw [smul_comm] exact IsLocalization.isInteger_smul hx⟩ #align fractional_ideal.span_finset FractionalIdeal.spanFinset @[simp] lemma spanFinset_coe {ι : Type*} (s : Finset ι) (f : ι → K) : (spanFinset R₁ s f : Submodule R₁ K) = Submodule.span R₁ (f '' s) := rfl variable {R₁} @[simp] theorem spanFinset_eq_zero {ι : Type*} {s : Finset ι} {f : ι → K} : spanFinset R₁ s f = 0 ↔ ∀ j ∈ s, f j = 0 := by simp only [← coeToSubmodule_inj, spanFinset_coe, coe_zero, Submodule.span_eq_bot, Set.mem_image, Finset.mem_coe, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂] #align fractional_ideal.span_finset_eq_zero FractionalIdeal.spanFinset_eq_zero theorem spanFinset_ne_zero {ι : Type*} {s : Finset ι} {f : ι → K} : spanFinset R₁ s f ≠ 0 ↔ ∃ j ∈ s, f j ≠ 0 := by simp #align fractional_ideal.span_finset_ne_zero FractionalIdeal.spanFinset_ne_zero open Submodule.IsPrincipal theorem isFractional_span_singleton (x : P) : IsFractional S (span R {x} : Submodule R P) := let ⟨a, ha⟩ := exists_integer_multiple S x isFractional_span_iff.mpr ⟨a, a.2, fun _ hx' => (Set.mem_singleton_iff.mp hx').symm ▸ ha⟩ #align fractional_ideal.is_fractional_span_singleton FractionalIdeal.isFractional_span_singleton variable (S) irreducible_def spanSingleton (x : P) : FractionalIdeal S P := ⟨span R {x}, isFractional_span_singleton x⟩ #align fractional_ideal.span_singleton FractionalIdeal.spanSingleton -- local attribute [semireducible] span_singleton @[simp] theorem coe_spanSingleton (x : P) : (spanSingleton S x : Submodule R P) = span R {x} := by rw [spanSingleton] rfl #align fractional_ideal.coe_span_singleton FractionalIdeal.coe_spanSingleton @[simp]
Mathlib/RingTheory/FractionalIdeal/Operations.lean
635
637
theorem mem_spanSingleton {x y : P} : x ∈ spanSingleton S y ↔ ∃ z : R, z • y = x := by
rw [spanSingleton] exact Submodule.mem_span_singleton
import Mathlib.Topology.ContinuousFunction.ZeroAtInfty open Topology Filter variable {E F 𝓕 : Type*} variable [SeminormedAddGroup E] [SeminormedAddCommGroup F] variable [FunLike 𝓕 E F] [ZeroAtInftyContinuousMapClass 𝓕 E F]
Mathlib/Analysis/Normed/Group/ZeroAtInfty.lean
24
34
theorem ZeroAtInftyContinuousMapClass.norm_le (f : 𝓕) (ε : ℝ) (hε : 0 < ε) : ∃ (r : ℝ), ∀ (x : E) (_hx : r < ‖x‖), ‖f x‖ < ε := by
have h := zero_at_infty f rw [tendsto_zero_iff_norm_tendsto_zero, tendsto_def] at h specialize h (Metric.ball 0 ε) (Metric.ball_mem_nhds 0 hε) rcases Metric.closedBall_compl_subset_of_mem_cocompact h 0 with ⟨r, hr⟩ use r intro x hr' suffices x ∈ (fun x ↦ ‖f x‖) ⁻¹' Metric.ball 0 ε by aesop apply hr aesop
import Mathlib.Data.Finsupp.Multiset import Mathlib.Order.Bounded import Mathlib.SetTheory.Cardinal.PartENat import Mathlib.SetTheory.Ordinal.Principal import Mathlib.Tactic.Linarith #align_import set_theory.cardinal.ordinal from "leanprover-community/mathlib"@"7c2ce0c2da15516b4e65d0c9e254bb6dc93abd1f" noncomputable section open Function Set Cardinal Equiv Order Ordinal open scoped Classical universe u v w namespace Cardinal section UsingOrdinals theorem ord_isLimit {c} (co : ℵ₀ ≤ c) : (ord c).IsLimit := by refine ⟨fun h => aleph0_ne_zero ?_, fun a => lt_imp_lt_of_le_imp_le fun h => ?_⟩ · rw [← Ordinal.le_zero, ord_le] at h simpa only [card_zero, nonpos_iff_eq_zero] using co.trans h · rw [ord_le] at h ⊢ rwa [← @add_one_of_aleph0_le (card a), ← card_succ] rw [← ord_le, ← le_succ_of_isLimit, ord_le] · exact co.trans h · rw [ord_aleph0] exact omega_isLimit #align cardinal.ord_is_limit Cardinal.ord_isLimit theorem noMaxOrder {c} (h : ℵ₀ ≤ c) : NoMaxOrder c.ord.out.α := Ordinal.out_no_max_of_succ_lt (ord_isLimit h).2 section aleph def alephIdx.initialSeg : @InitialSeg Cardinal Ordinal (· < ·) (· < ·) := @RelEmbedding.collapse Cardinal Ordinal (· < ·) (· < ·) _ Cardinal.ord.orderEmbedding.ltEmbedding #align cardinal.aleph_idx.initial_seg Cardinal.alephIdx.initialSeg def alephIdx : Cardinal → Ordinal := alephIdx.initialSeg #align cardinal.aleph_idx Cardinal.alephIdx @[simp] theorem alephIdx.initialSeg_coe : (alephIdx.initialSeg : Cardinal → Ordinal) = alephIdx := rfl #align cardinal.aleph_idx.initial_seg_coe Cardinal.alephIdx.initialSeg_coe @[simp] theorem alephIdx_lt {a b} : alephIdx a < alephIdx b ↔ a < b := alephIdx.initialSeg.toRelEmbedding.map_rel_iff #align cardinal.aleph_idx_lt Cardinal.alephIdx_lt @[simp] theorem alephIdx_le {a b} : alephIdx a ≤ alephIdx b ↔ a ≤ b := by rw [← not_lt, ← not_lt, alephIdx_lt] #align cardinal.aleph_idx_le Cardinal.alephIdx_le theorem alephIdx.init {a b} : b < alephIdx a → ∃ c, alephIdx c = b := alephIdx.initialSeg.init #align cardinal.aleph_idx.init Cardinal.alephIdx.init def alephIdx.relIso : @RelIso Cardinal.{u} Ordinal.{u} (· < ·) (· < ·) := @RelIso.ofSurjective Cardinal.{u} Ordinal.{u} (· < ·) (· < ·) alephIdx.initialSeg.{u} <| (InitialSeg.eq_or_principal alephIdx.initialSeg.{u}).resolve_right fun ⟨o, e⟩ => by have : ∀ c, alephIdx c < o := fun c => (e _).2 ⟨_, rfl⟩ refine Ordinal.inductionOn o ?_ this; intro α r _ h let s := ⨆ a, invFun alephIdx (Ordinal.typein r a) apply (lt_succ s).not_le have I : Injective.{u+2, u+2} alephIdx := alephIdx.initialSeg.toEmbedding.injective simpa only [typein_enum, leftInverse_invFun I (succ s)] using le_ciSup (Cardinal.bddAbove_range.{u, u} fun a : α => invFun alephIdx (Ordinal.typein r a)) (Ordinal.enum r _ (h (succ s))) #align cardinal.aleph_idx.rel_iso Cardinal.alephIdx.relIso @[simp] theorem alephIdx.relIso_coe : (alephIdx.relIso : Cardinal → Ordinal) = alephIdx := rfl #align cardinal.aleph_idx.rel_iso_coe Cardinal.alephIdx.relIso_coe @[simp] theorem type_cardinal : @type Cardinal (· < ·) _ = Ordinal.univ.{u, u + 1} := by rw [Ordinal.univ_id]; exact Quotient.sound ⟨alephIdx.relIso⟩ #align cardinal.type_cardinal Cardinal.type_cardinal @[simp] theorem mk_cardinal : #Cardinal = univ.{u, u + 1} := by simpa only [card_type, card_univ] using congr_arg card type_cardinal #align cardinal.mk_cardinal Cardinal.mk_cardinal def Aleph'.relIso := Cardinal.alephIdx.relIso.symm #align cardinal.aleph'.rel_iso Cardinal.Aleph'.relIso def aleph' : Ordinal → Cardinal := Aleph'.relIso #align cardinal.aleph' Cardinal.aleph' @[simp] theorem aleph'.relIso_coe : (Aleph'.relIso : Ordinal → Cardinal) = aleph' := rfl #align cardinal.aleph'.rel_iso_coe Cardinal.aleph'.relIso_coe @[simp] theorem aleph'_lt {o₁ o₂ : Ordinal} : aleph' o₁ < aleph' o₂ ↔ o₁ < o₂ := Aleph'.relIso.map_rel_iff #align cardinal.aleph'_lt Cardinal.aleph'_lt @[simp] theorem aleph'_le {o₁ o₂ : Ordinal} : aleph' o₁ ≤ aleph' o₂ ↔ o₁ ≤ o₂ := le_iff_le_iff_lt_iff_lt.2 aleph'_lt #align cardinal.aleph'_le Cardinal.aleph'_le @[simp] theorem aleph'_alephIdx (c : Cardinal) : aleph' c.alephIdx = c := Cardinal.alephIdx.relIso.toEquiv.symm_apply_apply c #align cardinal.aleph'_aleph_idx Cardinal.aleph'_alephIdx @[simp] theorem alephIdx_aleph' (o : Ordinal) : (aleph' o).alephIdx = o := Cardinal.alephIdx.relIso.toEquiv.apply_symm_apply o #align cardinal.aleph_idx_aleph' Cardinal.alephIdx_aleph' @[simp] theorem aleph'_zero : aleph' 0 = 0 := by rw [← nonpos_iff_eq_zero, ← aleph'_alephIdx 0, aleph'_le] apply Ordinal.zero_le #align cardinal.aleph'_zero Cardinal.aleph'_zero @[simp] theorem aleph'_succ {o : Ordinal} : aleph' (succ o) = succ (aleph' o) := by apply (succ_le_of_lt <| aleph'_lt.2 <| lt_succ o).antisymm' (Cardinal.alephIdx_le.1 <| _) rw [alephIdx_aleph', succ_le_iff, ← aleph'_lt, aleph'_alephIdx] apply lt_succ #align cardinal.aleph'_succ Cardinal.aleph'_succ @[simp] theorem aleph'_nat : ∀ n : ℕ, aleph' n = n | 0 => aleph'_zero | n + 1 => show aleph' (succ n) = n.succ by rw [aleph'_succ, aleph'_nat n, nat_succ] #align cardinal.aleph'_nat Cardinal.aleph'_nat theorem aleph'_le_of_limit {o : Ordinal} (l : o.IsLimit) {c} : aleph' o ≤ c ↔ ∀ o' < o, aleph' o' ≤ c := ⟨fun h o' h' => (aleph'_le.2 <| h'.le).trans h, fun h => by rw [← aleph'_alephIdx c, aleph'_le, limit_le l] intro x h' rw [← aleph'_le, aleph'_alephIdx] exact h _ h'⟩ #align cardinal.aleph'_le_of_limit Cardinal.aleph'_le_of_limit theorem aleph'_limit {o : Ordinal} (ho : o.IsLimit) : aleph' o = ⨆ a : Iio o, aleph' a := by refine le_antisymm ?_ (ciSup_le' fun i => aleph'_le.2 (le_of_lt i.2)) rw [aleph'_le_of_limit ho] exact fun a ha => le_ciSup (bddAbove_of_small _) (⟨a, ha⟩ : Iio o) #align cardinal.aleph'_limit Cardinal.aleph'_limit @[simp] theorem aleph'_omega : aleph' ω = ℵ₀ := eq_of_forall_ge_iff fun c => by simp only [aleph'_le_of_limit omega_isLimit, lt_omega, exists_imp, aleph0_le] exact forall_swap.trans (forall_congr' fun n => by simp only [forall_eq, aleph'_nat]) #align cardinal.aleph'_omega Cardinal.aleph'_omega @[simp] def aleph'Equiv : Ordinal ≃ Cardinal := ⟨aleph', alephIdx, alephIdx_aleph', aleph'_alephIdx⟩ #align cardinal.aleph'_equiv Cardinal.aleph'Equiv def aleph (o : Ordinal) : Cardinal := aleph' (ω + o) #align cardinal.aleph Cardinal.aleph @[simp] theorem aleph_lt {o₁ o₂ : Ordinal} : aleph o₁ < aleph o₂ ↔ o₁ < o₂ := aleph'_lt.trans (add_lt_add_iff_left _) #align cardinal.aleph_lt Cardinal.aleph_lt @[simp] theorem aleph_le {o₁ o₂ : Ordinal} : aleph o₁ ≤ aleph o₂ ↔ o₁ ≤ o₂ := le_iff_le_iff_lt_iff_lt.2 aleph_lt #align cardinal.aleph_le Cardinal.aleph_le @[simp] theorem max_aleph_eq (o₁ o₂ : Ordinal) : max (aleph o₁) (aleph o₂) = aleph (max o₁ o₂) := by rcases le_total (aleph o₁) (aleph o₂) with h | h · rw [max_eq_right h, max_eq_right (aleph_le.1 h)] · rw [max_eq_left h, max_eq_left (aleph_le.1 h)] #align cardinal.max_aleph_eq Cardinal.max_aleph_eq @[simp] theorem aleph_succ {o : Ordinal} : aleph (succ o) = succ (aleph o) := by rw [aleph, add_succ, aleph'_succ, aleph] #align cardinal.aleph_succ Cardinal.aleph_succ @[simp] theorem aleph_zero : aleph 0 = ℵ₀ := by rw [aleph, add_zero, aleph'_omega] #align cardinal.aleph_zero Cardinal.aleph_zero theorem aleph_limit {o : Ordinal} (ho : o.IsLimit) : aleph o = ⨆ a : Iio o, aleph a := by apply le_antisymm _ (ciSup_le' _) · rw [aleph, aleph'_limit (ho.add _)] refine ciSup_mono' (bddAbove_of_small _) ?_ rintro ⟨i, hi⟩ cases' lt_or_le i ω with h h · rcases lt_omega.1 h with ⟨n, rfl⟩ use ⟨0, ho.pos⟩ simpa using (nat_lt_aleph0 n).le · exact ⟨⟨_, (sub_lt_of_le h).2 hi⟩, aleph'_le.2 (le_add_sub _ _)⟩ · exact fun i => aleph_le.2 (le_of_lt i.2) #align cardinal.aleph_limit Cardinal.aleph_limit theorem aleph0_le_aleph' {o : Ordinal} : ℵ₀ ≤ aleph' o ↔ ω ≤ o := by rw [← aleph'_omega, aleph'_le] #align cardinal.aleph_0_le_aleph' Cardinal.aleph0_le_aleph' theorem aleph0_le_aleph (o : Ordinal) : ℵ₀ ≤ aleph o := by rw [aleph, aleph0_le_aleph'] apply Ordinal.le_add_right #align cardinal.aleph_0_le_aleph Cardinal.aleph0_le_aleph theorem aleph'_pos {o : Ordinal} (ho : 0 < o) : 0 < aleph' o := by rwa [← aleph'_zero, aleph'_lt] #align cardinal.aleph'_pos Cardinal.aleph'_pos theorem aleph_pos (o : Ordinal) : 0 < aleph o := aleph0_pos.trans_le (aleph0_le_aleph o) #align cardinal.aleph_pos Cardinal.aleph_pos @[simp] theorem aleph_toNat (o : Ordinal) : toNat (aleph o) = 0 := toNat_apply_of_aleph0_le <| aleph0_le_aleph o #align cardinal.aleph_to_nat Cardinal.aleph_toNat @[simp] theorem aleph_toPartENat (o : Ordinal) : toPartENat (aleph o) = ⊤ := toPartENat_apply_of_aleph0_le <| aleph0_le_aleph o #align cardinal.aleph_to_part_enat Cardinal.aleph_toPartENat instance nonempty_out_aleph (o : Ordinal) : Nonempty (aleph o).ord.out.α := by rw [out_nonempty_iff_ne_zero, ← ord_zero] exact fun h => (ord_injective h).not_gt (aleph_pos o) #align cardinal.nonempty_out_aleph Cardinal.nonempty_out_aleph theorem ord_aleph_isLimit (o : Ordinal) : (aleph o).ord.IsLimit := ord_isLimit <| aleph0_le_aleph _ #align cardinal.ord_aleph_is_limit Cardinal.ord_aleph_isLimit instance (o : Ordinal) : NoMaxOrder (aleph o).ord.out.α := out_no_max_of_succ_lt (ord_aleph_isLimit o).2 theorem exists_aleph {c : Cardinal} : ℵ₀ ≤ c ↔ ∃ o, c = aleph o := ⟨fun h => ⟨alephIdx c - ω, by rw [aleph, Ordinal.add_sub_cancel_of_le, aleph'_alephIdx] rwa [← aleph0_le_aleph', aleph'_alephIdx]⟩, fun ⟨o, e⟩ => e.symm ▸ aleph0_le_aleph _⟩ #align cardinal.exists_aleph Cardinal.exists_aleph theorem aleph'_isNormal : IsNormal (ord ∘ aleph') := ⟨fun o => ord_lt_ord.2 <| aleph'_lt.2 <| lt_succ o, fun o l a => by simp [ord_le, aleph'_le_of_limit l]⟩ #align cardinal.aleph'_is_normal Cardinal.aleph'_isNormal theorem aleph_isNormal : IsNormal (ord ∘ aleph) := aleph'_isNormal.trans <| add_isNormal ω #align cardinal.aleph_is_normal Cardinal.aleph_isNormal theorem succ_aleph0 : succ ℵ₀ = aleph 1 := by rw [← aleph_zero, ← aleph_succ, Ordinal.succ_zero] #align cardinal.succ_aleph_0 Cardinal.succ_aleph0 theorem aleph0_lt_aleph_one : ℵ₀ < aleph 1 := by rw [← succ_aleph0] apply lt_succ #align cardinal.aleph_0_lt_aleph_one Cardinal.aleph0_lt_aleph_one theorem countable_iff_lt_aleph_one {α : Type*} (s : Set α) : s.Countable ↔ #s < aleph 1 := by rw [← succ_aleph0, lt_succ_iff, le_aleph0_iff_set_countable] #align cardinal.countable_iff_lt_aleph_one Cardinal.countable_iff_lt_aleph_one theorem ord_card_unbounded : Unbounded (· < ·) { b : Ordinal | b.card.ord = b } := unbounded_lt_iff.2 fun a => ⟨_, ⟨by dsimp rw [card_ord], (lt_ord_succ_card a).le⟩⟩ #align cardinal.ord_card_unbounded Cardinal.ord_card_unbounded theorem eq_aleph'_of_eq_card_ord {o : Ordinal} (ho : o.card.ord = o) : ∃ a, (aleph' a).ord = o := ⟨Cardinal.alephIdx.relIso o.card, by simpa using ho⟩ #align cardinal.eq_aleph'_of_eq_card_ord Cardinal.eq_aleph'_of_eq_card_ord
Mathlib/SetTheory/Cardinal/Ordinal.lean
370
376
theorem ord_aleph'_eq_enum_card : ord ∘ aleph' = enumOrd { b : Ordinal | b.card.ord = b } := by
rw [← eq_enumOrd _ ord_card_unbounded, range_eq_iff] exact ⟨aleph'_isNormal.strictMono, ⟨fun a => by dsimp rw [card_ord], fun b hb => eq_aleph'_of_eq_card_ord hb⟩⟩
import Mathlib.Data.Finset.Sort import Mathlib.Data.Fin.VecNotation import Mathlib.Data.Sign import Mathlib.LinearAlgebra.AffineSpace.Combination import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv import Mathlib.LinearAlgebra.Basis.VectorSpace #align_import linear_algebra.affine_space.independent from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0" noncomputable section open Finset Function open scoped Affine section AffineIndependent variable (k : Type*) {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V] variable [AffineSpace V P] {ι : Type*} def AffineIndependent (p : ι → P) : Prop := ∀ (s : Finset ι) (w : ι → k), ∑ i ∈ s, w i = 0 → s.weightedVSub p w = (0 : V) → ∀ i ∈ s, w i = 0 #align affine_independent AffineIndependent theorem affineIndependent_def (p : ι → P) : AffineIndependent k p ↔ ∀ (s : Finset ι) (w : ι → k), ∑ i ∈ s, w i = 0 → s.weightedVSub p w = (0 : V) → ∀ i ∈ s, w i = 0 := Iff.rfl #align affine_independent_def affineIndependent_def theorem affineIndependent_of_subsingleton [Subsingleton ι] (p : ι → P) : AffineIndependent k p := fun _ _ h _ i hi => Fintype.eq_of_subsingleton_of_sum_eq h i hi #align affine_independent_of_subsingleton affineIndependent_of_subsingleton theorem affineIndependent_iff_of_fintype [Fintype ι] (p : ι → P) : AffineIndependent k p ↔ ∀ w : ι → k, ∑ i, w i = 0 → Finset.univ.weightedVSub p w = (0 : V) → ∀ i, w i = 0 := by constructor · exact fun h w hw hs i => h Finset.univ w hw hs i (Finset.mem_univ _) · intro h s w hw hs i hi rw [Finset.weightedVSub_indicator_subset _ _ (Finset.subset_univ s)] at hs rw [← Finset.sum_indicator_subset _ (Finset.subset_univ s)] at hw replace h := h ((↑s : Set ι).indicator w) hw hs i simpa [hi] using h #align affine_independent_iff_of_fintype affineIndependent_iff_of_fintype theorem affineIndependent_iff_linearIndependent_vsub (p : ι → P) (i1 : ι) : AffineIndependent k p ↔ LinearIndependent k fun i : { x // x ≠ i1 } => (p i -ᵥ p i1 : V) := by classical constructor · intro h rw [linearIndependent_iff'] intro s g hg i hi set f : ι → k := fun x => if hx : x = i1 then -∑ y ∈ s, g y else g ⟨x, hx⟩ with hfdef let s2 : Finset ι := insert i1 (s.map (Embedding.subtype _)) have hfg : ∀ x : { x // x ≠ i1 }, g x = f x := by intro x rw [hfdef] dsimp only erw [dif_neg x.property, Subtype.coe_eta] rw [hfg] have hf : ∑ ι ∈ s2, f ι = 0 := by rw [Finset.sum_insert (Finset.not_mem_map_subtype_of_not_property s (Classical.not_not.2 rfl)), Finset.sum_subtype_map_embedding fun x _ => (hfg x).symm] rw [hfdef] dsimp only rw [dif_pos rfl] exact neg_add_self _ have hs2 : s2.weightedVSub p f = (0 : V) := by set f2 : ι → V := fun x => f x • (p x -ᵥ p i1) with hf2def set g2 : { x // x ≠ i1 } → V := fun x => g x • (p x -ᵥ p i1) have hf2g2 : ∀ x : { x // x ≠ i1 }, f2 x = g2 x := by simp only [g2, hf2def] refine fun x => ?_ rw [hfg] rw [Finset.weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero s2 f p hf (p i1), Finset.weightedVSubOfPoint_insert, Finset.weightedVSubOfPoint_apply, Finset.sum_subtype_map_embedding fun x _ => hf2g2 x] exact hg exact h s2 f hf hs2 i (Finset.mem_insert_of_mem (Finset.mem_map.2 ⟨i, hi, rfl⟩)) · intro h rw [linearIndependent_iff'] at h intro s w hw hs i hi rw [Finset.weightedVSub_eq_weightedVSubOfPoint_of_sum_eq_zero s w p hw (p i1), ← s.weightedVSubOfPoint_erase w p i1, Finset.weightedVSubOfPoint_apply] at hs let f : ι → V := fun i => w i • (p i -ᵥ p i1) have hs2 : (∑ i ∈ (s.erase i1).subtype fun i => i ≠ i1, f i) = 0 := by rw [← hs] convert Finset.sum_subtype_of_mem f fun x => Finset.ne_of_mem_erase have h2 := h ((s.erase i1).subtype fun i => i ≠ i1) (fun x => w x) hs2 simp_rw [Finset.mem_subtype] at h2 have h2b : ∀ i ∈ s, i ≠ i1 → w i = 0 := fun i his hi => h2 ⟨i, hi⟩ (Finset.mem_erase_of_ne_of_mem hi his) exact Finset.eq_zero_of_sum_eq_zero hw h2b i hi #align affine_independent_iff_linear_independent_vsub affineIndependent_iff_linearIndependent_vsub theorem affineIndependent_set_iff_linearIndependent_vsub {s : Set P} {p₁ : P} (hp₁ : p₁ ∈ s) : AffineIndependent k (fun p => p : s → P) ↔ LinearIndependent k (fun v => v : (fun p => (p -ᵥ p₁ : V)) '' (s \ {p₁}) → V) := by rw [affineIndependent_iff_linearIndependent_vsub k (fun p => p : s → P) ⟨p₁, hp₁⟩] constructor · intro h have hv : ∀ v : (fun p => (p -ᵥ p₁ : V)) '' (s \ {p₁}), (v : V) +ᵥ p₁ ∈ s \ {p₁} := fun v => (vsub_left_injective p₁).mem_set_image.1 ((vadd_vsub (v : V) p₁).symm ▸ v.property) let f : (fun p : P => (p -ᵥ p₁ : V)) '' (s \ {p₁}) → { x : s // x ≠ ⟨p₁, hp₁⟩ } := fun x => ⟨⟨(x : V) +ᵥ p₁, Set.mem_of_mem_diff (hv x)⟩, fun hx => Set.not_mem_of_mem_diff (hv x) (Subtype.ext_iff.1 hx)⟩ convert h.comp f fun x1 x2 hx => Subtype.ext (vadd_right_cancel p₁ (Subtype.ext_iff.1 (Subtype.ext_iff.1 hx))) ext v exact (vadd_vsub (v : V) p₁).symm · intro h let f : { x : s // x ≠ ⟨p₁, hp₁⟩ } → (fun p : P => (p -ᵥ p₁ : V)) '' (s \ {p₁}) := fun x => ⟨((x : s) : P) -ᵥ p₁, ⟨x, ⟨⟨(x : s).property, fun hx => x.property (Subtype.ext hx)⟩, rfl⟩⟩⟩ convert h.comp f fun x1 x2 hx => Subtype.ext (Subtype.ext (vsub_left_cancel (Subtype.ext_iff.1 hx))) #align affine_independent_set_iff_linear_independent_vsub affineIndependent_set_iff_linearIndependent_vsub theorem linearIndependent_set_iff_affineIndependent_vadd_union_singleton {s : Set V} (hs : ∀ v ∈ s, v ≠ (0 : V)) (p₁ : P) : LinearIndependent k (fun v => v : s → V) ↔ AffineIndependent k (fun p => p : ({p₁} ∪ (fun v => v +ᵥ p₁) '' s : Set P) → P) := by rw [affineIndependent_set_iff_linearIndependent_vsub k (Set.mem_union_left _ (Set.mem_singleton p₁))] have h : (fun p => (p -ᵥ p₁ : V)) '' (({p₁} ∪ (fun v => v +ᵥ p₁) '' s) \ {p₁}) = s := by simp_rw [Set.union_diff_left, Set.image_diff (vsub_left_injective p₁), Set.image_image, Set.image_singleton, vsub_self, vadd_vsub, Set.image_id'] exact Set.diff_singleton_eq_self fun h => hs 0 h rfl rw [h] #align linear_independent_set_iff_affine_independent_vadd_union_singleton linearIndependent_set_iff_affineIndependent_vadd_union_singleton theorem affineIndependent_iff_indicator_eq_of_affineCombination_eq (p : ι → P) : AffineIndependent k p ↔ ∀ (s1 s2 : Finset ι) (w1 w2 : ι → k), ∑ i ∈ s1, w1 i = 1 → ∑ i ∈ s2, w2 i = 1 → s1.affineCombination k p w1 = s2.affineCombination k p w2 → Set.indicator (↑s1) w1 = Set.indicator (↑s2) w2 := by classical constructor · intro ha s1 s2 w1 w2 hw1 hw2 heq ext i by_cases hi : i ∈ s1 ∪ s2 · rw [← sub_eq_zero] rw [← Finset.sum_indicator_subset w1 (s1.subset_union_left (s₂:=s2))] at hw1 rw [← Finset.sum_indicator_subset w2 (s1.subset_union_right)] at hw2 have hws : (∑ i ∈ s1 ∪ s2, (Set.indicator (↑s1) w1 - Set.indicator (↑s2) w2) i) = 0 := by simp [hw1, hw2] rw [Finset.affineCombination_indicator_subset w1 p (s1.subset_union_left (s₂:=s2)), Finset.affineCombination_indicator_subset w2 p s1.subset_union_right, ← @vsub_eq_zero_iff_eq V, Finset.affineCombination_vsub] at heq exact ha (s1 ∪ s2) (Set.indicator (↑s1) w1 - Set.indicator (↑s2) w2) hws heq i hi · rw [← Finset.mem_coe, Finset.coe_union] at hi have h₁ : Set.indicator (↑s1) w1 i = 0 := by simp only [Set.indicator, Finset.mem_coe, ite_eq_right_iff] intro h by_contra exact (mt (@Set.mem_union_left _ i ↑s1 ↑s2) hi) h have h₂ : Set.indicator (↑s2) w2 i = 0 := by simp only [Set.indicator, Finset.mem_coe, ite_eq_right_iff] intro h by_contra exact (mt (@Set.mem_union_right _ i ↑s2 ↑s1) hi) h simp [h₁, h₂] · intro ha s w hw hs i0 hi0 let w1 : ι → k := Function.update (Function.const ι 0) i0 1 have hw1 : ∑ i ∈ s, w1 i = 1 := by rw [Finset.sum_update_of_mem hi0] simp only [Finset.sum_const_zero, add_zero, const_apply] have hw1s : s.affineCombination k p w1 = p i0 := s.affineCombination_of_eq_one_of_eq_zero w1 p hi0 (Function.update_same _ _ _) fun _ _ hne => Function.update_noteq hne _ _ let w2 := w + w1 have hw2 : ∑ i ∈ s, w2 i = 1 := by simp_all only [w2, Pi.add_apply, Finset.sum_add_distrib, zero_add] have hw2s : s.affineCombination k p w2 = p i0 := by simp_all only [w2, ← Finset.weightedVSub_vadd_affineCombination, zero_vadd] replace ha := ha s s w2 w1 hw2 hw1 (hw1s.symm ▸ hw2s) have hws : w2 i0 - w1 i0 = 0 := by rw [← Finset.mem_coe] at hi0 rw [← Set.indicator_of_mem hi0 w2, ← Set.indicator_of_mem hi0 w1, ha, sub_self] simpa [w2] using hws #align affine_independent_iff_indicator_eq_of_affine_combination_eq affineIndependent_iff_indicator_eq_of_affineCombination_eq theorem affineIndependent_iff_eq_of_fintype_affineCombination_eq [Fintype ι] (p : ι → P) : AffineIndependent k p ↔ ∀ w1 w2 : ι → k, ∑ i, w1 i = 1 → ∑ i, w2 i = 1 → Finset.univ.affineCombination k p w1 = Finset.univ.affineCombination k p w2 → w1 = w2 := by rw [affineIndependent_iff_indicator_eq_of_affineCombination_eq] constructor · intro h w1 w2 hw1 hw2 hweq simpa only [Set.indicator_univ, Finset.coe_univ] using h _ _ w1 w2 hw1 hw2 hweq · intro h s1 s2 w1 w2 hw1 hw2 hweq have hw1' : (∑ i, (s1 : Set ι).indicator w1 i) = 1 := by rwa [Finset.sum_indicator_subset _ (Finset.subset_univ s1)] have hw2' : (∑ i, (s2 : Set ι).indicator w2 i) = 1 := by rwa [Finset.sum_indicator_subset _ (Finset.subset_univ s2)] rw [Finset.affineCombination_indicator_subset w1 p (Finset.subset_univ s1), Finset.affineCombination_indicator_subset w2 p (Finset.subset_univ s2)] at hweq exact h _ _ hw1' hw2' hweq #align affine_independent_iff_eq_of_fintype_affine_combination_eq affineIndependent_iff_eq_of_fintype_affineCombination_eq variable {k} theorem AffineIndependent.units_lineMap {p : ι → P} (hp : AffineIndependent k p) (j : ι) (w : ι → Units k) : AffineIndependent k fun i => AffineMap.lineMap (p j) (p i) (w i : k) := by rw [affineIndependent_iff_linearIndependent_vsub k _ j] at hp ⊢ simp only [AffineMap.lineMap_vsub_left, AffineMap.coe_const, AffineMap.lineMap_same, const_apply] exact hp.units_smul fun i => w i #align affine_independent.units_line_map AffineIndependent.units_lineMap theorem AffineIndependent.indicator_eq_of_affineCombination_eq {p : ι → P} (ha : AffineIndependent k p) (s₁ s₂ : Finset ι) (w₁ w₂ : ι → k) (hw₁ : ∑ i ∈ s₁, w₁ i = 1) (hw₂ : ∑ i ∈ s₂, w₂ i = 1) (h : s₁.affineCombination k p w₁ = s₂.affineCombination k p w₂) : Set.indicator (↑s₁) w₁ = Set.indicator (↑s₂) w₂ := (affineIndependent_iff_indicator_eq_of_affineCombination_eq k p).1 ha s₁ s₂ w₁ w₂ hw₁ hw₂ h #align affine_independent.indicator_eq_of_affine_combination_eq AffineIndependent.indicator_eq_of_affineCombination_eq protected theorem AffineIndependent.injective [Nontrivial k] {p : ι → P} (ha : AffineIndependent k p) : Function.Injective p := by intro i j hij rw [affineIndependent_iff_linearIndependent_vsub _ _ j] at ha by_contra hij' refine ha.ne_zero ⟨i, hij'⟩ (vsub_eq_zero_iff_eq.mpr ?_) simp_all only [ne_eq] #align affine_independent.injective AffineIndependent.injective theorem AffineIndependent.comp_embedding {ι2 : Type*} (f : ι2 ↪ ι) {p : ι → P} (ha : AffineIndependent k p) : AffineIndependent k (p ∘ f) := by classical intro fs w hw hs i0 hi0 let fs' := fs.map f let w' i := if h : ∃ i2, f i2 = i then w h.choose else 0 have hw' : ∀ i2 : ι2, w' (f i2) = w i2 := by intro i2 have h : ∃ i : ι2, f i = f i2 := ⟨i2, rfl⟩ have hs : h.choose = i2 := f.injective h.choose_spec simp_rw [w', dif_pos h, hs] have hw's : ∑ i ∈ fs', w' i = 0 := by rw [← hw, Finset.sum_map] simp [hw'] have hs' : fs'.weightedVSub p w' = (0 : V) := by rw [← hs, Finset.weightedVSub_map] congr with i simp_all only [comp_apply, EmbeddingLike.apply_eq_iff_eq, exists_eq, dite_true] rw [← ha fs' w' hw's hs' (f i0) ((Finset.mem_map' _).2 hi0), hw'] #align affine_independent.comp_embedding AffineIndependent.comp_embedding protected theorem AffineIndependent.subtype {p : ι → P} (ha : AffineIndependent k p) (s : Set ι) : AffineIndependent k fun i : s => p i := ha.comp_embedding (Embedding.subtype _) #align affine_independent.subtype AffineIndependent.subtype protected theorem AffineIndependent.range {p : ι → P} (ha : AffineIndependent k p) : AffineIndependent k (fun x => x : Set.range p → P) := by let f : Set.range p → ι := fun x => x.property.choose have hf : ∀ x, p (f x) = x := fun x => x.property.choose_spec let fe : Set.range p ↪ ι := ⟨f, fun x₁ x₂ he => Subtype.ext (hf x₁ ▸ hf x₂ ▸ he ▸ rfl)⟩ convert ha.comp_embedding fe ext simp [fe, hf] #align affine_independent.range AffineIndependent.range theorem affineIndependent_equiv {ι' : Type*} (e : ι ≃ ι') {p : ι' → P} : AffineIndependent k (p ∘ e) ↔ AffineIndependent k p := by refine ⟨?_, AffineIndependent.comp_embedding e.toEmbedding⟩ intro h have : p = p ∘ e ∘ e.symm.toEmbedding := by ext simp rw [this] exact h.comp_embedding e.symm.toEmbedding #align affine_independent_equiv affineIndependent_equiv protected theorem AffineIndependent.mono {s t : Set P} (ha : AffineIndependent k (fun x => x : t → P)) (hs : s ⊆ t) : AffineIndependent k (fun x => x : s → P) := ha.comp_embedding (s.embeddingOfSubset t hs) #align affine_independent.mono AffineIndependent.mono theorem AffineIndependent.of_set_of_injective {p : ι → P} (ha : AffineIndependent k (fun x => x : Set.range p → P)) (hi : Function.Injective p) : AffineIndependent k p := ha.comp_embedding (⟨fun i => ⟨p i, Set.mem_range_self _⟩, fun _ _ h => hi (Subtype.mk_eq_mk.1 h)⟩ : ι ↪ Set.range p) #align affine_independent.of_set_of_injective AffineIndependent.of_set_of_injective section DivisionRing variable {k : Type*} {V : Type*} {P : Type*} [DivisionRing k] [AddCommGroup V] [Module k V] variable [AffineSpace V P] {ι : Type*} theorem exists_subset_affineIndependent_affineSpan_eq_top {s : Set P} (h : AffineIndependent k (fun p => p : s → P)) : ∃ t : Set P, s ⊆ t ∧ AffineIndependent k (fun p => p : t → P) ∧ affineSpan k t = ⊤ := by rcases s.eq_empty_or_nonempty with (rfl | ⟨p₁, hp₁⟩) · have p₁ : P := AddTorsor.nonempty.some let hsv := Basis.ofVectorSpace k V have hsvi := hsv.linearIndependent have hsvt := hsv.span_eq rw [Basis.coe_ofVectorSpace] at hsvi hsvt have h0 : ∀ v : V, v ∈ Basis.ofVectorSpaceIndex k V → v ≠ 0 := by intro v hv simpa [hsv] using hsv.ne_zero ⟨v, hv⟩ rw [linearIndependent_set_iff_affineIndependent_vadd_union_singleton k h0 p₁] at hsvi exact ⟨{p₁} ∪ (fun v => v +ᵥ p₁) '' _, Set.empty_subset _, hsvi, affineSpan_singleton_union_vadd_eq_top_of_span_eq_top p₁ hsvt⟩ · rw [affineIndependent_set_iff_linearIndependent_vsub k hp₁] at h let bsv := Basis.extend h have hsvi := bsv.linearIndependent have hsvt := bsv.span_eq rw [Basis.coe_extend] at hsvi hsvt have hsv := h.subset_extend (Set.subset_univ _) have h0 : ∀ v : V, v ∈ h.extend (Set.subset_univ _) → v ≠ 0 := by intro v hv simpa [bsv] using bsv.ne_zero ⟨v, hv⟩ rw [linearIndependent_set_iff_affineIndependent_vadd_union_singleton k h0 p₁] at hsvi refine ⟨{p₁} ∪ (fun v => v +ᵥ p₁) '' h.extend (Set.subset_univ _), ?_, ?_⟩ · refine Set.Subset.trans ?_ (Set.union_subset_union_right _ (Set.image_subset _ hsv)) simp [Set.image_image] · use hsvi exact affineSpan_singleton_union_vadd_eq_top_of_span_eq_top p₁ hsvt #align exists_subset_affine_independent_affine_span_eq_top exists_subset_affineIndependent_affineSpan_eq_top variable (k V)
Mathlib/LinearAlgebra/AffineSpace/Independent.lean
607
628
theorem exists_affineIndependent (s : Set P) : ∃ t ⊆ s, affineSpan k t = affineSpan k s ∧ AffineIndependent k ((↑) : t → P) := by
rcases s.eq_empty_or_nonempty with (rfl | ⟨p, hp⟩) · exact ⟨∅, Set.empty_subset ∅, rfl, affineIndependent_of_subsingleton k _⟩ obtain ⟨b, hb₁, hb₂, hb₃⟩ := exists_linearIndependent k ((Equiv.vaddConst p).symm '' s) have hb₀ : ∀ v : V, v ∈ b → v ≠ 0 := fun v hv => hb₃.ne_zero (⟨v, hv⟩ : b) rw [linearIndependent_set_iff_affineIndependent_vadd_union_singleton k hb₀ p] at hb₃ refine ⟨{p} ∪ Equiv.vaddConst p '' b, ?_, ?_, hb₃⟩ · apply Set.union_subset (Set.singleton_subset_iff.mpr hp) rwa [← (Equiv.vaddConst p).subset_symm_image b s] · rw [Equiv.coe_vaddConst_symm, ← vectorSpan_eq_span_vsub_set_right k hp] at hb₂ apply AffineSubspace.ext_of_direction_eq · have : Submodule.span k b = Submodule.span k (insert 0 b) := by simp simp only [direction_affineSpan, ← hb₂, Equiv.coe_vaddConst, Set.singleton_union, vectorSpan_eq_span_vsub_set_right k (Set.mem_insert p _), this] congr change (Equiv.vaddConst p).symm '' insert p (Equiv.vaddConst p '' b) = _ rw [Set.image_insert_eq, ← Set.image_comp] simp · use p simp only [Equiv.coe_vaddConst, Set.singleton_union, Set.mem_inter_iff, coe_affineSpan] exact ⟨mem_spanPoints k _ _ (Set.mem_insert p _), mem_spanPoints k _ _ hp⟩
import Mathlib.Algebra.Order.Monoid.Unbundled.MinMax import Mathlib.Algebra.Order.Monoid.WithTop import Mathlib.Data.Finset.Image import Mathlib.Data.Multiset.Fold #align_import data.finset.fold from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" -- TODO: -- assert_not_exists OrderedCommMonoid assert_not_exists MonoidWithZero namespace Finset open Multiset variable {α β γ : Type*} section Fold variable (op : β → β → β) [hc : Std.Commutative op] [ha : Std.Associative op] local notation a " * " b => op a b def fold (b : β) (f : α → β) (s : Finset α) : β := (s.1.map f).fold op b #align finset.fold Finset.fold variable {op} {f : α → β} {b : β} {s : Finset α} {a : α} @[simp] theorem fold_empty : (∅ : Finset α).fold op b f = b := rfl #align finset.fold_empty Finset.fold_empty @[simp] theorem fold_cons (h : a ∉ s) : (cons a s h).fold op b f = f a * s.fold op b f := by dsimp only [fold] rw [cons_val, Multiset.map_cons, fold_cons_left] #align finset.fold_cons Finset.fold_cons @[simp] theorem fold_insert [DecidableEq α] (h : a ∉ s) : (insert a s).fold op b f = f a * s.fold op b f := by unfold fold rw [insert_val, ndinsert_of_not_mem h, Multiset.map_cons, fold_cons_left] #align finset.fold_insert Finset.fold_insert @[simp] theorem fold_singleton : ({a} : Finset α).fold op b f = f a * b := rfl #align finset.fold_singleton Finset.fold_singleton @[simp] theorem fold_map {g : γ ↪ α} {s : Finset γ} : (s.map g).fold op b f = s.fold op b (f ∘ g) := by simp only [fold, map, Multiset.map_map] #align finset.fold_map Finset.fold_map @[simp] theorem fold_image [DecidableEq α] {g : γ → α} {s : Finset γ} (H : ∀ x ∈ s, ∀ y ∈ s, g x = g y → x = y) : (s.image g).fold op b f = s.fold op b (f ∘ g) := by simp only [fold, image_val_of_injOn H, Multiset.map_map] #align finset.fold_image Finset.fold_image @[congr] theorem fold_congr {g : α → β} (H : ∀ x ∈ s, f x = g x) : s.fold op b f = s.fold op b g := by rw [fold, fold, map_congr rfl H] #align finset.fold_congr Finset.fold_congr
Mathlib/Data/Finset/Fold.lean
83
85
theorem fold_op_distrib {f g : α → β} {b₁ b₂ : β} : (s.fold op (b₁ * b₂) fun x => f x * g x) = s.fold op b₁ f * s.fold op b₂ g := by
simp only [fold, fold_distrib]
import Mathlib.Algebra.FreeMonoid.Basic import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.GroupTheory.Congruence.Basic import Mathlib.GroupTheory.FreeGroup.IsFreeGroup import Mathlib.Data.List.Chain import Mathlib.SetTheory.Cardinal.Basic import Mathlib.Data.Set.Pointwise.SMul #align_import group_theory.free_product from "leanprover-community/mathlib"@"9114ddffa023340c9ec86965e00cdd6fe26fcdf6" open Set variable {ι : Type*} (M : ι → Type*) [∀ i, Monoid (M i)] inductive Monoid.CoprodI.Rel : FreeMonoid (Σi, M i) → FreeMonoid (Σi, M i) → Prop | of_one (i : ι) : Monoid.CoprodI.Rel (FreeMonoid.of ⟨i, 1⟩) 1 | of_mul {i : ι} (x y : M i) : Monoid.CoprodI.Rel (FreeMonoid.of ⟨i, x⟩ * FreeMonoid.of ⟨i, y⟩) (FreeMonoid.of ⟨i, x * y⟩) #align free_product.rel Monoid.CoprodI.Rel def Monoid.CoprodI : Type _ := (conGen (Monoid.CoprodI.Rel M)).Quotient #align free_product Monoid.CoprodI -- Porting note: could not de derived instance : Monoid (Monoid.CoprodI M) := by delta Monoid.CoprodI; infer_instance instance : Inhabited (Monoid.CoprodI M) := ⟨1⟩ namespace Monoid.CoprodI @[ext] structure Word where toList : List (Σi, M i) ne_one : ∀ l ∈ toList, Sigma.snd l ≠ 1 chain_ne : toList.Chain' fun l l' => Sigma.fst l ≠ Sigma.fst l' #align free_product.word Monoid.CoprodI.Word variable {M} def of {i : ι} : M i →* CoprodI M where toFun x := Con.mk' _ (FreeMonoid.of <| Sigma.mk i x) map_one' := (Con.eq _).mpr (ConGen.Rel.of _ _ (CoprodI.Rel.of_one i)) map_mul' x y := Eq.symm <| (Con.eq _).mpr (ConGen.Rel.of _ _ (CoprodI.Rel.of_mul x y)) #align free_product.of Monoid.CoprodI.of theorem of_apply {i} (m : M i) : of m = Con.mk' _ (FreeMonoid.of <| Sigma.mk i m) := rfl #align free_product.of_apply Monoid.CoprodI.of_apply variable {N : Type*} [Monoid N] -- Porting note: higher `ext` priority @[ext 1100] theorem ext_hom (f g : CoprodI M →* N) (h : ∀ i, f.comp (of : M i →* _) = g.comp of) : f = g := (MonoidHom.cancel_right Con.mk'_surjective).mp <| FreeMonoid.hom_eq fun ⟨i, x⟩ => by -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [MonoidHom.comp_apply, MonoidHom.comp_apply, ← of_apply, ← MonoidHom.comp_apply, ← MonoidHom.comp_apply, h]; rfl #align free_product.ext_hom Monoid.CoprodI.ext_hom @[simps symm_apply] def lift : (∀ i, M i →* N) ≃ (CoprodI M →* N) where toFun fi := Con.lift _ (FreeMonoid.lift fun p : Σi, M i => fi p.fst p.snd) <| Con.conGen_le <| by simp_rw [Con.ker_rel] rintro _ _ (i | ⟨x, y⟩) · change FreeMonoid.lift _ (FreeMonoid.of _) = FreeMonoid.lift _ 1 simp only [MonoidHom.map_one, FreeMonoid.lift_eval_of] · change FreeMonoid.lift _ (FreeMonoid.of _ * FreeMonoid.of _) = FreeMonoid.lift _ (FreeMonoid.of _) simp only [MonoidHom.map_mul, FreeMonoid.lift_eval_of] invFun f i := f.comp of left_inv := by intro fi ext i x -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [MonoidHom.comp_apply, of_apply, Con.lift_mk', FreeMonoid.lift_eval_of] right_inv := by intro f ext i x rfl #align free_product.lift Monoid.CoprodI.lift @[simp] theorem lift_comp_of {N} [Monoid N] (fi : ∀ i, M i →* N) i : (lift fi).comp of = fi i := congr_fun (lift.symm_apply_apply fi) i @[simp] theorem lift_of {N} [Monoid N] (fi : ∀ i, M i →* N) {i} (m : M i) : lift fi (of m) = fi i m := DFunLike.congr_fun (lift_comp_of ..) m #align free_product.lift_of Monoid.CoprodI.lift_of @[simp] theorem lift_comp_of' {N} [Monoid N] (f : CoprodI M →* N) : lift (fun i ↦ f.comp (of (i := i))) = f := lift.apply_symm_apply f @[simp] theorem lift_of' : lift (fun i ↦ (of : M i →* CoprodI M)) = .id (CoprodI M) := lift_comp_of' (.id _) theorem of_leftInverse [DecidableEq ι] (i : ι) : Function.LeftInverse (lift <| Pi.mulSingle i (MonoidHom.id (M i))) of := fun x => by simp only [lift_of, Pi.mulSingle_eq_same, MonoidHom.id_apply] #align free_product.of_left_inverse Monoid.CoprodI.of_leftInverse theorem of_injective (i : ι) : Function.Injective (of : M i →* _) := by classical exact (of_leftInverse i).injective #align free_product.of_injective Monoid.CoprodI.of_injective theorem mrange_eq_iSup {N} [Monoid N] (f : ∀ i, M i →* N) : MonoidHom.mrange (lift f) = ⨆ i, MonoidHom.mrange (f i) := by rw [lift, Equiv.coe_fn_mk, Con.lift_range, FreeMonoid.mrange_lift, range_sigma_eq_iUnion_range, Submonoid.closure_iUnion] simp only [MonoidHom.mclosure_range] #align free_product.mrange_eq_supr Monoid.CoprodI.mrange_eq_iSup theorem lift_mrange_le {N} [Monoid N] (f : ∀ i, M i →* N) {s : Submonoid N} : MonoidHom.mrange (lift f) ≤ s ↔ ∀ i, MonoidHom.mrange (f i) ≤ s := by simp [mrange_eq_iSup] #align free_product.lift_mrange_le Monoid.CoprodI.lift_mrange_le @[simp] theorem iSup_mrange_of : ⨆ i, MonoidHom.mrange (of : M i →* CoprodI M) = ⊤ := by simp [← mrange_eq_iSup] @[simp] theorem mclosure_iUnion_range_of : Submonoid.closure (⋃ i, Set.range (of : M i →* CoprodI M)) = ⊤ := by simp [Submonoid.closure_iUnion] @[elab_as_elim] theorem induction_left {C : CoprodI M → Prop} (m : CoprodI M) (one : C 1) (mul : ∀ {i} (m : M i) x, C x → C (of m * x)) : C m := by induction m using Submonoid.induction_of_closure_eq_top_left mclosure_iUnion_range_of with | one => exact one | mul x hx y ihy => obtain ⟨i, m, rfl⟩ : ∃ (i : ι) (m : M i), of m = x := by simpa using hx exact mul m y ihy @[elab_as_elim] theorem induction_on {C : CoprodI M → Prop} (m : CoprodI M) (h_one : C 1) (h_of : ∀ (i) (m : M i), C (of m)) (h_mul : ∀ x y, C x → C y → C (x * y)) : C m := by induction m using CoprodI.induction_left with | one => exact h_one | mul m x hx => exact h_mul _ _ (h_of _ _) hx #align free_product.induction_on Monoid.CoprodI.induction_on namespace Word @[simps] def empty : Word M where toList := [] ne_one := by simp chain_ne := List.chain'_nil #align free_product.word.empty Monoid.CoprodI.Word.empty instance : Inhabited (Word M) := ⟨empty⟩ def prod (w : Word M) : CoprodI M := List.prod (w.toList.map fun l => of l.snd) #align free_product.word.prod Monoid.CoprodI.Word.prod @[simp] theorem prod_empty : prod (empty : Word M) = 1 := rfl #align free_product.word.prod_empty Monoid.CoprodI.Word.prod_empty def fstIdx (w : Word M) : Option ι := w.toList.head?.map Sigma.fst #align free_product.word.fst_idx Monoid.CoprodI.Word.fstIdx theorem fstIdx_ne_iff {w : Word M} {i} : fstIdx w ≠ some i ↔ ∀ l ∈ w.toList.head?, i ≠ Sigma.fst l := not_iff_not.mp <| by simp [fstIdx] #align free_product.word.fst_idx_ne_iff Monoid.CoprodI.Word.fstIdx_ne_iff variable (M) @[ext] structure Pair (i : ι) where head : M i tail : Word M fstIdx_ne : fstIdx tail ≠ some i #align free_product.word.pair Monoid.CoprodI.Word.Pair instance (i : ι) : Inhabited (Pair M i) := ⟨⟨1, empty, by tauto⟩⟩ variable {M} variable [∀ i, DecidableEq (M i)] @[simps] def cons {i} (m : M i) (w : Word M) (hmw : w.fstIdx ≠ some i) (h1 : m ≠ 1) : Word M := { toList := ⟨i, m⟩ :: w.toList, ne_one := by simp only [List.mem_cons] rintro l (rfl | hl) · exact h1 · exact w.ne_one l hl chain_ne := w.chain_ne.cons' (fstIdx_ne_iff.mp hmw) } def rcons {i} (p : Pair M i) : Word M := if h : p.head = 1 then p.tail else cons p.head p.tail p.fstIdx_ne h #align free_product.word.rcons Monoid.CoprodI.Word.rcons #noalign free_product.word.cons_eq_rcons @[simp] theorem prod_rcons {i} (p : Pair M i) : prod (rcons p) = of p.head * prod p.tail := if hm : p.head = 1 then by rw [rcons, dif_pos hm, hm, MonoidHom.map_one, one_mul] else by rw [rcons, dif_neg hm, cons, prod, List.map_cons, List.prod_cons, prod] #align free_product.word.prod_rcons Monoid.CoprodI.Word.prod_rcons theorem rcons_inj {i} : Function.Injective (rcons : Pair M i → Word M) := by rintro ⟨m, w, h⟩ ⟨m', w', h'⟩ he by_cases hm : m = 1 <;> by_cases hm' : m' = 1 · simp only [rcons, dif_pos hm, dif_pos hm'] at he aesop · exfalso simp only [rcons, dif_pos hm, dif_neg hm'] at he rw [he] at h exact h rfl · exfalso simp only [rcons, dif_pos hm', dif_neg hm] at he rw [← he] at h' exact h' rfl · have : m = m' ∧ w.toList = w'.toList := by simpa [cons, rcons, dif_neg hm, dif_neg hm', true_and_iff, eq_self_iff_true, Subtype.mk_eq_mk, heq_iff_eq, ← Subtype.ext_iff_val] using he rcases this with ⟨rfl, h⟩ congr exact Word.ext _ _ h #align free_product.word.rcons_inj Monoid.CoprodI.Word.rcons_inj theorem mem_rcons_iff {i j : ι} (p : Pair M i) (m : M j) : ⟨_, m⟩ ∈ (rcons p).toList ↔ ⟨_, m⟩ ∈ p.tail.toList ∨ m ≠ 1 ∧ (∃ h : i = j, m = h ▸ p.head) := by simp only [rcons, cons, ne_eq] by_cases hij : i = j · subst i by_cases hm : m = p.head · subst m split_ifs <;> simp_all · split_ifs <;> simp_all · split_ifs <;> simp_all [Ne.symm hij] @[simp]
Mathlib/GroupTheory/CoprodI.lean
406
407
theorem fstIdx_cons {i} (m : M i) (w : Word M) (hmw : w.fstIdx ≠ some i) (h1 : m ≠ 1) : fstIdx (cons m w hmw h1) = some i := by
simp [cons, fstIdx]
import Mathlib.CategoryTheory.Sites.Sheaf import Mathlib.CategoryTheory.Sites.CoverLifting import Mathlib.CategoryTheory.Adjunction.FullyFaithful #align_import category_theory.sites.dense_subsite from "leanprover-community/mathlib"@"1d650c2e131f500f3c17f33b4d19d2ea15987f2c" universe w v u namespace CategoryTheory variable {C : Type*} [Category C] {D : Type*} [Category D] {E : Type*} [Category E] variable (J : GrothendieckTopology C) (K : GrothendieckTopology D) variable {L : GrothendieckTopology E} -- Porting note(#5171): removed `@[nolint has_nonempty_instance]` structure Presieve.CoverByImageStructure (G : C ⥤ D) {V U : D} (f : V ⟶ U) where obj : C lift : V ⟶ G.obj obj map : G.obj obj ⟶ U fac : lift ≫ map = f := by aesop_cat #align category_theory.presieve.cover_by_image_structure CategoryTheory.Presieve.CoverByImageStructure attribute [nolint docBlame] Presieve.CoverByImageStructure.obj Presieve.CoverByImageStructure.lift Presieve.CoverByImageStructure.map Presieve.CoverByImageStructure.fac attribute [reassoc (attr := simp)] Presieve.CoverByImageStructure.fac def Presieve.coverByImage (G : C ⥤ D) (U : D) : Presieve U := fun _ f => Nonempty (Presieve.CoverByImageStructure G f) #align category_theory.presieve.cover_by_image CategoryTheory.Presieve.coverByImage def Sieve.coverByImage (G : C ⥤ D) (U : D) : Sieve U := ⟨Presieve.coverByImage G U, fun ⟨⟨Z, f₁, f₂, (e : _ = _)⟩⟩ g => ⟨⟨Z, g ≫ f₁, f₂, show (g ≫ f₁) ≫ f₂ = g ≫ _ by rw [Category.assoc, ← e]⟩⟩⟩ #align category_theory.sieve.cover_by_image CategoryTheory.Sieve.coverByImage theorem Presieve.in_coverByImage (G : C ⥤ D) {X : D} {Y : C} (f : G.obj Y ⟶ X) : Presieve.coverByImage G X f := ⟨⟨Y, 𝟙 _, f, by simp⟩⟩ #align category_theory.presieve.in_cover_by_image CategoryTheory.Presieve.in_coverByImage class Functor.IsCoverDense (G : C ⥤ D) (K : GrothendieckTopology D) : Prop where is_cover : ∀ U : D, Sieve.coverByImage G U ∈ K U #align category_theory.cover_dense CategoryTheory.Functor.IsCoverDense lemma Functor.is_cover_of_isCoverDense (G : C ⥤ D) (K : GrothendieckTopology D) [G.IsCoverDense K] (U : D) : Sieve.coverByImage G U ∈ K U := by apply Functor.IsCoverDense.is_cover lemma Functor.isCoverDense_of_generate_singleton_functor_π_mem (G : C ⥤ D) (K : GrothendieckTopology D) (h : ∀ B, ∃ (X : C) (f : G.obj X ⟶ B), Sieve.generate (Presieve.singleton f) ∈ K B) : G.IsCoverDense K where is_cover B := by obtain ⟨X, f, h⟩ := h B refine K.superset_covering ?_ h intro Y f ⟨Z, g, _, h, w⟩ cases h exact ⟨⟨_, g, _, w⟩⟩ attribute [nolint docBlame] CategoryTheory.Functor.IsCoverDense.is_cover open Presieve Opposite namespace Functor namespace IsCoverDense variable {K} variable {A : Type*} [Category A] (G : C ⥤ D) [G.IsCoverDense K] -- this is not marked with `@[ext]` because `H` can not be inferred from the type theorem ext (ℱ : SheafOfTypes K) (X : D) {s t : ℱ.val.obj (op X)} (h : ∀ ⦃Y : C⦄ (f : G.obj Y ⟶ X), ℱ.val.map f.op s = ℱ.val.map f.op t) : s = t := by apply (ℱ.cond (Sieve.coverByImage G X) (G.is_cover_of_isCoverDense K X)).isSeparatedFor.ext rintro Y _ ⟨Z, f₁, f₂, ⟨rfl⟩⟩ simp [h f₂] #align category_theory.cover_dense.ext CategoryTheory.Functor.IsCoverDense.ext variable {G}
Mathlib/CategoryTheory/Sites/DenseSubsite.lean
133
141
theorem functorPullback_pushforward_covering [Full G] {X : C} (T : K (G.obj X)) : (T.val.functorPullback G).functorPushforward G ∈ K (G.obj X) := by
refine K.superset_covering ?_ (K.bind_covering T.property fun Y f _ => G.is_cover_of_isCoverDense K Y) rintro Y _ ⟨Z, _, f, hf, ⟨W, g, f', ⟨rfl⟩⟩, rfl⟩ use W; use G.preimage (f' ≫ f); use g constructor · simpa using T.val.downward_closed hf f' · simp
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order #align_import measure_theory.constructions.borel_space.basic from "leanprover-community/mathlib"@"9f55d0d4363ae59948c33864cbc52e0b12e0e8ce" open Set Filter MeasureTheory MeasurableSpace open scoped Classical Topology NNReal ENNReal MeasureTheory universe u v w x y variable {α β γ δ : Type*} {ι : Sort y} {s t u : Set α} namespace Real theorem borel_eq_generateFrom_Ioo_rat : borel ℝ = .generateFrom (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) (b : ℝ)}) := isTopologicalBasis_Ioo_rat.borel_eq_generateFrom #align real.borel_eq_generate_from_Ioo_rat Real.borel_eq_generateFrom_Ioo_rat theorem borel_eq_generateFrom_Iio_rat : borel ℝ = .generateFrom (⋃ a : ℚ, {Iio (a : ℝ)}) := by rw [borel_eq_generateFrom_Iio] refine le_antisymm (generateFrom_le ?_) (generateFrom_mono <| iUnion_subset fun q ↦ singleton_subset_iff.mpr <| mem_range_self _) rintro _ ⟨a, rfl⟩ have : IsLUB (range ((↑) : ℚ → ℝ) ∩ Iio a) a := by simp [isLUB_iff_le_iff, mem_upperBounds, ← le_iff_forall_rat_lt_imp_le] rw [← this.biUnion_Iio_eq, ← image_univ, ← image_inter_preimage, univ_inter, biUnion_image] exact MeasurableSet.biUnion (to_countable _) fun b _ => GenerateMeasurable.basic (Iio (b : ℝ)) (by simp)
Mathlib/MeasureTheory/Constructions/BorelSpace/Real.lean
56
66
theorem borel_eq_generateFrom_Ioi_rat : borel ℝ = .generateFrom (⋃ a : ℚ, {Ioi (a : ℝ)}) := by
rw [borel_eq_generateFrom_Ioi] refine le_antisymm (generateFrom_le ?_) (generateFrom_mono <| iUnion_subset fun q ↦ singleton_subset_iff.mpr <| mem_range_self _) rintro _ ⟨a, rfl⟩ have : IsGLB (range ((↑) : ℚ → ℝ) ∩ Ioi a) a := by simp [isGLB_iff_le_iff, mem_lowerBounds, ← le_iff_forall_lt_rat_imp_le] rw [← this.biUnion_Ioi_eq, ← image_univ, ← image_inter_preimage, univ_inter, biUnion_image] exact MeasurableSet.biUnion (to_countable _) fun b _ => GenerateMeasurable.basic (Ioi (b : ℝ)) (by simp)
import Mathlib.SetTheory.Cardinal.Finite #align_import data.finite.card from "leanprover-community/mathlib"@"3ff3f2d6a3118b8711063de7111a0d77a53219a8" noncomputable section open scoped Classical variable {α β γ : Type*} def Finite.equivFin (α : Type*) [Finite α] : α ≃ Fin (Nat.card α) := by have := (Finite.exists_equiv_fin α).choose_spec.some rwa [Nat.card_eq_of_equiv_fin this] #align finite.equiv_fin Finite.equivFin def Finite.equivFinOfCardEq [Finite α] {n : ℕ} (h : Nat.card α = n) : α ≃ Fin n := by subst h apply Finite.equivFin #align finite.equiv_fin_of_card_eq Finite.equivFinOfCardEq theorem Nat.card_eq (α : Type*) : Nat.card α = if h : Finite α then @Fintype.card α (Fintype.ofFinite α) else 0 := by cases finite_or_infinite α · letI := Fintype.ofFinite α simp only [*, Nat.card_eq_fintype_card, dif_pos] · simp only [*, card_eq_zero_of_infinite, not_finite_iff_infinite.mpr, dite_false] #align nat.card_eq Nat.card_eq theorem Finite.card_pos_iff [Finite α] : 0 < Nat.card α ↔ Nonempty α := by haveI := Fintype.ofFinite α rw [Nat.card_eq_fintype_card, Fintype.card_pos_iff] #align finite.card_pos_iff Finite.card_pos_iff theorem Finite.card_pos [Finite α] [h : Nonempty α] : 0 < Nat.card α := Finite.card_pos_iff.mpr h #align finite.card_pos Finite.card_pos namespace Finite theorem cast_card_eq_mk {α : Type*} [Finite α] : ↑(Nat.card α) = Cardinal.mk α := Cardinal.cast_toNat_of_lt_aleph0 (Cardinal.lt_aleph0_of_finite α) #align finite.cast_card_eq_mk Finite.cast_card_eq_mk theorem card_eq [Finite α] [Finite β] : Nat.card α = Nat.card β ↔ Nonempty (α ≃ β) := by haveI := Fintype.ofFinite α haveI := Fintype.ofFinite β simp only [Nat.card_eq_fintype_card, Fintype.card_eq] #align finite.card_eq Finite.card_eq theorem card_le_one_iff_subsingleton [Finite α] : Nat.card α ≤ 1 ↔ Subsingleton α := by haveI := Fintype.ofFinite α simp only [Nat.card_eq_fintype_card, Fintype.card_le_one_iff_subsingleton] #align finite.card_le_one_iff_subsingleton Finite.card_le_one_iff_subsingleton
Mathlib/Data/Finite/Card.lean
83
85
theorem one_lt_card_iff_nontrivial [Finite α] : 1 < Nat.card α ↔ Nontrivial α := by
haveI := Fintype.ofFinite α simp only [Nat.card_eq_fintype_card, Fintype.one_lt_card_iff_nontrivial]
import Mathlib.Order.Interval.Set.Image import Mathlib.Order.CompleteLatticeIntervals import Mathlib.Topology.Order.DenselyOrdered import Mathlib.Topology.Order.Monotone #align_import topology.algebra.order.intermediate_value from "leanprover-community/mathlib"@"4c19a16e4b705bf135cf9a80ac18fcc99c438514" open Filter OrderDual TopologicalSpace Function Set open Topology Filter universe u v w section variable {X : Type u} {α : Type v} [TopologicalSpace X] [LinearOrder α] [TopologicalSpace α] [OrderClosedTopology α] theorem intermediate_value_univ₂ [PreconnectedSpace X] {a b : X} {f g : X → α} (hf : Continuous f) (hg : Continuous g) (ha : f a ≤ g a) (hb : g b ≤ f b) : ∃ x, f x = g x := by obtain ⟨x, _, hfg, hgf⟩ : (univ ∩ { x | f x ≤ g x ∧ g x ≤ f x }).Nonempty := isPreconnected_closed_iff.1 PreconnectedSpace.isPreconnected_univ _ _ (isClosed_le hf hg) (isClosed_le hg hf) (fun _ _ => le_total _ _) ⟨a, trivial, ha⟩ ⟨b, trivial, hb⟩ exact ⟨x, le_antisymm hfg hgf⟩ #align intermediate_value_univ₂ intermediate_value_univ₂ theorem intermediate_value_univ₂_eventually₁ [PreconnectedSpace X] {a : X} {l : Filter X} [NeBot l] {f g : X → α} (hf : Continuous f) (hg : Continuous g) (ha : f a ≤ g a) (he : g ≤ᶠ[l] f) : ∃ x, f x = g x := let ⟨_, h⟩ := he.exists; intermediate_value_univ₂ hf hg ha h #align intermediate_value_univ₂_eventually₁ intermediate_value_univ₂_eventually₁ theorem intermediate_value_univ₂_eventually₂ [PreconnectedSpace X] {l₁ l₂ : Filter X} [NeBot l₁] [NeBot l₂] {f g : X → α} (hf : Continuous f) (hg : Continuous g) (he₁ : f ≤ᶠ[l₁] g) (he₂ : g ≤ᶠ[l₂] f) : ∃ x, f x = g x := let ⟨_, h₁⟩ := he₁.exists let ⟨_, h₂⟩ := he₂.exists intermediate_value_univ₂ hf hg h₁ h₂ #align intermediate_value_univ₂_eventually₂ intermediate_value_univ₂_eventually₂ theorem IsPreconnected.intermediate_value₂ {s : Set X} (hs : IsPreconnected s) {a b : X} (ha : a ∈ s) (hb : b ∈ s) {f g : X → α} (hf : ContinuousOn f s) (hg : ContinuousOn g s) (ha' : f a ≤ g a) (hb' : g b ≤ f b) : ∃ x ∈ s, f x = g x := let ⟨x, hx⟩ := @intermediate_value_univ₂ s α _ _ _ _ (Subtype.preconnectedSpace hs) ⟨a, ha⟩ ⟨b, hb⟩ _ _ (continuousOn_iff_continuous_restrict.1 hf) (continuousOn_iff_continuous_restrict.1 hg) ha' hb' ⟨x, x.2, hx⟩ #align is_preconnected.intermediate_value₂ IsPreconnected.intermediate_value₂ theorem IsPreconnected.intermediate_value₂_eventually₁ {s : Set X} (hs : IsPreconnected s) {a : X} {l : Filter X} (ha : a ∈ s) [NeBot l] (hl : l ≤ 𝓟 s) {f g : X → α} (hf : ContinuousOn f s) (hg : ContinuousOn g s) (ha' : f a ≤ g a) (he : g ≤ᶠ[l] f) : ∃ x ∈ s, f x = g x := by rw [continuousOn_iff_continuous_restrict] at hf hg obtain ⟨b, h⟩ := @intermediate_value_univ₂_eventually₁ _ _ _ _ _ _ (Subtype.preconnectedSpace hs) ⟨a, ha⟩ _ (comap_coe_neBot_of_le_principal hl) _ _ hf hg ha' (he.comap _) exact ⟨b, b.prop, h⟩ #align is_preconnected.intermediate_value₂_eventually₁ IsPreconnected.intermediate_value₂_eventually₁ theorem IsPreconnected.intermediate_value₂_eventually₂ {s : Set X} (hs : IsPreconnected s) {l₁ l₂ : Filter X} [NeBot l₁] [NeBot l₂] (hl₁ : l₁ ≤ 𝓟 s) (hl₂ : l₂ ≤ 𝓟 s) {f g : X → α} (hf : ContinuousOn f s) (hg : ContinuousOn g s) (he₁ : f ≤ᶠ[l₁] g) (he₂ : g ≤ᶠ[l₂] f) : ∃ x ∈ s, f x = g x := by rw [continuousOn_iff_continuous_restrict] at hf hg obtain ⟨b, h⟩ := @intermediate_value_univ₂_eventually₂ _ _ _ _ _ _ (Subtype.preconnectedSpace hs) _ _ (comap_coe_neBot_of_le_principal hl₁) (comap_coe_neBot_of_le_principal hl₂) _ _ hf hg (he₁.comap _) (he₂.comap _) exact ⟨b, b.prop, h⟩ #align is_preconnected.intermediate_value₂_eventually₂ IsPreconnected.intermediate_value₂_eventually₂ theorem IsPreconnected.intermediate_value {s : Set X} (hs : IsPreconnected s) {a b : X} (ha : a ∈ s) (hb : b ∈ s) {f : X → α} (hf : ContinuousOn f s) : Icc (f a) (f b) ⊆ f '' s := fun _x hx => hs.intermediate_value₂ ha hb hf continuousOn_const hx.1 hx.2 #align is_preconnected.intermediate_value IsPreconnected.intermediate_value theorem IsPreconnected.intermediate_value_Ico {s : Set X} (hs : IsPreconnected s) {a : X} {l : Filter X} (ha : a ∈ s) [NeBot l] (hl : l ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s) {v : α} (ht : Tendsto f l (𝓝 v)) : Ico (f a) v ⊆ f '' s := fun _ h => hs.intermediate_value₂_eventually₁ ha hl hf continuousOn_const h.1 (eventually_ge_of_tendsto_gt h.2 ht) #align is_preconnected.intermediate_value_Ico IsPreconnected.intermediate_value_Ico theorem IsPreconnected.intermediate_value_Ioc {s : Set X} (hs : IsPreconnected s) {a : X} {l : Filter X} (ha : a ∈ s) [NeBot l] (hl : l ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s) {v : α} (ht : Tendsto f l (𝓝 v)) : Ioc v (f a) ⊆ f '' s := fun _ h => (hs.intermediate_value₂_eventually₁ ha hl continuousOn_const hf h.2 (eventually_le_of_tendsto_lt h.1 ht)).imp fun _ h => h.imp_right Eq.symm #align is_preconnected.intermediate_value_Ioc IsPreconnected.intermediate_value_Ioc theorem IsPreconnected.intermediate_value_Ioo {s : Set X} (hs : IsPreconnected s) {l₁ l₂ : Filter X} [NeBot l₁] [NeBot l₂] (hl₁ : l₁ ≤ 𝓟 s) (hl₂ : l₂ ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s) {v₁ v₂ : α} (ht₁ : Tendsto f l₁ (𝓝 v₁)) (ht₂ : Tendsto f l₂ (𝓝 v₂)) : Ioo v₁ v₂ ⊆ f '' s := fun _ h => hs.intermediate_value₂_eventually₂ hl₁ hl₂ hf continuousOn_const (eventually_le_of_tendsto_lt h.1 ht₁) (eventually_ge_of_tendsto_gt h.2 ht₂) #align is_preconnected.intermediate_value_Ioo IsPreconnected.intermediate_value_Ioo theorem IsPreconnected.intermediate_value_Ici {s : Set X} (hs : IsPreconnected s) {a : X} {l : Filter X} (ha : a ∈ s) [NeBot l] (hl : l ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s) (ht : Tendsto f l atTop) : Ici (f a) ⊆ f '' s := fun y h => hs.intermediate_value₂_eventually₁ ha hl hf continuousOn_const h (tendsto_atTop.1 ht y) #align is_preconnected.intermediate_value_Ici IsPreconnected.intermediate_value_Ici theorem IsPreconnected.intermediate_value_Iic {s : Set X} (hs : IsPreconnected s) {a : X} {l : Filter X} (ha : a ∈ s) [NeBot l] (hl : l ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s) (ht : Tendsto f l atBot) : Iic (f a) ⊆ f '' s := fun y h => (hs.intermediate_value₂_eventually₁ ha hl continuousOn_const hf h (tendsto_atBot.1 ht y)).imp fun _ h => h.imp_right Eq.symm #align is_preconnected.intermediate_value_Iic IsPreconnected.intermediate_value_Iic theorem IsPreconnected.intermediate_value_Ioi {s : Set X} (hs : IsPreconnected s) {l₁ l₂ : Filter X} [NeBot l₁] [NeBot l₂] (hl₁ : l₁ ≤ 𝓟 s) (hl₂ : l₂ ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s) {v : α} (ht₁ : Tendsto f l₁ (𝓝 v)) (ht₂ : Tendsto f l₂ atTop) : Ioi v ⊆ f '' s := fun y h => hs.intermediate_value₂_eventually₂ hl₁ hl₂ hf continuousOn_const (eventually_le_of_tendsto_lt h ht₁) (tendsto_atTop.1 ht₂ y) #align is_preconnected.intermediate_value_Ioi IsPreconnected.intermediate_value_Ioi theorem IsPreconnected.intermediate_value_Iio {s : Set X} (hs : IsPreconnected s) {l₁ l₂ : Filter X} [NeBot l₁] [NeBot l₂] (hl₁ : l₁ ≤ 𝓟 s) (hl₂ : l₂ ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s) {v : α} (ht₁ : Tendsto f l₁ atBot) (ht₂ : Tendsto f l₂ (𝓝 v)) : Iio v ⊆ f '' s := fun y h => hs.intermediate_value₂_eventually₂ hl₁ hl₂ hf continuousOn_const (tendsto_atBot.1 ht₁ y) (eventually_ge_of_tendsto_gt h ht₂) #align is_preconnected.intermediate_value_Iio IsPreconnected.intermediate_value_Iio theorem IsPreconnected.intermediate_value_Iii {s : Set X} (hs : IsPreconnected s) {l₁ l₂ : Filter X} [NeBot l₁] [NeBot l₂] (hl₁ : l₁ ≤ 𝓟 s) (hl₂ : l₂ ≤ 𝓟 s) {f : X → α} (hf : ContinuousOn f s) (ht₁ : Tendsto f l₁ atBot) (ht₂ : Tendsto f l₂ atTop) : univ ⊆ f '' s := fun y _ => hs.intermediate_value₂_eventually₂ hl₁ hl₂ hf continuousOn_const (tendsto_atBot.1 ht₁ y) (tendsto_atTop.1 ht₂ y) set_option linter.uppercaseLean3 false in #align is_preconnected.intermediate_value_Iii IsPreconnected.intermediate_value_Iii theorem intermediate_value_univ [PreconnectedSpace X] (a b : X) {f : X → α} (hf : Continuous f) : Icc (f a) (f b) ⊆ range f := fun _ hx => intermediate_value_univ₂ hf continuous_const hx.1 hx.2 #align intermediate_value_univ intermediate_value_univ theorem mem_range_of_exists_le_of_exists_ge [PreconnectedSpace X] {c : α} {f : X → α} (hf : Continuous f) (h₁ : ∃ a, f a ≤ c) (h₂ : ∃ b, c ≤ f b) : c ∈ range f := let ⟨a, ha⟩ := h₁; let ⟨b, hb⟩ := h₂; intermediate_value_univ a b hf ⟨ha, hb⟩ #align mem_range_of_exists_le_of_exists_ge mem_range_of_exists_le_of_exists_ge theorem IsPreconnected.Icc_subset {s : Set α} (hs : IsPreconnected s) {a b : α} (ha : a ∈ s) (hb : b ∈ s) : Icc a b ⊆ s := by simpa only [image_id] using hs.intermediate_value ha hb continuousOn_id #align is_preconnected.Icc_subset IsPreconnected.Icc_subset theorem IsPreconnected.ordConnected {s : Set α} (h : IsPreconnected s) : OrdConnected s := ⟨fun _ hx _ hy => h.Icc_subset hx hy⟩ #align is_preconnected.ord_connected IsPreconnected.ordConnected theorem IsConnected.Icc_subset {s : Set α} (hs : IsConnected s) {a b : α} (ha : a ∈ s) (hb : b ∈ s) : Icc a b ⊆ s := hs.2.Icc_subset ha hb #align is_connected.Icc_subset IsConnected.Icc_subset
Mathlib/Topology/Order/IntermediateValue.lean
235
240
theorem IsPreconnected.eq_univ_of_unbounded {s : Set α} (hs : IsPreconnected s) (hb : ¬BddBelow s) (ha : ¬BddAbove s) : s = univ := by
refine eq_univ_of_forall fun x => ?_ obtain ⟨y, ys, hy⟩ : ∃ y ∈ s, y < x := not_bddBelow_iff.1 hb x obtain ⟨z, zs, hz⟩ : ∃ z ∈ s, x < z := not_bddAbove_iff.1 ha x exact hs.Icc_subset ys zs ⟨le_of_lt hy, le_of_lt hz⟩
import Mathlib.Algebra.Algebra.Bilinear import Mathlib.RingTheory.Localization.Basic #align_import algebra.module.localized_module from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" section IsLocalizedModule universe u v variable {R : Type*} [CommSemiring R] (S : Submonoid R) variable {M M' M'' : Type*} [AddCommMonoid M] [AddCommMonoid M'] [AddCommMonoid M''] variable {A : Type*} [CommSemiring A] [Algebra R A] [Module A M'] [IsLocalization S A] variable [Module R M] [Module R M'] [Module R M''] [IsScalarTower R A M'] variable (f : M →ₗ[R] M') (g : M →ₗ[R] M'') @[mk_iff] class IsLocalizedModule : Prop where map_units : ∀ x : S, IsUnit (algebraMap R (Module.End R M') x) surj' : ∀ y : M', ∃ x : M × S, x.2 • y = f x.1 exists_of_eq : ∀ {x₁ x₂}, f x₁ = f x₂ → ∃ c : S, c • x₁ = c • x₂ #align is_localized_module IsLocalizedModule attribute [nolint docBlame] IsLocalizedModule.map_units IsLocalizedModule.surj' IsLocalizedModule.exists_of_eq -- Porting note: Manually added to make `S` and `f` explicit. lemma IsLocalizedModule.surj [IsLocalizedModule S f] (y : M') : ∃ x : M × S, x.2 • y = f x.1 := surj' y -- Porting note: Manually added to make `S` and `f` explicit. lemma IsLocalizedModule.eq_iff_exists [IsLocalizedModule S f] {x₁ x₂} : f x₁ = f x₂ ↔ ∃ c : S, c • x₁ = c • x₂ := Iff.intro exists_of_eq fun ⟨c, h⟩ ↦ by apply_fun f at h simp_rw [f.map_smul_of_tower, Submonoid.smul_def, ← Module.algebraMap_end_apply R R] at h exact ((Module.End_isUnit_iff _).mp <| map_units f c).1 h
Mathlib/Algebra/Module/LocalizedModule.lean
574
588
theorem IsLocalizedModule.of_linearEquiv (e : M' ≃ₗ[R] M'') [hf : IsLocalizedModule S f] : IsLocalizedModule S (e ∘ₗ f : M →ₗ[R] M'') where map_units s := by
rw [show algebraMap R (Module.End R M'') s = e ∘ₗ (algebraMap R (Module.End R M') s) ∘ₗ e.symm by ext; simp, Module.End_isUnit_iff, LinearMap.coe_comp, LinearMap.coe_comp, LinearEquiv.coe_coe, LinearEquiv.coe_coe, EquivLike.comp_bijective, EquivLike.bijective_comp] exact (Module.End_isUnit_iff _).mp <| hf.map_units s surj' x := by obtain ⟨p, h⟩ := hf.surj' (e.symm x) exact ⟨p, by rw [LinearMap.coe_comp, LinearEquiv.coe_coe, Function.comp_apply, ← e.congr_arg h, Submonoid.smul_def, Submonoid.smul_def, LinearEquiv.map_smul, LinearEquiv.apply_symm_apply]⟩ exists_of_eq h := by simp_rw [LinearMap.coe_comp, LinearEquiv.coe_coe, Function.comp_apply, EmbeddingLike.apply_eq_iff_eq] at h exact hf.exists_of_eq h
import Mathlib.Algebra.Field.Basic import Mathlib.Algebra.GroupWithZero.Units.Equiv import Mathlib.Algebra.Order.Field.Defs import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Order.Bounds.OrderIso import Mathlib.Tactic.Positivity.Core #align_import algebra.order.field.basic from "leanprover-community/mathlib"@"84771a9f5f0bd5e5d6218811556508ddf476dcbd" open Function OrderDual variable {ι α β : Type*} section LinearOrderedSemifield variable [LinearOrderedSemifield α] {a b c d e : α} {m n : ℤ} @[simps! (config := { simpRhs := true })] def OrderIso.mulLeft₀ (a : α) (ha : 0 < a) : α ≃o α := { Equiv.mulLeft₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_left ha } #align order_iso.mul_left₀ OrderIso.mulLeft₀ #align order_iso.mul_left₀_symm_apply OrderIso.mulLeft₀_symm_apply #align order_iso.mul_left₀_apply OrderIso.mulLeft₀_apply @[simps! (config := { simpRhs := true })] def OrderIso.mulRight₀ (a : α) (ha : 0 < a) : α ≃o α := { Equiv.mulRight₀ a ha.ne' with map_rel_iff' := @fun _ _ => mul_le_mul_right ha } #align order_iso.mul_right₀ OrderIso.mulRight₀ #align order_iso.mul_right₀_symm_apply OrderIso.mulRight₀_symm_apply #align order_iso.mul_right₀_apply OrderIso.mulRight₀_apply theorem le_div_iff (hc : 0 < c) : a ≤ b / c ↔ a * c ≤ b := ⟨fun h => div_mul_cancel₀ b (ne_of_lt hc).symm ▸ mul_le_mul_of_nonneg_right h hc.le, fun h => calc a = a * c * (1 / c) := mul_mul_div a (ne_of_lt hc).symm _ ≤ b * (1 / c) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hc).le _ = b / c := (div_eq_mul_one_div b c).symm ⟩ #align le_div_iff le_div_iff theorem le_div_iff' (hc : 0 < c) : a ≤ b / c ↔ c * a ≤ b := by rw [mul_comm, le_div_iff hc] #align le_div_iff' le_div_iff' theorem div_le_iff (hb : 0 < b) : a / b ≤ c ↔ a ≤ c * b := ⟨fun h => calc a = a / b * b := by rw [div_mul_cancel₀ _ (ne_of_lt hb).symm] _ ≤ c * b := mul_le_mul_of_nonneg_right h hb.le , fun h => calc a / b = a * (1 / b) := div_eq_mul_one_div a b _ ≤ c * b * (1 / b) := mul_le_mul_of_nonneg_right h (one_div_pos.2 hb).le _ = c * b / b := (div_eq_mul_one_div (c * b) b).symm _ = c := by refine (div_eq_iff (ne_of_gt hb)).mpr rfl ⟩ #align div_le_iff div_le_iff theorem div_le_iff' (hb : 0 < b) : a / b ≤ c ↔ a ≤ b * c := by rw [mul_comm, div_le_iff hb] #align div_le_iff' div_le_iff' lemma div_le_comm₀ (hb : 0 < b) (hc : 0 < c) : a / b ≤ c ↔ a / c ≤ b := by rw [div_le_iff hb, div_le_iff' hc] theorem lt_div_iff (hc : 0 < c) : a < b / c ↔ a * c < b := lt_iff_lt_of_le_iff_le <| div_le_iff hc #align lt_div_iff lt_div_iff
Mathlib/Algebra/Order/Field/Basic.lean
86
86
theorem lt_div_iff' (hc : 0 < c) : a < b / c ↔ c * a < b := by
rw [mul_comm, lt_div_iff hc]
import Mathlib.CategoryTheory.Limits.Types import Mathlib.CategoryTheory.IsConnected import Mathlib.CategoryTheory.Limits.Final import Mathlib.CategoryTheory.Conj universe w v u namespace CategoryTheory.Limits.Types variable (C : Type u) [Category.{v} C] def constPUnitFunctor : C ⥤ Type w := (Functor.const C).obj PUnit.{w + 1} @[simps] def pUnitCocone : Cocone (constPUnitFunctor.{w} C) where pt := PUnit ι := { app := fun X => id } noncomputable def isColimitPUnitCocone [IsConnected C] : IsColimit (pUnitCocone.{w} C) where desc s := s.ι.app Classical.ofNonempty fac s j := by ext ⟨⟩ apply constant_of_preserves_morphisms (s.ι.app · PUnit.unit) intros X Y f exact congrFun (s.ι.naturality f).symm PUnit.unit uniq s m h := by ext ⟨⟩ simp [← h Classical.ofNonempty] instance instHasColimitConstPUnitFunctor [IsConnected C] : HasColimit (constPUnitFunctor.{w} C) := ⟨_, isColimitPUnitCocone _⟩ instance instSubsingletonColimitPUnit [IsPreconnected C] [HasColimit (constPUnitFunctor.{w} C)] : Subsingleton (colimit (constPUnitFunctor.{w} C)) where allEq a b := by obtain ⟨c, ⟨⟩, rfl⟩ := jointly_surjective' a obtain ⟨d, ⟨⟩, rfl⟩ := jointly_surjective' b apply constant_of_preserves_morphisms (colimit.ι (constPUnitFunctor C) · PUnit.unit) exact fun c d f => colimit_sound f rfl noncomputable def colimitConstPUnitIsoPUnit [IsConnected C] : colimit (constPUnitFunctor.{w} C) ≅ PUnit.{w + 1} := IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) (isColimitPUnitCocone.{w} C)
Mathlib/CategoryTheory/Limits/IsConnected.lean
87
93
theorem zigzag_of_eqvGen_quot_rel (F : C ⥤ Type w) (c d : Σ j, F.obj j) (h : EqvGen (Quot.Rel F) c d) : Zigzag c.1 d.1 := by
induction h with | rel _ _ h => exact Zigzag.of_hom <| Exists.choose h | refl _ => exact Zigzag.refl _ | symm _ _ _ ih => exact zigzag_symmetric ih | trans _ _ _ _ _ ih₁ ih₂ => exact ih₁.trans ih₂
import Mathlib.Topology.Category.TopCat.OpenNhds import Mathlib.Topology.Sheaves.Presheaf import Mathlib.Topology.Sheaves.SheafCondition.UniqueGluing import Mathlib.CategoryTheory.Adjunction.Evaluation import Mathlib.CategoryTheory.Limits.Types import Mathlib.CategoryTheory.Limits.Preserves.Filtered import Mathlib.CategoryTheory.Limits.Final import Mathlib.Tactic.CategoryTheory.Elementwise import Mathlib.Algebra.Category.Ring.Colimits import Mathlib.CategoryTheory.Sites.Pullback #align_import topology.sheaves.stalks from "leanprover-community/mathlib"@"5dc6092d09e5e489106865241986f7f2ad28d4c8" noncomputable section universe v u v' u' open CategoryTheory open TopCat open CategoryTheory.Limits open TopologicalSpace open Opposite variable {C : Type u} [Category.{v} C] variable [HasColimits.{v} C] variable {X Y Z : TopCat.{v}} namespace TopCat.Presheaf variable (C) def stalkFunctor (x : X) : X.Presheaf C ⥤ C := (whiskeringLeft _ _ C).obj (OpenNhds.inclusion x).op ⋙ colim set_option linter.uppercaseLean3 false in #align Top.presheaf.stalk_functor TopCat.Presheaf.stalkFunctor variable {C} def stalk (ℱ : X.Presheaf C) (x : X) : C := (stalkFunctor C x).obj ℱ set_option linter.uppercaseLean3 false in #align Top.presheaf.stalk TopCat.Presheaf.stalk -- -- colimit ((open_nhds.inclusion x).op ⋙ ℱ) @[simp] theorem stalkFunctor_obj (ℱ : X.Presheaf C) (x : X) : (stalkFunctor C x).obj ℱ = ℱ.stalk x := rfl set_option linter.uppercaseLean3 false in #align Top.presheaf.stalk_functor_obj TopCat.Presheaf.stalkFunctor_obj def germ (F : X.Presheaf C) {U : Opens X} (x : U) : F.obj (op U) ⟶ stalk F x := colimit.ι ((OpenNhds.inclusion x.1).op ⋙ F) (op ⟨U, x.2⟩) set_option linter.uppercaseLean3 false in #align Top.presheaf.germ TopCat.Presheaf.germ theorem germ_res (F : X.Presheaf C) {U V : Opens X} (i : U ⟶ V) (x : U) : F.map i.op ≫ germ F x = germ F (i x : V) := let i' : (⟨U, x.2⟩ : OpenNhds x.1) ⟶ ⟨V, (i x : V).2⟩ := i colimit.w ((OpenNhds.inclusion x.1).op ⋙ F) i'.op set_option linter.uppercaseLean3 false in #align Top.presheaf.germ_res TopCat.Presheaf.germ_res -- Porting note: `@[elementwise]` did not generate the best lemma when applied to `germ_res` attribute [local instance] ConcreteCategory.instFunLike in theorem germ_res_apply (F : X.Presheaf C) {U V : Opens X} (i : U ⟶ V) (x : U) [ConcreteCategory C] (s) : germ F x (F.map i.op s) = germ F (i x) s := by rw [← comp_apply, germ_res] set_option linter.uppercaseLean3 false in #align Top.presheaf.germ_res_apply TopCat.Presheaf.germ_res_apply @[ext] theorem stalk_hom_ext (F : X.Presheaf C) {x} {Y : C} {f₁ f₂ : F.stalk x ⟶ Y} (ih : ∀ (U : Opens X) (hxU : x ∈ U), F.germ ⟨x, hxU⟩ ≫ f₁ = F.germ ⟨x, hxU⟩ ≫ f₂) : f₁ = f₂ := colimit.hom_ext fun U => by induction' U using Opposite.rec with U; cases' U with U hxU; exact ih U hxU set_option linter.uppercaseLean3 false in #align Top.presheaf.stalk_hom_ext TopCat.Presheaf.stalk_hom_ext @[reassoc (attr := simp), elementwise (attr := simp)] theorem stalkFunctor_map_germ {F G : X.Presheaf C} (U : Opens X) (x : U) (f : F ⟶ G) : germ F x ≫ (stalkFunctor C x.1).map f = f.app (op U) ≫ germ G x := colimit.ι_map (whiskerLeft (OpenNhds.inclusion x.1).op f) (op ⟨U, x.2⟩) set_option linter.uppercaseLean3 false in #align Top.presheaf.stalk_functor_map_germ TopCat.Presheaf.stalkFunctor_map_germ variable (C) def stalkPushforward (f : X ⟶ Y) (F : X.Presheaf C) (x : X) : (f _* F).stalk (f x) ⟶ F.stalk x := by -- This is a hack; Lean doesn't like to elaborate the term written directly. -- Porting note: The original proof was `trans; swap`, but `trans` does nothing. refine ?_ ≫ colimit.pre _ (OpenNhds.map f x).op exact colim.map (whiskerRight (NatTrans.op (OpenNhds.inclusionMapIso f x).inv) F) set_option linter.uppercaseLean3 false in #align Top.presheaf.stalk_pushforward TopCat.Presheaf.stalkPushforward @[reassoc (attr := simp), elementwise (attr := simp)] theorem stalkPushforward_germ (f : X ⟶ Y) (F : X.Presheaf C) (U : Opens Y) (x : (Opens.map f).obj U) : (f _* F).germ ⟨(f : X → Y) (x : X), x.2⟩ ≫ F.stalkPushforward C f x = F.germ x := by simp [germ, stalkPushforward] set_option linter.uppercaseLean3 false in #align Top.presheaf.stalk_pushforward_germ TopCat.Presheaf.stalkPushforward_germ -- Here are two other potential solutions, suggested by @fpvandoorn at -- <https://github.com/leanprover-community/mathlib/pull/1018#discussion_r283978240> -- However, I can't get the subsequent two proofs to work with either one. -- def stalkPushforward'' (f : X ⟶ Y) (ℱ : X.Presheaf C) (x : X) : -- (f _* ℱ).stalk (f x) ⟶ ℱ.stalk x := -- colim.map ((Functor.associator _ _ _).inv ≫ -- whiskerRight (NatTrans.op (OpenNhds.inclusionMapIso f x).inv) ℱ) ≫ -- colimit.pre ((OpenNhds.inclusion x).op ⋙ ℱ) (OpenNhds.map f x).op -- def stalkPushforward''' (f : X ⟶ Y) (ℱ : X.Presheaf C) (x : X) : -- (f _* ℱ).stalk (f x) ⟶ ℱ.stalk x := -- (colim.map (whiskerRight (NatTrans.op (OpenNhds.inclusionMapIso f x).inv) ℱ) : -- colim.obj ((OpenNhds.inclusion (f x) ⋙ Opens.map f).op ⋙ ℱ) ⟶ _) ≫ -- colimit.pre ((OpenNhds.inclusion x).op ⋙ ℱ) (OpenNhds.map f x).op section Concrete variable {C} variable [ConcreteCategory.{v} C] attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike -- Porting note (#11215): TODO: @[ext] attribute only applies to structures or lemmas proving x = y -- @[ext] theorem germ_ext (F : X.Presheaf C) {U V : Opens X} {x : X} {hxU : x ∈ U} {hxV : x ∈ V} (W : Opens X) (hxW : x ∈ W) (iWU : W ⟶ U) (iWV : W ⟶ V) {sU : F.obj (op U)} {sV : F.obj (op V)} (ih : F.map iWU.op sU = F.map iWV.op sV) : F.germ ⟨x, hxU⟩ sU = F.germ ⟨x, hxV⟩ sV := by erw [← F.germ_res iWU ⟨x, hxW⟩, ← F.germ_res iWV ⟨x, hxW⟩, comp_apply, comp_apply, ih] set_option linter.uppercaseLean3 false in #align Top.presheaf.germ_ext TopCat.Presheaf.germ_ext variable [PreservesFilteredColimits (forget C)] theorem germ_exist (F : X.Presheaf C) (x : X) (t : (stalk.{v, u} F x : Type v)) : ∃ (U : Opens X) (m : x ∈ U) (s : F.obj (op U)), F.germ ⟨x, m⟩ s = t := by obtain ⟨U, s, e⟩ := Types.jointly_surjective.{v, v} _ (isColimitOfPreserves (forget C) (colimit.isColimit _)) t revert s e induction U with | h U => ?_ cases' U with V m intro s e exact ⟨V, m, s, e⟩ set_option linter.uppercaseLean3 false in #align Top.presheaf.germ_exist TopCat.Presheaf.germ_exist theorem germ_eq (F : X.Presheaf C) {U V : Opens X} (x : X) (mU : x ∈ U) (mV : x ∈ V) (s : F.obj (op U)) (t : F.obj (op V)) (h : germ F ⟨x, mU⟩ s = germ F ⟨x, mV⟩ t) : ∃ (W : Opens X) (_m : x ∈ W) (iU : W ⟶ U) (iV : W ⟶ V), F.map iU.op s = F.map iV.op t := by obtain ⟨W, iU, iV, e⟩ := (Types.FilteredColimit.isColimit_eq_iff.{v, v} _ (isColimitOfPreserves _ (colimit.isColimit ((OpenNhds.inclusion x).op ⋙ F)))).mp h exact ⟨(unop W).1, (unop W).2, iU.unop, iV.unop, e⟩ set_option linter.uppercaseLean3 false in #align Top.presheaf.germ_eq TopCat.Presheaf.germ_eq theorem stalkFunctor_map_injective_of_app_injective {F G : Presheaf C X} (f : F ⟶ G) (h : ∀ U : Opens X, Function.Injective (f.app (op U))) (x : X) : Function.Injective ((stalkFunctor C x).map f) := fun s t hst => by rcases germ_exist F x s with ⟨U₁, hxU₁, s, rfl⟩ rcases germ_exist F x t with ⟨U₂, hxU₂, t, rfl⟩ erw [stalkFunctor_map_germ_apply _ ⟨x, _⟩] at hst erw [stalkFunctor_map_germ_apply _ ⟨x, _⟩] at hst obtain ⟨W, hxW, iWU₁, iWU₂, heq⟩ := G.germ_eq x hxU₁ hxU₂ _ _ hst rw [← comp_apply, ← comp_apply, ← f.naturality, ← f.naturality, comp_apply, comp_apply] at heq replace heq := h W heq convert congr_arg (F.germ ⟨x, hxW⟩) heq using 1 exacts [(F.germ_res_apply iWU₁ ⟨x, hxW⟩ s).symm, (F.germ_res_apply iWU₂ ⟨x, hxW⟩ t).symm] set_option linter.uppercaseLean3 false in #align Top.presheaf.stalk_functor_map_injective_of_app_injective TopCat.Presheaf.stalkFunctor_map_injective_of_app_injective variable [HasLimits C] [PreservesLimits (forget C)] [(forget C).ReflectsIsomorphisms] theorem section_ext (F : Sheaf C X) (U : Opens X) (s t : F.1.obj (op U)) (h : ∀ x : U, F.presheaf.germ x s = F.presheaf.germ x t) : s = t := by -- We use `germ_eq` and the axiom of choice, to pick for every point `x` a neighbourhood -- `V x`, such that the restrictions of `s` and `t` to `V x` coincide. choose V m i₁ i₂ heq using fun x : U => F.presheaf.germ_eq x.1 x.2 x.2 s t (h x) -- Since `F` is a sheaf, we can prove the equality locally, if we can show that these -- neighborhoods form a cover of `U`. apply F.eq_of_locally_eq' V U i₁ · intro x hxU simp only [Opens.coe_iSup, Set.mem_iUnion, SetLike.mem_coe] exact ⟨⟨x, hxU⟩, m ⟨x, hxU⟩⟩ · intro x rw [heq, Subsingleton.elim (i₁ x) (i₂ x)] set_option linter.uppercaseLean3 false in #align Top.presheaf.section_ext TopCat.Presheaf.section_ext theorem app_injective_of_stalkFunctor_map_injective {F : Sheaf C X} {G : Presheaf C X} (f : F.1 ⟶ G) (U : Opens X) (h : ∀ x : U, Function.Injective ((stalkFunctor C x.val).map f)) : Function.Injective (f.app (op U)) := fun s t hst => section_ext F _ _ _ fun x => h x <| by erw [stalkFunctor_map_germ_apply, stalkFunctor_map_germ_apply, hst] set_option linter.uppercaseLean3 false in #align Top.presheaf.app_injective_of_stalk_functor_map_injective TopCat.Presheaf.app_injective_of_stalkFunctor_map_injective theorem app_injective_iff_stalkFunctor_map_injective {F : Sheaf C X} {G : Presheaf C X} (f : F.1 ⟶ G) : (∀ x : X, Function.Injective ((stalkFunctor C x).map f)) ↔ ∀ U : Opens X, Function.Injective (f.app (op U)) := ⟨fun h U => app_injective_of_stalkFunctor_map_injective f U fun x => h x.1, stalkFunctor_map_injective_of_app_injective f⟩ set_option linter.uppercaseLean3 false in #align Top.presheaf.app_injective_iff_stalk_functor_map_injective TopCat.Presheaf.app_injective_iff_stalkFunctor_map_injective instance stalkFunctor_preserves_mono (x : X) : Functor.PreservesMonomorphisms (Sheaf.forget C X ⋙ stalkFunctor C x) := ⟨@fun _𝓐 _𝓑 f _ => ConcreteCategory.mono_of_injective _ <| (app_injective_iff_stalkFunctor_map_injective f.1).mpr (fun c => (@ConcreteCategory.mono_iff_injective_of_preservesPullback _ _ _ _ _ (f.1.app (op c))).mp ((NatTrans.mono_iff_mono_app _ f.1).mp (CategoryTheory.presheaf_mono_of_mono ..) <| op c)) x⟩ set_option linter.uppercaseLean3 false in #align Top.presheaf.stalk_functor_preserves_mono TopCat.Presheaf.stalkFunctor_preserves_mono theorem stalk_mono_of_mono {F G : Sheaf C X} (f : F ⟶ G) [Mono f] : ∀ x, Mono <| (stalkFunctor C x).map f.1 := fun x => Functor.map_mono (Sheaf.forget.{v} C X ⋙ stalkFunctor C x) f set_option linter.uppercaseLean3 false in #align Top.presheaf.stalk_mono_of_mono TopCat.Presheaf.stalk_mono_of_mono theorem mono_of_stalk_mono {F G : Sheaf C X} (f : F ⟶ G) [∀ x, Mono <| (stalkFunctor C x).map f.1] : Mono f := (Sheaf.Hom.mono_iff_presheaf_mono _ _ _).mpr <| (NatTrans.mono_iff_mono_app _ _).mpr fun U => (ConcreteCategory.mono_iff_injective_of_preservesPullback _).mpr <| app_injective_of_stalkFunctor_map_injective f.1 U.unop fun ⟨_x, _hx⟩ => (ConcreteCategory.mono_iff_injective_of_preservesPullback _).mp <| inferInstance set_option linter.uppercaseLean3 false in #align Top.presheaf.mono_of_stalk_mono TopCat.Presheaf.mono_of_stalk_mono theorem mono_iff_stalk_mono {F G : Sheaf C X} (f : F ⟶ G) : Mono f ↔ ∀ x, Mono ((stalkFunctor C x).map f.1) := ⟨fun _ => stalk_mono_of_mono _, fun _ => mono_of_stalk_mono _⟩ set_option linter.uppercaseLean3 false in #align Top.presheaf.mono_iff_stalk_mono TopCat.Presheaf.mono_iff_stalk_mono theorem app_surjective_of_injective_of_locally_surjective {F G : Sheaf C X} (f : F ⟶ G) (U : Opens X) (hinj : ∀ x : U, Function.Injective ((stalkFunctor C x.1).map f.1)) (hsurj : ∀ (t) (x : U), ∃ (V : Opens X) (_ : x.1 ∈ V) (iVU : V ⟶ U) (s : F.1.obj (op V)), f.1.app (op V) s = G.1.map iVU.op t) : Function.Surjective (f.1.app (op U)) := by intro t -- We use the axiom of choice to pick around each point `x` an open neighborhood `V` and a -- preimage under `f` on `V`. choose V mV iVU sf heq using hsurj t -- These neighborhoods clearly cover all of `U`. have V_cover : U ≤ iSup V := by intro x hxU simp only [Opens.coe_iSup, Set.mem_iUnion, SetLike.mem_coe] exact ⟨⟨x, hxU⟩, mV ⟨x, hxU⟩⟩ suffices IsCompatible F.val V sf by -- Since `F` is a sheaf, we can glue all the local preimages together to get a global preimage. obtain ⟨s, s_spec, -⟩ := F.existsUnique_gluing' V U iVU V_cover sf this · use s apply G.eq_of_locally_eq' V U iVU V_cover intro x rw [← comp_apply, ← f.1.naturality, comp_apply, s_spec, heq] intro x y -- What's left to show here is that the sections `sf` are compatible, i.e. they agree on -- the intersections `V x ⊓ V y`. We prove this by showing that all germs are equal. apply section_ext intro z -- Here, we need to use injectivity of the stalk maps. apply hinj ⟨z, (iVU x).le ((inf_le_left : V x ⊓ V y ≤ V x) z.2)⟩ dsimp only erw [stalkFunctor_map_germ_apply, stalkFunctor_map_germ_apply] simp_rw [← comp_apply, f.1.naturality, comp_apply, heq, ← comp_apply, ← G.1.map_comp] rfl set_option linter.uppercaseLean3 false in #align Top.presheaf.app_surjective_of_injective_of_locally_surjective TopCat.Presheaf.app_surjective_of_injective_of_locally_surjective theorem app_surjective_of_stalkFunctor_map_bijective {F G : Sheaf C X} (f : F ⟶ G) (U : Opens X) (h : ∀ x : U, Function.Bijective ((stalkFunctor C x.val).map f.1)) : Function.Surjective (f.1.app (op U)) := by refine app_surjective_of_injective_of_locally_surjective f U (fun x => (h x).1) fun t x => ?_ -- Now we need to prove our initial claim: That we can find preimages of `t` locally. -- Since `f` is surjective on stalks, we can find a preimage `s₀` of the germ of `t` at `x` obtain ⟨s₀, hs₀⟩ := (h x).2 (G.presheaf.germ x t) -- ... and this preimage must come from some section `s₁` defined on some open neighborhood `V₁` obtain ⟨V₁, hxV₁, s₁, hs₁⟩ := F.presheaf.germ_exist x.1 s₀ subst hs₁; rename' hs₀ => hs₁ erw [stalkFunctor_map_germ_apply V₁ ⟨x.1, hxV₁⟩ f.1 s₁] at hs₁ -- Now, the germ of `f.app (op V₁) s₁` equals the germ of `t`, hence they must coincide on -- some open neighborhood `V₂`. obtain ⟨V₂, hxV₂, iV₂V₁, iV₂U, heq⟩ := G.presheaf.germ_eq x.1 hxV₁ x.2 _ _ hs₁ -- The restriction of `s₁` to that neighborhood is our desired local preimage. use V₂, hxV₂, iV₂U, F.1.map iV₂V₁.op s₁ rw [← comp_apply, f.1.naturality, comp_apply, heq] set_option linter.uppercaseLean3 false in #align Top.presheaf.app_surjective_of_stalk_functor_map_bijective TopCat.Presheaf.app_surjective_of_stalkFunctor_map_bijective theorem app_bijective_of_stalkFunctor_map_bijective {F G : Sheaf C X} (f : F ⟶ G) (U : Opens X) (h : ∀ x : U, Function.Bijective ((stalkFunctor C x.val).map f.1)) : Function.Bijective (f.1.app (op U)) := ⟨app_injective_of_stalkFunctor_map_injective f.1 U fun x => (h x).1, app_surjective_of_stalkFunctor_map_bijective f U h⟩ set_option linter.uppercaseLean3 false in #align Top.presheaf.app_bijective_of_stalk_functor_map_bijective TopCat.Presheaf.app_bijective_of_stalkFunctor_map_bijective theorem app_isIso_of_stalkFunctor_map_iso {F G : Sheaf C X} (f : F ⟶ G) (U : Opens X) [∀ x : U, IsIso ((stalkFunctor C x.val).map f.1)] : IsIso (f.1.app (op U)) := by -- Since the forgetful functor of `C` reflects isomorphisms, it suffices to see that the -- underlying map between types is an isomorphism, i.e. bijective. suffices IsIso ((forget C).map (f.1.app (op U))) by exact isIso_of_reflects_iso (f.1.app (op U)) (forget C) rw [isIso_iff_bijective] apply app_bijective_of_stalkFunctor_map_bijective intro x apply (isIso_iff_bijective _).mp exact Functor.map_isIso (forget C) ((stalkFunctor C x.1).map f.1) set_option linter.uppercaseLean3 false in #align Top.presheaf.app_is_iso_of_stalk_functor_map_iso TopCat.Presheaf.app_isIso_of_stalkFunctor_map_iso -- Making this an instance would cause a loop in typeclass resolution with `Functor.map_isIso`
Mathlib/Topology/Sheaves/Stalks.lean
609
618
theorem isIso_of_stalkFunctor_map_iso {F G : Sheaf C X} (f : F ⟶ G) [∀ x : X, IsIso ((stalkFunctor C x).map f.1)] : IsIso f := by
-- Since the inclusion functor from sheaves to presheaves is fully faithful, it suffices to -- show that `f`, as a morphism between _presheaves_, is an isomorphism. suffices IsIso ((Sheaf.forget C X).map f) by exact isIso_of_fully_faithful (Sheaf.forget C X) f -- We show that all components of `f` are isomorphisms. suffices ∀ U : (Opens X)ᵒᵖ, IsIso (f.1.app U) by exact @NatIso.isIso_of_isIso_app _ _ _ _ F.1 G.1 f.1 this intro U; induction U apply app_isIso_of_stalkFunctor_map_iso
import Mathlib.Combinatorics.SimpleGraph.Subgraph import Mathlib.Data.List.Rotate #align_import combinatorics.simple_graph.connectivity from "leanprover-community/mathlib"@"b99e2d58a5e6861833fa8de11e51a81144258db4" open Function universe u v w namespace SimpleGraph variable {V : Type u} {V' : Type v} {V'' : Type w} variable (G : SimpleGraph V) (G' : SimpleGraph V') (G'' : SimpleGraph V'') inductive Walk : V → V → Type u | nil {u : V} : Walk u u | cons {u v w : V} (h : G.Adj u v) (p : Walk v w) : Walk u w deriving DecidableEq #align simple_graph.walk SimpleGraph.Walk attribute [refl] Walk.nil @[simps] instance Walk.instInhabited (v : V) : Inhabited (G.Walk v v) := ⟨Walk.nil⟩ #align simple_graph.walk.inhabited SimpleGraph.Walk.instInhabited @[match_pattern, reducible] def Adj.toWalk {G : SimpleGraph V} {u v : V} (h : G.Adj u v) : G.Walk u v := Walk.cons h Walk.nil #align simple_graph.adj.to_walk SimpleGraph.Adj.toWalk namespace Walk variable {G} @[match_pattern] abbrev nil' (u : V) : G.Walk u u := Walk.nil #align simple_graph.walk.nil' SimpleGraph.Walk.nil' @[match_pattern] abbrev cons' (u v w : V) (h : G.Adj u v) (p : G.Walk v w) : G.Walk u w := Walk.cons h p #align simple_graph.walk.cons' SimpleGraph.Walk.cons' protected def copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : G.Walk u' v' := hu ▸ hv ▸ p #align simple_graph.walk.copy SimpleGraph.Walk.copy @[simp] theorem copy_rfl_rfl {u v} (p : G.Walk u v) : p.copy rfl rfl = p := rfl #align simple_graph.walk.copy_rfl_rfl SimpleGraph.Walk.copy_rfl_rfl @[simp] theorem copy_copy {u v u' v' u'' v''} (p : G.Walk u v) (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') : (p.copy hu hv).copy hu' hv' = p.copy (hu.trans hu') (hv.trans hv') := by subst_vars rfl #align simple_graph.walk.copy_copy SimpleGraph.Walk.copy_copy @[simp] theorem copy_nil {u u'} (hu : u = u') : (Walk.nil : G.Walk u u).copy hu hu = Walk.nil := by subst_vars rfl #align simple_graph.walk.copy_nil SimpleGraph.Walk.copy_nil theorem copy_cons {u v w u' w'} (h : G.Adj u v) (p : G.Walk v w) (hu : u = u') (hw : w = w') : (Walk.cons h p).copy hu hw = Walk.cons (hu ▸ h) (p.copy rfl hw) := by subst_vars rfl #align simple_graph.walk.copy_cons SimpleGraph.Walk.copy_cons @[simp] theorem cons_copy {u v w v' w'} (h : G.Adj u v) (p : G.Walk v' w') (hv : v' = v) (hw : w' = w) : Walk.cons h (p.copy hv hw) = (Walk.cons (hv ▸ h) p).copy rfl hw := by subst_vars rfl #align simple_graph.walk.cons_copy SimpleGraph.Walk.cons_copy theorem exists_eq_cons_of_ne {u v : V} (hne : u ≠ v) : ∀ (p : G.Walk u v), ∃ (w : V) (h : G.Adj u w) (p' : G.Walk w v), p = cons h p' | nil => (hne rfl).elim | cons h p' => ⟨_, h, p', rfl⟩ #align simple_graph.walk.exists_eq_cons_of_ne SimpleGraph.Walk.exists_eq_cons_of_ne def length {u v : V} : G.Walk u v → ℕ | nil => 0 | cons _ q => q.length.succ #align simple_graph.walk.length SimpleGraph.Walk.length @[trans] def append {u v w : V} : G.Walk u v → G.Walk v w → G.Walk u w | nil, q => q | cons h p, q => cons h (p.append q) #align simple_graph.walk.append SimpleGraph.Walk.append def concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : G.Walk u w := p.append (cons h nil) #align simple_graph.walk.concat SimpleGraph.Walk.concat theorem concat_eq_append {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : p.concat h = p.append (cons h nil) := rfl #align simple_graph.walk.concat_eq_append SimpleGraph.Walk.concat_eq_append protected def reverseAux {u v w : V} : G.Walk u v → G.Walk u w → G.Walk v w | nil, q => q | cons h p, q => Walk.reverseAux p (cons (G.symm h) q) #align simple_graph.walk.reverse_aux SimpleGraph.Walk.reverseAux @[symm] def reverse {u v : V} (w : G.Walk u v) : G.Walk v u := w.reverseAux nil #align simple_graph.walk.reverse SimpleGraph.Walk.reverse def getVert {u v : V} : G.Walk u v → ℕ → V | nil, _ => u | cons _ _, 0 => u | cons _ q, n + 1 => q.getVert n #align simple_graph.walk.get_vert SimpleGraph.Walk.getVert @[simp] theorem getVert_zero {u v} (w : G.Walk u v) : w.getVert 0 = u := by cases w <;> rfl #align simple_graph.walk.get_vert_zero SimpleGraph.Walk.getVert_zero theorem getVert_of_length_le {u v} (w : G.Walk u v) {i : ℕ} (hi : w.length ≤ i) : w.getVert i = v := by induction w generalizing i with | nil => rfl | cons _ _ ih => cases i · cases hi · exact ih (Nat.succ_le_succ_iff.1 hi) #align simple_graph.walk.get_vert_of_length_le SimpleGraph.Walk.getVert_of_length_le @[simp] theorem getVert_length {u v} (w : G.Walk u v) : w.getVert w.length = v := w.getVert_of_length_le rfl.le #align simple_graph.walk.get_vert_length SimpleGraph.Walk.getVert_length theorem adj_getVert_succ {u v} (w : G.Walk u v) {i : ℕ} (hi : i < w.length) : G.Adj (w.getVert i) (w.getVert (i + 1)) := by induction w generalizing i with | nil => cases hi | cons hxy _ ih => cases i · simp [getVert, hxy] · exact ih (Nat.succ_lt_succ_iff.1 hi) #align simple_graph.walk.adj_get_vert_succ SimpleGraph.Walk.adj_getVert_succ @[simp] theorem cons_append {u v w x : V} (h : G.Adj u v) (p : G.Walk v w) (q : G.Walk w x) : (cons h p).append q = cons h (p.append q) := rfl #align simple_graph.walk.cons_append SimpleGraph.Walk.cons_append @[simp] theorem cons_nil_append {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h nil).append p = cons h p := rfl #align simple_graph.walk.cons_nil_append SimpleGraph.Walk.cons_nil_append @[simp] theorem append_nil {u v : V} (p : G.Walk u v) : p.append nil = p := by induction p with | nil => rfl | cons _ _ ih => rw [cons_append, ih] #align simple_graph.walk.append_nil SimpleGraph.Walk.append_nil @[simp] theorem nil_append {u v : V} (p : G.Walk u v) : nil.append p = p := rfl #align simple_graph.walk.nil_append SimpleGraph.Walk.nil_append theorem append_assoc {u v w x : V} (p : G.Walk u v) (q : G.Walk v w) (r : G.Walk w x) : p.append (q.append r) = (p.append q).append r := by induction p with | nil => rfl | cons h p' ih => dsimp only [append] rw [ih] #align simple_graph.walk.append_assoc SimpleGraph.Walk.append_assoc @[simp] theorem append_copy_copy {u v w u' v' w'} (p : G.Walk u v) (q : G.Walk v w) (hu : u = u') (hv : v = v') (hw : w = w') : (p.copy hu hv).append (q.copy hv hw) = (p.append q).copy hu hw := by subst_vars rfl #align simple_graph.walk.append_copy_copy SimpleGraph.Walk.append_copy_copy theorem concat_nil {u v : V} (h : G.Adj u v) : nil.concat h = cons h nil := rfl #align simple_graph.walk.concat_nil SimpleGraph.Walk.concat_nil @[simp] theorem concat_cons {u v w x : V} (h : G.Adj u v) (p : G.Walk v w) (h' : G.Adj w x) : (cons h p).concat h' = cons h (p.concat h') := rfl #align simple_graph.walk.concat_cons SimpleGraph.Walk.concat_cons theorem append_concat {u v w x : V} (p : G.Walk u v) (q : G.Walk v w) (h : G.Adj w x) : p.append (q.concat h) = (p.append q).concat h := append_assoc _ _ _ #align simple_graph.walk.append_concat SimpleGraph.Walk.append_concat theorem concat_append {u v w x : V} (p : G.Walk u v) (h : G.Adj v w) (q : G.Walk w x) : (p.concat h).append q = p.append (cons h q) := by rw [concat_eq_append, ← append_assoc, cons_nil_append] #align simple_graph.walk.concat_append SimpleGraph.Walk.concat_append theorem exists_cons_eq_concat {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : ∃ (x : V) (q : G.Walk u x) (h' : G.Adj x w), cons h p = q.concat h' := by induction p generalizing u with | nil => exact ⟨_, nil, h, rfl⟩ | cons h' p ih => obtain ⟨y, q, h'', hc⟩ := ih h' refine ⟨y, cons h q, h'', ?_⟩ rw [concat_cons, hc] #align simple_graph.walk.exists_cons_eq_concat SimpleGraph.Walk.exists_cons_eq_concat theorem exists_concat_eq_cons {u v w : V} : ∀ (p : G.Walk u v) (h : G.Adj v w), ∃ (x : V) (h' : G.Adj u x) (q : G.Walk x w), p.concat h = cons h' q | nil, h => ⟨_, h, nil, rfl⟩ | cons h' p, h => ⟨_, h', Walk.concat p h, concat_cons _ _ _⟩ #align simple_graph.walk.exists_concat_eq_cons SimpleGraph.Walk.exists_concat_eq_cons @[simp] theorem reverse_nil {u : V} : (nil : G.Walk u u).reverse = nil := rfl #align simple_graph.walk.reverse_nil SimpleGraph.Walk.reverse_nil theorem reverse_singleton {u v : V} (h : G.Adj u v) : (cons h nil).reverse = cons (G.symm h) nil := rfl #align simple_graph.walk.reverse_singleton SimpleGraph.Walk.reverse_singleton @[simp] theorem cons_reverseAux {u v w x : V} (p : G.Walk u v) (q : G.Walk w x) (h : G.Adj w u) : (cons h p).reverseAux q = p.reverseAux (cons (G.symm h) q) := rfl #align simple_graph.walk.cons_reverse_aux SimpleGraph.Walk.cons_reverseAux @[simp] protected theorem append_reverseAux {u v w x : V} (p : G.Walk u v) (q : G.Walk v w) (r : G.Walk u x) : (p.append q).reverseAux r = q.reverseAux (p.reverseAux r) := by induction p with | nil => rfl | cons h _ ih => exact ih q (cons (G.symm h) r) #align simple_graph.walk.append_reverse_aux SimpleGraph.Walk.append_reverseAux @[simp] protected theorem reverseAux_append {u v w x : V} (p : G.Walk u v) (q : G.Walk u w) (r : G.Walk w x) : (p.reverseAux q).append r = p.reverseAux (q.append r) := by induction p with | nil => rfl | cons h _ ih => simp [ih (cons (G.symm h) q)] #align simple_graph.walk.reverse_aux_append SimpleGraph.Walk.reverseAux_append protected theorem reverseAux_eq_reverse_append {u v w : V} (p : G.Walk u v) (q : G.Walk u w) : p.reverseAux q = p.reverse.append q := by simp [reverse] #align simple_graph.walk.reverse_aux_eq_reverse_append SimpleGraph.Walk.reverseAux_eq_reverse_append @[simp] theorem reverse_cons {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h p).reverse = p.reverse.append (cons (G.symm h) nil) := by simp [reverse] #align simple_graph.walk.reverse_cons SimpleGraph.Walk.reverse_cons @[simp] theorem reverse_copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : (p.copy hu hv).reverse = p.reverse.copy hv hu := by subst_vars rfl #align simple_graph.walk.reverse_copy SimpleGraph.Walk.reverse_copy @[simp] theorem reverse_append {u v w : V} (p : G.Walk u v) (q : G.Walk v w) : (p.append q).reverse = q.reverse.append p.reverse := by simp [reverse] #align simple_graph.walk.reverse_append SimpleGraph.Walk.reverse_append @[simp] theorem reverse_concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : (p.concat h).reverse = cons (G.symm h) p.reverse := by simp [concat_eq_append] #align simple_graph.walk.reverse_concat SimpleGraph.Walk.reverse_concat @[simp] theorem reverse_reverse {u v : V} (p : G.Walk u v) : p.reverse.reverse = p := by induction p with | nil => rfl | cons _ _ ih => simp [ih] #align simple_graph.walk.reverse_reverse SimpleGraph.Walk.reverse_reverse @[simp] theorem length_nil {u : V} : (nil : G.Walk u u).length = 0 := rfl #align simple_graph.walk.length_nil SimpleGraph.Walk.length_nil @[simp] theorem length_cons {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h p).length = p.length + 1 := rfl #align simple_graph.walk.length_cons SimpleGraph.Walk.length_cons @[simp] theorem length_copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : (p.copy hu hv).length = p.length := by subst_vars rfl #align simple_graph.walk.length_copy SimpleGraph.Walk.length_copy @[simp] theorem length_append {u v w : V} (p : G.Walk u v) (q : G.Walk v w) : (p.append q).length = p.length + q.length := by induction p with | nil => simp | cons _ _ ih => simp [ih, add_comm, add_left_comm, add_assoc] #align simple_graph.walk.length_append SimpleGraph.Walk.length_append @[simp] theorem length_concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : (p.concat h).length = p.length + 1 := length_append _ _ #align simple_graph.walk.length_concat SimpleGraph.Walk.length_concat @[simp] protected theorem length_reverseAux {u v w : V} (p : G.Walk u v) (q : G.Walk u w) : (p.reverseAux q).length = p.length + q.length := by induction p with | nil => simp! | cons _ _ ih => simp [ih, Nat.succ_add, Nat.add_assoc] #align simple_graph.walk.length_reverse_aux SimpleGraph.Walk.length_reverseAux @[simp] theorem length_reverse {u v : V} (p : G.Walk u v) : p.reverse.length = p.length := by simp [reverse] #align simple_graph.walk.length_reverse SimpleGraph.Walk.length_reverse theorem eq_of_length_eq_zero {u v : V} : ∀ {p : G.Walk u v}, p.length = 0 → u = v | nil, _ => rfl #align simple_graph.walk.eq_of_length_eq_zero SimpleGraph.Walk.eq_of_length_eq_zero theorem adj_of_length_eq_one {u v : V} : ∀ {p : G.Walk u v}, p.length = 1 → G.Adj u v | cons h nil, _ => h @[simp] theorem exists_length_eq_zero_iff {u v : V} : (∃ p : G.Walk u v, p.length = 0) ↔ u = v := by constructor · rintro ⟨p, hp⟩ exact eq_of_length_eq_zero hp · rintro rfl exact ⟨nil, rfl⟩ #align simple_graph.walk.exists_length_eq_zero_iff SimpleGraph.Walk.exists_length_eq_zero_iff @[simp] theorem length_eq_zero_iff {u : V} {p : G.Walk u u} : p.length = 0 ↔ p = nil := by cases p <;> simp #align simple_graph.walk.length_eq_zero_iff SimpleGraph.Walk.length_eq_zero_iff theorem getVert_append {u v w : V} (p : G.Walk u v) (q : G.Walk v w) (i : ℕ) : (p.append q).getVert i = if i < p.length then p.getVert i else q.getVert (i - p.length) := by induction p generalizing i with | nil => simp | cons h p ih => cases i <;> simp [getVert, ih, Nat.succ_lt_succ_iff] theorem getVert_reverse {u v : V} (p : G.Walk u v) (i : ℕ) : p.reverse.getVert i = p.getVert (p.length - i) := by induction p with | nil => rfl | cons h p ih => simp only [reverse_cons, getVert_append, length_reverse, ih, length_cons] split_ifs next hi => rw [Nat.succ_sub hi.le] simp [getVert] next hi => obtain rfl | hi' := Nat.eq_or_lt_of_not_lt hi · simp [getVert] · rw [Nat.eq_add_of_sub_eq (Nat.sub_pos_of_lt hi') rfl, Nat.sub_eq_zero_of_le hi'] simp [getVert] theorem concat_ne_nil {u v : V} (p : G.Walk u v) (h : G.Adj v u) : p.concat h ≠ nil := by cases p <;> simp [concat] #align simple_graph.walk.concat_ne_nil SimpleGraph.Walk.concat_ne_nil theorem concat_inj {u v v' w : V} {p : G.Walk u v} {h : G.Adj v w} {p' : G.Walk u v'} {h' : G.Adj v' w} (he : p.concat h = p'.concat h') : ∃ hv : v = v', p.copy rfl hv = p' := by induction p with | nil => cases p' · exact ⟨rfl, rfl⟩ · exfalso simp only [concat_nil, concat_cons, cons.injEq] at he obtain ⟨rfl, he⟩ := he simp only [heq_iff_eq] at he exact concat_ne_nil _ _ he.symm | cons _ _ ih => rw [concat_cons] at he cases p' · exfalso simp only [concat_nil, cons.injEq] at he obtain ⟨rfl, he⟩ := he rw [heq_iff_eq] at he exact concat_ne_nil _ _ he · rw [concat_cons, cons.injEq] at he obtain ⟨rfl, he⟩ := he rw [heq_iff_eq] at he obtain ⟨rfl, rfl⟩ := ih he exact ⟨rfl, rfl⟩ #align simple_graph.walk.concat_inj SimpleGraph.Walk.concat_inj def support {u v : V} : G.Walk u v → List V | nil => [u] | cons _ p => u :: p.support #align simple_graph.walk.support SimpleGraph.Walk.support def darts {u v : V} : G.Walk u v → List G.Dart | nil => [] | cons h p => ⟨(u, _), h⟩ :: p.darts #align simple_graph.walk.darts SimpleGraph.Walk.darts def edges {u v : V} (p : G.Walk u v) : List (Sym2 V) := p.darts.map Dart.edge #align simple_graph.walk.edges SimpleGraph.Walk.edges @[simp] theorem support_nil {u : V} : (nil : G.Walk u u).support = [u] := rfl #align simple_graph.walk.support_nil SimpleGraph.Walk.support_nil @[simp] theorem support_cons {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h p).support = u :: p.support := rfl #align simple_graph.walk.support_cons SimpleGraph.Walk.support_cons @[simp] theorem support_concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : (p.concat h).support = p.support.concat w := by induction p <;> simp [*, concat_nil] #align simple_graph.walk.support_concat SimpleGraph.Walk.support_concat @[simp] theorem support_copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : (p.copy hu hv).support = p.support := by subst_vars rfl #align simple_graph.walk.support_copy SimpleGraph.Walk.support_copy theorem support_append {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : (p.append p').support = p.support ++ p'.support.tail := by induction p <;> cases p' <;> simp [*] #align simple_graph.walk.support_append SimpleGraph.Walk.support_append @[simp] theorem support_reverse {u v : V} (p : G.Walk u v) : p.reverse.support = p.support.reverse := by induction p <;> simp [support_append, *] #align simple_graph.walk.support_reverse SimpleGraph.Walk.support_reverse @[simp] theorem support_ne_nil {u v : V} (p : G.Walk u v) : p.support ≠ [] := by cases p <;> simp #align simple_graph.walk.support_ne_nil SimpleGraph.Walk.support_ne_nil theorem tail_support_append {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : (p.append p').support.tail = p.support.tail ++ p'.support.tail := by rw [support_append, List.tail_append_of_ne_nil _ _ (support_ne_nil _)] #align simple_graph.walk.tail_support_append SimpleGraph.Walk.tail_support_append theorem support_eq_cons {u v : V} (p : G.Walk u v) : p.support = u :: p.support.tail := by cases p <;> simp #align simple_graph.walk.support_eq_cons SimpleGraph.Walk.support_eq_cons @[simp] theorem start_mem_support {u v : V} (p : G.Walk u v) : u ∈ p.support := by cases p <;> simp #align simple_graph.walk.start_mem_support SimpleGraph.Walk.start_mem_support @[simp] theorem end_mem_support {u v : V} (p : G.Walk u v) : v ∈ p.support := by induction p <;> simp [*] #align simple_graph.walk.end_mem_support SimpleGraph.Walk.end_mem_support @[simp] theorem support_nonempty {u v : V} (p : G.Walk u v) : { w | w ∈ p.support }.Nonempty := ⟨u, by simp⟩ #align simple_graph.walk.support_nonempty SimpleGraph.Walk.support_nonempty theorem mem_support_iff {u v w : V} (p : G.Walk u v) : w ∈ p.support ↔ w = u ∨ w ∈ p.support.tail := by cases p <;> simp #align simple_graph.walk.mem_support_iff SimpleGraph.Walk.mem_support_iff theorem mem_support_nil_iff {u v : V} : u ∈ (nil : G.Walk v v).support ↔ u = v := by simp #align simple_graph.walk.mem_support_nil_iff SimpleGraph.Walk.mem_support_nil_iff @[simp] theorem mem_tail_support_append_iff {t u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : t ∈ (p.append p').support.tail ↔ t ∈ p.support.tail ∨ t ∈ p'.support.tail := by rw [tail_support_append, List.mem_append] #align simple_graph.walk.mem_tail_support_append_iff SimpleGraph.Walk.mem_tail_support_append_iff @[simp] theorem end_mem_tail_support_of_ne {u v : V} (h : u ≠ v) (p : G.Walk u v) : v ∈ p.support.tail := by obtain ⟨_, _, _, rfl⟩ := exists_eq_cons_of_ne h p simp #align simple_graph.walk.end_mem_tail_support_of_ne SimpleGraph.Walk.end_mem_tail_support_of_ne @[simp, nolint unusedHavesSuffices] theorem mem_support_append_iff {t u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : t ∈ (p.append p').support ↔ t ∈ p.support ∨ t ∈ p'.support := by simp only [mem_support_iff, mem_tail_support_append_iff] obtain rfl | h := eq_or_ne t v <;> obtain rfl | h' := eq_or_ne t u <;> -- this `have` triggers the unusedHavesSuffices linter: (try have := h'.symm) <;> simp [*] #align simple_graph.walk.mem_support_append_iff SimpleGraph.Walk.mem_support_append_iff @[simp] theorem subset_support_append_left {V : Type u} {G : SimpleGraph V} {u v w : V} (p : G.Walk u v) (q : G.Walk v w) : p.support ⊆ (p.append q).support := by simp only [Walk.support_append, List.subset_append_left] #align simple_graph.walk.subset_support_append_left SimpleGraph.Walk.subset_support_append_left @[simp] theorem subset_support_append_right {V : Type u} {G : SimpleGraph V} {u v w : V} (p : G.Walk u v) (q : G.Walk v w) : q.support ⊆ (p.append q).support := by intro h simp (config := { contextual := true }) only [mem_support_append_iff, or_true_iff, imp_true_iff] #align simple_graph.walk.subset_support_append_right SimpleGraph.Walk.subset_support_append_right theorem coe_support {u v : V} (p : G.Walk u v) : (p.support : Multiset V) = {u} + p.support.tail := by cases p <;> rfl #align simple_graph.walk.coe_support SimpleGraph.Walk.coe_support theorem coe_support_append {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : ((p.append p').support : Multiset V) = {u} + p.support.tail + p'.support.tail := by rw [support_append, ← Multiset.coe_add, coe_support] #align simple_graph.walk.coe_support_append SimpleGraph.Walk.coe_support_append theorem coe_support_append' [DecidableEq V] {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : ((p.append p').support : Multiset V) = p.support + p'.support - {v} := by rw [support_append, ← Multiset.coe_add] simp only [coe_support] rw [add_comm ({v} : Multiset V)] simp only [← add_assoc, add_tsub_cancel_right] #align simple_graph.walk.coe_support_append' SimpleGraph.Walk.coe_support_append' theorem chain_adj_support {u v w : V} (h : G.Adj u v) : ∀ (p : G.Walk v w), List.Chain G.Adj u p.support | nil => List.Chain.cons h List.Chain.nil | cons h' p => List.Chain.cons h (chain_adj_support h' p) #align simple_graph.walk.chain_adj_support SimpleGraph.Walk.chain_adj_support theorem chain'_adj_support {u v : V} : ∀ (p : G.Walk u v), List.Chain' G.Adj p.support | nil => List.Chain.nil | cons h p => chain_adj_support h p #align simple_graph.walk.chain'_adj_support SimpleGraph.Walk.chain'_adj_support theorem chain_dartAdj_darts {d : G.Dart} {v w : V} (h : d.snd = v) (p : G.Walk v w) : List.Chain G.DartAdj d p.darts := by induction p generalizing d with | nil => exact List.Chain.nil -- Porting note: needed to defer `h` and `rfl` to help elaboration | cons h' p ih => exact List.Chain.cons (by exact h) (ih (by rfl)) #align simple_graph.walk.chain_dart_adj_darts SimpleGraph.Walk.chain_dartAdj_darts theorem chain'_dartAdj_darts {u v : V} : ∀ (p : G.Walk u v), List.Chain' G.DartAdj p.darts | nil => trivial -- Porting note: needed to defer `rfl` to help elaboration | cons h p => chain_dartAdj_darts (by rfl) p #align simple_graph.walk.chain'_dart_adj_darts SimpleGraph.Walk.chain'_dartAdj_darts theorem edges_subset_edgeSet {u v : V} : ∀ (p : G.Walk u v) ⦃e : Sym2 V⦄, e ∈ p.edges → e ∈ G.edgeSet | cons h' p', e, h => by cases h · exact h' next h' => exact edges_subset_edgeSet p' h' #align simple_graph.walk.edges_subset_edge_set SimpleGraph.Walk.edges_subset_edgeSet theorem adj_of_mem_edges {u v x y : V} (p : G.Walk u v) (h : s(x, y) ∈ p.edges) : G.Adj x y := edges_subset_edgeSet p h #align simple_graph.walk.adj_of_mem_edges SimpleGraph.Walk.adj_of_mem_edges @[simp] theorem darts_nil {u : V} : (nil : G.Walk u u).darts = [] := rfl #align simple_graph.walk.darts_nil SimpleGraph.Walk.darts_nil @[simp] theorem darts_cons {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h p).darts = ⟨(u, v), h⟩ :: p.darts := rfl #align simple_graph.walk.darts_cons SimpleGraph.Walk.darts_cons @[simp] theorem darts_concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : (p.concat h).darts = p.darts.concat ⟨(v, w), h⟩ := by induction p <;> simp [*, concat_nil] #align simple_graph.walk.darts_concat SimpleGraph.Walk.darts_concat @[simp] theorem darts_copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : (p.copy hu hv).darts = p.darts := by subst_vars rfl #align simple_graph.walk.darts_copy SimpleGraph.Walk.darts_copy @[simp] theorem darts_append {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : (p.append p').darts = p.darts ++ p'.darts := by induction p <;> simp [*] #align simple_graph.walk.darts_append SimpleGraph.Walk.darts_append @[simp] theorem darts_reverse {u v : V} (p : G.Walk u v) : p.reverse.darts = (p.darts.map Dart.symm).reverse := by induction p <;> simp [*, Sym2.eq_swap] #align simple_graph.walk.darts_reverse SimpleGraph.Walk.darts_reverse
Mathlib/Combinatorics/SimpleGraph/Connectivity.lean
735
736
theorem mem_darts_reverse {u v : V} {d : G.Dart} {p : G.Walk u v} : d ∈ p.reverse.darts ↔ d.symm ∈ p.darts := by
simp
import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.Orientation import Mathlib.Data.Complex.Orientation import Mathlib.Tactic.LinearCombination #align_import analysis.inner_product_space.two_dim from "leanprover-community/mathlib"@"cd8fafa2fac98e1a67097e8a91ad9901cfde48af" noncomputable section open scoped RealInnerProductSpace ComplexConjugate open FiniteDimensional lemma FiniteDimensional.of_fact_finrank_eq_two {K V : Type*} [DivisionRing K] [AddCommGroup V] [Module K V] [Fact (finrank K V = 2)] : FiniteDimensional K V := .of_fact_finrank_eq_succ 1 attribute [local instance] FiniteDimensional.of_fact_finrank_eq_two @[deprecated (since := "2024-02-02")] alias FiniteDimensional.finiteDimensional_of_fact_finrank_eq_two := FiniteDimensional.of_fact_finrank_eq_two variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [Fact (finrank ℝ E = 2)] (o : Orientation ℝ E (Fin 2)) namespace Orientation irreducible_def areaForm : E →ₗ[ℝ] E →ₗ[ℝ] ℝ := by let z : E [⋀^Fin 0]→ₗ[ℝ] ℝ ≃ₗ[ℝ] ℝ := AlternatingMap.constLinearEquivOfIsEmpty.symm let y : E [⋀^Fin 1]→ₗ[ℝ] ℝ →ₗ[ℝ] E →ₗ[ℝ] ℝ := LinearMap.llcomp ℝ E (E [⋀^Fin 0]→ₗ[ℝ] ℝ) ℝ z ∘ₗ AlternatingMap.curryLeftLinearMap exact y ∘ₗ AlternatingMap.curryLeftLinearMap (R' := ℝ) o.volumeForm #align orientation.area_form Orientation.areaForm local notation "ω" => o.areaForm theorem areaForm_to_volumeForm (x y : E) : ω x y = o.volumeForm ![x, y] := by simp [areaForm] #align orientation.area_form_to_volume_form Orientation.areaForm_to_volumeForm @[simp] theorem areaForm_apply_self (x : E) : ω x x = 0 := by rw [areaForm_to_volumeForm] refine o.volumeForm.map_eq_zero_of_eq ![x, x] ?_ (?_ : (0 : Fin 2) ≠ 1) · simp · norm_num #align orientation.area_form_apply_self Orientation.areaForm_apply_self theorem areaForm_swap (x y : E) : ω x y = -ω y x := by simp only [areaForm_to_volumeForm] convert o.volumeForm.map_swap ![y, x] (_ : (0 : Fin 2) ≠ 1) · ext i fin_cases i <;> rfl · norm_num #align orientation.area_form_swap Orientation.areaForm_swap @[simp] theorem areaForm_neg_orientation : (-o).areaForm = -o.areaForm := by ext x y simp [areaForm_to_volumeForm] #align orientation.area_form_neg_orientation Orientation.areaForm_neg_orientation def areaForm' : E →L[ℝ] E →L[ℝ] ℝ := LinearMap.toContinuousLinearMap (↑(LinearMap.toContinuousLinearMap : (E →ₗ[ℝ] ℝ) ≃ₗ[ℝ] E →L[ℝ] ℝ) ∘ₗ o.areaForm) #align orientation.area_form' Orientation.areaForm' @[simp] theorem areaForm'_apply (x : E) : o.areaForm' x = LinearMap.toContinuousLinearMap (o.areaForm x) := rfl #align orientation.area_form'_apply Orientation.areaForm'_apply theorem abs_areaForm_le (x y : E) : |ω x y| ≤ ‖x‖ * ‖y‖ := by simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.abs_volumeForm_apply_le ![x, y] #align orientation.abs_area_form_le Orientation.abs_areaForm_le theorem areaForm_le (x y : E) : ω x y ≤ ‖x‖ * ‖y‖ := by simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.volumeForm_apply_le ![x, y] #align orientation.area_form_le Orientation.areaForm_le theorem abs_areaForm_of_orthogonal {x y : E} (h : ⟪x, y⟫ = 0) : |ω x y| = ‖x‖ * ‖y‖ := by rw [o.areaForm_to_volumeForm, o.abs_volumeForm_apply_of_pairwise_orthogonal] · simp [Fin.prod_univ_succ] intro i j hij fin_cases i <;> fin_cases j · simp_all · simpa using h · simpa [real_inner_comm] using h · simp_all #align orientation.abs_area_form_of_orthogonal Orientation.abs_areaForm_of_orthogonal theorem areaForm_map {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] [hF : Fact (finrank ℝ F = 2)] (φ : E ≃ₗᵢ[ℝ] F) (x y : F) : (Orientation.map (Fin 2) φ.toLinearEquiv o).areaForm x y = o.areaForm (φ.symm x) (φ.symm y) := by have : φ.symm ∘ ![x, y] = ![φ.symm x, φ.symm y] := by ext i fin_cases i <;> rfl simp [areaForm_to_volumeForm, volumeForm_map, this] #align orientation.area_form_map Orientation.areaForm_map theorem areaForm_comp_linearIsometryEquiv (φ : E ≃ₗᵢ[ℝ] E) (hφ : 0 < LinearMap.det (φ.toLinearEquiv : E →ₗ[ℝ] E)) (x y : E) : o.areaForm (φ x) (φ y) = o.areaForm x y := by convert o.areaForm_map φ (φ x) (φ y) · symm rwa [← o.map_eq_iff_det_pos φ.toLinearEquiv] at hφ rw [@Fact.out (finrank ℝ E = 2), Fintype.card_fin] · simp · simp #align orientation.area_form_comp_linear_isometry_equiv Orientation.areaForm_comp_linearIsometryEquiv irreducible_def rightAngleRotationAux₁ : E →ₗ[ℝ] E := let to_dual : E ≃ₗ[ℝ] E →ₗ[ℝ] ℝ := (InnerProductSpace.toDual ℝ E).toLinearEquiv ≪≫ₗ LinearMap.toContinuousLinearMap.symm ↑to_dual.symm ∘ₗ ω #align orientation.right_angle_rotation_aux₁ Orientation.rightAngleRotationAux₁ @[simp] theorem inner_rightAngleRotationAux₁_left (x y : E) : ⟪o.rightAngleRotationAux₁ x, y⟫ = ω x y := by -- Porting note: split `simp only` for greater proof control simp only [rightAngleRotationAux₁, LinearEquiv.trans_symm, LinearIsometryEquiv.toLinearEquiv_symm, LinearMap.coe_comp, LinearEquiv.coe_coe, Function.comp_apply, LinearEquiv.trans_apply, LinearIsometryEquiv.coe_toLinearEquiv] rw [InnerProductSpace.toDual_symm_apply] norm_cast #align orientation.inner_right_angle_rotation_aux₁_left Orientation.inner_rightAngleRotationAux₁_left @[simp] theorem inner_rightAngleRotationAux₁_right (x y : E) : ⟪x, o.rightAngleRotationAux₁ y⟫ = -ω x y := by rw [real_inner_comm] simp [o.areaForm_swap y x] #align orientation.inner_right_angle_rotation_aux₁_right Orientation.inner_rightAngleRotationAux₁_right def rightAngleRotationAux₂ : E →ₗᵢ[ℝ] E := { o.rightAngleRotationAux₁ with norm_map' := fun x => by dsimp refine le_antisymm ?_ ?_ · cases' eq_or_lt_of_le (norm_nonneg (o.rightAngleRotationAux₁ x)) with h h · rw [← h] positivity refine le_of_mul_le_mul_right ?_ h rw [← real_inner_self_eq_norm_mul_norm, o.inner_rightAngleRotationAux₁_left] exact o.areaForm_le x (o.rightAngleRotationAux₁ x) · let K : Submodule ℝ E := ℝ ∙ x have : Nontrivial Kᗮ := by apply @FiniteDimensional.nontrivial_of_finrank_pos ℝ have : finrank ℝ K ≤ Finset.card {x} := by rw [← Set.toFinset_singleton] exact finrank_span_le_card ({x} : Set E) have : Finset.card {x} = 1 := Finset.card_singleton x have : finrank ℝ K + finrank ℝ Kᗮ = finrank ℝ E := K.finrank_add_finrank_orthogonal have : finrank ℝ E = 2 := Fact.out linarith obtain ⟨w, hw₀⟩ : ∃ w : Kᗮ, w ≠ 0 := exists_ne 0 have hw' : ⟪x, (w : E)⟫ = 0 := Submodule.mem_orthogonal_singleton_iff_inner_right.mp w.2 have hw : (w : E) ≠ 0 := fun h => hw₀ (Submodule.coe_eq_zero.mp h) refine le_of_mul_le_mul_right ?_ (by rwa [norm_pos_iff] : 0 < ‖(w : E)‖) rw [← o.abs_areaForm_of_orthogonal hw'] rw [← o.inner_rightAngleRotationAux₁_left x w] exact abs_real_inner_le_norm (o.rightAngleRotationAux₁ x) w } #align orientation.right_angle_rotation_aux₂ Orientation.rightAngleRotationAux₂ @[simp] theorem rightAngleRotationAux₁_rightAngleRotationAux₁ (x : E) : o.rightAngleRotationAux₁ (o.rightAngleRotationAux₁ x) = -x := by apply ext_inner_left ℝ intro y have : ⟪o.rightAngleRotationAux₁ y, o.rightAngleRotationAux₁ x⟫ = ⟪y, x⟫ := LinearIsometry.inner_map_map o.rightAngleRotationAux₂ y x rw [o.inner_rightAngleRotationAux₁_right, ← o.inner_rightAngleRotationAux₁_left, this, inner_neg_right] #align orientation.right_angle_rotation_aux₁_right_angle_rotation_aux₁ Orientation.rightAngleRotationAux₁_rightAngleRotationAux₁ irreducible_def rightAngleRotation : E ≃ₗᵢ[ℝ] E := LinearIsometryEquiv.ofLinearIsometry o.rightAngleRotationAux₂ (-o.rightAngleRotationAux₁) (by ext; simp [rightAngleRotationAux₂]) (by ext; simp [rightAngleRotationAux₂]) #align orientation.right_angle_rotation Orientation.rightAngleRotation local notation "J" => o.rightAngleRotation @[simp] theorem inner_rightAngleRotation_left (x y : E) : ⟪J x, y⟫ = ω x y := by rw [rightAngleRotation] exact o.inner_rightAngleRotationAux₁_left x y #align orientation.inner_right_angle_rotation_left Orientation.inner_rightAngleRotation_left @[simp] theorem inner_rightAngleRotation_right (x y : E) : ⟪x, J y⟫ = -ω x y := by rw [rightAngleRotation] exact o.inner_rightAngleRotationAux₁_right x y #align orientation.inner_right_angle_rotation_right Orientation.inner_rightAngleRotation_right @[simp] theorem rightAngleRotation_rightAngleRotation (x : E) : J (J x) = -x := by rw [rightAngleRotation] exact o.rightAngleRotationAux₁_rightAngleRotationAux₁ x #align orientation.right_angle_rotation_right_angle_rotation Orientation.rightAngleRotation_rightAngleRotation @[simp] theorem rightAngleRotation_symm : LinearIsometryEquiv.symm J = LinearIsometryEquiv.trans J (LinearIsometryEquiv.neg ℝ) := by rw [rightAngleRotation] exact LinearIsometryEquiv.toLinearIsometry_injective rfl #align orientation.right_angle_rotation_symm Orientation.rightAngleRotation_symm -- @[simp] -- Porting note (#10618): simp already proves this theorem inner_rightAngleRotation_self (x : E) : ⟪J x, x⟫ = 0 := by simp #align orientation.inner_right_angle_rotation_self Orientation.inner_rightAngleRotation_self theorem inner_rightAngleRotation_swap (x y : E) : ⟪x, J y⟫ = -⟪J x, y⟫ := by simp #align orientation.inner_right_angle_rotation_swap Orientation.inner_rightAngleRotation_swap
Mathlib/Analysis/InnerProductSpace/TwoDim.lean
293
294
theorem inner_rightAngleRotation_swap' (x y : E) : ⟪J x, y⟫ = -⟪x, J y⟫ := by
simp [o.inner_rightAngleRotation_swap x y]
import Mathlib.MeasureTheory.Measure.MeasureSpace open scoped ENNReal NNReal Topology open Set MeasureTheory Measure Filter MeasurableSpace ENNReal Function variable {R α β δ γ ι : Type*} namespace MeasureTheory variable {m0 : MeasurableSpace α} [MeasurableSpace β] [MeasurableSpace γ] variable {μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α} {s s' t : Set α} namespace Measure noncomputable def restrictₗ {m0 : MeasurableSpace α} (s : Set α) : Measure α →ₗ[ℝ≥0∞] Measure α := liftLinear (OuterMeasure.restrict s) fun μ s' hs' t => by suffices μ (s ∩ t) = μ (s ∩ t ∩ s') + μ ((s ∩ t) \ s') by simpa [← Set.inter_assoc, Set.inter_comm _ s, ← inter_diff_assoc] exact le_toOuterMeasure_caratheodory _ _ hs' _ #align measure_theory.measure.restrictₗ MeasureTheory.Measure.restrictₗ noncomputable def restrict {_m0 : MeasurableSpace α} (μ : Measure α) (s : Set α) : Measure α := restrictₗ s μ #align measure_theory.measure.restrict MeasureTheory.Measure.restrict @[simp] theorem restrictₗ_apply {_m0 : MeasurableSpace α} (s : Set α) (μ : Measure α) : restrictₗ s μ = μ.restrict s := rfl #align measure_theory.measure.restrictₗ_apply MeasureTheory.Measure.restrictₗ_apply theorem restrict_toOuterMeasure_eq_toOuterMeasure_restrict (h : MeasurableSet s) : (μ.restrict s).toOuterMeasure = OuterMeasure.restrict s μ.toOuterMeasure := by simp_rw [restrict, restrictₗ, liftLinear, LinearMap.coe_mk, AddHom.coe_mk, toMeasure_toOuterMeasure, OuterMeasure.restrict_trim h, μ.trimmed] #align measure_theory.measure.restrict_to_outer_measure_eq_to_outer_measure_restrict MeasureTheory.Measure.restrict_toOuterMeasure_eq_toOuterMeasure_restrict theorem restrict_apply₀ (ht : NullMeasurableSet t (μ.restrict s)) : μ.restrict s t = μ (t ∩ s) := by rw [← restrictₗ_apply, restrictₗ, liftLinear_apply₀ _ ht, OuterMeasure.restrict_apply, coe_toOuterMeasure] #align measure_theory.measure.restrict_apply₀ MeasureTheory.Measure.restrict_apply₀ @[simp] theorem restrict_apply (ht : MeasurableSet t) : μ.restrict s t = μ (t ∩ s) := restrict_apply₀ ht.nullMeasurableSet #align measure_theory.measure.restrict_apply MeasureTheory.Measure.restrict_apply theorem restrict_mono' {_m0 : MeasurableSpace α} ⦃s s' : Set α⦄ ⦃μ ν : Measure α⦄ (hs : s ≤ᵐ[μ] s') (hμν : μ ≤ ν) : μ.restrict s ≤ ν.restrict s' := Measure.le_iff.2 fun t ht => calc μ.restrict s t = μ (t ∩ s) := restrict_apply ht _ ≤ μ (t ∩ s') := (measure_mono_ae <| hs.mono fun _x hx ⟨hxt, hxs⟩ => ⟨hxt, hx hxs⟩) _ ≤ ν (t ∩ s') := le_iff'.1 hμν (t ∩ s') _ = ν.restrict s' t := (restrict_apply ht).symm #align measure_theory.measure.restrict_mono' MeasureTheory.Measure.restrict_mono' @[mono] theorem restrict_mono {_m0 : MeasurableSpace α} ⦃s s' : Set α⦄ (hs : s ⊆ s') ⦃μ ν : Measure α⦄ (hμν : μ ≤ ν) : μ.restrict s ≤ ν.restrict s' := restrict_mono' (ae_of_all _ hs) hμν #align measure_theory.measure.restrict_mono MeasureTheory.Measure.restrict_mono theorem restrict_mono_ae (h : s ≤ᵐ[μ] t) : μ.restrict s ≤ μ.restrict t := restrict_mono' h (le_refl μ) #align measure_theory.measure.restrict_mono_ae MeasureTheory.Measure.restrict_mono_ae theorem restrict_congr_set (h : s =ᵐ[μ] t) : μ.restrict s = μ.restrict t := le_antisymm (restrict_mono_ae h.le) (restrict_mono_ae h.symm.le) #align measure_theory.measure.restrict_congr_set MeasureTheory.Measure.restrict_congr_set @[simp] theorem restrict_apply' (hs : MeasurableSet s) : μ.restrict s t = μ (t ∩ s) := by rw [← toOuterMeasure_apply, Measure.restrict_toOuterMeasure_eq_toOuterMeasure_restrict hs, OuterMeasure.restrict_apply s t _, toOuterMeasure_apply] #align measure_theory.measure.restrict_apply' MeasureTheory.Measure.restrict_apply' theorem restrict_apply₀' (hs : NullMeasurableSet s μ) : μ.restrict s t = μ (t ∩ s) := by rw [← restrict_congr_set hs.toMeasurable_ae_eq, restrict_apply' (measurableSet_toMeasurable _ _), measure_congr ((ae_eq_refl t).inter hs.toMeasurable_ae_eq)] #align measure_theory.measure.restrict_apply₀' MeasureTheory.Measure.restrict_apply₀' theorem restrict_le_self : μ.restrict s ≤ μ := Measure.le_iff.2 fun t ht => calc μ.restrict s t = μ (t ∩ s) := restrict_apply ht _ ≤ μ t := measure_mono inter_subset_left #align measure_theory.measure.restrict_le_self MeasureTheory.Measure.restrict_le_self variable (μ) theorem restrict_eq_self (h : s ⊆ t) : μ.restrict t s = μ s := (le_iff'.1 restrict_le_self s).antisymm <| calc μ s ≤ μ (toMeasurable (μ.restrict t) s ∩ t) := measure_mono (subset_inter (subset_toMeasurable _ _) h) _ = μ.restrict t s := by rw [← restrict_apply (measurableSet_toMeasurable _ _), measure_toMeasurable] #align measure_theory.measure.restrict_eq_self MeasureTheory.Measure.restrict_eq_self @[simp] theorem restrict_apply_self (s : Set α) : (μ.restrict s) s = μ s := restrict_eq_self μ Subset.rfl #align measure_theory.measure.restrict_apply_self MeasureTheory.Measure.restrict_apply_self variable {μ} theorem restrict_apply_univ (s : Set α) : μ.restrict s univ = μ s := by rw [restrict_apply MeasurableSet.univ, Set.univ_inter] #align measure_theory.measure.restrict_apply_univ MeasureTheory.Measure.restrict_apply_univ theorem le_restrict_apply (s t : Set α) : μ (t ∩ s) ≤ μ.restrict s t := calc μ (t ∩ s) = μ.restrict s (t ∩ s) := (restrict_eq_self μ inter_subset_right).symm _ ≤ μ.restrict s t := measure_mono inter_subset_left #align measure_theory.measure.le_restrict_apply MeasureTheory.Measure.le_restrict_apply theorem restrict_apply_le (s t : Set α) : μ.restrict s t ≤ μ t := Measure.le_iff'.1 restrict_le_self _ theorem restrict_apply_superset (h : s ⊆ t) : μ.restrict s t = μ s := ((measure_mono (subset_univ _)).trans_eq <| restrict_apply_univ _).antisymm ((restrict_apply_self μ s).symm.trans_le <| measure_mono h) #align measure_theory.measure.restrict_apply_superset MeasureTheory.Measure.restrict_apply_superset @[simp] theorem restrict_add {_m0 : MeasurableSpace α} (μ ν : Measure α) (s : Set α) : (μ + ν).restrict s = μ.restrict s + ν.restrict s := (restrictₗ s).map_add μ ν #align measure_theory.measure.restrict_add MeasureTheory.Measure.restrict_add @[simp] theorem restrict_zero {_m0 : MeasurableSpace α} (s : Set α) : (0 : Measure α).restrict s = 0 := (restrictₗ s).map_zero #align measure_theory.measure.restrict_zero MeasureTheory.Measure.restrict_zero @[simp] theorem restrict_smul {_m0 : MeasurableSpace α} (c : ℝ≥0∞) (μ : Measure α) (s : Set α) : (c • μ).restrict s = c • μ.restrict s := (restrictₗ s).map_smul c μ #align measure_theory.measure.restrict_smul MeasureTheory.Measure.restrict_smul theorem restrict_restrict₀ (hs : NullMeasurableSet s (μ.restrict t)) : (μ.restrict t).restrict s = μ.restrict (s ∩ t) := ext fun u hu => by simp only [Set.inter_assoc, restrict_apply hu, restrict_apply₀ (hu.nullMeasurableSet.inter hs)] #align measure_theory.measure.restrict_restrict₀ MeasureTheory.Measure.restrict_restrict₀ @[simp] theorem restrict_restrict (hs : MeasurableSet s) : (μ.restrict t).restrict s = μ.restrict (s ∩ t) := restrict_restrict₀ hs.nullMeasurableSet #align measure_theory.measure.restrict_restrict MeasureTheory.Measure.restrict_restrict theorem restrict_restrict_of_subset (h : s ⊆ t) : (μ.restrict t).restrict s = μ.restrict s := by ext1 u hu rw [restrict_apply hu, restrict_apply hu, restrict_eq_self] exact inter_subset_right.trans h #align measure_theory.measure.restrict_restrict_of_subset MeasureTheory.Measure.restrict_restrict_of_subset theorem restrict_restrict₀' (ht : NullMeasurableSet t μ) : (μ.restrict t).restrict s = μ.restrict (s ∩ t) := ext fun u hu => by simp only [restrict_apply hu, restrict_apply₀' ht, inter_assoc] #align measure_theory.measure.restrict_restrict₀' MeasureTheory.Measure.restrict_restrict₀' theorem restrict_restrict' (ht : MeasurableSet t) : (μ.restrict t).restrict s = μ.restrict (s ∩ t) := restrict_restrict₀' ht.nullMeasurableSet #align measure_theory.measure.restrict_restrict' MeasureTheory.Measure.restrict_restrict' theorem restrict_comm (hs : MeasurableSet s) : (μ.restrict t).restrict s = (μ.restrict s).restrict t := by rw [restrict_restrict hs, restrict_restrict' hs, inter_comm] #align measure_theory.measure.restrict_comm MeasureTheory.Measure.restrict_comm theorem restrict_apply_eq_zero (ht : MeasurableSet t) : μ.restrict s t = 0 ↔ μ (t ∩ s) = 0 := by rw [restrict_apply ht] #align measure_theory.measure.restrict_apply_eq_zero MeasureTheory.Measure.restrict_apply_eq_zero theorem measure_inter_eq_zero_of_restrict (h : μ.restrict s t = 0) : μ (t ∩ s) = 0 := nonpos_iff_eq_zero.1 (h ▸ le_restrict_apply _ _) #align measure_theory.measure.measure_inter_eq_zero_of_restrict MeasureTheory.Measure.measure_inter_eq_zero_of_restrict theorem restrict_apply_eq_zero' (hs : MeasurableSet s) : μ.restrict s t = 0 ↔ μ (t ∩ s) = 0 := by rw [restrict_apply' hs] #align measure_theory.measure.restrict_apply_eq_zero' MeasureTheory.Measure.restrict_apply_eq_zero' @[simp] theorem restrict_eq_zero : μ.restrict s = 0 ↔ μ s = 0 := by rw [← measure_univ_eq_zero, restrict_apply_univ] #align measure_theory.measure.restrict_eq_zero MeasureTheory.Measure.restrict_eq_zero instance restrict.neZero [NeZero (μ s)] : NeZero (μ.restrict s) := ⟨mt restrict_eq_zero.mp <| NeZero.ne _⟩ theorem restrict_zero_set {s : Set α} (h : μ s = 0) : μ.restrict s = 0 := restrict_eq_zero.2 h #align measure_theory.measure.restrict_zero_set MeasureTheory.Measure.restrict_zero_set @[simp] theorem restrict_empty : μ.restrict ∅ = 0 := restrict_zero_set measure_empty #align measure_theory.measure.restrict_empty MeasureTheory.Measure.restrict_empty @[simp] theorem restrict_univ : μ.restrict univ = μ := ext fun s hs => by simp [hs] #align measure_theory.measure.restrict_univ MeasureTheory.Measure.restrict_univ theorem restrict_inter_add_diff₀ (s : Set α) (ht : NullMeasurableSet t μ) : μ.restrict (s ∩ t) + μ.restrict (s \ t) = μ.restrict s := by ext1 u hu simp only [add_apply, restrict_apply hu, ← inter_assoc, diff_eq] exact measure_inter_add_diff₀ (u ∩ s) ht #align measure_theory.measure.restrict_inter_add_diff₀ MeasureTheory.Measure.restrict_inter_add_diff₀ theorem restrict_inter_add_diff (s : Set α) (ht : MeasurableSet t) : μ.restrict (s ∩ t) + μ.restrict (s \ t) = μ.restrict s := restrict_inter_add_diff₀ s ht.nullMeasurableSet #align measure_theory.measure.restrict_inter_add_diff MeasureTheory.Measure.restrict_inter_add_diff theorem restrict_union_add_inter₀ (s : Set α) (ht : NullMeasurableSet t μ) : μ.restrict (s ∪ t) + μ.restrict (s ∩ t) = μ.restrict s + μ.restrict t := by rw [← restrict_inter_add_diff₀ (s ∪ t) ht, union_inter_cancel_right, union_diff_right, ← restrict_inter_add_diff₀ s ht, add_comm, ← add_assoc, add_right_comm] #align measure_theory.measure.restrict_union_add_inter₀ MeasureTheory.Measure.restrict_union_add_inter₀ theorem restrict_union_add_inter (s : Set α) (ht : MeasurableSet t) : μ.restrict (s ∪ t) + μ.restrict (s ∩ t) = μ.restrict s + μ.restrict t := restrict_union_add_inter₀ s ht.nullMeasurableSet #align measure_theory.measure.restrict_union_add_inter MeasureTheory.Measure.restrict_union_add_inter theorem restrict_union_add_inter' (hs : MeasurableSet s) (t : Set α) : μ.restrict (s ∪ t) + μ.restrict (s ∩ t) = μ.restrict s + μ.restrict t := by simpa only [union_comm, inter_comm, add_comm] using restrict_union_add_inter t hs #align measure_theory.measure.restrict_union_add_inter' MeasureTheory.Measure.restrict_union_add_inter' theorem restrict_union₀ (h : AEDisjoint μ s t) (ht : NullMeasurableSet t μ) : μ.restrict (s ∪ t) = μ.restrict s + μ.restrict t := by simp [← restrict_union_add_inter₀ s ht, restrict_zero_set h] #align measure_theory.measure.restrict_union₀ MeasureTheory.Measure.restrict_union₀ theorem restrict_union (h : Disjoint s t) (ht : MeasurableSet t) : μ.restrict (s ∪ t) = μ.restrict s + μ.restrict t := restrict_union₀ h.aedisjoint ht.nullMeasurableSet #align measure_theory.measure.restrict_union MeasureTheory.Measure.restrict_union theorem restrict_union' (h : Disjoint s t) (hs : MeasurableSet s) : μ.restrict (s ∪ t) = μ.restrict s + μ.restrict t := by rw [union_comm, restrict_union h.symm hs, add_comm] #align measure_theory.measure.restrict_union' MeasureTheory.Measure.restrict_union' @[simp] theorem restrict_add_restrict_compl (hs : MeasurableSet s) : μ.restrict s + μ.restrict sᶜ = μ := by rw [← restrict_union (@disjoint_compl_right (Set α) _ _) hs.compl, union_compl_self, restrict_univ] #align measure_theory.measure.restrict_add_restrict_compl MeasureTheory.Measure.restrict_add_restrict_compl @[simp] theorem restrict_compl_add_restrict (hs : MeasurableSet s) : μ.restrict sᶜ + μ.restrict s = μ := by rw [add_comm, restrict_add_restrict_compl hs] #align measure_theory.measure.restrict_compl_add_restrict MeasureTheory.Measure.restrict_compl_add_restrict theorem restrict_union_le (s s' : Set α) : μ.restrict (s ∪ s') ≤ μ.restrict s + μ.restrict s' := le_iff.2 fun t ht ↦ by simpa [ht, inter_union_distrib_left] using measure_union_le (t ∩ s) (t ∩ s') #align measure_theory.measure.restrict_union_le MeasureTheory.Measure.restrict_union_le theorem restrict_iUnion_apply_ae [Countable ι] {s : ι → Set α} (hd : Pairwise (AEDisjoint μ on s)) (hm : ∀ i, NullMeasurableSet (s i) μ) {t : Set α} (ht : MeasurableSet t) : μ.restrict (⋃ i, s i) t = ∑' i, μ.restrict (s i) t := by simp only [restrict_apply, ht, inter_iUnion] exact measure_iUnion₀ (hd.mono fun i j h => h.mono inter_subset_right inter_subset_right) fun i => ht.nullMeasurableSet.inter (hm i) #align measure_theory.measure.restrict_Union_apply_ae MeasureTheory.Measure.restrict_iUnion_apply_ae theorem restrict_iUnion_apply [Countable ι] {s : ι → Set α} (hd : Pairwise (Disjoint on s)) (hm : ∀ i, MeasurableSet (s i)) {t : Set α} (ht : MeasurableSet t) : μ.restrict (⋃ i, s i) t = ∑' i, μ.restrict (s i) t := restrict_iUnion_apply_ae hd.aedisjoint (fun i => (hm i).nullMeasurableSet) ht #align measure_theory.measure.restrict_Union_apply MeasureTheory.Measure.restrict_iUnion_apply
Mathlib/MeasureTheory/Measure/Restrict.lean
318
322
theorem restrict_iUnion_apply_eq_iSup [Countable ι] {s : ι → Set α} (hd : Directed (· ⊆ ·) s) {t : Set α} (ht : MeasurableSet t) : μ.restrict (⋃ i, s i) t = ⨆ i, μ.restrict (s i) t := by
simp only [restrict_apply ht, inter_iUnion] rw [measure_iUnion_eq_iSup] exacts [hd.mono_comp _ fun s₁ s₂ => inter_subset_inter_right _]
import Mathlib.Order.ConditionallyCompleteLattice.Finset import Mathlib.Order.Interval.Finset.Nat #align_import data.nat.lattice from "leanprover-community/mathlib"@"52fa514ec337dd970d71d8de8d0fd68b455a1e54" assert_not_exists MonoidWithZero open Set namespace Nat open scoped Classical noncomputable instance : InfSet ℕ := ⟨fun s ↦ if h : ∃ n, n ∈ s then @Nat.find (fun n ↦ n ∈ s) _ h else 0⟩ noncomputable instance : SupSet ℕ := ⟨fun s ↦ if h : ∃ n, ∀ a ∈ s, a ≤ n then @Nat.find (fun n ↦ ∀ a ∈ s, a ≤ n) _ h else 0⟩ theorem sInf_def {s : Set ℕ} (h : s.Nonempty) : sInf s = @Nat.find (fun n ↦ n ∈ s) _ h := dif_pos _ #align nat.Inf_def Nat.sInf_def theorem sSup_def {s : Set ℕ} (h : ∃ n, ∀ a ∈ s, a ≤ n) : sSup s = @Nat.find (fun n ↦ ∀ a ∈ s, a ≤ n) _ h := dif_pos _ #align nat.Sup_def Nat.sSup_def theorem _root_.Set.Infinite.Nat.sSup_eq_zero {s : Set ℕ} (h : s.Infinite) : sSup s = 0 := dif_neg fun ⟨n, hn⟩ ↦ let ⟨k, hks, hk⟩ := h.exists_gt n (hn k hks).not_lt hk #align set.infinite.nat.Sup_eq_zero Set.Infinite.Nat.sSup_eq_zero @[simp] theorem sInf_eq_zero {s : Set ℕ} : sInf s = 0 ↔ 0 ∈ s ∨ s = ∅ := by cases eq_empty_or_nonempty s with | inl h => subst h simp only [or_true_iff, eq_self_iff_true, iff_true_iff, iInf, InfSet.sInf, mem_empty_iff_false, exists_false, dif_neg, not_false_iff] | inr h => simp only [h.ne_empty, or_false_iff, Nat.sInf_def, h, Nat.find_eq_zero] #align nat.Inf_eq_zero Nat.sInf_eq_zero @[simp] theorem sInf_empty : sInf ∅ = 0 := by rw [sInf_eq_zero] right rfl #align nat.Inf_empty Nat.sInf_empty @[simp] theorem iInf_of_empty {ι : Sort*} [IsEmpty ι] (f : ι → ℕ) : iInf f = 0 := by rw [iInf_of_isEmpty, sInf_empty] #align nat.infi_of_empty Nat.iInf_of_empty @[simp] lemma iInf_const_zero {ι : Sort*} : ⨅ i : ι, 0 = 0 := (isEmpty_or_nonempty ι).elim (fun h ↦ by simp) fun h ↦ sInf_eq_zero.2 <| by simp theorem sInf_mem {s : Set ℕ} (h : s.Nonempty) : sInf s ∈ s := by rw [Nat.sInf_def h] exact Nat.find_spec h #align nat.Inf_mem Nat.sInf_mem theorem not_mem_of_lt_sInf {s : Set ℕ} {m : ℕ} (hm : m < sInf s) : m ∉ s := by cases eq_empty_or_nonempty s with | inl h => subst h; apply not_mem_empty | inr h => rw [Nat.sInf_def h] at hm; exact Nat.find_min h hm #align nat.not_mem_of_lt_Inf Nat.not_mem_of_lt_sInf protected theorem sInf_le {s : Set ℕ} {m : ℕ} (hm : m ∈ s) : sInf s ≤ m := by rw [Nat.sInf_def ⟨m, hm⟩] exact Nat.find_min' ⟨m, hm⟩ hm #align nat.Inf_le Nat.sInf_le theorem nonempty_of_pos_sInf {s : Set ℕ} (h : 0 < sInf s) : s.Nonempty := by by_contra contra rw [Set.not_nonempty_iff_eq_empty] at contra have h' : sInf s ≠ 0 := ne_of_gt h apply h' rw [Nat.sInf_eq_zero] right assumption #align nat.nonempty_of_pos_Inf Nat.nonempty_of_pos_sInf theorem nonempty_of_sInf_eq_succ {s : Set ℕ} {k : ℕ} (h : sInf s = k + 1) : s.Nonempty := nonempty_of_pos_sInf (h.symm ▸ succ_pos k : sInf s > 0) #align nat.nonempty_of_Inf_eq_succ Nat.nonempty_of_sInf_eq_succ theorem eq_Ici_of_nonempty_of_upward_closed {s : Set ℕ} (hs : s.Nonempty) (hs' : ∀ k₁ k₂ : ℕ, k₁ ≤ k₂ → k₁ ∈ s → k₂ ∈ s) : s = Ici (sInf s) := ext fun n ↦ ⟨fun H ↦ Nat.sInf_le H, fun H ↦ hs' (sInf s) n H (sInf_mem hs)⟩ #align nat.eq_Ici_of_nonempty_of_upward_closed Nat.eq_Ici_of_nonempty_of_upward_closed theorem sInf_upward_closed_eq_succ_iff {s : Set ℕ} (hs : ∀ k₁ k₂ : ℕ, k₁ ≤ k₂ → k₁ ∈ s → k₂ ∈ s) (k : ℕ) : sInf s = k + 1 ↔ k + 1 ∈ s ∧ k ∉ s := by constructor · intro H rw [eq_Ici_of_nonempty_of_upward_closed (nonempty_of_sInf_eq_succ _) hs, H, mem_Ici, mem_Ici] · exact ⟨le_rfl, k.not_succ_le_self⟩; · exact k · assumption · rintro ⟨H, H'⟩ rw [sInf_def (⟨_, H⟩ : s.Nonempty), find_eq_iff] exact ⟨H, fun n hnk hns ↦ H' <| hs n k (Nat.lt_succ_iff.mp hnk) hns⟩ #align nat.Inf_upward_closed_eq_succ_iff Nat.sInf_upward_closed_eq_succ_iff instance : Lattice ℕ := LinearOrder.toLattice noncomputable instance : ConditionallyCompleteLinearOrderBot ℕ := { (inferInstance : OrderBot ℕ), (LinearOrder.toLattice : Lattice ℕ), (inferInstance : LinearOrder ℕ) with -- sup := sSup -- Porting note: removed, unnecessary? -- inf := sInf -- Porting note: removed, unnecessary? le_csSup := fun s a hb ha ↦ by rw [sSup_def hb]; revert a ha; exact @Nat.find_spec _ _ hb csSup_le := fun s a _ ha ↦ by rw [sSup_def ⟨a, ha⟩]; exact Nat.find_min' _ ha le_csInf := fun s a hs hb ↦ by rw [sInf_def hs]; exact hb (@Nat.find_spec (fun n ↦ n ∈ s) _ _) csInf_le := fun s a _ ha ↦ by rw [sInf_def ⟨a, ha⟩]; exact Nat.find_min' _ ha csSup_empty := by simp only [sSup_def, Set.mem_empty_iff_false, forall_const, forall_prop_of_false, not_false_iff, exists_const] apply bot_unique (Nat.find_min' _ _) trivial csSup_of_not_bddAbove := by intro s hs simp only [mem_univ, forall_true_left, sSup, mem_empty_iff_false, IsEmpty.forall_iff, forall_const, exists_const, dite_true] rw [dif_neg] · exact le_antisymm (zero_le _) (find_le trivial) · exact hs csInf_of_not_bddBelow := fun s hs ↦ by simp at hs } theorem sSup_mem {s : Set ℕ} (h₁ : s.Nonempty) (h₂ : BddAbove s) : sSup s ∈ s := let ⟨k, hk⟩ := h₂ h₁.csSup_mem ((finite_le_nat k).subset hk) #align nat.Sup_mem Nat.sSup_mem theorem sInf_add {n : ℕ} {p : ℕ → Prop} (hn : n ≤ sInf { m | p m }) : sInf { m | p (m + n) } + n = sInf { m | p m } := by obtain h | ⟨m, hm⟩ := { m | p (m + n) }.eq_empty_or_nonempty · rw [h, Nat.sInf_empty, zero_add] obtain hnp | hnp := hn.eq_or_lt · exact hnp suffices hp : p (sInf { m | p m } - n + n) from (h.subset hp).elim rw [Nat.sub_add_cancel hn] exact csInf_mem (nonempty_of_pos_sInf <| n.zero_le.trans_lt hnp) · have hp : ∃ n, n ∈ { m | p m } := ⟨_, hm⟩ rw [Nat.sInf_def ⟨m, hm⟩, Nat.sInf_def hp] rw [Nat.sInf_def hp] at hn exact find_add hn #align nat.Inf_add Nat.sInf_add theorem sInf_add' {n : ℕ} {p : ℕ → Prop} (h : 0 < sInf { m | p m }) : sInf { m | p m } + n = sInf { m | p (m - n) } := by suffices h₁ : n ≤ sInf {m | p (m - n)} by convert sInf_add h₁ simp_rw [Nat.add_sub_cancel_right] obtain ⟨m, hm⟩ := nonempty_of_pos_sInf h refine le_csInf ⟨m + n, ?_⟩ fun b hb ↦ le_of_not_lt fun hbn ↦ ne_of_mem_of_not_mem ?_ (not_mem_of_lt_sInf h) (Nat.sub_eq_zero_of_le hbn.le) · dsimp rwa [Nat.add_sub_cancel_right] · exact hb #align nat.Inf_add' Nat.sInf_add' section variable {α : Type*} [CompleteLattice α] theorem iSup_lt_succ (u : ℕ → α) (n : ℕ) : ⨆ k < n + 1, u k = (⨆ k < n, u k) ⊔ u n := by simp [Nat.lt_succ_iff_lt_or_eq, iSup_or, iSup_sup_eq] #align nat.supr_lt_succ Nat.iSup_lt_succ
Mathlib/Data/Nat/Lattice.lean
195
197
theorem iSup_lt_succ' (u : ℕ → α) (n : ℕ) : ⨆ k < n + 1, u k = u 0 ⊔ ⨆ k < n, u (k + 1) := by
rw [← sup_iSup_nat_succ] simp
import Mathlib.Combinatorics.SetFamily.Shadow #align_import combinatorics.set_family.compression.uv from "leanprover-community/mathlib"@"6f8ab7de1c4b78a68ab8cf7dd83d549eb78a68a1" open Finset variable {α : Type*}
Mathlib/Combinatorics/SetFamily/Compression/UV.lean
57
64
theorem sup_sdiff_injOn [GeneralizedBooleanAlgebra α] (u v : α) : { x | Disjoint u x ∧ v ≤ x }.InjOn fun x => (x ⊔ u) \ v := by
rintro a ha b hb hab have h : ((a ⊔ u) \ v) \ u ⊔ v = ((b ⊔ u) \ v) \ u ⊔ v := by dsimp at hab rw [hab] rwa [sdiff_sdiff_comm, ha.1.symm.sup_sdiff_cancel_right, sdiff_sdiff_comm, hb.1.symm.sup_sdiff_cancel_right, sdiff_sup_cancel ha.2, sdiff_sup_cancel hb.2] at h
import Mathlib.Algebra.Order.Ring.Int import Mathlib.Data.Nat.SuccPred #align_import data.int.succ_pred from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open Function Order namespace Int -- so that Lean reads `Int.succ` through `SuccOrder.succ` @[instance] abbrev instSuccOrder : SuccOrder ℤ := { SuccOrder.ofSuccLeIff succ fun {_ _} => Iff.rfl with succ := succ } -- so that Lean reads `Int.pred` through `PredOrder.pred` @[instance] abbrev instPredOrder : PredOrder ℤ where pred := pred pred_le _ := (sub_one_lt_of_le le_rfl).le min_of_le_pred ha := ((sub_one_lt_of_le le_rfl).not_le ha).elim le_pred_of_lt {_ _} := le_sub_one_of_lt le_of_pred_lt {_ _} := le_of_sub_one_lt @[simp] theorem succ_eq_succ : Order.succ = succ := rfl #align int.succ_eq_succ Int.succ_eq_succ @[simp] theorem pred_eq_pred : Order.pred = pred := rfl #align int.pred_eq_pred Int.pred_eq_pred theorem pos_iff_one_le {a : ℤ} : 0 < a ↔ 1 ≤ a := Order.succ_le_iff.symm #align int.pos_iff_one_le Int.pos_iff_one_le theorem succ_iterate (a : ℤ) : ∀ n, succ^[n] a = a + n | 0 => (add_zero a).symm | n + 1 => by rw [Function.iterate_succ', Int.ofNat_succ, ← add_assoc] exact congr_arg _ (succ_iterate a n) #align int.succ_iterate Int.succ_iterate theorem pred_iterate (a : ℤ) : ∀ n, pred^[n] a = a - n | 0 => (sub_zero a).symm | n + 1 => by rw [Function.iterate_succ', Int.ofNat_succ, ← sub_sub] exact congr_arg _ (pred_iterate a n) #align int.pred_iterate Int.pred_iterate instance : IsSuccArchimedean ℤ := ⟨fun {a b} h => ⟨(b - a).toNat, by rw [succ_eq_succ, succ_iterate, toNat_sub_of_le h, ← add_sub_assoc, add_sub_cancel_left]⟩⟩ instance : IsPredArchimedean ℤ := ⟨fun {a b} h => ⟨(b - a).toNat, by rw [pred_eq_pred, pred_iterate, toNat_sub_of_le h, sub_sub_cancel]⟩⟩ protected theorem covBy_iff_succ_eq {m n : ℤ} : m ⋖ n ↔ m + 1 = n := succ_eq_iff_covBy.symm #align int.covby_iff_succ_eq Int.covBy_iff_succ_eq @[simp]
Mathlib/Data/Int/SuccPred.lean
79
79
theorem sub_one_covBy (z : ℤ) : z - 1 ⋖ z := by
rw [Int.covBy_iff_succ_eq, sub_add_cancel]
import Mathlib.Tactic.CategoryTheory.Elementwise import Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer import Mathlib.CategoryTheory.Limits.Constructions.EpiMono import Mathlib.CategoryTheory.Limits.Preserves.Limits import Mathlib.CategoryTheory.Limits.Shapes.Types #align_import category_theory.glue_data from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7" noncomputable section open CategoryTheory.Limits namespace CategoryTheory universe v u₁ u₂ variable (C : Type u₁) [Category.{v} C] {C' : Type u₂} [Category.{v} C'] -- Porting note(#5171): linter not ported yet -- @[nolint has_nonempty_instance] structure GlueData where J : Type v U : J → C V : J × J → C f : ∀ i j, V (i, j) ⟶ U i f_mono : ∀ i j, Mono (f i j) := by infer_instance f_hasPullback : ∀ i j k, HasPullback (f i j) (f i k) := by infer_instance f_id : ∀ i, IsIso (f i i) := by infer_instance t : ∀ i j, V (i, j) ⟶ V (j, i) t_id : ∀ i, t i i = 𝟙 _ t' : ∀ i j k, pullback (f i j) (f i k) ⟶ pullback (f j k) (f j i) t_fac : ∀ i j k, t' i j k ≫ pullback.snd = pullback.fst ≫ t i j cocycle : ∀ i j k, t' i j k ≫ t' j k i ≫ t' k i j = 𝟙 _ #align category_theory.glue_data CategoryTheory.GlueData attribute [simp] GlueData.t_id attribute [instance] GlueData.f_id GlueData.f_mono GlueData.f_hasPullback attribute [reassoc] GlueData.t_fac GlueData.cocycle namespace GlueData variable {C} variable (D : GlueData C) @[simp] theorem t'_iij (i j : D.J) : D.t' i i j = (pullbackSymmetry _ _).hom := by have eq₁ := D.t_fac i i j have eq₂ := (IsIso.eq_comp_inv (D.f i i)).mpr (@pullback.condition _ _ _ _ _ _ (D.f i j) _) rw [D.t_id, Category.comp_id, eq₂] at eq₁ have eq₃ := (IsIso.eq_comp_inv (D.f i i)).mp eq₁ rw [Category.assoc, ← pullback.condition, ← Category.assoc] at eq₃ exact Mono.right_cancellation _ _ ((Mono.right_cancellation _ _ eq₃).trans (pullbackSymmetry_hom_comp_fst _ _).symm) #align category_theory.glue_data.t'_iij CategoryTheory.GlueData.t'_iij theorem t'_jii (i j : D.J) : D.t' j i i = pullback.fst ≫ D.t j i ≫ inv pullback.snd := by rw [← Category.assoc, ← D.t_fac] simp #align category_theory.glue_data.t'_jii CategoryTheory.GlueData.t'_jii theorem t'_iji (i j : D.J) : D.t' i j i = pullback.fst ≫ D.t i j ≫ inv pullback.snd := by rw [← Category.assoc, ← D.t_fac] simp #align category_theory.glue_data.t'_iji CategoryTheory.GlueData.t'_iji @[reassoc, elementwise (attr := simp)]
Mathlib/CategoryTheory/GlueData.lean
99
105
theorem t_inv (i j : D.J) : D.t i j ≫ D.t j i = 𝟙 _ := by
have eq : (pullbackSymmetry (D.f i i) (D.f i j)).hom = pullback.snd ≫ inv pullback.fst := by simp have := D.cocycle i j i rw [D.t'_iij, D.t'_jii, D.t'_iji, fst_eq_snd_of_mono_eq, eq] at this simp only [Category.assoc, IsIso.inv_hom_id_assoc] at this rw [← IsIso.eq_inv_comp, ← Category.assoc, IsIso.comp_inv_eq] at this simpa using this
import Mathlib.Algebra.BigOperators.Fin import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Data.Finset.Sort import Mathlib.Data.Set.Subsingleton #align_import combinatorics.composition from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" open List variable {n : ℕ} @[ext] structure Composition (n : ℕ) where blocks : List ℕ blocks_pos : ∀ {i}, i ∈ blocks → 0 < i blocks_sum : blocks.sum = n #align composition Composition @[ext] structure CompositionAsSet (n : ℕ) where boundaries : Finset (Fin n.succ) zero_mem : (0 : Fin n.succ) ∈ boundaries getLast_mem : Fin.last n ∈ boundaries #align composition_as_set CompositionAsSet instance {n : ℕ} : Inhabited (CompositionAsSet n) := ⟨⟨Finset.univ, Finset.mem_univ _, Finset.mem_univ _⟩⟩ namespace Composition variable (c : Composition n) instance (n : ℕ) : ToString (Composition n) := ⟨fun c => toString c.blocks⟩ abbrev length : ℕ := c.blocks.length #align composition.length Composition.length theorem blocks_length : c.blocks.length = c.length := rfl #align composition.blocks_length Composition.blocks_length def blocksFun : Fin c.length → ℕ := c.blocks.get #align composition.blocks_fun Composition.blocksFun theorem ofFn_blocksFun : ofFn c.blocksFun = c.blocks := ofFn_get _ #align composition.of_fn_blocks_fun Composition.ofFn_blocksFun theorem sum_blocksFun : ∑ i, c.blocksFun i = n := by conv_rhs => rw [← c.blocks_sum, ← ofFn_blocksFun, sum_ofFn] #align composition.sum_blocks_fun Composition.sum_blocksFun theorem blocksFun_mem_blocks (i : Fin c.length) : c.blocksFun i ∈ c.blocks := get_mem _ _ _ #align composition.blocks_fun_mem_blocks Composition.blocksFun_mem_blocks @[simp] theorem one_le_blocks {i : ℕ} (h : i ∈ c.blocks) : 1 ≤ i := c.blocks_pos h #align composition.one_le_blocks Composition.one_le_blocks @[simp] theorem one_le_blocks' {i : ℕ} (h : i < c.length) : 1 ≤ c.blocks.get ⟨i, h⟩ := c.one_le_blocks (get_mem (blocks c) i h) #align composition.one_le_blocks' Composition.one_le_blocks' @[simp] theorem blocks_pos' (i : ℕ) (h : i < c.length) : 0 < c.blocks.get ⟨i, h⟩ := c.one_le_blocks' h #align composition.blocks_pos' Composition.blocks_pos' theorem one_le_blocksFun (i : Fin c.length) : 1 ≤ c.blocksFun i := c.one_le_blocks (c.blocksFun_mem_blocks i) #align composition.one_le_blocks_fun Composition.one_le_blocksFun theorem length_le : c.length ≤ n := by conv_rhs => rw [← c.blocks_sum] exact length_le_sum_of_one_le _ fun i hi => c.one_le_blocks hi #align composition.length_le Composition.length_le theorem length_pos_of_pos (h : 0 < n) : 0 < c.length := by apply length_pos_of_sum_pos convert h exact c.blocks_sum #align composition.length_pos_of_pos Composition.length_pos_of_pos def sizeUpTo (i : ℕ) : ℕ := (c.blocks.take i).sum #align composition.size_up_to Composition.sizeUpTo @[simp] theorem sizeUpTo_zero : c.sizeUpTo 0 = 0 := by simp [sizeUpTo] #align composition.size_up_to_zero Composition.sizeUpTo_zero theorem sizeUpTo_ofLength_le (i : ℕ) (h : c.length ≤ i) : c.sizeUpTo i = n := by dsimp [sizeUpTo] convert c.blocks_sum exact take_all_of_le h #align composition.size_up_to_of_length_le Composition.sizeUpTo_ofLength_le @[simp] theorem sizeUpTo_length : c.sizeUpTo c.length = n := c.sizeUpTo_ofLength_le c.length le_rfl #align composition.size_up_to_length Composition.sizeUpTo_length theorem sizeUpTo_le (i : ℕ) : c.sizeUpTo i ≤ n := by conv_rhs => rw [← c.blocks_sum, ← sum_take_add_sum_drop _ i] exact Nat.le_add_right _ _ #align composition.size_up_to_le Composition.sizeUpTo_le theorem sizeUpTo_succ {i : ℕ} (h : i < c.length) : c.sizeUpTo (i + 1) = c.sizeUpTo i + c.blocks.get ⟨i, h⟩ := by simp only [sizeUpTo] rw [sum_take_succ _ _ h] #align composition.size_up_to_succ Composition.sizeUpTo_succ theorem sizeUpTo_succ' (i : Fin c.length) : c.sizeUpTo ((i : ℕ) + 1) = c.sizeUpTo i + c.blocksFun i := c.sizeUpTo_succ i.2 #align composition.size_up_to_succ' Composition.sizeUpTo_succ' theorem sizeUpTo_strict_mono {i : ℕ} (h : i < c.length) : c.sizeUpTo i < c.sizeUpTo (i + 1) := by rw [c.sizeUpTo_succ h] simp #align composition.size_up_to_strict_mono Composition.sizeUpTo_strict_mono theorem monotone_sizeUpTo : Monotone c.sizeUpTo := monotone_sum_take _ #align composition.monotone_size_up_to Composition.monotone_sizeUpTo def boundary : Fin (c.length + 1) ↪o Fin (n + 1) := (OrderEmbedding.ofStrictMono fun i => ⟨c.sizeUpTo i, Nat.lt_succ_of_le (c.sizeUpTo_le i)⟩) <| Fin.strictMono_iff_lt_succ.2 fun ⟨_, hi⟩ => c.sizeUpTo_strict_mono hi #align composition.boundary Composition.boundary @[simp] theorem boundary_zero : c.boundary 0 = 0 := by simp [boundary, Fin.ext_iff] #align composition.boundary_zero Composition.boundary_zero @[simp] theorem boundary_last : c.boundary (Fin.last c.length) = Fin.last n := by simp [boundary, Fin.ext_iff] #align composition.boundary_last Composition.boundary_last def boundaries : Finset (Fin (n + 1)) := Finset.univ.map c.boundary.toEmbedding #align composition.boundaries Composition.boundaries theorem card_boundaries_eq_succ_length : c.boundaries.card = c.length + 1 := by simp [boundaries] #align composition.card_boundaries_eq_succ_length Composition.card_boundaries_eq_succ_length def toCompositionAsSet : CompositionAsSet n where boundaries := c.boundaries zero_mem := by simp only [boundaries, Finset.mem_univ, exists_prop_of_true, Finset.mem_map] exact ⟨0, And.intro True.intro rfl⟩ getLast_mem := by simp only [boundaries, Finset.mem_univ, exists_prop_of_true, Finset.mem_map] exact ⟨Fin.last c.length, And.intro True.intro c.boundary_last⟩ #align composition.to_composition_as_set Composition.toCompositionAsSet theorem orderEmbOfFin_boundaries : c.boundaries.orderEmbOfFin c.card_boundaries_eq_succ_length = c.boundary := by refine (Finset.orderEmbOfFin_unique' _ ?_).symm exact fun i => (Finset.mem_map' _).2 (Finset.mem_univ _) #align composition.order_emb_of_fin_boundaries Composition.orderEmbOfFin_boundaries def embedding (i : Fin c.length) : Fin (c.blocksFun i) ↪o Fin n := (Fin.natAddOrderEmb <| c.sizeUpTo i).trans <| Fin.castLEOrderEmb <| calc c.sizeUpTo i + c.blocksFun i = c.sizeUpTo (i + 1) := (c.sizeUpTo_succ _).symm _ ≤ c.sizeUpTo c.length := monotone_sum_take _ i.2 _ = n := c.sizeUpTo_length #align composition.embedding Composition.embedding @[simp] theorem coe_embedding (i : Fin c.length) (j : Fin (c.blocksFun i)) : (c.embedding i j : ℕ) = c.sizeUpTo i + j := rfl #align composition.coe_embedding Composition.coe_embedding theorem index_exists {j : ℕ} (h : j < n) : ∃ i : ℕ, j < c.sizeUpTo (i + 1) ∧ i < c.length := by have n_pos : 0 < n := lt_of_le_of_lt (zero_le j) h have : 0 < c.blocks.sum := by rwa [← c.blocks_sum] at n_pos have length_pos : 0 < c.blocks.length := length_pos_of_sum_pos (blocks c) this refine ⟨c.length - 1, ?_, Nat.pred_lt (ne_of_gt length_pos)⟩ have : c.length - 1 + 1 = c.length := Nat.succ_pred_eq_of_pos length_pos simp [this, h] #align composition.index_exists Composition.index_exists def index (j : Fin n) : Fin c.length := ⟨Nat.find (c.index_exists j.2), (Nat.find_spec (c.index_exists j.2)).2⟩ #align composition.index Composition.index theorem lt_sizeUpTo_index_succ (j : Fin n) : (j : ℕ) < c.sizeUpTo (c.index j).succ := (Nat.find_spec (c.index_exists j.2)).1 #align composition.lt_size_up_to_index_succ Composition.lt_sizeUpTo_index_succ theorem sizeUpTo_index_le (j : Fin n) : c.sizeUpTo (c.index j) ≤ j := by by_contra H set i := c.index j push_neg at H have i_pos : (0 : ℕ) < i := by by_contra! i_pos revert H simp [nonpos_iff_eq_zero.1 i_pos, c.sizeUpTo_zero] let i₁ := (i : ℕ).pred have i₁_lt_i : i₁ < i := Nat.pred_lt (ne_of_gt i_pos) have i₁_succ : i₁ + 1 = i := Nat.succ_pred_eq_of_pos i_pos have := Nat.find_min (c.index_exists j.2) i₁_lt_i simp [lt_trans i₁_lt_i (c.index j).2, i₁_succ] at this exact Nat.lt_le_asymm H this #align composition.size_up_to_index_le Composition.sizeUpTo_index_le def invEmbedding (j : Fin n) : Fin (c.blocksFun (c.index j)) := ⟨j - c.sizeUpTo (c.index j), by rw [tsub_lt_iff_right, add_comm, ← sizeUpTo_succ'] · exact lt_sizeUpTo_index_succ _ _ · exact sizeUpTo_index_le _ _⟩ #align composition.inv_embedding Composition.invEmbedding @[simp] theorem coe_invEmbedding (j : Fin n) : (c.invEmbedding j : ℕ) = j - c.sizeUpTo (c.index j) := rfl #align composition.coe_inv_embedding Composition.coe_invEmbedding theorem embedding_comp_inv (j : Fin n) : c.embedding (c.index j) (c.invEmbedding j) = j := by rw [Fin.ext_iff] apply add_tsub_cancel_of_le (c.sizeUpTo_index_le j) #align composition.embedding_comp_inv Composition.embedding_comp_inv theorem mem_range_embedding_iff {j : Fin n} {i : Fin c.length} : j ∈ Set.range (c.embedding i) ↔ c.sizeUpTo i ≤ j ∧ (j : ℕ) < c.sizeUpTo (i : ℕ).succ := by constructor · intro h rcases Set.mem_range.2 h with ⟨k, hk⟩ rw [Fin.ext_iff] at hk dsimp at hk rw [← hk] simp [sizeUpTo_succ', k.is_lt] · intro h apply Set.mem_range.2 refine ⟨⟨j - c.sizeUpTo i, ?_⟩, ?_⟩ · rw [tsub_lt_iff_left, ← sizeUpTo_succ'] · exact h.2 · exact h.1 · rw [Fin.ext_iff] exact add_tsub_cancel_of_le h.1 #align composition.mem_range_embedding_iff Composition.mem_range_embedding_iff theorem disjoint_range {i₁ i₂ : Fin c.length} (h : i₁ ≠ i₂) : Disjoint (Set.range (c.embedding i₁)) (Set.range (c.embedding i₂)) := by classical wlog h' : i₁ < i₂ · exact (this c h.symm (h.lt_or_lt.resolve_left h')).symm by_contra d obtain ⟨x, hx₁, hx₂⟩ : ∃ x : Fin n, x ∈ Set.range (c.embedding i₁) ∧ x ∈ Set.range (c.embedding i₂) := Set.not_disjoint_iff.1 d have A : (i₁ : ℕ).succ ≤ i₂ := Nat.succ_le_of_lt h' apply lt_irrefl (x : ℕ) calc (x : ℕ) < c.sizeUpTo (i₁ : ℕ).succ := (c.mem_range_embedding_iff.1 hx₁).2 _ ≤ c.sizeUpTo (i₂ : ℕ) := monotone_sum_take _ A _ ≤ x := (c.mem_range_embedding_iff.1 hx₂).1 #align composition.disjoint_range Composition.disjoint_range theorem mem_range_embedding (j : Fin n) : j ∈ Set.range (c.embedding (c.index j)) := by have : c.embedding (c.index j) (c.invEmbedding j) ∈ Set.range (c.embedding (c.index j)) := Set.mem_range_self _ rwa [c.embedding_comp_inv j] at this #align composition.mem_range_embedding Composition.mem_range_embedding theorem mem_range_embedding_iff' {j : Fin n} {i : Fin c.length} : j ∈ Set.range (c.embedding i) ↔ i = c.index j := by constructor · rw [← not_imp_not] intro h exact Set.disjoint_right.1 (c.disjoint_range h) (c.mem_range_embedding j) · intro h rw [h] exact c.mem_range_embedding j #align composition.mem_range_embedding_iff' Composition.mem_range_embedding_iff' theorem index_embedding (i : Fin c.length) (j : Fin (c.blocksFun i)) : c.index (c.embedding i j) = i := by symm rw [← mem_range_embedding_iff'] apply Set.mem_range_self #align composition.index_embedding Composition.index_embedding theorem invEmbedding_comp (i : Fin c.length) (j : Fin (c.blocksFun i)) : (c.invEmbedding (c.embedding i j) : ℕ) = j := by simp_rw [coe_invEmbedding, index_embedding, coe_embedding, add_tsub_cancel_left] #align composition.inv_embedding_comp Composition.invEmbedding_comp def blocksFinEquiv : (Σi : Fin c.length, Fin (c.blocksFun i)) ≃ Fin n where toFun x := c.embedding x.1 x.2 invFun j := ⟨c.index j, c.invEmbedding j⟩ left_inv x := by rcases x with ⟨i, y⟩ dsimp congr; · exact c.index_embedding _ _ rw [Fin.heq_ext_iff] · exact c.invEmbedding_comp _ _ · rw [c.index_embedding] right_inv j := c.embedding_comp_inv j #align composition.blocks_fin_equiv Composition.blocksFinEquiv
Mathlib/Combinatorics/Enumerative/Composition.lean
443
450
theorem blocksFun_congr {n₁ n₂ : ℕ} (c₁ : Composition n₁) (c₂ : Composition n₂) (i₁ : Fin c₁.length) (i₂ : Fin c₂.length) (hn : n₁ = n₂) (hc : c₁.blocks = c₂.blocks) (hi : (i₁ : ℕ) = i₂) : c₁.blocksFun i₁ = c₂.blocksFun i₂ := by
cases hn rw [← Composition.ext_iff] at hc cases hc congr rwa [Fin.ext_iff]
import Mathlib.MeasureTheory.PiSystem import Mathlib.Order.OmegaCompletePartialOrder import Mathlib.Topology.Constructions import Mathlib.MeasureTheory.MeasurableSpace.Basic open Set namespace MeasureTheory variable {ι : Type _} {α : ι → Type _} section cylinder def cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) : Set (∀ i, α i) := (fun (f : ∀ i, α i) (i : s) ↦ f i) ⁻¹' S @[simp] theorem mem_cylinder (s : Finset ι) (S : Set (∀ i : s, α i)) (f : ∀ i, α i) : f ∈ cylinder s S ↔ (fun i : s ↦ f i) ∈ S := mem_preimage @[simp]
Mathlib/MeasureTheory/Constructions/Cylinders.lean
161
162
theorem cylinder_empty (s : Finset ι) : cylinder s (∅ : Set (∀ i : s, α i)) = ∅ := by
rw [cylinder, preimage_empty]
import Mathlib.CategoryTheory.Functor.FullyFaithful import Mathlib.CategoryTheory.FullSubcategory import Mathlib.CategoryTheory.Whiskering import Mathlib.CategoryTheory.EssentialImage import Mathlib.Tactic.CategoryTheory.Slice #align_import category_theory.equivalence from "leanprover-community/mathlib"@"9aba7801eeecebb61f58a5763c2b6dd1b47dc6ef" namespace CategoryTheory open CategoryTheory.Functor NatIso Category -- declare the `v`'s first; see `CategoryTheory.Category` for an explanation universe v₁ v₂ v₃ u₁ u₂ u₃ @[ext] structure Equivalence (C : Type u₁) (D : Type u₂) [Category.{v₁} C] [Category.{v₂} D] where mk' :: functor : C ⥤ D inverse : D ⥤ C unitIso : 𝟭 C ≅ functor ⋙ inverse counitIso : inverse ⋙ functor ≅ 𝟭 D functor_unitIso_comp : ∀ X : C, functor.map (unitIso.hom.app X) ≫ counitIso.hom.app (functor.obj X) = 𝟙 (functor.obj X) := by aesop_cat #align category_theory.equivalence CategoryTheory.Equivalence #align category_theory.equivalence.unit_iso CategoryTheory.Equivalence.unitIso #align category_theory.equivalence.counit_iso CategoryTheory.Equivalence.counitIso #align category_theory.equivalence.functor_unit_iso_comp CategoryTheory.Equivalence.functor_unitIso_comp infixr:10 " ≌ " => Equivalence variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] namespace Equivalence abbrev unit (e : C ≌ D) : 𝟭 C ⟶ e.functor ⋙ e.inverse := e.unitIso.hom #align category_theory.equivalence.unit CategoryTheory.Equivalence.unit abbrev counit (e : C ≌ D) : e.inverse ⋙ e.functor ⟶ 𝟭 D := e.counitIso.hom #align category_theory.equivalence.counit CategoryTheory.Equivalence.counit abbrev unitInv (e : C ≌ D) : e.functor ⋙ e.inverse ⟶ 𝟭 C := e.unitIso.inv #align category_theory.equivalence.unit_inv CategoryTheory.Equivalence.unitInv abbrev counitInv (e : C ≌ D) : 𝟭 D ⟶ e.inverse ⋙ e.functor := e.counitIso.inv #align category_theory.equivalence.counit_inv CategoryTheory.Equivalence.counitInv @[simp] theorem Equivalence_mk'_unit (functor inverse unit_iso counit_iso f) : (⟨functor, inverse, unit_iso, counit_iso, f⟩ : C ≌ D).unit = unit_iso.hom := rfl #align category_theory.equivalence.equivalence_mk'_unit CategoryTheory.Equivalence.Equivalence_mk'_unit @[simp] theorem Equivalence_mk'_counit (functor inverse unit_iso counit_iso f) : (⟨functor, inverse, unit_iso, counit_iso, f⟩ : C ≌ D).counit = counit_iso.hom := rfl #align category_theory.equivalence.equivalence_mk'_counit CategoryTheory.Equivalence.Equivalence_mk'_counit @[simp] theorem Equivalence_mk'_unitInv (functor inverse unit_iso counit_iso f) : (⟨functor, inverse, unit_iso, counit_iso, f⟩ : C ≌ D).unitInv = unit_iso.inv := rfl #align category_theory.equivalence.equivalence_mk'_unit_inv CategoryTheory.Equivalence.Equivalence_mk'_unitInv @[simp] theorem Equivalence_mk'_counitInv (functor inverse unit_iso counit_iso f) : (⟨functor, inverse, unit_iso, counit_iso, f⟩ : C ≌ D).counitInv = counit_iso.inv := rfl #align category_theory.equivalence.equivalence_mk'_counit_inv CategoryTheory.Equivalence.Equivalence_mk'_counitInv @[reassoc (attr := simp)] theorem functor_unit_comp (e : C ≌ D) (X : C) : e.functor.map (e.unit.app X) ≫ e.counit.app (e.functor.obj X) = 𝟙 (e.functor.obj X) := e.functor_unitIso_comp X #align category_theory.equivalence.functor_unit_comp CategoryTheory.Equivalence.functor_unit_comp @[reassoc (attr := simp)] theorem counitInv_functor_comp (e : C ≌ D) (X : C) : e.counitInv.app (e.functor.obj X) ≫ e.functor.map (e.unitInv.app X) = 𝟙 (e.functor.obj X) := by erw [Iso.inv_eq_inv (e.functor.mapIso (e.unitIso.app X) ≪≫ e.counitIso.app (e.functor.obj X)) (Iso.refl _)] exact e.functor_unit_comp X #align category_theory.equivalence.counit_inv_functor_comp CategoryTheory.Equivalence.counitInv_functor_comp theorem counitInv_app_functor (e : C ≌ D) (X : C) : e.counitInv.app (e.functor.obj X) = e.functor.map (e.unit.app X) := by symm erw [← Iso.comp_hom_eq_id (e.counitIso.app _), functor_unit_comp] rfl #align category_theory.equivalence.counit_inv_app_functor CategoryTheory.Equivalence.counitInv_app_functor theorem counit_app_functor (e : C ≌ D) (X : C) : e.counit.app (e.functor.obj X) = e.functor.map (e.unitInv.app X) := by erw [← Iso.hom_comp_eq_id (e.functor.mapIso (e.unitIso.app X)), functor_unit_comp] rfl #align category_theory.equivalence.counit_app_functor CategoryTheory.Equivalence.counit_app_functor @[reassoc (attr := simp)] theorem unit_inverse_comp (e : C ≌ D) (Y : D) : e.unit.app (e.inverse.obj Y) ≫ e.inverse.map (e.counit.app Y) = 𝟙 (e.inverse.obj Y) := by rw [← id_comp (e.inverse.map _), ← map_id e.inverse, ← counitInv_functor_comp, map_comp] dsimp rw [← Iso.hom_inv_id_assoc (e.unitIso.app _) (e.inverse.map (e.functor.map _)), app_hom, app_inv] slice_lhs 2 3 => erw [e.unit.naturality] slice_lhs 1 2 => erw [e.unit.naturality] slice_lhs 4 4 => rw [← Iso.hom_inv_id_assoc (e.inverse.mapIso (e.counitIso.app _)) (e.unitInv.app _)] slice_lhs 3 4 => erw [← map_comp e.inverse, e.counit.naturality] erw [(e.counitIso.app _).hom_inv_id, map_id] erw [id_comp] slice_lhs 2 3 => erw [← map_comp e.inverse, e.counitIso.inv.naturality, map_comp] slice_lhs 3 4 => erw [e.unitInv.naturality] slice_lhs 4 5 => erw [← map_comp (e.functor ⋙ e.inverse), (e.unitIso.app _).hom_inv_id, map_id] erw [id_comp] slice_lhs 3 4 => erw [← e.unitInv.naturality] slice_lhs 2 3 => erw [← map_comp e.inverse, ← e.counitIso.inv.naturality, (e.counitIso.app _).hom_inv_id, map_id] erw [id_comp, (e.unitIso.app _).hom_inv_id]; rfl #align category_theory.equivalence.unit_inverse_comp CategoryTheory.Equivalence.unit_inverse_comp @[reassoc (attr := simp)] theorem inverse_counitInv_comp (e : C ≌ D) (Y : D) : e.inverse.map (e.counitInv.app Y) ≫ e.unitInv.app (e.inverse.obj Y) = 𝟙 (e.inverse.obj Y) := by erw [Iso.inv_eq_inv (e.unitIso.app (e.inverse.obj Y) ≪≫ e.inverse.mapIso (e.counitIso.app Y)) (Iso.refl _)] exact e.unit_inverse_comp Y #align category_theory.equivalence.inverse_counit_inv_comp CategoryTheory.Equivalence.inverse_counitInv_comp theorem unit_app_inverse (e : C ≌ D) (Y : D) : e.unit.app (e.inverse.obj Y) = e.inverse.map (e.counitInv.app Y) := by erw [← Iso.comp_hom_eq_id (e.inverse.mapIso (e.counitIso.app Y)), unit_inverse_comp] dsimp #align category_theory.equivalence.unit_app_inverse CategoryTheory.Equivalence.unit_app_inverse theorem unitInv_app_inverse (e : C ≌ D) (Y : D) : e.unitInv.app (e.inverse.obj Y) = e.inverse.map (e.counit.app Y) := by symm erw [← Iso.hom_comp_eq_id (e.unitIso.app _), unit_inverse_comp] rfl #align category_theory.equivalence.unit_inv_app_inverse CategoryTheory.Equivalence.unitInv_app_inverse @[reassoc, simp] theorem fun_inv_map (e : C ≌ D) (X Y : D) (f : X ⟶ Y) : e.functor.map (e.inverse.map f) = e.counit.app X ≫ f ≫ e.counitInv.app Y := (NatIso.naturality_2 e.counitIso f).symm #align category_theory.equivalence.fun_inv_map CategoryTheory.Equivalence.fun_inv_map @[reassoc, simp] theorem inv_fun_map (e : C ≌ D) (X Y : C) (f : X ⟶ Y) : e.inverse.map (e.functor.map f) = e.unitInv.app X ≫ f ≫ e.unit.app Y := (NatIso.naturality_1 e.unitIso f).symm #align category_theory.equivalence.inv_fun_map CategoryTheory.Equivalence.inv_fun_map section -- In this section we convert an arbitrary equivalence to a half-adjoint equivalence. variable {F : C ⥤ D} {G : D ⥤ C} (η : 𝟭 C ≅ F ⋙ G) (ε : G ⋙ F ≅ 𝟭 D) def adjointifyη : 𝟭 C ≅ F ⋙ G := by calc 𝟭 C ≅ F ⋙ G := η _ ≅ F ⋙ 𝟭 D ⋙ G := isoWhiskerLeft F (leftUnitor G).symm _ ≅ F ⋙ (G ⋙ F) ⋙ G := isoWhiskerLeft F (isoWhiskerRight ε.symm G) _ ≅ F ⋙ G ⋙ F ⋙ G := isoWhiskerLeft F (associator G F G) _ ≅ (F ⋙ G) ⋙ F ⋙ G := (associator F G (F ⋙ G)).symm _ ≅ 𝟭 C ⋙ F ⋙ G := isoWhiskerRight η.symm (F ⋙ G) _ ≅ F ⋙ G := leftUnitor (F ⋙ G) #align category_theory.equivalence.adjointify_η CategoryTheory.Equivalence.adjointifyη @[reassoc] theorem adjointify_η_ε (X : C) : F.map ((adjointifyη η ε).hom.app X) ≫ ε.hom.app (F.obj X) = 𝟙 (F.obj X) := by dsimp [adjointifyη,Trans.trans] simp only [comp_id, assoc, map_comp] have := ε.hom.naturality (F.map (η.inv.app X)); dsimp at this; rw [this]; clear this rw [← assoc _ _ (F.map _)] have := ε.hom.naturality (ε.inv.app <| F.obj X); dsimp at this; rw [this]; clear this have := (ε.app <| F.obj X).hom_inv_id; dsimp at this; rw [this]; clear this rw [id_comp]; have := (F.mapIso <| η.app X).hom_inv_id; dsimp at this; rw [this] #align category_theory.equivalence.adjointify_η_ε CategoryTheory.Equivalence.adjointify_η_ε end protected def mk (F : C ⥤ D) (G : D ⥤ C) (η : 𝟭 C ≅ F ⋙ G) (ε : G ⋙ F ≅ 𝟭 D) : C ≌ D := ⟨F, G, adjointifyη η ε, ε, adjointify_η_ε η ε⟩ #align category_theory.equivalence.mk CategoryTheory.Equivalence.mk @[refl, simps] def refl : C ≌ C := ⟨𝟭 C, 𝟭 C, Iso.refl _, Iso.refl _, fun _ => Category.id_comp _⟩ #align category_theory.equivalence.refl CategoryTheory.Equivalence.refl instance : Inhabited (C ≌ C) := ⟨refl⟩ @[symm, simps] def symm (e : C ≌ D) : D ≌ C := ⟨e.inverse, e.functor, e.counitIso.symm, e.unitIso.symm, e.inverse_counitInv_comp⟩ #align category_theory.equivalence.symm CategoryTheory.Equivalence.symm variable {E : Type u₃} [Category.{v₃} E] @[trans, simps] def trans (e : C ≌ D) (f : D ≌ E) : C ≌ E where functor := e.functor ⋙ f.functor inverse := f.inverse ⋙ e.inverse unitIso := by refine Iso.trans e.unitIso ?_ exact isoWhiskerLeft e.functor (isoWhiskerRight f.unitIso e.inverse) counitIso := by refine Iso.trans ?_ f.counitIso exact isoWhiskerLeft f.inverse (isoWhiskerRight e.counitIso f.functor) -- We wouldn't have needed to give this proof if we'd used `Equivalence.mk`, -- but we choose to avoid using that here, for the sake of good structure projection `simp` -- lemmas. functor_unitIso_comp X := by dsimp rw [← f.functor.map_comp_assoc, e.functor.map_comp, ← counitInv_app_functor, fun_inv_map, Iso.inv_hom_id_app_assoc, assoc, Iso.inv_hom_id_app, counit_app_functor, ← Functor.map_comp] erw [comp_id, Iso.hom_inv_id_app, Functor.map_id] #align category_theory.equivalence.trans CategoryTheory.Equivalence.trans def funInvIdAssoc (e : C ≌ D) (F : C ⥤ E) : e.functor ⋙ e.inverse ⋙ F ≅ F := (Functor.associator _ _ _).symm ≪≫ isoWhiskerRight e.unitIso.symm F ≪≫ F.leftUnitor #align category_theory.equivalence.fun_inv_id_assoc CategoryTheory.Equivalence.funInvIdAssoc @[simp] theorem funInvIdAssoc_hom_app (e : C ≌ D) (F : C ⥤ E) (X : C) : (funInvIdAssoc e F).hom.app X = F.map (e.unitInv.app X) := by dsimp [funInvIdAssoc] aesop_cat #align category_theory.equivalence.fun_inv_id_assoc_hom_app CategoryTheory.Equivalence.funInvIdAssoc_hom_app @[simp] theorem funInvIdAssoc_inv_app (e : C ≌ D) (F : C ⥤ E) (X : C) : (funInvIdAssoc e F).inv.app X = F.map (e.unit.app X) := by dsimp [funInvIdAssoc] aesop_cat #align category_theory.equivalence.fun_inv_id_assoc_inv_app CategoryTheory.Equivalence.funInvIdAssoc_inv_app def invFunIdAssoc (e : C ≌ D) (F : D ⥤ E) : e.inverse ⋙ e.functor ⋙ F ≅ F := (Functor.associator _ _ _).symm ≪≫ isoWhiskerRight e.counitIso F ≪≫ F.leftUnitor #align category_theory.equivalence.inv_fun_id_assoc CategoryTheory.Equivalence.invFunIdAssoc @[simp] theorem invFunIdAssoc_hom_app (e : C ≌ D) (F : D ⥤ E) (X : D) : (invFunIdAssoc e F).hom.app X = F.map (e.counit.app X) := by dsimp [invFunIdAssoc] aesop_cat #align category_theory.equivalence.inv_fun_id_assoc_hom_app CategoryTheory.Equivalence.invFunIdAssoc_hom_app @[simp] theorem invFunIdAssoc_inv_app (e : C ≌ D) (F : D ⥤ E) (X : D) : (invFunIdAssoc e F).inv.app X = F.map (e.counitInv.app X) := by dsimp [invFunIdAssoc] aesop_cat #align category_theory.equivalence.inv_fun_id_assoc_inv_app CategoryTheory.Equivalence.invFunIdAssoc_inv_app @[simps! functor inverse unitIso counitIso] def congrLeft (e : C ≌ D) : C ⥤ E ≌ D ⥤ E := Equivalence.mk ((whiskeringLeft _ _ _).obj e.inverse) ((whiskeringLeft _ _ _).obj e.functor) (NatIso.ofComponents fun F => (e.funInvIdAssoc F).symm) (NatIso.ofComponents fun F => e.invFunIdAssoc F) #align category_theory.equivalence.congr_left CategoryTheory.Equivalence.congrLeft @[simps! functor inverse unitIso counitIso] def congrRight (e : C ≌ D) : E ⥤ C ≌ E ⥤ D := Equivalence.mk ((whiskeringRight _ _ _).obj e.functor) ((whiskeringRight _ _ _).obj e.inverse) (NatIso.ofComponents fun F => F.rightUnitor.symm ≪≫ isoWhiskerLeft F e.unitIso ≪≫ Functor.associator _ _ _) (NatIso.ofComponents fun F => Functor.associator _ _ _ ≪≫ isoWhiskerLeft F e.counitIso ≪≫ F.rightUnitor) #align category_theory.equivalence.congr_right CategoryTheory.Equivalence.congrRight section -- There's of course a monoid structure on `C ≌ C`, -- but let's not encourage using it. -- The power structure is nevertheless useful. def powNat (e : C ≌ C) : ℕ → (C ≌ C) | 0 => Equivalence.refl | 1 => e | n + 2 => e.trans (powNat e (n + 1)) #align category_theory.equivalence.pow_nat CategoryTheory.Equivalence.powNat def pow (e : C ≌ C) : ℤ → (C ≌ C) | Int.ofNat n => e.powNat n | Int.negSucc n => e.symm.powNat (n + 1) #align category_theory.equivalence.pow CategoryTheory.Equivalence.pow instance : Pow (C ≌ C) ℤ := ⟨pow⟩ @[simp] theorem pow_zero (e : C ≌ C) : e ^ (0 : ℤ) = Equivalence.refl := rfl #align category_theory.equivalence.pow_zero CategoryTheory.Equivalence.pow_zero @[simp] theorem pow_one (e : C ≌ C) : e ^ (1 : ℤ) = e := rfl #align category_theory.equivalence.pow_one CategoryTheory.Equivalence.pow_one @[simp] theorem pow_neg_one (e : C ≌ C) : e ^ (-1 : ℤ) = e.symm := rfl #align category_theory.equivalence.pow_neg_one CategoryTheory.Equivalence.pow_neg_one -- TODO as necessary, add the natural isomorphisms `(e^a).trans e^b ≅ e^(a+b)`. -- At this point, we haven't even defined the category of equivalences. -- Note: the better formulation of this would involve `HasShift`. end instance essSurj_functor (e : C ≌ E) : e.functor.EssSurj := ⟨fun Y => ⟨e.inverse.obj Y, ⟨e.counitIso.app Y⟩⟩⟩ instance essSurj_inverse (e : C ≌ E) : e.inverse.EssSurj := e.symm.essSurj_functor instance faithful_functor (e : C ≌ E) : e.functor.Faithful where map_injective {X Y f g} h := by rw [← cancel_mono (e.unit.app Y), ← cancel_epi (e.unitInv.app X), ← e.inv_fun_map _ _ f, ← e.inv_fun_map _ _ g, h] instance faithful_inverse (e : C ≌ E) : e.inverse.Faithful := e.symm.faithful_functor instance full_functor (e : C ≌ E) : e.functor.Full where map_surjective {X Y} f := ⟨e.unitIso.hom.app X ≫ e.inverse.map f ≫ e.unitIso.inv.app Y, e.inverse.map_injective (by simp)⟩ instance full_inverse (e : C ≌ E) : e.inverse.Full := e.symm.full_functor @[simps!] def changeFunctor (e : C ≌ D) {G : C ⥤ D} (iso : e.functor ≅ G) : C ≌ D where functor := G inverse := e.inverse unitIso := e.unitIso ≪≫ isoWhiskerRight iso _ counitIso := isoWhiskerLeft _ iso.symm ≪≫ e.counitIso
Mathlib/CategoryTheory/Equivalence.lean
517
517
theorem changeFunctor_refl (e : C ≌ D) : e.changeFunctor (Iso.refl _) = e := by
aesop_cat
import Mathlib.CategoryTheory.Closed.Cartesian import Mathlib.CategoryTheory.Limits.Preserves.Shapes.BinaryProducts import Mathlib.CategoryTheory.Adjunction.FullyFaithful #align_import category_theory.closed.functor from "leanprover-community/mathlib"@"cea27692b3fdeb328a2ddba6aabf181754543184" noncomputable section namespace CategoryTheory open Category Limits CartesianClosed universe v u u' variable {C : Type u} [Category.{v} C] variable {D : Type u'} [Category.{v} D] variable [HasFiniteProducts C] [HasFiniteProducts D] variable (F : C ⥤ D) {L : D ⥤ C} def frobeniusMorphism (h : L ⊣ F) (A : C) : prod.functor.obj (F.obj A) ⋙ L ⟶ L ⋙ prod.functor.obj A := prodComparisonNatTrans L (F.obj A) ≫ whiskerLeft _ (prod.functor.map (h.counit.app _)) #align category_theory.frobenius_morphism CategoryTheory.frobeniusMorphism instance frobeniusMorphism_iso_of_preserves_binary_products (h : L ⊣ F) (A : C) [PreservesLimitsOfShape (Discrete WalkingPair) L] [F.Full] [F.Faithful] : IsIso (frobeniusMorphism F h A) := suffices ∀ (X : D), IsIso ((frobeniusMorphism F h A).app X) from NatIso.isIso_of_isIso_app _ fun B ↦ by dsimp [frobeniusMorphism]; infer_instance #align category_theory.frobenius_morphism_iso_of_preserves_binary_products CategoryTheory.frobeniusMorphism_iso_of_preserves_binary_products variable [CartesianClosed C] [CartesianClosed D] variable [PreservesLimitsOfShape (Discrete WalkingPair) F] def expComparison (A : C) : exp A ⋙ F ⟶ F ⋙ exp (F.obj A) := transferNatTrans (exp.adjunction A) (exp.adjunction (F.obj A)) (prodComparisonNatIso F A).inv #align category_theory.exp_comparison CategoryTheory.expComparison theorem expComparison_ev (A B : C) : Limits.prod.map (𝟙 (F.obj A)) ((expComparison F A).app B) ≫ (exp.ev (F.obj A)).app (F.obj B) = inv (prodComparison F _ _) ≫ F.map ((exp.ev _).app _) := by convert transferNatTrans_counit _ _ (prodComparisonNatIso F A).inv B using 2 apply IsIso.inv_eq_of_hom_inv_id -- Porting note: was `ext` simp only [Limits.prodComparisonNatIso_inv, asIso_inv, NatIso.isIso_inv_app, IsIso.hom_inv_id] #align category_theory.exp_comparison_ev CategoryTheory.expComparison_ev theorem coev_expComparison (A B : C) : F.map ((exp.coev A).app B) ≫ (expComparison F A).app (A ⨯ B) = (exp.coev _).app (F.obj B) ≫ (exp (F.obj A)).map (inv (prodComparison F A B)) := by convert unit_transferNatTrans _ _ (prodComparisonNatIso F A).inv B using 3 apply IsIso.inv_eq_of_hom_inv_id -- Porting note: was `ext` dsimp simp #align category_theory.coev_exp_comparison CategoryTheory.coev_expComparison theorem uncurry_expComparison (A B : C) : CartesianClosed.uncurry ((expComparison F A).app B) = inv (prodComparison F _ _) ≫ F.map ((exp.ev _).app _) := by rw [uncurry_eq, expComparison_ev] #align category_theory.uncurry_exp_comparison CategoryTheory.uncurry_expComparison theorem expComparison_whiskerLeft {A A' : C} (f : A' ⟶ A) : expComparison F A ≫ whiskerLeft _ (pre (F.map f)) = whiskerRight (pre f) _ ≫ expComparison F A' := by ext B dsimp apply uncurry_injective rw [uncurry_natural_left, uncurry_natural_left, uncurry_expComparison, uncurry_pre, prod.map_swap_assoc, ← F.map_id, expComparison_ev, ← F.map_id, ← prodComparison_inv_natural_assoc, ← prodComparison_inv_natural_assoc, ← F.map_comp, ← F.map_comp, prod_map_pre_app_comp_ev] #align category_theory.exp_comparison_whisker_left CategoryTheory.expComparison_whiskerLeft class CartesianClosedFunctor : Prop where comparison_iso : ∀ A, IsIso (expComparison F A) #align category_theory.cartesian_closed_functor CategoryTheory.CartesianClosedFunctor attribute [instance] CartesianClosedFunctor.comparison_iso theorem frobeniusMorphism_mate (h : L ⊣ F) (A : C) : transferNatTransSelf (h.comp (exp.adjunction A)) ((exp.adjunction (F.obj A)).comp h) (frobeniusMorphism F h A) = expComparison F A := by rw [← Equiv.eq_symm_apply] ext B : 2 dsimp [frobeniusMorphism, transferNatTransSelf, transferNatTrans, Adjunction.comp] simp only [id_comp, comp_id] rw [← L.map_comp_assoc, prod.map_id_comp, assoc] -- Porting note: need to use `erw` here. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [expComparison_ev] rw [prod.map_id_comp, assoc, ← F.map_id, ← prodComparison_inv_natural_assoc, ← F.map_comp] -- Porting note: need to use `erw` here. -- https://github.com/leanprover-community/mathlib4/issues/5164 erw [exp.ev_coev] rw [F.map_id (A ⨯ L.obj B), comp_id] ext · rw [assoc, assoc, ← h.counit_naturality, ← L.map_comp_assoc, assoc, inv_prodComparison_map_fst] simp · rw [assoc, assoc, ← h.counit_naturality, ← L.map_comp_assoc, assoc, inv_prodComparison_map_snd] simp #align category_theory.frobenius_morphism_mate CategoryTheory.frobeniusMorphism_mate theorem frobeniusMorphism_iso_of_expComparison_iso (h : L ⊣ F) (A : C) [i : IsIso (expComparison F A)] : IsIso (frobeniusMorphism F h A) := by rw [← frobeniusMorphism_mate F h] at i exact @transferNatTransSelf_of_iso _ _ _ _ _ _ _ _ _ _ _ i #align category_theory.frobenius_morphism_iso_of_exp_comparison_iso CategoryTheory.frobeniusMorphism_iso_of_expComparison_iso
Mathlib/CategoryTheory/Closed/Functor.lean
166
168
theorem expComparison_iso_of_frobeniusMorphism_iso (h : L ⊣ F) (A : C) [i : IsIso (frobeniusMorphism F h A)] : IsIso (expComparison F A) := by
rw [← frobeniusMorphism_mate F h]; infer_instance
import Mathlib.Algebra.Group.Subgroup.Pointwise import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup #align_import number_theory.modular_forms.congruence_subgroups from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5" local notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R attribute [-instance] Matrix.SpecialLinearGroup.instCoeFun local notation:1024 "↑ₘ" A:1024 => ((A : SL(2, ℤ)) : Matrix (Fin 2) (Fin 2) ℤ) open Matrix.SpecialLinearGroup Matrix variable (N : ℕ) local notation "SLMOD(" N ")" => @Matrix.SpecialLinearGroup.map (Fin 2) _ _ _ _ _ _ (Int.castRingHom (ZMod N)) set_option linter.uppercaseLean3 false @[simp] theorem SL_reduction_mod_hom_val (N : ℕ) (γ : SL(2, ℤ)) : ∀ i j : Fin 2, (SLMOD(N) γ : Matrix (Fin 2) (Fin 2) (ZMod N)) i j = ((↑ₘγ i j : ℤ) : ZMod N) := fun _ _ => rfl #align SL_reduction_mod_hom_val SL_reduction_mod_hom_val def Gamma (N : ℕ) : Subgroup SL(2, ℤ) := SLMOD(N).ker #align Gamma Gamma theorem Gamma_mem' (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ SLMOD(N) γ = 1 := Iff.rfl #align Gamma_mem' Gamma_mem' @[simp] theorem Gamma_mem (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ ((↑ₘγ 0 0 : ℤ) : ZMod N) = 1 ∧ ((↑ₘγ 0 1 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 0 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 1 : ℤ) : ZMod N) = 1 := by rw [Gamma_mem'] constructor · intro h simp [← SL_reduction_mod_hom_val N γ, h] · intro h ext i j rw [SL_reduction_mod_hom_val N γ] fin_cases i <;> fin_cases j <;> simp only [h] exacts [h.1, h.2.1, h.2.2.1, h.2.2.2] #align Gamma_mem Gamma_mem theorem Gamma_normal (N : ℕ) : Subgroup.Normal (Gamma N) := SLMOD(N).normal_ker #align Gamma_normal Gamma_normal
Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean
73
75
theorem Gamma_one_top : Gamma 1 = ⊤ := by
ext simp [eq_iff_true_of_subsingleton]
import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.Order.Module.OrderedSMul import Mathlib.Algebra.Order.Group.Instances import Mathlib.Data.Prod.Lex import Mathlib.Data.Set.Image import Mathlib.GroupTheory.Perm.Support import Mathlib.Order.Monotone.Monovary import Mathlib.Tactic.Abel #align_import algebra.order.rearrangement from "leanprover-community/mathlib"@"b3f25363ae62cb169e72cd6b8b1ac97bacf21ca7" open Equiv Equiv.Perm Finset Function OrderDual variable {ι α β : Type*} section SMul variable [LinearOrderedRing α] [LinearOrderedAddCommGroup β] [Module α β] [OrderedSMul α β] {s : Finset ι} {σ : Perm ι} {f : ι → α} {g : ι → β} theorem MonovaryOn.sum_smul_comp_perm_le_sum_smul (hfg : MonovaryOn f g s) (hσ : { x | σ x ≠ x } ⊆ s) : (∑ i ∈ s, f i • g (σ i)) ≤ ∑ i ∈ s, f i • g i := by classical revert hσ σ hfg -- Porting note: Specify `p` to get around `∀ {σ}` in the current goal. apply Finset.induction_on_max_value (fun i ↦ toLex (g i, f i)) (p := fun t ↦ ∀ {σ : Perm ι}, MonovaryOn f g t → { x | σ x ≠ x } ⊆ t → (∑ i ∈ t, f i • g (σ i)) ≤ ∑ i ∈ t, f i • g i) s · simp only [le_rfl, Finset.sum_empty, imp_true_iff] intro a s has hamax hind σ hfg hσ set τ : Perm ι := σ.trans (swap a (σ a)) with hτ have hτs : { x | τ x ≠ x } ⊆ s := by intro x hx simp only [τ, Ne, Set.mem_setOf_eq, Equiv.coe_trans, Equiv.swap_comp_apply] at hx split_ifs at hx with h₁ h₂ · obtain rfl | hax := eq_or_ne x a · contradiction · exact mem_of_mem_insert_of_ne (hσ fun h ↦ hax <| h.symm.trans h₁) hax · exact (hx <| σ.injective h₂.symm).elim · exact mem_of_mem_insert_of_ne (hσ hx) (ne_of_apply_ne _ h₂) specialize hind (hfg.subset <| subset_insert _ _) hτs simp_rw [sum_insert has] refine le_trans ?_ (add_le_add_left hind _) obtain hσa | hσa := eq_or_ne a (σ a) · rw [hτ, ← hσa, swap_self, trans_refl] have h1s : σ⁻¹ a ∈ s := by rw [Ne, ← inv_eq_iff_eq] at hσa refine mem_of_mem_insert_of_ne (hσ fun h ↦ hσa ?_) hσa rwa [apply_inv_self, eq_comm] at h simp only [← s.sum_erase_add _ h1s, add_comm] rw [← add_assoc, ← add_assoc] simp only [hτ, swap_apply_left, Function.comp_apply, Equiv.coe_trans, apply_inv_self] refine add_le_add (smul_add_smul_le_smul_add_smul' ?_ ?_) (sum_congr rfl fun x hx ↦ ?_).le · specialize hamax (σ⁻¹ a) h1s rw [Prod.Lex.le_iff] at hamax cases' hamax with hamax hamax · exact hfg (mem_insert_of_mem h1s) (mem_insert_self _ _) hamax · exact hamax.2 · specialize hamax (σ a) (mem_of_mem_insert_of_ne (hσ <| σ.injective.ne hσa.symm) hσa.symm) rw [Prod.Lex.le_iff] at hamax cases' hamax with hamax hamax · exact hamax.le · exact hamax.1.le · rw [mem_erase, Ne, eq_inv_iff_eq] at hx rw [swap_apply_of_ne_of_ne hx.1 (σ.injective.ne _)] rintro rfl exact has hx.2 #align monovary_on.sum_smul_comp_perm_le_sum_smul MonovaryOn.sum_smul_comp_perm_le_sum_smul theorem MonovaryOn.sum_smul_comp_perm_eq_sum_smul_iff (hfg : MonovaryOn f g s) (hσ : { x | σ x ≠ x } ⊆ s) : ((∑ i ∈ s, f i • g (σ i)) = ∑ i ∈ s, f i • g i) ↔ MonovaryOn f (g ∘ σ) s := by classical refine ⟨not_imp_not.1 fun h ↦ ?_, fun h ↦ (hfg.sum_smul_comp_perm_le_sum_smul hσ).antisymm ?_⟩ · rw [MonovaryOn] at h push_neg at h obtain ⟨x, hx, y, hy, hgxy, hfxy⟩ := h set τ : Perm ι := (Equiv.swap x y).trans σ have hτs : { x | τ x ≠ x } ⊆ s := by refine (set_support_mul_subset σ <| swap x y).trans (Set.union_subset hσ fun z hz ↦ ?_) obtain ⟨_, rfl | rfl⟩ := swap_apply_ne_self_iff.1 hz <;> assumption refine ((hfg.sum_smul_comp_perm_le_sum_smul hτs).trans_lt' ?_).ne obtain rfl | hxy := eq_or_ne x y · cases lt_irrefl _ hfxy simp only [τ, ← s.sum_erase_add _ hx, ← (s.erase x).sum_erase_add _ (mem_erase.2 ⟨hxy.symm, hy⟩), add_assoc, Equiv.coe_trans, Function.comp_apply, swap_apply_right, swap_apply_left] refine add_lt_add_of_le_of_lt (Finset.sum_congr rfl fun z hz ↦ ?_).le (smul_add_smul_lt_smul_add_smul hfxy hgxy) simp_rw [mem_erase] at hz rw [swap_apply_of_ne_of_ne hz.2.1 hz.1] · convert h.sum_smul_comp_perm_le_sum_smul ((set_support_inv_eq _).subset.trans hσ) using 1 simp_rw [Function.comp_apply, apply_inv_self] #align monovary_on.sum_smul_comp_perm_eq_sum_smul_iff MonovaryOn.sum_smul_comp_perm_eq_sum_smul_iff
Mathlib/Algebra/Order/Rearrangement.lean
143
147
theorem MonovaryOn.sum_smul_comp_perm_lt_sum_smul_iff (hfg : MonovaryOn f g s) (hσ : { x | σ x ≠ x } ⊆ s) : ((∑ i ∈ s, f i • g (σ i)) < ∑ i ∈ s, f i • g i) ↔ ¬MonovaryOn f (g ∘ σ) s := by
simp [← hfg.sum_smul_comp_perm_eq_sum_smul_iff hσ, lt_iff_le_and_ne, hfg.sum_smul_comp_perm_le_sum_smul hσ]
import Mathlib.Analysis.BoxIntegral.Partition.Split import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul #align_import analysis.box_integral.partition.additive from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" noncomputable section open scoped Classical open Function Set namespace BoxIntegral variable {ι M : Type*} {n : ℕ} structure BoxAdditiveMap (ι M : Type*) [AddCommMonoid M] (I : WithTop (Box ι)) where toFun : Box ι → M sum_partition_boxes' : ∀ J : Box ι, ↑J ≤ I → ∀ π : Prepartition J, π.IsPartition → ∑ Ji ∈ π.boxes, toFun Ji = toFun J #align box_integral.box_additive_map BoxIntegral.BoxAdditiveMap scoped notation:25 ι " →ᵇᵃ " M => BoxIntegral.BoxAdditiveMap ι M ⊤ @[inherit_doc] scoped notation:25 ι " →ᵇᵃ[" I "] " M => BoxIntegral.BoxAdditiveMap ι M I namespace BoxAdditiveMap open Box Prepartition Finset variable {N : Type*} [AddCommMonoid M] [AddCommMonoid N] {I₀ : WithTop (Box ι)} {I J : Box ι} {i : ι} instance : FunLike (ι →ᵇᵃ[I₀] M) (Box ι) M where coe := toFun coe_injective' f g h := by cases f; cases g; congr initialize_simps_projections BoxIntegral.BoxAdditiveMap (toFun → apply) #noalign box_integral.box_additive_map.to_fun_eq_coe @[simp] theorem coe_mk (f h) : ⇑(mk f h : ι →ᵇᵃ[I₀] M) = f := rfl #align box_integral.box_additive_map.coe_mk BoxIntegral.BoxAdditiveMap.coe_mk theorem coe_injective : Injective fun (f : ι →ᵇᵃ[I₀] M) x => f x := DFunLike.coe_injective #align box_integral.box_additive_map.coe_injective BoxIntegral.BoxAdditiveMap.coe_injective -- Porting note (#10618): was @[simp], now can be proved by `simp` theorem coe_inj {f g : ι →ᵇᵃ[I₀] M} : (f : Box ι → M) = g ↔ f = g := DFunLike.coe_fn_eq #align box_integral.box_additive_map.coe_inj BoxIntegral.BoxAdditiveMap.coe_inj theorem sum_partition_boxes (f : ι →ᵇᵃ[I₀] M) (hI : ↑I ≤ I₀) {π : Prepartition I} (h : π.IsPartition) : ∑ J ∈ π.boxes, f J = f I := f.sum_partition_boxes' I hI π h #align box_integral.box_additive_map.sum_partition_boxes BoxIntegral.BoxAdditiveMap.sum_partition_boxes @[simps (config := .asFn)] instance : Zero (ι →ᵇᵃ[I₀] M) := ⟨⟨0, fun _ _ _ _ => sum_const_zero⟩⟩ instance : Inhabited (ι →ᵇᵃ[I₀] M) := ⟨0⟩ instance : Add (ι →ᵇᵃ[I₀] M) := ⟨fun f g => ⟨f + g, fun I hI π hπ => by simp only [Pi.add_apply, sum_add_distrib, sum_partition_boxes _ hI hπ]⟩⟩ instance {R} [Monoid R] [DistribMulAction R M] : SMul R (ι →ᵇᵃ[I₀] M) := ⟨fun r f => ⟨r • (f : Box ι → M), fun I hI π hπ => by simp only [Pi.smul_apply, ← smul_sum, sum_partition_boxes _ hI hπ]⟩⟩ instance : AddCommMonoid (ι →ᵇᵃ[I₀] M) := Function.Injective.addCommMonoid _ coe_injective rfl (fun _ _ => rfl) fun _ _ => rfl @[simp] theorem map_split_add (f : ι →ᵇᵃ[I₀] M) (hI : ↑I ≤ I₀) (i : ι) (x : ℝ) : (I.splitLower i x).elim' 0 f + (I.splitUpper i x).elim' 0 f = f I := by rw [← f.sum_partition_boxes hI (isPartitionSplit I i x), sum_split_boxes] #align box_integral.box_additive_map.map_split_add BoxIntegral.BoxAdditiveMap.map_split_add @[simps] def restrict (f : ι →ᵇᵃ[I₀] M) (I : WithTop (Box ι)) (hI : I ≤ I₀) : ι →ᵇᵃ[I] M := ⟨f, fun J hJ => f.2 J (hJ.trans hI)⟩ #align box_integral.box_additive_map.restrict BoxIntegral.BoxAdditiveMap.restrict def ofMapSplitAdd [Finite ι] (f : Box ι → M) (I₀ : WithTop (Box ι)) (hf : ∀ I : Box ι, ↑I ≤ I₀ → ∀ {i x}, x ∈ Ioo (I.lower i) (I.upper i) → (I.splitLower i x).elim' 0 f + (I.splitUpper i x).elim' 0 f = f I) : ι →ᵇᵃ[I₀] M := by refine ⟨f, ?_⟩ replace hf : ∀ I : Box ι, ↑I ≤ I₀ → ∀ s, (∑ J ∈ (splitMany I s).boxes, f J) = f I := by intro I hI s induction' s using Finset.induction_on with a s _ ihs · simp rw [splitMany_insert, inf_split, ← ihs, biUnion_boxes, sum_biUnion_boxes] refine Finset.sum_congr rfl fun J' hJ' => ?_ by_cases h : a.2 ∈ Ioo (J'.lower a.1) (J'.upper a.1) · rw [sum_split_boxes] exact hf _ ((WithTop.coe_le_coe.2 <| le_of_mem _ hJ').trans hI) h · rw [split_of_not_mem_Ioo h, top_boxes, Finset.sum_singleton] intro I hI π hπ have Hle : ∀ J ∈ π, ↑J ≤ I₀ := fun J hJ => (WithTop.coe_le_coe.2 <| π.le_of_mem hJ).trans hI rcases hπ.exists_splitMany_le with ⟨s, hs⟩ rw [← hf _ hI, ← inf_of_le_right hs, inf_splitMany, biUnion_boxes, sum_biUnion_boxes] exact Finset.sum_congr rfl fun J hJ => (hf _ (Hle _ hJ) _).symm #align box_integral.box_additive_map.of_map_split_add BoxIntegral.BoxAdditiveMap.ofMapSplitAdd @[simps (config := .asFn)] def map (f : ι →ᵇᵃ[I₀] M) (g : M →+ N) : ι →ᵇᵃ[I₀] N where toFun := g ∘ f sum_partition_boxes' I hI π hπ := by simp_rw [comp, ← map_sum, f.sum_partition_boxes hI hπ] #align box_integral.box_additive_map.map BoxIntegral.BoxAdditiveMap.map
Mathlib/Analysis/BoxIntegral/Partition/Additive.lean
159
175
theorem sum_boxes_congr [Finite ι] (f : ι →ᵇᵃ[I₀] M) (hI : ↑I ≤ I₀) {π₁ π₂ : Prepartition I} (h : π₁.iUnion = π₂.iUnion) : ∑ J ∈ π₁.boxes, f J = ∑ J ∈ π₂.boxes, f J := by
rcases exists_splitMany_inf_eq_filter_of_finite {π₁, π₂} ((finite_singleton _).insert _) with ⟨s, hs⟩ simp only [inf_splitMany] at hs rcases hs _ (Or.inl rfl), hs _ (Or.inr rfl) with ⟨h₁, h₂⟩; clear hs rw [h] at h₁ calc ∑ J ∈ π₁.boxes, f J = ∑ J ∈ π₁.boxes, ∑ J' ∈ (splitMany J s).boxes, f J' := Finset.sum_congr rfl fun J hJ => (f.sum_partition_boxes ?_ (isPartition_splitMany _ _)).symm _ = ∑ J ∈ (π₁.biUnion fun J => splitMany J s).boxes, f J := (sum_biUnion_boxes _ _ _).symm _ = ∑ J ∈ (π₂.biUnion fun J => splitMany J s).boxes, f J := by rw [h₁, h₂] _ = ∑ J ∈ π₂.boxes, ∑ J' ∈ (splitMany J s).boxes, f J' := sum_biUnion_boxes _ _ _ _ = ∑ J ∈ π₂.boxes, f J := Finset.sum_congr rfl fun J hJ => f.sum_partition_boxes ?_ (isPartition_splitMany _ _) exacts [(WithTop.coe_le_coe.2 <| π₁.le_of_mem hJ).trans hI, (WithTop.coe_le_coe.2 <| π₂.le_of_mem hJ).trans hI]
import Mathlib.Data.ENat.Lattice import Mathlib.Order.OrderIsoNat import Mathlib.Tactic.TFAE #align_import order.height from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b" open List hiding le_antisymm open OrderDual universe u v variable {α β : Type*} namespace Set section LT variable [LT α] [LT β] (s t : Set α) def subchain : Set (List α) := { l | l.Chain' (· < ·) ∧ ∀ i ∈ l, i ∈ s } #align set.subchain Set.subchain @[simp] -- porting note: new `simp` theorem nil_mem_subchain : [] ∈ s.subchain := ⟨trivial, fun _ ↦ nofun⟩ #align set.nil_mem_subchain Set.nil_mem_subchain variable {s} {l : List α} {a : α} theorem cons_mem_subchain_iff : (a::l) ∈ s.subchain ↔ a ∈ s ∧ l ∈ s.subchain ∧ ∀ b ∈ l.head?, a < b := by simp only [subchain, mem_setOf_eq, forall_mem_cons, chain'_cons', and_left_comm, and_comm, and_assoc] #align set.cons_mem_subchain_iff Set.cons_mem_subchain_iff @[simp] -- Porting note (#10756): new lemma + `simp` theorem singleton_mem_subchain_iff : [a] ∈ s.subchain ↔ a ∈ s := by simp [cons_mem_subchain_iff] instance : Nonempty s.subchain := ⟨⟨[], s.nil_mem_subchain⟩⟩ variable (s) noncomputable def chainHeight : ℕ∞ := ⨆ l ∈ s.subchain, length l #align set.chain_height Set.chainHeight theorem chainHeight_eq_iSup_subtype : s.chainHeight = ⨆ l : s.subchain, ↑l.1.length := iSup_subtype' #align set.chain_height_eq_supr_subtype Set.chainHeight_eq_iSup_subtype theorem exists_chain_of_le_chainHeight {n : ℕ} (hn : ↑n ≤ s.chainHeight) : ∃ l ∈ s.subchain, length l = n := by rcases (le_top : s.chainHeight ≤ ⊤).eq_or_lt with ha | ha <;> rw [chainHeight_eq_iSup_subtype] at ha · obtain ⟨_, ⟨⟨l, h₁, h₂⟩, rfl⟩, h₃⟩ := not_bddAbove_iff'.mp (WithTop.iSup_coe_eq_top.1 ha) n exact ⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩, (l.length_take n).trans <| min_eq_left <| le_of_not_ge h₃⟩ · rw [ENat.iSup_coe_lt_top] at ha obtain ⟨⟨l, h₁, h₂⟩, e : l.length = _⟩ := Nat.sSup_mem (Set.range_nonempty _) ha refine ⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩, (l.length_take n).trans <| min_eq_left <| ?_⟩ rwa [e, ← Nat.cast_le (α := ℕ∞), sSup_range, ENat.coe_iSup ha, ← chainHeight_eq_iSup_subtype] #align set.exists_chain_of_le_chain_height Set.exists_chain_of_le_chainHeight theorem le_chainHeight_TFAE (n : ℕ) : TFAE [↑n ≤ s.chainHeight, ∃ l ∈ s.subchain, length l = n, ∃ l ∈ s.subchain, n ≤ length l] := by tfae_have 1 → 2; · exact s.exists_chain_of_le_chainHeight tfae_have 2 → 3; · rintro ⟨l, hls, he⟩; exact ⟨l, hls, he.ge⟩ tfae_have 3 → 1; · rintro ⟨l, hs, hn⟩; exact le_iSup₂_of_le l hs (WithTop.coe_le_coe.2 hn) tfae_finish #align set.le_chain_height_tfae Set.le_chainHeight_TFAE variable {s t} theorem le_chainHeight_iff {n : ℕ} : ↑n ≤ s.chainHeight ↔ ∃ l ∈ s.subchain, length l = n := (le_chainHeight_TFAE s n).out 0 1 #align set.le_chain_height_iff Set.le_chainHeight_iff theorem length_le_chainHeight_of_mem_subchain (hl : l ∈ s.subchain) : ↑l.length ≤ s.chainHeight := le_chainHeight_iff.mpr ⟨l, hl, rfl⟩ #align set.length_le_chain_height_of_mem_subchain Set.length_le_chainHeight_of_mem_subchain theorem chainHeight_eq_top_iff : s.chainHeight = ⊤ ↔ ∀ n, ∃ l ∈ s.subchain, length l = n := by refine ⟨fun h n ↦ le_chainHeight_iff.1 (le_top.trans_eq h.symm), fun h ↦ ?_⟩ contrapose! h; obtain ⟨n, hn⟩ := WithTop.ne_top_iff_exists.1 h exact ⟨n + 1, fun l hs ↦ (Nat.lt_succ_iff.2 <| Nat.cast_le.1 <| (length_le_chainHeight_of_mem_subchain hs).trans_eq hn.symm).ne⟩ #align set.chain_height_eq_top_iff Set.chainHeight_eq_top_iff @[simp] theorem one_le_chainHeight_iff : 1 ≤ s.chainHeight ↔ s.Nonempty := by rw [← Nat.cast_one, Set.le_chainHeight_iff] simp only [length_eq_one, @and_comm (_ ∈ _), @eq_comm _ _ [_], exists_exists_eq_and, singleton_mem_subchain_iff, Set.Nonempty] #align set.one_le_chain_height_iff Set.one_le_chainHeight_iff @[simp] theorem chainHeight_eq_zero_iff : s.chainHeight = 0 ↔ s = ∅ := by rw [← not_iff_not, ← Ne, ← ENat.one_le_iff_ne_zero, one_le_chainHeight_iff, nonempty_iff_ne_empty] #align set.chain_height_eq_zero_iff Set.chainHeight_eq_zero_iff @[simp] theorem chainHeight_empty : (∅ : Set α).chainHeight = 0 := chainHeight_eq_zero_iff.2 rfl #align set.chain_height_empty Set.chainHeight_empty @[simp] theorem chainHeight_of_isEmpty [IsEmpty α] : s.chainHeight = 0 := chainHeight_eq_zero_iff.mpr (Subsingleton.elim _ _) #align set.chain_height_of_is_empty Set.chainHeight_of_isEmpty theorem le_chainHeight_add_nat_iff {n m : ℕ} : ↑n ≤ s.chainHeight + m ↔ ∃ l ∈ s.subchain, n ≤ length l + m := by simp_rw [← tsub_le_iff_right, ← ENat.coe_sub, (le_chainHeight_TFAE s (n - m)).out 0 2] #align set.le_chain_height_add_nat_iff Set.le_chainHeight_add_nat_iff
Mathlib/Order/Height.lean
162
184
theorem chainHeight_add_le_chainHeight_add (s : Set α) (t : Set β) (n m : ℕ) : s.chainHeight + n ≤ t.chainHeight + m ↔ ∀ l ∈ s.subchain, ∃ l' ∈ t.subchain, length l + n ≤ length l' + m := by
refine ⟨fun e l h ↦ le_chainHeight_add_nat_iff.1 ((add_le_add_right (length_le_chainHeight_of_mem_subchain h) _).trans e), fun H ↦ ?_⟩ by_cases h : s.chainHeight = ⊤ · suffices t.chainHeight = ⊤ by rw [this, top_add] exact le_top rw [chainHeight_eq_top_iff] at h ⊢ intro k have := (le_chainHeight_TFAE t k).out 1 2 rw [this] obtain ⟨l, hs, hl⟩ := h (k + m) obtain ⟨l', ht, hl'⟩ := H l hs exact ⟨l', ht, (add_le_add_iff_right m).1 <| _root_.trans (hl.symm.trans_le le_self_add) hl'⟩ · obtain ⟨k, hk⟩ := WithTop.ne_top_iff_exists.1 h obtain ⟨l, hs, hl⟩ := le_chainHeight_iff.1 hk.le rw [← hk, ← hl] exact le_chainHeight_add_nat_iff.2 (H l hs)
import Mathlib.Topology.UniformSpace.UniformConvergenceTopology #align_import topology.uniform_space.equicontinuity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" section open UniformSpace Filter Set Uniformity Topology UniformConvergence Function variable {ι κ X X' Y Z α α' β β' γ 𝓕 : Type*} [tX : TopologicalSpace X] [tY : TopologicalSpace Y] [tZ : TopologicalSpace Z] [uα : UniformSpace α] [uβ : UniformSpace β] [uγ : UniformSpace γ] def EquicontinuousAt (F : ι → X → α) (x₀ : X) : Prop := ∀ U ∈ 𝓤 α, ∀ᶠ x in 𝓝 x₀, ∀ i, (F i x₀, F i x) ∈ U #align equicontinuous_at EquicontinuousAt protected abbrev Set.EquicontinuousAt (H : Set <| X → α) (x₀ : X) : Prop := EquicontinuousAt ((↑) : H → X → α) x₀ #align set.equicontinuous_at Set.EquicontinuousAt def EquicontinuousWithinAt (F : ι → X → α) (S : Set X) (x₀ : X) : Prop := ∀ U ∈ 𝓤 α, ∀ᶠ x in 𝓝[S] x₀, ∀ i, (F i x₀, F i x) ∈ U protected abbrev Set.EquicontinuousWithinAt (H : Set <| X → α) (S : Set X) (x₀ : X) : Prop := EquicontinuousWithinAt ((↑) : H → X → α) S x₀ def Equicontinuous (F : ι → X → α) : Prop := ∀ x₀, EquicontinuousAt F x₀ #align equicontinuous Equicontinuous protected abbrev Set.Equicontinuous (H : Set <| X → α) : Prop := Equicontinuous ((↑) : H → X → α) #align set.equicontinuous Set.Equicontinuous def EquicontinuousOn (F : ι → X → α) (S : Set X) : Prop := ∀ x₀ ∈ S, EquicontinuousWithinAt F S x₀ protected abbrev Set.EquicontinuousOn (H : Set <| X → α) (S : Set X) : Prop := EquicontinuousOn ((↑) : H → X → α) S def UniformEquicontinuous (F : ι → β → α) : Prop := ∀ U ∈ 𝓤 α, ∀ᶠ xy : β × β in 𝓤 β, ∀ i, (F i xy.1, F i xy.2) ∈ U #align uniform_equicontinuous UniformEquicontinuous protected abbrev Set.UniformEquicontinuous (H : Set <| β → α) : Prop := UniformEquicontinuous ((↑) : H → β → α) #align set.uniform_equicontinuous Set.UniformEquicontinuous def UniformEquicontinuousOn (F : ι → β → α) (S : Set β) : Prop := ∀ U ∈ 𝓤 α, ∀ᶠ xy : β × β in 𝓤 β ⊓ 𝓟 (S ×ˢ S), ∀ i, (F i xy.1, F i xy.2) ∈ U protected abbrev Set.UniformEquicontinuousOn (H : Set <| β → α) (S : Set β) : Prop := UniformEquicontinuousOn ((↑) : H → β → α) S lemma EquicontinuousAt.equicontinuousWithinAt {F : ι → X → α} {x₀ : X} (H : EquicontinuousAt F x₀) (S : Set X) : EquicontinuousWithinAt F S x₀ := fun U hU ↦ (H U hU).filter_mono inf_le_left lemma EquicontinuousWithinAt.mono {F : ι → X → α} {x₀ : X} {S T : Set X} (H : EquicontinuousWithinAt F T x₀) (hST : S ⊆ T) : EquicontinuousWithinAt F S x₀ := fun U hU ↦ (H U hU).filter_mono <| nhdsWithin_mono x₀ hST @[simp] lemma equicontinuousWithinAt_univ (F : ι → X → α) (x₀ : X) : EquicontinuousWithinAt F univ x₀ ↔ EquicontinuousAt F x₀ := by rw [EquicontinuousWithinAt, EquicontinuousAt, nhdsWithin_univ] lemma equicontinuousAt_restrict_iff (F : ι → X → α) {S : Set X} (x₀ : S) : EquicontinuousAt (S.restrict ∘ F) x₀ ↔ EquicontinuousWithinAt F S x₀ := by simp [EquicontinuousWithinAt, EquicontinuousAt, ← eventually_nhds_subtype_iff] lemma Equicontinuous.equicontinuousOn {F : ι → X → α} (H : Equicontinuous F) (S : Set X) : EquicontinuousOn F S := fun x _ ↦ (H x).equicontinuousWithinAt S lemma EquicontinuousOn.mono {F : ι → X → α} {S T : Set X} (H : EquicontinuousOn F T) (hST : S ⊆ T) : EquicontinuousOn F S := fun x hx ↦ (H x (hST hx)).mono hST lemma equicontinuousOn_univ (F : ι → X → α) : EquicontinuousOn F univ ↔ Equicontinuous F := by simp [EquicontinuousOn, Equicontinuous] lemma equicontinuous_restrict_iff (F : ι → X → α) {S : Set X} : Equicontinuous (S.restrict ∘ F) ↔ EquicontinuousOn F S := by simp [Equicontinuous, EquicontinuousOn, equicontinuousAt_restrict_iff] lemma UniformEquicontinuous.uniformEquicontinuousOn {F : ι → β → α} (H : UniformEquicontinuous F) (S : Set β) : UniformEquicontinuousOn F S := fun U hU ↦ (H U hU).filter_mono inf_le_left lemma UniformEquicontinuousOn.mono {F : ι → β → α} {S T : Set β} (H : UniformEquicontinuousOn F T) (hST : S ⊆ T) : UniformEquicontinuousOn F S := fun U hU ↦ (H U hU).filter_mono <| by gcongr lemma uniformEquicontinuousOn_univ (F : ι → β → α) : UniformEquicontinuousOn F univ ↔ UniformEquicontinuous F := by simp [UniformEquicontinuousOn, UniformEquicontinuous] lemma uniformEquicontinuous_restrict_iff (F : ι → β → α) {S : Set β} : UniformEquicontinuous (S.restrict ∘ F) ↔ UniformEquicontinuousOn F S := by rw [UniformEquicontinuous, UniformEquicontinuousOn] conv in _ ⊓ _ => rw [← Subtype.range_val (s := S), ← range_prod_map, ← map_comap] rfl @[simp] lemma equicontinuousAt_empty [h : IsEmpty ι] (F : ι → X → α) (x₀ : X) : EquicontinuousAt F x₀ := fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim) @[simp] lemma equicontinuousWithinAt_empty [h : IsEmpty ι] (F : ι → X → α) (S : Set X) (x₀ : X) : EquicontinuousWithinAt F S x₀ := fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim) @[simp] lemma equicontinuous_empty [IsEmpty ι] (F : ι → X → α) : Equicontinuous F := equicontinuousAt_empty F @[simp] lemma equicontinuousOn_empty [IsEmpty ι] (F : ι → X → α) (S : Set X) : EquicontinuousOn F S := fun x₀ _ ↦ equicontinuousWithinAt_empty F S x₀ @[simp] lemma uniformEquicontinuous_empty [h : IsEmpty ι] (F : ι → β → α) : UniformEquicontinuous F := fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim) @[simp] lemma uniformEquicontinuousOn_empty [h : IsEmpty ι] (F : ι → β → α) (S : Set β) : UniformEquicontinuousOn F S := fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim) theorem equicontinuousAt_finite [Finite ι] {F : ι → X → α} {x₀ : X} : EquicontinuousAt F x₀ ↔ ∀ i, ContinuousAt (F i) x₀ := by simp [EquicontinuousAt, ContinuousAt, (nhds_basis_uniformity' (𝓤 α).basis_sets).tendsto_right_iff, UniformSpace.ball, @forall_swap _ ι] theorem equicontinuousWithinAt_finite [Finite ι] {F : ι → X → α} {S : Set X} {x₀ : X} : EquicontinuousWithinAt F S x₀ ↔ ∀ i, ContinuousWithinAt (F i) S x₀ := by simp [EquicontinuousWithinAt, ContinuousWithinAt, (nhds_basis_uniformity' (𝓤 α).basis_sets).tendsto_right_iff, UniformSpace.ball, @forall_swap _ ι] theorem equicontinuous_finite [Finite ι] {F : ι → X → α} : Equicontinuous F ↔ ∀ i, Continuous (F i) := by simp only [Equicontinuous, equicontinuousAt_finite, continuous_iff_continuousAt, @forall_swap ι] theorem equicontinuousOn_finite [Finite ι] {F : ι → X → α} {S : Set X} : EquicontinuousOn F S ↔ ∀ i, ContinuousOn (F i) S := by simp only [EquicontinuousOn, equicontinuousWithinAt_finite, ContinuousOn, @forall_swap ι] theorem uniformEquicontinuous_finite [Finite ι] {F : ι → β → α} : UniformEquicontinuous F ↔ ∀ i, UniformContinuous (F i) := by simp only [UniformEquicontinuous, eventually_all, @forall_swap _ ι]; rfl theorem uniformEquicontinuousOn_finite [Finite ι] {F : ι → β → α} {S : Set β} : UniformEquicontinuousOn F S ↔ ∀ i, UniformContinuousOn (F i) S := by simp only [UniformEquicontinuousOn, eventually_all, @forall_swap _ ι]; rfl theorem equicontinuousAt_unique [Unique ι] {F : ι → X → α} {x : X} : EquicontinuousAt F x ↔ ContinuousAt (F default) x := equicontinuousAt_finite.trans Unique.forall_iff theorem equicontinuousWithinAt_unique [Unique ι] {F : ι → X → α} {S : Set X} {x : X} : EquicontinuousWithinAt F S x ↔ ContinuousWithinAt (F default) S x := equicontinuousWithinAt_finite.trans Unique.forall_iff theorem equicontinuous_unique [Unique ι] {F : ι → X → α} : Equicontinuous F ↔ Continuous (F default) := equicontinuous_finite.trans Unique.forall_iff theorem equicontinuousOn_unique [Unique ι] {F : ι → X → α} {S : Set X} : EquicontinuousOn F S ↔ ContinuousOn (F default) S := equicontinuousOn_finite.trans Unique.forall_iff theorem uniformEquicontinuous_unique [Unique ι] {F : ι → β → α} : UniformEquicontinuous F ↔ UniformContinuous (F default) := uniformEquicontinuous_finite.trans Unique.forall_iff theorem uniformEquicontinuousOn_unique [Unique ι] {F : ι → β → α} {S : Set β} : UniformEquicontinuousOn F S ↔ UniformContinuousOn (F default) S := uniformEquicontinuousOn_finite.trans Unique.forall_iff theorem equicontinuousWithinAt_iff_pair {F : ι → X → α} {S : Set X} {x₀ : X} (hx₀ : x₀ ∈ S) : EquicontinuousWithinAt F S x₀ ↔ ∀ U ∈ 𝓤 α, ∃ V ∈ 𝓝[S] x₀, ∀ x ∈ V, ∀ y ∈ V, ∀ i, (F i x, F i y) ∈ U := by constructor <;> intro H U hU · rcases comp_symm_mem_uniformity_sets hU with ⟨V, hV, hVsymm, hVU⟩ refine ⟨_, H V hV, fun x hx y hy i => hVU (prod_mk_mem_compRel ?_ (hy i))⟩ exact hVsymm.mk_mem_comm.mp (hx i) · rcases H U hU with ⟨V, hV, hVU⟩ filter_upwards [hV] using fun x hx i => hVU x₀ (mem_of_mem_nhdsWithin hx₀ hV) x hx i theorem equicontinuousAt_iff_pair {F : ι → X → α} {x₀ : X} : EquicontinuousAt F x₀ ↔ ∀ U ∈ 𝓤 α, ∃ V ∈ 𝓝 x₀, ∀ x ∈ V, ∀ y ∈ V, ∀ i, (F i x, F i y) ∈ U := by simp_rw [← equicontinuousWithinAt_univ, equicontinuousWithinAt_iff_pair (mem_univ x₀), nhdsWithin_univ] #align equicontinuous_at_iff_pair equicontinuousAt_iff_pair theorem UniformEquicontinuous.equicontinuous {F : ι → β → α} (h : UniformEquicontinuous F) : Equicontinuous F := fun x₀ U hU ↦ mem_of_superset (ball_mem_nhds x₀ (h U hU)) fun _ hx i ↦ hx i #align uniform_equicontinuous.equicontinuous UniformEquicontinuous.equicontinuous theorem UniformEquicontinuousOn.equicontinuousOn {F : ι → β → α} {S : Set β} (h : UniformEquicontinuousOn F S) : EquicontinuousOn F S := fun _ hx₀ U hU ↦ mem_of_superset (ball_mem_nhdsWithin hx₀ (h U hU)) fun _ hx i ↦ hx i theorem EquicontinuousAt.continuousAt {F : ι → X → α} {x₀ : X} (h : EquicontinuousAt F x₀) (i : ι) : ContinuousAt (F i) x₀ := (UniformSpace.hasBasis_nhds _).tendsto_right_iff.2 fun U ⟨hU, _⟩ ↦ (h U hU).mono fun _x hx ↦ hx i #align equicontinuous_at.continuous_at EquicontinuousAt.continuousAt theorem EquicontinuousWithinAt.continuousWithinAt {F : ι → X → α} {S : Set X} {x₀ : X} (h : EquicontinuousWithinAt F S x₀) (i : ι) : ContinuousWithinAt (F i) S x₀ := (UniformSpace.hasBasis_nhds _).tendsto_right_iff.2 fun U ⟨hU, _⟩ ↦ (h U hU).mono fun _x hx ↦ hx i protected theorem Set.EquicontinuousAt.continuousAt_of_mem {H : Set <| X → α} {x₀ : X} (h : H.EquicontinuousAt x₀) {f : X → α} (hf : f ∈ H) : ContinuousAt f x₀ := h.continuousAt ⟨f, hf⟩ #align set.equicontinuous_at.continuous_at_of_mem Set.EquicontinuousAt.continuousAt_of_mem protected theorem Set.EquicontinuousWithinAt.continuousWithinAt_of_mem {H : Set <| X → α} {S : Set X} {x₀ : X} (h : H.EquicontinuousWithinAt S x₀) {f : X → α} (hf : f ∈ H) : ContinuousWithinAt f S x₀ := h.continuousWithinAt ⟨f, hf⟩ theorem Equicontinuous.continuous {F : ι → X → α} (h : Equicontinuous F) (i : ι) : Continuous (F i) := continuous_iff_continuousAt.mpr fun x => (h x).continuousAt i #align equicontinuous.continuous Equicontinuous.continuous theorem EquicontinuousOn.continuousOn {F : ι → X → α} {S : Set X} (h : EquicontinuousOn F S) (i : ι) : ContinuousOn (F i) S := fun x hx ↦ (h x hx).continuousWithinAt i protected theorem Set.Equicontinuous.continuous_of_mem {H : Set <| X → α} (h : H.Equicontinuous) {f : X → α} (hf : f ∈ H) : Continuous f := h.continuous ⟨f, hf⟩ #align set.equicontinuous.continuous_of_mem Set.Equicontinuous.continuous_of_mem protected theorem Set.EquicontinuousOn.continuousOn_of_mem {H : Set <| X → α} {S : Set X} (h : H.EquicontinuousOn S) {f : X → α} (hf : f ∈ H) : ContinuousOn f S := h.continuousOn ⟨f, hf⟩ theorem UniformEquicontinuous.uniformContinuous {F : ι → β → α} (h : UniformEquicontinuous F) (i : ι) : UniformContinuous (F i) := fun U hU => mem_map.mpr (mem_of_superset (h U hU) fun _ hxy => hxy i) #align uniform_equicontinuous.uniform_continuous UniformEquicontinuous.uniformContinuous theorem UniformEquicontinuousOn.uniformContinuousOn {F : ι → β → α} {S : Set β} (h : UniformEquicontinuousOn F S) (i : ι) : UniformContinuousOn (F i) S := fun U hU => mem_map.mpr (mem_of_superset (h U hU) fun _ hxy => hxy i) protected theorem Set.UniformEquicontinuous.uniformContinuous_of_mem {H : Set <| β → α} (h : H.UniformEquicontinuous) {f : β → α} (hf : f ∈ H) : UniformContinuous f := h.uniformContinuous ⟨f, hf⟩ #align set.uniform_equicontinuous.uniform_continuous_of_mem Set.UniformEquicontinuous.uniformContinuous_of_mem protected theorem Set.UniformEquicontinuousOn.uniformContinuousOn_of_mem {H : Set <| β → α} {S : Set β} (h : H.UniformEquicontinuousOn S) {f : β → α} (hf : f ∈ H) : UniformContinuousOn f S := h.uniformContinuousOn ⟨f, hf⟩ theorem EquicontinuousAt.comp {F : ι → X → α} {x₀ : X} (h : EquicontinuousAt F x₀) (u : κ → ι) : EquicontinuousAt (F ∘ u) x₀ := fun U hU => (h U hU).mono fun _ H k => H (u k) #align equicontinuous_at.comp EquicontinuousAt.comp theorem EquicontinuousWithinAt.comp {F : ι → X → α} {S : Set X} {x₀ : X} (h : EquicontinuousWithinAt F S x₀) (u : κ → ι) : EquicontinuousWithinAt (F ∘ u) S x₀ := fun U hU ↦ (h U hU).mono fun _ H k => H (u k) protected theorem Set.EquicontinuousAt.mono {H H' : Set <| X → α} {x₀ : X} (h : H.EquicontinuousAt x₀) (hH : H' ⊆ H) : H'.EquicontinuousAt x₀ := h.comp (inclusion hH) #align set.equicontinuous_at.mono Set.EquicontinuousAt.mono protected theorem Set.EquicontinuousWithinAt.mono {H H' : Set <| X → α} {S : Set X} {x₀ : X} (h : H.EquicontinuousWithinAt S x₀) (hH : H' ⊆ H) : H'.EquicontinuousWithinAt S x₀ := h.comp (inclusion hH) theorem Equicontinuous.comp {F : ι → X → α} (h : Equicontinuous F) (u : κ → ι) : Equicontinuous (F ∘ u) := fun x => (h x).comp u #align equicontinuous.comp Equicontinuous.comp theorem EquicontinuousOn.comp {F : ι → X → α} {S : Set X} (h : EquicontinuousOn F S) (u : κ → ι) : EquicontinuousOn (F ∘ u) S := fun x hx ↦ (h x hx).comp u protected theorem Set.Equicontinuous.mono {H H' : Set <| X → α} (h : H.Equicontinuous) (hH : H' ⊆ H) : H'.Equicontinuous := h.comp (inclusion hH) #align set.equicontinuous.mono Set.Equicontinuous.mono protected theorem Set.EquicontinuousOn.mono {H H' : Set <| X → α} {S : Set X} (h : H.EquicontinuousOn S) (hH : H' ⊆ H) : H'.EquicontinuousOn S := h.comp (inclusion hH) theorem UniformEquicontinuous.comp {F : ι → β → α} (h : UniformEquicontinuous F) (u : κ → ι) : UniformEquicontinuous (F ∘ u) := fun U hU => (h U hU).mono fun _ H k => H (u k) #align uniform_equicontinuous.comp UniformEquicontinuous.comp theorem UniformEquicontinuousOn.comp {F : ι → β → α} {S : Set β} (h : UniformEquicontinuousOn F S) (u : κ → ι) : UniformEquicontinuousOn (F ∘ u) S := fun U hU ↦ (h U hU).mono fun _ H k => H (u k) protected theorem Set.UniformEquicontinuous.mono {H H' : Set <| β → α} (h : H.UniformEquicontinuous) (hH : H' ⊆ H) : H'.UniformEquicontinuous := h.comp (inclusion hH) #align set.uniform_equicontinuous.mono Set.UniformEquicontinuous.mono protected theorem Set.UniformEquicontinuousOn.mono {H H' : Set <| β → α} {S : Set β} (h : H.UniformEquicontinuousOn S) (hH : H' ⊆ H) : H'.UniformEquicontinuousOn S := h.comp (inclusion hH) theorem equicontinuousAt_iff_range {F : ι → X → α} {x₀ : X} : EquicontinuousAt F x₀ ↔ EquicontinuousAt ((↑) : range F → X → α) x₀ := by simp only [EquicontinuousAt, forall_subtype_range_iff] #align equicontinuous_at_iff_range equicontinuousAt_iff_range theorem equicontinuousWithinAt_iff_range {F : ι → X → α} {S : Set X} {x₀ : X} : EquicontinuousWithinAt F S x₀ ↔ EquicontinuousWithinAt ((↑) : range F → X → α) S x₀ := by simp only [EquicontinuousWithinAt, forall_subtype_range_iff] theorem equicontinuous_iff_range {F : ι → X → α} : Equicontinuous F ↔ Equicontinuous ((↑) : range F → X → α) := forall_congr' fun _ => equicontinuousAt_iff_range #align equicontinuous_iff_range equicontinuous_iff_range theorem equicontinuousOn_iff_range {F : ι → X → α} {S : Set X} : EquicontinuousOn F S ↔ EquicontinuousOn ((↑) : range F → X → α) S := forall_congr' fun _ ↦ forall_congr' fun _ ↦ equicontinuousWithinAt_iff_range theorem uniformEquicontinuous_iff_range {F : ι → β → α} : UniformEquicontinuous F ↔ UniformEquicontinuous ((↑) : range F → β → α) := ⟨fun h => by rw [← comp_rangeSplitting F]; exact h.comp _, fun h => h.comp (rangeFactorization F)⟩ #align uniform_equicontinuous_at_iff_range uniformEquicontinuous_iff_range theorem uniformEquicontinuousOn_iff_range {F : ι → β → α} {S : Set β} : UniformEquicontinuousOn F S ↔ UniformEquicontinuousOn ((↑) : range F → β → α) S := ⟨fun h => by rw [← comp_rangeSplitting F]; exact h.comp _, fun h => h.comp (rangeFactorization F)⟩ section open UniformFun theorem equicontinuousAt_iff_continuousAt {F : ι → X → α} {x₀ : X} : EquicontinuousAt F x₀ ↔ ContinuousAt (ofFun ∘ Function.swap F : X → ι →ᵤ α) x₀ := by rw [ContinuousAt, (UniformFun.hasBasis_nhds ι α _).tendsto_right_iff] rfl #align equicontinuous_at_iff_continuous_at equicontinuousAt_iff_continuousAt theorem equicontinuousWithinAt_iff_continuousWithinAt {F : ι → X → α} {S : Set X} {x₀ : X} : EquicontinuousWithinAt F S x₀ ↔ ContinuousWithinAt (ofFun ∘ Function.swap F : X → ι →ᵤ α) S x₀ := by rw [ContinuousWithinAt, (UniformFun.hasBasis_nhds ι α _).tendsto_right_iff] rfl theorem equicontinuous_iff_continuous {F : ι → X → α} : Equicontinuous F ↔ Continuous (ofFun ∘ Function.swap F : X → ι →ᵤ α) := by simp_rw [Equicontinuous, continuous_iff_continuousAt, equicontinuousAt_iff_continuousAt] #align equicontinuous_iff_continuous equicontinuous_iff_continuous theorem equicontinuousOn_iff_continuousOn {F : ι → X → α} {S : Set X} : EquicontinuousOn F S ↔ ContinuousOn (ofFun ∘ Function.swap F : X → ι →ᵤ α) S := by simp_rw [EquicontinuousOn, ContinuousOn, equicontinuousWithinAt_iff_continuousWithinAt]
Mathlib/Topology/UniformSpace/Equicontinuity.lean
546
549
theorem uniformEquicontinuous_iff_uniformContinuous {F : ι → β → α} : UniformEquicontinuous F ↔ UniformContinuous (ofFun ∘ Function.swap F : β → ι →ᵤ α) := by
rw [UniformContinuous, (UniformFun.hasBasis_uniformity ι α).tendsto_right_iff] rfl
import Mathlib.RingTheory.Localization.FractionRing import Mathlib.RingTheory.Localization.Ideal import Mathlib.RingTheory.Noetherian #align_import ring_theory.localization.submodule from "leanprover-community/mathlib"@"1ebb20602a8caef435ce47f6373e1aa40851a177" variable {R : Type*} [CommRing R] (M : Submonoid R) (S : Type*) [CommRing S] variable [Algebra R S] {P : Type*} [CommRing P] namespace IsLocalization -- This was previously a `hasCoe` instance, but if `S = R` then this will loop. -- It could be a `hasCoeT` instance, but we keep it explicit here to avoid slowing down -- the rest of the library. def coeSubmodule (I : Ideal R) : Submodule R S := Submodule.map (Algebra.linearMap R S) I #align is_localization.coe_submodule IsLocalization.coeSubmodule theorem mem_coeSubmodule (I : Ideal R) {x : S} : x ∈ coeSubmodule S I ↔ ∃ y : R, y ∈ I ∧ algebraMap R S y = x := Iff.rfl #align is_localization.mem_coe_submodule IsLocalization.mem_coeSubmodule theorem coeSubmodule_mono {I J : Ideal R} (h : I ≤ J) : coeSubmodule S I ≤ coeSubmodule S J := Submodule.map_mono h #align is_localization.coe_submodule_mono IsLocalization.coeSubmodule_mono @[simp] theorem coeSubmodule_bot : coeSubmodule S (⊥ : Ideal R) = ⊥ := by rw [coeSubmodule, Submodule.map_bot] #align is_localization.coe_submodule_bot IsLocalization.coeSubmodule_bot @[simp] theorem coeSubmodule_top : coeSubmodule S (⊤ : Ideal R) = 1 := by rw [coeSubmodule, Submodule.map_top, Submodule.one_eq_range] #align is_localization.coe_submodule_top IsLocalization.coeSubmodule_top @[simp] theorem coeSubmodule_sup (I J : Ideal R) : coeSubmodule S (I ⊔ J) = coeSubmodule S I ⊔ coeSubmodule S J := Submodule.map_sup _ _ _ #align is_localization.coe_submodule_sup IsLocalization.coeSubmodule_sup @[simp] theorem coeSubmodule_mul (I J : Ideal R) : coeSubmodule S (I * J) = coeSubmodule S I * coeSubmodule S J := Submodule.map_mul _ _ (Algebra.ofId R S) #align is_localization.coe_submodule_mul IsLocalization.coeSubmodule_mul theorem coeSubmodule_fg (hS : Function.Injective (algebraMap R S)) (I : Ideal R) : Submodule.FG (coeSubmodule S I) ↔ Submodule.FG I := ⟨Submodule.fg_of_fg_map _ (LinearMap.ker_eq_bot.mpr hS), Submodule.FG.map _⟩ #align is_localization.coe_submodule_fg IsLocalization.coeSubmodule_fg @[simp] theorem coeSubmodule_span (s : Set R) : coeSubmodule S (Ideal.span s) = Submodule.span R (algebraMap R S '' s) := by rw [IsLocalization.coeSubmodule, Ideal.span, Submodule.map_span] rfl #align is_localization.coe_submodule_span IsLocalization.coeSubmodule_span -- @[simp] -- Porting note (#10618): simp can prove this theorem coeSubmodule_span_singleton (x : R) : coeSubmodule S (Ideal.span {x}) = Submodule.span R {(algebraMap R S) x} := by rw [coeSubmodule_span, Set.image_singleton] #align is_localization.coe_submodule_span_singleton IsLocalization.coeSubmodule_span_singleton variable {g : R →+* P} variable {T : Submonoid P} (hy : M ≤ T.comap g) {Q : Type*} [CommRing Q] variable [Algebra P Q] [IsLocalization T Q] variable [IsLocalization M S] section theorem isNoetherianRing (h : IsNoetherianRing R) : IsNoetherianRing S := by rw [isNoetherianRing_iff, isNoetherian_iff_wellFounded] at h ⊢ exact OrderEmbedding.wellFounded (IsLocalization.orderEmbedding M S).dual h #align is_localization.is_noetherian_ring IsLocalization.isNoetherianRing end variable {S M} @[mono] theorem coeSubmodule_le_coeSubmodule (h : M ≤ nonZeroDivisors R) {I J : Ideal R} : coeSubmodule S I ≤ coeSubmodule S J ↔ I ≤ J := -- Note: #8386 had to specify the value of `f` here: Submodule.map_le_map_iff_of_injective (f := Algebra.linearMap R S) (IsLocalization.injective _ h) _ _ #align is_localization.coe_submodule_le_coe_submodule IsLocalization.coeSubmodule_le_coeSubmodule @[mono] theorem coeSubmodule_strictMono (h : M ≤ nonZeroDivisors R) : StrictMono (coeSubmodule S : Ideal R → Submodule R S) := strictMono_of_le_iff_le fun _ _ => (coeSubmodule_le_coeSubmodule h).symm #align is_localization.coe_submodule_strict_mono IsLocalization.coeSubmodule_strictMono variable (S) theorem coeSubmodule_injective (h : M ≤ nonZeroDivisors R) : Function.Injective (coeSubmodule S : Ideal R → Submodule R S) := injective_of_le_imp_le _ fun hl => (coeSubmodule_le_coeSubmodule h).mp hl #align is_localization.coe_submodule_injective IsLocalization.coeSubmodule_injective
Mathlib/RingTheory/Localization/Submodule.lean
125
133
theorem coeSubmodule_isPrincipal {I : Ideal R} (h : M ≤ nonZeroDivisors R) : (coeSubmodule S I).IsPrincipal ↔ I.IsPrincipal := by
constructor <;> rintro ⟨⟨x, hx⟩⟩ · have x_mem : x ∈ coeSubmodule S I := hx.symm ▸ Submodule.mem_span_singleton_self x obtain ⟨x, _, rfl⟩ := (mem_coeSubmodule _ _).mp x_mem refine ⟨⟨x, coeSubmodule_injective S h ?_⟩⟩ rw [Ideal.submodule_span_eq, hx, coeSubmodule_span_singleton] · refine ⟨⟨algebraMap R S x, ?_⟩⟩ rw [hx, Ideal.submodule_span_eq, coeSubmodule_span_singleton]
import Mathlib.Order.Filter.Basic #align_import order.filter.prod from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce" open Set open Filter namespace Filter variable {α β γ δ : Type*} {ι : Sort*} section Prod variable {s : Set α} {t : Set β} {f : Filter α} {g : Filter β} protected def prod (f : Filter α) (g : Filter β) : Filter (α × β) := f.comap Prod.fst ⊓ g.comap Prod.snd #align filter.prod Filter.prod instance instSProd : SProd (Filter α) (Filter β) (Filter (α × β)) where sprod := Filter.prod theorem prod_mem_prod (hs : s ∈ f) (ht : t ∈ g) : s ×ˢ t ∈ f ×ˢ g := inter_mem_inf (preimage_mem_comap hs) (preimage_mem_comap ht) #align filter.prod_mem_prod Filter.prod_mem_prod theorem mem_prod_iff {s : Set (α × β)} {f : Filter α} {g : Filter β} : s ∈ f ×ˢ g ↔ ∃ t₁ ∈ f, ∃ t₂ ∈ g, t₁ ×ˢ t₂ ⊆ s := by simp only [SProd.sprod, Filter.prod] constructor · rintro ⟨t₁, ⟨s₁, hs₁, hts₁⟩, t₂, ⟨s₂, hs₂, hts₂⟩, rfl⟩ exact ⟨s₁, hs₁, s₂, hs₂, fun p ⟨h, h'⟩ => ⟨hts₁ h, hts₂ h'⟩⟩ · rintro ⟨t₁, ht₁, t₂, ht₂, h⟩ exact mem_inf_of_inter (preimage_mem_comap ht₁) (preimage_mem_comap ht₂) h #align filter.mem_prod_iff Filter.mem_prod_iff @[simp] theorem prod_mem_prod_iff [f.NeBot] [g.NeBot] : s ×ˢ t ∈ f ×ˢ g ↔ s ∈ f ∧ t ∈ g := ⟨fun h => let ⟨_s', hs', _t', ht', H⟩ := mem_prod_iff.1 h (prod_subset_prod_iff.1 H).elim (fun ⟨hs's, ht't⟩ => ⟨mem_of_superset hs' hs's, mem_of_superset ht' ht't⟩) fun h => h.elim (fun hs'e => absurd hs'e (nonempty_of_mem hs').ne_empty) fun ht'e => absurd ht'e (nonempty_of_mem ht').ne_empty, fun h => prod_mem_prod h.1 h.2⟩ #align filter.prod_mem_prod_iff Filter.prod_mem_prod_iff theorem mem_prod_principal {s : Set (α × β)} : s ∈ f ×ˢ 𝓟 t ↔ { a | ∀ b ∈ t, (a, b) ∈ s } ∈ f := by rw [← @exists_mem_subset_iff _ f, mem_prod_iff] refine exists_congr fun u => Iff.rfl.and ⟨?_, fun h => ⟨t, mem_principal_self t, ?_⟩⟩ · rintro ⟨v, v_in, hv⟩ a a_in b b_in exact hv (mk_mem_prod a_in <| v_in b_in) · rintro ⟨x, y⟩ ⟨hx, hy⟩ exact h hx y hy #align filter.mem_prod_principal Filter.mem_prod_principal theorem mem_prod_top {s : Set (α × β)} : s ∈ f ×ˢ (⊤ : Filter β) ↔ { a | ∀ b, (a, b) ∈ s } ∈ f := by rw [← principal_univ, mem_prod_principal] simp only [mem_univ, forall_true_left] #align filter.mem_prod_top Filter.mem_prod_top theorem eventually_prod_principal_iff {p : α × β → Prop} {s : Set β} : (∀ᶠ x : α × β in f ×ˢ 𝓟 s, p x) ↔ ∀ᶠ x : α in f, ∀ y : β, y ∈ s → p (x, y) := by rw [eventually_iff, eventually_iff, mem_prod_principal] simp only [mem_setOf_eq] #align filter.eventually_prod_principal_iff Filter.eventually_prod_principal_iff theorem comap_prod (f : α → β × γ) (b : Filter β) (c : Filter γ) : comap f (b ×ˢ c) = comap (Prod.fst ∘ f) b ⊓ comap (Prod.snd ∘ f) c := by erw [comap_inf, Filter.comap_comap, Filter.comap_comap] #align filter.comap_prod Filter.comap_prod theorem prod_top : f ×ˢ (⊤ : Filter β) = f.comap Prod.fst := by dsimp only [SProd.sprod] rw [Filter.prod, comap_top, inf_top_eq] #align filter.prod_top Filter.prod_top theorem top_prod : (⊤ : Filter α) ×ˢ g = g.comap Prod.snd := by dsimp only [SProd.sprod] rw [Filter.prod, comap_top, top_inf_eq] theorem sup_prod (f₁ f₂ : Filter α) (g : Filter β) : (f₁ ⊔ f₂) ×ˢ g = (f₁ ×ˢ g) ⊔ (f₂ ×ˢ g) := by dsimp only [SProd.sprod] rw [Filter.prod, comap_sup, inf_sup_right, ← Filter.prod, ← Filter.prod] #align filter.sup_prod Filter.sup_prod theorem prod_sup (f : Filter α) (g₁ g₂ : Filter β) : f ×ˢ (g₁ ⊔ g₂) = (f ×ˢ g₁) ⊔ (f ×ˢ g₂) := by dsimp only [SProd.sprod] rw [Filter.prod, comap_sup, inf_sup_left, ← Filter.prod, ← Filter.prod] #align filter.prod_sup Filter.prod_sup theorem eventually_prod_iff {p : α × β → Prop} : (∀ᶠ x in f ×ˢ g, p x) ↔ ∃ pa : α → Prop, (∀ᶠ x in f, pa x) ∧ ∃ pb : β → Prop, (∀ᶠ y in g, pb y) ∧ ∀ {x}, pa x → ∀ {y}, pb y → p (x, y) := by simpa only [Set.prod_subset_iff] using @mem_prod_iff α β p f g #align filter.eventually_prod_iff Filter.eventually_prod_iff theorem tendsto_fst : Tendsto Prod.fst (f ×ˢ g) f := tendsto_inf_left tendsto_comap #align filter.tendsto_fst Filter.tendsto_fst theorem tendsto_snd : Tendsto Prod.snd (f ×ˢ g) g := tendsto_inf_right tendsto_comap #align filter.tendsto_snd Filter.tendsto_snd theorem Tendsto.fst {h : Filter γ} {m : α → β × γ} (H : Tendsto m f (g ×ˢ h)) : Tendsto (fun a ↦ (m a).1) f g := tendsto_fst.comp H theorem Tendsto.snd {h : Filter γ} {m : α → β × γ} (H : Tendsto m f (g ×ˢ h)) : Tendsto (fun a ↦ (m a).2) f h := tendsto_snd.comp H theorem Tendsto.prod_mk {h : Filter γ} {m₁ : α → β} {m₂ : α → γ} (h₁ : Tendsto m₁ f g) (h₂ : Tendsto m₂ f h) : Tendsto (fun x => (m₁ x, m₂ x)) f (g ×ˢ h) := tendsto_inf.2 ⟨tendsto_comap_iff.2 h₁, tendsto_comap_iff.2 h₂⟩ #align filter.tendsto.prod_mk Filter.Tendsto.prod_mk theorem tendsto_prod_swap : Tendsto (Prod.swap : α × β → β × α) (f ×ˢ g) (g ×ˢ f) := tendsto_snd.prod_mk tendsto_fst #align filter.tendsto_prod_swap Filter.tendsto_prod_swap theorem Eventually.prod_inl {la : Filter α} {p : α → Prop} (h : ∀ᶠ x in la, p x) (lb : Filter β) : ∀ᶠ x in la ×ˢ lb, p (x : α × β).1 := tendsto_fst.eventually h #align filter.eventually.prod_inl Filter.Eventually.prod_inl theorem Eventually.prod_inr {lb : Filter β} {p : β → Prop} (h : ∀ᶠ x in lb, p x) (la : Filter α) : ∀ᶠ x in la ×ˢ lb, p (x : α × β).2 := tendsto_snd.eventually h #align filter.eventually.prod_inr Filter.Eventually.prod_inr theorem Eventually.prod_mk {la : Filter α} {pa : α → Prop} (ha : ∀ᶠ x in la, pa x) {lb : Filter β} {pb : β → Prop} (hb : ∀ᶠ y in lb, pb y) : ∀ᶠ p in la ×ˢ lb, pa (p : α × β).1 ∧ pb p.2 := (ha.prod_inl lb).and (hb.prod_inr la) #align filter.eventually.prod_mk Filter.Eventually.prod_mk theorem EventuallyEq.prod_map {δ} {la : Filter α} {fa ga : α → γ} (ha : fa =ᶠ[la] ga) {lb : Filter β} {fb gb : β → δ} (hb : fb =ᶠ[lb] gb) : Prod.map fa fb =ᶠ[la ×ˢ lb] Prod.map ga gb := (Eventually.prod_mk ha hb).mono fun _ h => Prod.ext h.1 h.2 #align filter.eventually_eq.prod_map Filter.EventuallyEq.prod_map theorem EventuallyLE.prod_map {δ} [LE γ] [LE δ] {la : Filter α} {fa ga : α → γ} (ha : fa ≤ᶠ[la] ga) {lb : Filter β} {fb gb : β → δ} (hb : fb ≤ᶠ[lb] gb) : Prod.map fa fb ≤ᶠ[la ×ˢ lb] Prod.map ga gb := Eventually.prod_mk ha hb #align filter.eventually_le.prod_map Filter.EventuallyLE.prod_map theorem Eventually.curry {la : Filter α} {lb : Filter β} {p : α × β → Prop} (h : ∀ᶠ x in la ×ˢ lb, p x) : ∀ᶠ x in la, ∀ᶠ y in lb, p (x, y) := by rcases eventually_prod_iff.1 h with ⟨pa, ha, pb, hb, h⟩ exact ha.mono fun a ha => hb.mono fun b hb => h ha hb #align filter.eventually.curry Filter.Eventually.curry protected lemma Frequently.uncurry {la : Filter α} {lb : Filter β} {p : α → β → Prop} (h : ∃ᶠ x in la, ∃ᶠ y in lb, p x y) : ∃ᶠ xy in la ×ˢ lb, p xy.1 xy.2 := mt (fun h ↦ by simpa only [not_frequently] using h.curry) h theorem Eventually.diag_of_prod {p : α × α → Prop} (h : ∀ᶠ i in f ×ˢ f, p i) : ∀ᶠ i in f, p (i, i) := by obtain ⟨t, ht, s, hs, hst⟩ := eventually_prod_iff.1 h apply (ht.and hs).mono fun x hx => hst hx.1 hx.2 #align filter.eventually.diag_of_prod Filter.Eventually.diag_of_prod theorem Eventually.diag_of_prod_left {f : Filter α} {g : Filter γ} {p : (α × α) × γ → Prop} : (∀ᶠ x in (f ×ˢ f) ×ˢ g, p x) → ∀ᶠ x : α × γ in f ×ˢ g, p ((x.1, x.1), x.2) := by intro h obtain ⟨t, ht, s, hs, hst⟩ := eventually_prod_iff.1 h exact (ht.diag_of_prod.prod_mk hs).mono fun x hx => by simp only [hst hx.1 hx.2] #align filter.eventually.diag_of_prod_left Filter.Eventually.diag_of_prod_left theorem Eventually.diag_of_prod_right {f : Filter α} {g : Filter γ} {p : α × γ × γ → Prop} : (∀ᶠ x in f ×ˢ (g ×ˢ g), p x) → ∀ᶠ x : α × γ in f ×ˢ g, p (x.1, x.2, x.2) := by intro h obtain ⟨t, ht, s, hs, hst⟩ := eventually_prod_iff.1 h exact (ht.prod_mk hs.diag_of_prod).mono fun x hx => by simp only [hst hx.1 hx.2] #align filter.eventually.diag_of_prod_right Filter.Eventually.diag_of_prod_right theorem tendsto_diag : Tendsto (fun i => (i, i)) f (f ×ˢ f) := tendsto_iff_eventually.mpr fun _ hpr => hpr.diag_of_prod #align filter.tendsto_diag Filter.tendsto_diag theorem prod_iInf_left [Nonempty ι] {f : ι → Filter α} {g : Filter β} : (⨅ i, f i) ×ˢ g = ⨅ i, f i ×ˢ g := by dsimp only [SProd.sprod] rw [Filter.prod, comap_iInf, iInf_inf] simp only [Filter.prod, eq_self_iff_true] #align filter.prod_infi_left Filter.prod_iInf_left theorem prod_iInf_right [Nonempty ι] {f : Filter α} {g : ι → Filter β} : (f ×ˢ ⨅ i, g i) = ⨅ i, f ×ˢ g i := by dsimp only [SProd.sprod] rw [Filter.prod, comap_iInf, inf_iInf] simp only [Filter.prod, eq_self_iff_true] #align filter.prod_infi_right Filter.prod_iInf_right @[mono, gcongr] theorem prod_mono {f₁ f₂ : Filter α} {g₁ g₂ : Filter β} (hf : f₁ ≤ f₂) (hg : g₁ ≤ g₂) : f₁ ×ˢ g₁ ≤ f₂ ×ˢ g₂ := inf_le_inf (comap_mono hf) (comap_mono hg) #align filter.prod_mono Filter.prod_mono @[gcongr] theorem prod_mono_left (g : Filter β) {f₁ f₂ : Filter α} (hf : f₁ ≤ f₂) : f₁ ×ˢ g ≤ f₂ ×ˢ g := Filter.prod_mono hf rfl.le #align filter.prod_mono_left Filter.prod_mono_left @[gcongr] theorem prod_mono_right (f : Filter α) {g₁ g₂ : Filter β} (hf : g₁ ≤ g₂) : f ×ˢ g₁ ≤ f ×ˢ g₂ := Filter.prod_mono rfl.le hf #align filter.prod_mono_right Filter.prod_mono_right theorem prod_comap_comap_eq.{u, v, w, x} {α₁ : Type u} {α₂ : Type v} {β₁ : Type w} {β₂ : Type x} {f₁ : Filter α₁} {f₂ : Filter α₂} {m₁ : β₁ → α₁} {m₂ : β₂ → α₂} : comap m₁ f₁ ×ˢ comap m₂ f₂ = comap (fun p : β₁ × β₂ => (m₁ p.1, m₂ p.2)) (f₁ ×ˢ f₂) := by simp only [SProd.sprod, Filter.prod, comap_comap, comap_inf, (· ∘ ·)] #align filter.prod_comap_comap_eq Filter.prod_comap_comap_eq theorem prod_comm' : f ×ˢ g = comap Prod.swap (g ×ˢ f) := by simp only [SProd.sprod, Filter.prod, comap_comap, (· ∘ ·), inf_comm, Prod.swap, comap_inf] #align filter.prod_comm' Filter.prod_comm' theorem prod_comm : f ×ˢ g = map (fun p : β × α => (p.2, p.1)) (g ×ˢ f) := by rw [prod_comm', ← map_swap_eq_comap_swap] rfl #align filter.prod_comm Filter.prod_comm theorem mem_prod_iff_left {s : Set (α × β)} : s ∈ f ×ˢ g ↔ ∃ t ∈ f, ∀ᶠ y in g, ∀ x ∈ t, (x, y) ∈ s := by simp only [mem_prod_iff, prod_subset_iff] refine exists_congr fun _ => Iff.rfl.and <| Iff.trans ?_ exists_mem_subset_iff exact exists_congr fun _ => Iff.rfl.and forall₂_swap theorem mem_prod_iff_right {s : Set (α × β)} : s ∈ f ×ˢ g ↔ ∃ t ∈ g, ∀ᶠ x in f, ∀ y ∈ t, (x, y) ∈ s := by rw [prod_comm, mem_map, mem_prod_iff_left]; rfl @[simp] theorem map_fst_prod (f : Filter α) (g : Filter β) [NeBot g] : map Prod.fst (f ×ˢ g) = f := by ext s simp only [mem_map, mem_prod_iff_left, mem_preimage, eventually_const, ← subset_def, exists_mem_subset_iff] #align filter.map_fst_prod Filter.map_fst_prod @[simp]
Mathlib/Order/Filter/Prod.lean
295
296
theorem map_snd_prod (f : Filter α) (g : Filter β) [NeBot f] : map Prod.snd (f ×ˢ g) = g := by
rw [prod_comm, map_map]; apply map_fst_prod
import Mathlib.RingTheory.Ideal.Cotangent import Mathlib.RingTheory.QuotientNilpotent import Mathlib.RingTheory.TensorProduct.Basic import Mathlib.RingTheory.FinitePresentation import Mathlib.RingTheory.Localization.Away.Basic import Mathlib.RingTheory.Localization.Away.AdjoinRoot #align_import ring_theory.etale from "leanprover-community/mathlib"@"73f96237417835f148a1f7bc1ff55f67119b7166" -- Porting note: added to make the syntax work below. open scoped TensorProduct universe u namespace Algebra section variable (R : Type u) [CommSemiring R] variable (A : Type u) [Semiring A] [Algebra R A] @[mk_iff] class FormallySmooth : Prop where comp_surjective : ∀ ⦃B : Type u⦄ [CommRing B], ∀ [Algebra R B] (I : Ideal B) (_ : I ^ 2 = ⊥), Function.Surjective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I) #align algebra.formally_smooth Algebra.FormallySmooth end namespace FormallySmooth section variable {R : Type u} [CommSemiring R] variable {A : Type u} [Semiring A] [Algebra R A] variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B) theorem exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B] [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) : ∃ f : A →ₐ[R] B, (Ideal.Quotient.mkₐ R I).comp f = g := by revert g change Function.Surjective (Ideal.Quotient.mkₐ R I).comp revert _RB apply Ideal.IsNilpotent.induction_on (R := B) I hI · intro B _ I hI _; exact FormallySmooth.comp_surjective I hI · intro B _ I J hIJ h₁ h₂ _ g let this : ((B ⧸ I) ⧸ J.map (Ideal.Quotient.mk I)) ≃ₐ[R] B ⧸ J := { (DoubleQuot.quotQuotEquivQuotSup I J).trans (Ideal.quotEquivOfEq (sup_eq_right.mpr hIJ)) with commutes' := fun x => rfl } obtain ⟨g', e⟩ := h₂ (this.symm.toAlgHom.comp g) obtain ⟨g', rfl⟩ := h₁ g' replace e := congr_arg this.toAlgHom.comp e conv_rhs at e => rw [← AlgHom.comp_assoc, AlgEquiv.toAlgHom_eq_coe, AlgEquiv.toAlgHom_eq_coe, AlgEquiv.comp_symm, AlgHom.id_comp] exact ⟨g', e⟩ #align algebra.formally_smooth.exists_lift Algebra.FormallySmooth.exists_lift noncomputable def lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) : A →ₐ[R] B := (FormallySmooth.exists_lift I hI g).choose #align algebra.formally_smooth.lift Algebra.FormallySmooth.lift @[simp] theorem comp_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) : (Ideal.Quotient.mkₐ R I).comp (FormallySmooth.lift I hI g) = g := (FormallySmooth.exists_lift I hI g).choose_spec #align algebra.formally_smooth.comp_lift Algebra.FormallySmooth.comp_lift @[simp] theorem mk_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) (x : A) : Ideal.Quotient.mk I (FormallySmooth.lift I hI g x) = g x := AlgHom.congr_fun (FormallySmooth.comp_lift I hI g : _) x #align algebra.formally_smooth.mk_lift Algebra.FormallySmooth.mk_lift variable {C : Type u} [CommRing C] [Algebra R C] noncomputable def liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C) (hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) : A →ₐ[R] B := FormallySmooth.lift _ hg' ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f) #align algebra.formally_smooth.lift_of_surjective Algebra.FormallySmooth.liftOfSurjective @[simp] theorem liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C) (hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) (x : A) : g (FormallySmooth.liftOfSurjective f g hg hg' x) = f x := by apply (Ideal.quotientKerAlgEquivOfSurjective hg).symm.injective change _ = ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f) x -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [← FormallySmooth.mk_lift _ hg' ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)] apply (Ideal.quotientKerAlgEquivOfSurjective hg).injective simp only [liftOfSurjective, AlgEquiv.apply_symm_apply, AlgEquiv.toAlgHom_eq_coe, Ideal.quotientKerAlgEquivOfSurjective_apply, RingHom.kerLift_mk, RingHom.coe_coe] #align algebra.formally_smooth.lift_of_surjective_apply Algebra.FormallySmooth.liftOfSurjective_apply @[simp] theorem comp_liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C) (hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) : g.comp (FormallySmooth.liftOfSurjective f g hg hg') = f := AlgHom.ext (FormallySmooth.liftOfSurjective_apply f g hg hg') #align algebra.formally_smooth.comp_lift_of_surjective Algebra.FormallySmooth.comp_liftOfSurjective end section Comp variable (R : Type u) [CommSemiring R] variable (A : Type u) [CommSemiring A] [Algebra R A] variable (B : Type u) [Semiring B] [Algebra R B] [Algebra A B] [IsScalarTower R A B]
Mathlib/RingTheory/Smooth/Basic.lean
188
196
theorem comp [FormallySmooth R A] [FormallySmooth A B] : FormallySmooth R B := by
constructor intro C _ _ I hI f obtain ⟨f', e⟩ := FormallySmooth.comp_surjective I hI (f.comp (IsScalarTower.toAlgHom R A B)) letI := f'.toRingHom.toAlgebra obtain ⟨f'', e'⟩ := FormallySmooth.comp_surjective I hI { f.toRingHom with commutes' := AlgHom.congr_fun e.symm } apply_fun AlgHom.restrictScalars R at e' exact ⟨f''.restrictScalars _, e'.trans (AlgHom.ext fun _ => rfl)⟩
import Mathlib.Order.Filter.Bases #align_import order.filter.pi from "leanprover-community/mathlib"@"ce64cd319bb6b3e82f31c2d38e79080d377be451" open Set Function open scoped Classical open Filter namespace Filter variable {ι : Type*} {α : ι → Type*} {f f₁ f₂ : (i : ι) → Filter (α i)} {s : (i : ι) → Set (α i)} {p : ∀ i, α i → Prop} section CoprodCat -- for "Coprod" set_option linter.uppercaseLean3 false protected def coprodᵢ (f : ∀ i, Filter (α i)) : Filter (∀ i, α i) := ⨆ i : ι, comap (eval i) (f i) #align filter.Coprod Filter.coprodᵢ theorem mem_coprodᵢ_iff {s : Set (∀ i, α i)} : s ∈ Filter.coprodᵢ f ↔ ∀ i : ι, ∃ t₁ ∈ f i, eval i ⁻¹' t₁ ⊆ s := by simp [Filter.coprodᵢ] #align filter.mem_Coprod_iff Filter.mem_coprodᵢ_iff
Mathlib/Order/Filter/Pi.lean
233
235
theorem compl_mem_coprodᵢ {s : Set (∀ i, α i)} : sᶜ ∈ Filter.coprodᵢ f ↔ ∀ i, (eval i '' s)ᶜ ∈ f i := by
simp only [Filter.coprodᵢ, mem_iSup, compl_mem_comap]
import Mathlib.MeasureTheory.Integral.IntervalIntegral import Mathlib.MeasureTheory.Integral.Average #align_import measure_theory.integral.interval_average from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853" open MeasureTheory Set TopologicalSpace open scoped Interval variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] notation3 "⨍ "(...)" in "a".."b", "r:60:(scoped f => average (Measure.restrict volume (uIoc a b)) f) => r
Mathlib/MeasureTheory/Integral/IntervalAverage.lean
39
40
theorem interval_average_symm (f : ℝ → E) (a b : ℝ) : (⨍ x in a..b, f x) = ⨍ x in b..a, f x := by
rw [setAverage_eq, setAverage_eq, uIoc_comm]
import Mathlib.Algebra.Algebra.Subalgebra.Unitization import Mathlib.Analysis.RCLike.Basic import Mathlib.Topology.Algebra.StarSubalgebra import Mathlib.Topology.ContinuousFunction.ContinuousMapZero import Mathlib.Topology.ContinuousFunction.Weierstrass #align_import topology.continuous_function.stone_weierstrass from "leanprover-community/mathlib"@"16e59248c0ebafabd5d071b1cd41743eb8698ffb" noncomputable section namespace ContinuousMap variable {X : Type*} [TopologicalSpace X] [CompactSpace X] open scoped Polynomial def attachBound (f : C(X, ℝ)) : C(X, Set.Icc (-‖f‖) ‖f‖) where toFun x := ⟨f x, ⟨neg_norm_le_apply f x, apply_le_norm f x⟩⟩ #align continuous_map.attach_bound ContinuousMap.attachBound @[simp] theorem attachBound_apply_coe (f : C(X, ℝ)) (x : X) : ((attachBound f) x : ℝ) = f x := rfl #align continuous_map.attach_bound_apply_coe ContinuousMap.attachBound_apply_coe theorem polynomial_comp_attachBound (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound = Polynomial.aeval f g := by ext simp only [ContinuousMap.coe_comp, Function.comp_apply, ContinuousMap.attachBound_apply_coe, Polynomial.toContinuousMapOn_apply, Polynomial.aeval_subalgebra_coe, Polynomial.aeval_continuousMap_apply, Polynomial.toContinuousMap_apply] -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [ContinuousMap.attachBound_apply_coe] #align continuous_map.polynomial_comp_attach_bound ContinuousMap.polynomial_comp_attachBound theorem polynomial_comp_attachBound_mem (A : Subalgebra ℝ C(X, ℝ)) (f : A) (g : ℝ[X]) : (g.toContinuousMapOn (Set.Icc (-‖f‖) ‖f‖)).comp (f : C(X, ℝ)).attachBound ∈ A := by rw [polynomial_comp_attachBound] apply SetLike.coe_mem #align continuous_map.polynomial_comp_attach_bound_mem ContinuousMap.polynomial_comp_attachBound_mem
Mathlib/Topology/ContinuousFunction/StoneWeierstrass.lean
94
113
theorem comp_attachBound_mem_closure (A : Subalgebra ℝ C(X, ℝ)) (f : A) (p : C(Set.Icc (-‖f‖) ‖f‖, ℝ)) : p.comp (attachBound (f : C(X, ℝ))) ∈ A.topologicalClosure := by
-- `p` itself is in the closure of polynomials, by the Weierstrass theorem, have mem_closure : p ∈ (polynomialFunctions (Set.Icc (-‖f‖) ‖f‖)).topologicalClosure := continuousMap_mem_polynomialFunctions_closure _ _ p -- and so there are polynomials arbitrarily close. have frequently_mem_polynomials := mem_closure_iff_frequently.mp mem_closure -- To prove `p.comp (attachBound f)` is in the closure of `A`, -- we show there are elements of `A` arbitrarily close. apply mem_closure_iff_frequently.mpr -- To show that, we pull back the polynomials close to `p`, refine ((compRightContinuousMap ℝ (attachBound (f : C(X, ℝ)))).continuousAt p).tendsto.frequently_map _ ?_ frequently_mem_polynomials -- but need to show that those pullbacks are actually in `A`. rintro _ ⟨g, ⟨-, rfl⟩⟩ simp only [SetLike.mem_coe, AlgHom.coe_toRingHom, compRightContinuousMap_apply, Polynomial.toContinuousMapOnAlgHom_apply] apply polynomial_comp_attachBound_mem
import Mathlib.Algebra.Order.Monoid.Defs import Mathlib.Algebra.Order.Sub.Defs import Mathlib.Util.AssertExists #align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce" open Function universe u variable {α : Type u} class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b #align ordered_add_comm_group OrderedAddCommGroup class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b #align ordered_comm_group OrderedCommGroup attribute [to_additive] OrderedCommGroup @[to_additive] instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] : CovariantClass α α (· * ·) (· ≤ ·) where elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a #align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le #align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le -- See note [lower instance priority] @[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid] instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] : OrderedCancelCommMonoid α := { ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' } #align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid #align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) := IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α -- Porting note: this instance is not used, -- and causes timeouts after lean4#2210. -- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564 -- but without the motivation clearly explained. @[to_additive "A choice-free shortcut instance."]
Mathlib/Algebra/Order/Group/Defs.lean
71
73
theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] : ContravariantClass α α (· * ·) (· ≤ ·) where elim a b c bc := by
simpa using mul_le_mul_left' bc a⁻¹
import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Lifts import Mathlib.Algebra.Polynomial.Splits import Mathlib.RingTheory.RootsOfUnity.Complex import Mathlib.NumberTheory.ArithmeticFunction import Mathlib.RingTheory.RootsOfUnity.Basic import Mathlib.FieldTheory.RatFunc.AsPolynomial #align_import ring_theory.polynomial.cyclotomic.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Polynomial noncomputable section universe u namespace Polynomial section Cyclotomic' section IsDomain variable {R : Type*} [CommRing R] [IsDomain R] def cyclotomic' (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : R[X] := ∏ μ ∈ primitiveRoots n R, (X - C μ) #align polynomial.cyclotomic' Polynomial.cyclotomic' @[simp] theorem cyclotomic'_zero (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' 0 R = 1 := by simp only [cyclotomic', Finset.prod_empty, primitiveRoots_zero] #align polynomial.cyclotomic'_zero Polynomial.cyclotomic'_zero @[simp] theorem cyclotomic'_one (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' 1 R = X - 1 := by simp only [cyclotomic', Finset.prod_singleton, RingHom.map_one, IsPrimitiveRoot.primitiveRoots_one] #align polynomial.cyclotomic'_one Polynomial.cyclotomic'_one @[simp] theorem cyclotomic'_two (R : Type*) [CommRing R] [IsDomain R] (p : ℕ) [CharP R p] (hp : p ≠ 2) : cyclotomic' 2 R = X + 1 := by rw [cyclotomic'] have prim_root_two : primitiveRoots 2 R = {(-1 : R)} := by simp only [Finset.eq_singleton_iff_unique_mem, mem_primitiveRoots two_pos] exact ⟨IsPrimitiveRoot.neg_one p hp, fun x => IsPrimitiveRoot.eq_neg_one_of_two_right⟩ simp only [prim_root_two, Finset.prod_singleton, RingHom.map_neg, RingHom.map_one, sub_neg_eq_add] #align polynomial.cyclotomic'_two Polynomial.cyclotomic'_two theorem cyclotomic'.monic (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : (cyclotomic' n R).Monic := monic_prod_of_monic _ _ fun _ _ => monic_X_sub_C _ #align polynomial.cyclotomic'.monic Polynomial.cyclotomic'.monic theorem cyclotomic'_ne_zero (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' n R ≠ 0 := (cyclotomic'.monic n R).ne_zero #align polynomial.cyclotomic'_ne_zero Polynomial.cyclotomic'_ne_zero
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
107
114
theorem natDegree_cyclotomic' {ζ : R} {n : ℕ} (h : IsPrimitiveRoot ζ n) : (cyclotomic' n R).natDegree = Nat.totient n := by
rw [cyclotomic'] rw [natDegree_prod (primitiveRoots n R) fun z : R => X - C z] · simp only [IsPrimitiveRoot.card_primitiveRoots h, mul_one, natDegree_X_sub_C, Nat.cast_id, Finset.sum_const, nsmul_eq_mul] intro z _ exact X_sub_C_ne_zero z
import Mathlib.Topology.UniformSpace.UniformConvergenceTopology #align_import topology.uniform_space.equicontinuity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" section open UniformSpace Filter Set Uniformity Topology UniformConvergence Function variable {ι κ X X' Y Z α α' β β' γ 𝓕 : Type*} [tX : TopologicalSpace X] [tY : TopologicalSpace Y] [tZ : TopologicalSpace Z] [uα : UniformSpace α] [uβ : UniformSpace β] [uγ : UniformSpace γ] def EquicontinuousAt (F : ι → X → α) (x₀ : X) : Prop := ∀ U ∈ 𝓤 α, ∀ᶠ x in 𝓝 x₀, ∀ i, (F i x₀, F i x) ∈ U #align equicontinuous_at EquicontinuousAt protected abbrev Set.EquicontinuousAt (H : Set <| X → α) (x₀ : X) : Prop := EquicontinuousAt ((↑) : H → X → α) x₀ #align set.equicontinuous_at Set.EquicontinuousAt def EquicontinuousWithinAt (F : ι → X → α) (S : Set X) (x₀ : X) : Prop := ∀ U ∈ 𝓤 α, ∀ᶠ x in 𝓝[S] x₀, ∀ i, (F i x₀, F i x) ∈ U protected abbrev Set.EquicontinuousWithinAt (H : Set <| X → α) (S : Set X) (x₀ : X) : Prop := EquicontinuousWithinAt ((↑) : H → X → α) S x₀ def Equicontinuous (F : ι → X → α) : Prop := ∀ x₀, EquicontinuousAt F x₀ #align equicontinuous Equicontinuous protected abbrev Set.Equicontinuous (H : Set <| X → α) : Prop := Equicontinuous ((↑) : H → X → α) #align set.equicontinuous Set.Equicontinuous def EquicontinuousOn (F : ι → X → α) (S : Set X) : Prop := ∀ x₀ ∈ S, EquicontinuousWithinAt F S x₀ protected abbrev Set.EquicontinuousOn (H : Set <| X → α) (S : Set X) : Prop := EquicontinuousOn ((↑) : H → X → α) S def UniformEquicontinuous (F : ι → β → α) : Prop := ∀ U ∈ 𝓤 α, ∀ᶠ xy : β × β in 𝓤 β, ∀ i, (F i xy.1, F i xy.2) ∈ U #align uniform_equicontinuous UniformEquicontinuous protected abbrev Set.UniformEquicontinuous (H : Set <| β → α) : Prop := UniformEquicontinuous ((↑) : H → β → α) #align set.uniform_equicontinuous Set.UniformEquicontinuous def UniformEquicontinuousOn (F : ι → β → α) (S : Set β) : Prop := ∀ U ∈ 𝓤 α, ∀ᶠ xy : β × β in 𝓤 β ⊓ 𝓟 (S ×ˢ S), ∀ i, (F i xy.1, F i xy.2) ∈ U protected abbrev Set.UniformEquicontinuousOn (H : Set <| β → α) (S : Set β) : Prop := UniformEquicontinuousOn ((↑) : H → β → α) S lemma EquicontinuousAt.equicontinuousWithinAt {F : ι → X → α} {x₀ : X} (H : EquicontinuousAt F x₀) (S : Set X) : EquicontinuousWithinAt F S x₀ := fun U hU ↦ (H U hU).filter_mono inf_le_left lemma EquicontinuousWithinAt.mono {F : ι → X → α} {x₀ : X} {S T : Set X} (H : EquicontinuousWithinAt F T x₀) (hST : S ⊆ T) : EquicontinuousWithinAt F S x₀ := fun U hU ↦ (H U hU).filter_mono <| nhdsWithin_mono x₀ hST @[simp] lemma equicontinuousWithinAt_univ (F : ι → X → α) (x₀ : X) : EquicontinuousWithinAt F univ x₀ ↔ EquicontinuousAt F x₀ := by rw [EquicontinuousWithinAt, EquicontinuousAt, nhdsWithin_univ] lemma equicontinuousAt_restrict_iff (F : ι → X → α) {S : Set X} (x₀ : S) : EquicontinuousAt (S.restrict ∘ F) x₀ ↔ EquicontinuousWithinAt F S x₀ := by simp [EquicontinuousWithinAt, EquicontinuousAt, ← eventually_nhds_subtype_iff] lemma Equicontinuous.equicontinuousOn {F : ι → X → α} (H : Equicontinuous F) (S : Set X) : EquicontinuousOn F S := fun x _ ↦ (H x).equicontinuousWithinAt S lemma EquicontinuousOn.mono {F : ι → X → α} {S T : Set X} (H : EquicontinuousOn F T) (hST : S ⊆ T) : EquicontinuousOn F S := fun x hx ↦ (H x (hST hx)).mono hST lemma equicontinuousOn_univ (F : ι → X → α) : EquicontinuousOn F univ ↔ Equicontinuous F := by simp [EquicontinuousOn, Equicontinuous] lemma equicontinuous_restrict_iff (F : ι → X → α) {S : Set X} : Equicontinuous (S.restrict ∘ F) ↔ EquicontinuousOn F S := by simp [Equicontinuous, EquicontinuousOn, equicontinuousAt_restrict_iff] lemma UniformEquicontinuous.uniformEquicontinuousOn {F : ι → β → α} (H : UniformEquicontinuous F) (S : Set β) : UniformEquicontinuousOn F S := fun U hU ↦ (H U hU).filter_mono inf_le_left lemma UniformEquicontinuousOn.mono {F : ι → β → α} {S T : Set β} (H : UniformEquicontinuousOn F T) (hST : S ⊆ T) : UniformEquicontinuousOn F S := fun U hU ↦ (H U hU).filter_mono <| by gcongr lemma uniformEquicontinuousOn_univ (F : ι → β → α) : UniformEquicontinuousOn F univ ↔ UniformEquicontinuous F := by simp [UniformEquicontinuousOn, UniformEquicontinuous] lemma uniformEquicontinuous_restrict_iff (F : ι → β → α) {S : Set β} : UniformEquicontinuous (S.restrict ∘ F) ↔ UniformEquicontinuousOn F S := by rw [UniformEquicontinuous, UniformEquicontinuousOn] conv in _ ⊓ _ => rw [← Subtype.range_val (s := S), ← range_prod_map, ← map_comap] rfl @[simp] lemma equicontinuousAt_empty [h : IsEmpty ι] (F : ι → X → α) (x₀ : X) : EquicontinuousAt F x₀ := fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim) @[simp] lemma equicontinuousWithinAt_empty [h : IsEmpty ι] (F : ι → X → α) (S : Set X) (x₀ : X) : EquicontinuousWithinAt F S x₀ := fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim) @[simp] lemma equicontinuous_empty [IsEmpty ι] (F : ι → X → α) : Equicontinuous F := equicontinuousAt_empty F @[simp] lemma equicontinuousOn_empty [IsEmpty ι] (F : ι → X → α) (S : Set X) : EquicontinuousOn F S := fun x₀ _ ↦ equicontinuousWithinAt_empty F S x₀ @[simp] lemma uniformEquicontinuous_empty [h : IsEmpty ι] (F : ι → β → α) : UniformEquicontinuous F := fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim) @[simp] lemma uniformEquicontinuousOn_empty [h : IsEmpty ι] (F : ι → β → α) (S : Set β) : UniformEquicontinuousOn F S := fun _ _ ↦ eventually_of_forall (fun _ ↦ h.elim) theorem equicontinuousAt_finite [Finite ι] {F : ι → X → α} {x₀ : X} : EquicontinuousAt F x₀ ↔ ∀ i, ContinuousAt (F i) x₀ := by simp [EquicontinuousAt, ContinuousAt, (nhds_basis_uniformity' (𝓤 α).basis_sets).tendsto_right_iff, UniformSpace.ball, @forall_swap _ ι] theorem equicontinuousWithinAt_finite [Finite ι] {F : ι → X → α} {S : Set X} {x₀ : X} : EquicontinuousWithinAt F S x₀ ↔ ∀ i, ContinuousWithinAt (F i) S x₀ := by simp [EquicontinuousWithinAt, ContinuousWithinAt, (nhds_basis_uniformity' (𝓤 α).basis_sets).tendsto_right_iff, UniformSpace.ball, @forall_swap _ ι] theorem equicontinuous_finite [Finite ι] {F : ι → X → α} : Equicontinuous F ↔ ∀ i, Continuous (F i) := by simp only [Equicontinuous, equicontinuousAt_finite, continuous_iff_continuousAt, @forall_swap ι] theorem equicontinuousOn_finite [Finite ι] {F : ι → X → α} {S : Set X} : EquicontinuousOn F S ↔ ∀ i, ContinuousOn (F i) S := by simp only [EquicontinuousOn, equicontinuousWithinAt_finite, ContinuousOn, @forall_swap ι] theorem uniformEquicontinuous_finite [Finite ι] {F : ι → β → α} : UniformEquicontinuous F ↔ ∀ i, UniformContinuous (F i) := by simp only [UniformEquicontinuous, eventually_all, @forall_swap _ ι]; rfl theorem uniformEquicontinuousOn_finite [Finite ι] {F : ι → β → α} {S : Set β} : UniformEquicontinuousOn F S ↔ ∀ i, UniformContinuousOn (F i) S := by simp only [UniformEquicontinuousOn, eventually_all, @forall_swap _ ι]; rfl theorem equicontinuousAt_unique [Unique ι] {F : ι → X → α} {x : X} : EquicontinuousAt F x ↔ ContinuousAt (F default) x := equicontinuousAt_finite.trans Unique.forall_iff theorem equicontinuousWithinAt_unique [Unique ι] {F : ι → X → α} {S : Set X} {x : X} : EquicontinuousWithinAt F S x ↔ ContinuousWithinAt (F default) S x := equicontinuousWithinAt_finite.trans Unique.forall_iff theorem equicontinuous_unique [Unique ι] {F : ι → X → α} : Equicontinuous F ↔ Continuous (F default) := equicontinuous_finite.trans Unique.forall_iff theorem equicontinuousOn_unique [Unique ι] {F : ι → X → α} {S : Set X} : EquicontinuousOn F S ↔ ContinuousOn (F default) S := equicontinuousOn_finite.trans Unique.forall_iff theorem uniformEquicontinuous_unique [Unique ι] {F : ι → β → α} : UniformEquicontinuous F ↔ UniformContinuous (F default) := uniformEquicontinuous_finite.trans Unique.forall_iff theorem uniformEquicontinuousOn_unique [Unique ι] {F : ι → β → α} {S : Set β} : UniformEquicontinuousOn F S ↔ UniformContinuousOn (F default) S := uniformEquicontinuousOn_finite.trans Unique.forall_iff theorem equicontinuousWithinAt_iff_pair {F : ι → X → α} {S : Set X} {x₀ : X} (hx₀ : x₀ ∈ S) : EquicontinuousWithinAt F S x₀ ↔ ∀ U ∈ 𝓤 α, ∃ V ∈ 𝓝[S] x₀, ∀ x ∈ V, ∀ y ∈ V, ∀ i, (F i x, F i y) ∈ U := by constructor <;> intro H U hU · rcases comp_symm_mem_uniformity_sets hU with ⟨V, hV, hVsymm, hVU⟩ refine ⟨_, H V hV, fun x hx y hy i => hVU (prod_mk_mem_compRel ?_ (hy i))⟩ exact hVsymm.mk_mem_comm.mp (hx i) · rcases H U hU with ⟨V, hV, hVU⟩ filter_upwards [hV] using fun x hx i => hVU x₀ (mem_of_mem_nhdsWithin hx₀ hV) x hx i theorem equicontinuousAt_iff_pair {F : ι → X → α} {x₀ : X} : EquicontinuousAt F x₀ ↔ ∀ U ∈ 𝓤 α, ∃ V ∈ 𝓝 x₀, ∀ x ∈ V, ∀ y ∈ V, ∀ i, (F i x, F i y) ∈ U := by simp_rw [← equicontinuousWithinAt_univ, equicontinuousWithinAt_iff_pair (mem_univ x₀), nhdsWithin_univ] #align equicontinuous_at_iff_pair equicontinuousAt_iff_pair theorem UniformEquicontinuous.equicontinuous {F : ι → β → α} (h : UniformEquicontinuous F) : Equicontinuous F := fun x₀ U hU ↦ mem_of_superset (ball_mem_nhds x₀ (h U hU)) fun _ hx i ↦ hx i #align uniform_equicontinuous.equicontinuous UniformEquicontinuous.equicontinuous theorem UniformEquicontinuousOn.equicontinuousOn {F : ι → β → α} {S : Set β} (h : UniformEquicontinuousOn F S) : EquicontinuousOn F S := fun _ hx₀ U hU ↦ mem_of_superset (ball_mem_nhdsWithin hx₀ (h U hU)) fun _ hx i ↦ hx i theorem EquicontinuousAt.continuousAt {F : ι → X → α} {x₀ : X} (h : EquicontinuousAt F x₀) (i : ι) : ContinuousAt (F i) x₀ := (UniformSpace.hasBasis_nhds _).tendsto_right_iff.2 fun U ⟨hU, _⟩ ↦ (h U hU).mono fun _x hx ↦ hx i #align equicontinuous_at.continuous_at EquicontinuousAt.continuousAt theorem EquicontinuousWithinAt.continuousWithinAt {F : ι → X → α} {S : Set X} {x₀ : X} (h : EquicontinuousWithinAt F S x₀) (i : ι) : ContinuousWithinAt (F i) S x₀ := (UniformSpace.hasBasis_nhds _).tendsto_right_iff.2 fun U ⟨hU, _⟩ ↦ (h U hU).mono fun _x hx ↦ hx i protected theorem Set.EquicontinuousAt.continuousAt_of_mem {H : Set <| X → α} {x₀ : X} (h : H.EquicontinuousAt x₀) {f : X → α} (hf : f ∈ H) : ContinuousAt f x₀ := h.continuousAt ⟨f, hf⟩ #align set.equicontinuous_at.continuous_at_of_mem Set.EquicontinuousAt.continuousAt_of_mem protected theorem Set.EquicontinuousWithinAt.continuousWithinAt_of_mem {H : Set <| X → α} {S : Set X} {x₀ : X} (h : H.EquicontinuousWithinAt S x₀) {f : X → α} (hf : f ∈ H) : ContinuousWithinAt f S x₀ := h.continuousWithinAt ⟨f, hf⟩ theorem Equicontinuous.continuous {F : ι → X → α} (h : Equicontinuous F) (i : ι) : Continuous (F i) := continuous_iff_continuousAt.mpr fun x => (h x).continuousAt i #align equicontinuous.continuous Equicontinuous.continuous theorem EquicontinuousOn.continuousOn {F : ι → X → α} {S : Set X} (h : EquicontinuousOn F S) (i : ι) : ContinuousOn (F i) S := fun x hx ↦ (h x hx).continuousWithinAt i protected theorem Set.Equicontinuous.continuous_of_mem {H : Set <| X → α} (h : H.Equicontinuous) {f : X → α} (hf : f ∈ H) : Continuous f := h.continuous ⟨f, hf⟩ #align set.equicontinuous.continuous_of_mem Set.Equicontinuous.continuous_of_mem protected theorem Set.EquicontinuousOn.continuousOn_of_mem {H : Set <| X → α} {S : Set X} (h : H.EquicontinuousOn S) {f : X → α} (hf : f ∈ H) : ContinuousOn f S := h.continuousOn ⟨f, hf⟩ theorem UniformEquicontinuous.uniformContinuous {F : ι → β → α} (h : UniformEquicontinuous F) (i : ι) : UniformContinuous (F i) := fun U hU => mem_map.mpr (mem_of_superset (h U hU) fun _ hxy => hxy i) #align uniform_equicontinuous.uniform_continuous UniformEquicontinuous.uniformContinuous theorem UniformEquicontinuousOn.uniformContinuousOn {F : ι → β → α} {S : Set β} (h : UniformEquicontinuousOn F S) (i : ι) : UniformContinuousOn (F i) S := fun U hU => mem_map.mpr (mem_of_superset (h U hU) fun _ hxy => hxy i) protected theorem Set.UniformEquicontinuous.uniformContinuous_of_mem {H : Set <| β → α} (h : H.UniformEquicontinuous) {f : β → α} (hf : f ∈ H) : UniformContinuous f := h.uniformContinuous ⟨f, hf⟩ #align set.uniform_equicontinuous.uniform_continuous_of_mem Set.UniformEquicontinuous.uniformContinuous_of_mem protected theorem Set.UniformEquicontinuousOn.uniformContinuousOn_of_mem {H : Set <| β → α} {S : Set β} (h : H.UniformEquicontinuousOn S) {f : β → α} (hf : f ∈ H) : UniformContinuousOn f S := h.uniformContinuousOn ⟨f, hf⟩ theorem EquicontinuousAt.comp {F : ι → X → α} {x₀ : X} (h : EquicontinuousAt F x₀) (u : κ → ι) : EquicontinuousAt (F ∘ u) x₀ := fun U hU => (h U hU).mono fun _ H k => H (u k) #align equicontinuous_at.comp EquicontinuousAt.comp theorem EquicontinuousWithinAt.comp {F : ι → X → α} {S : Set X} {x₀ : X} (h : EquicontinuousWithinAt F S x₀) (u : κ → ι) : EquicontinuousWithinAt (F ∘ u) S x₀ := fun U hU ↦ (h U hU).mono fun _ H k => H (u k) protected theorem Set.EquicontinuousAt.mono {H H' : Set <| X → α} {x₀ : X} (h : H.EquicontinuousAt x₀) (hH : H' ⊆ H) : H'.EquicontinuousAt x₀ := h.comp (inclusion hH) #align set.equicontinuous_at.mono Set.EquicontinuousAt.mono protected theorem Set.EquicontinuousWithinAt.mono {H H' : Set <| X → α} {S : Set X} {x₀ : X} (h : H.EquicontinuousWithinAt S x₀) (hH : H' ⊆ H) : H'.EquicontinuousWithinAt S x₀ := h.comp (inclusion hH) theorem Equicontinuous.comp {F : ι → X → α} (h : Equicontinuous F) (u : κ → ι) : Equicontinuous (F ∘ u) := fun x => (h x).comp u #align equicontinuous.comp Equicontinuous.comp theorem EquicontinuousOn.comp {F : ι → X → α} {S : Set X} (h : EquicontinuousOn F S) (u : κ → ι) : EquicontinuousOn (F ∘ u) S := fun x hx ↦ (h x hx).comp u protected theorem Set.Equicontinuous.mono {H H' : Set <| X → α} (h : H.Equicontinuous) (hH : H' ⊆ H) : H'.Equicontinuous := h.comp (inclusion hH) #align set.equicontinuous.mono Set.Equicontinuous.mono protected theorem Set.EquicontinuousOn.mono {H H' : Set <| X → α} {S : Set X} (h : H.EquicontinuousOn S) (hH : H' ⊆ H) : H'.EquicontinuousOn S := h.comp (inclusion hH) theorem UniformEquicontinuous.comp {F : ι → β → α} (h : UniformEquicontinuous F) (u : κ → ι) : UniformEquicontinuous (F ∘ u) := fun U hU => (h U hU).mono fun _ H k => H (u k) #align uniform_equicontinuous.comp UniformEquicontinuous.comp theorem UniformEquicontinuousOn.comp {F : ι → β → α} {S : Set β} (h : UniformEquicontinuousOn F S) (u : κ → ι) : UniformEquicontinuousOn (F ∘ u) S := fun U hU ↦ (h U hU).mono fun _ H k => H (u k) protected theorem Set.UniformEquicontinuous.mono {H H' : Set <| β → α} (h : H.UniformEquicontinuous) (hH : H' ⊆ H) : H'.UniformEquicontinuous := h.comp (inclusion hH) #align set.uniform_equicontinuous.mono Set.UniformEquicontinuous.mono protected theorem Set.UniformEquicontinuousOn.mono {H H' : Set <| β → α} {S : Set β} (h : H.UniformEquicontinuousOn S) (hH : H' ⊆ H) : H'.UniformEquicontinuousOn S := h.comp (inclusion hH) theorem equicontinuousAt_iff_range {F : ι → X → α} {x₀ : X} : EquicontinuousAt F x₀ ↔ EquicontinuousAt ((↑) : range F → X → α) x₀ := by simp only [EquicontinuousAt, forall_subtype_range_iff] #align equicontinuous_at_iff_range equicontinuousAt_iff_range theorem equicontinuousWithinAt_iff_range {F : ι → X → α} {S : Set X} {x₀ : X} : EquicontinuousWithinAt F S x₀ ↔ EquicontinuousWithinAt ((↑) : range F → X → α) S x₀ := by simp only [EquicontinuousWithinAt, forall_subtype_range_iff] theorem equicontinuous_iff_range {F : ι → X → α} : Equicontinuous F ↔ Equicontinuous ((↑) : range F → X → α) := forall_congr' fun _ => equicontinuousAt_iff_range #align equicontinuous_iff_range equicontinuous_iff_range theorem equicontinuousOn_iff_range {F : ι → X → α} {S : Set X} : EquicontinuousOn F S ↔ EquicontinuousOn ((↑) : range F → X → α) S := forall_congr' fun _ ↦ forall_congr' fun _ ↦ equicontinuousWithinAt_iff_range theorem uniformEquicontinuous_iff_range {F : ι → β → α} : UniformEquicontinuous F ↔ UniformEquicontinuous ((↑) : range F → β → α) := ⟨fun h => by rw [← comp_rangeSplitting F]; exact h.comp _, fun h => h.comp (rangeFactorization F)⟩ #align uniform_equicontinuous_at_iff_range uniformEquicontinuous_iff_range theorem uniformEquicontinuousOn_iff_range {F : ι → β → α} {S : Set β} : UniformEquicontinuousOn F S ↔ UniformEquicontinuousOn ((↑) : range F → β → α) S := ⟨fun h => by rw [← comp_rangeSplitting F]; exact h.comp _, fun h => h.comp (rangeFactorization F)⟩ section open UniformFun theorem equicontinuousAt_iff_continuousAt {F : ι → X → α} {x₀ : X} : EquicontinuousAt F x₀ ↔ ContinuousAt (ofFun ∘ Function.swap F : X → ι →ᵤ α) x₀ := by rw [ContinuousAt, (UniformFun.hasBasis_nhds ι α _).tendsto_right_iff] rfl #align equicontinuous_at_iff_continuous_at equicontinuousAt_iff_continuousAt theorem equicontinuousWithinAt_iff_continuousWithinAt {F : ι → X → α} {S : Set X} {x₀ : X} : EquicontinuousWithinAt F S x₀ ↔ ContinuousWithinAt (ofFun ∘ Function.swap F : X → ι →ᵤ α) S x₀ := by rw [ContinuousWithinAt, (UniformFun.hasBasis_nhds ι α _).tendsto_right_iff] rfl theorem equicontinuous_iff_continuous {F : ι → X → α} : Equicontinuous F ↔ Continuous (ofFun ∘ Function.swap F : X → ι →ᵤ α) := by simp_rw [Equicontinuous, continuous_iff_continuousAt, equicontinuousAt_iff_continuousAt] #align equicontinuous_iff_continuous equicontinuous_iff_continuous theorem equicontinuousOn_iff_continuousOn {F : ι → X → α} {S : Set X} : EquicontinuousOn F S ↔ ContinuousOn (ofFun ∘ Function.swap F : X → ι →ᵤ α) S := by simp_rw [EquicontinuousOn, ContinuousOn, equicontinuousWithinAt_iff_continuousWithinAt] theorem uniformEquicontinuous_iff_uniformContinuous {F : ι → β → α} : UniformEquicontinuous F ↔ UniformContinuous (ofFun ∘ Function.swap F : β → ι →ᵤ α) := by rw [UniformContinuous, (UniformFun.hasBasis_uniformity ι α).tendsto_right_iff] rfl #align uniform_equicontinuous_iff_uniform_continuous uniformEquicontinuous_iff_uniformContinuous theorem uniformEquicontinuousOn_iff_uniformContinuousOn {F : ι → β → α} {S : Set β} : UniformEquicontinuousOn F S ↔ UniformContinuousOn (ofFun ∘ Function.swap F : β → ι →ᵤ α) S := by rw [UniformContinuousOn, (UniformFun.hasBasis_uniformity ι α).tendsto_right_iff] rfl theorem equicontinuousWithinAt_iInf_rng {u : κ → UniformSpace α'} {F : ι → X → α'} {S : Set X} {x₀ : X} : EquicontinuousWithinAt (uα := ⨅ k, u k) F S x₀ ↔ ∀ k, EquicontinuousWithinAt (uα := u k) F S x₀ := by simp only [equicontinuousWithinAt_iff_continuousWithinAt (uα := _), topologicalSpace] unfold ContinuousWithinAt rw [UniformFun.iInf_eq, toTopologicalSpace_iInf, nhds_iInf, tendsto_iInf] theorem equicontinuousAt_iInf_rng {u : κ → UniformSpace α'} {F : ι → X → α'} {x₀ : X} : EquicontinuousAt (uα := ⨅ k, u k) F x₀ ↔ ∀ k, EquicontinuousAt (uα := u k) F x₀ := by simp only [← equicontinuousWithinAt_univ (uα := _), equicontinuousWithinAt_iInf_rng] theorem equicontinuous_iInf_rng {u : κ → UniformSpace α'} {F : ι → X → α'} : Equicontinuous (uα := ⨅ k, u k) F ↔ ∀ k, Equicontinuous (uα := u k) F := by simp_rw [equicontinuous_iff_continuous (uα := _), UniformFun.topologicalSpace] rw [UniformFun.iInf_eq, toTopologicalSpace_iInf, continuous_iInf_rng] theorem equicontinuousOn_iInf_rng {u : κ → UniformSpace α'} {F : ι → X → α'} {S : Set X} : EquicontinuousOn (uα := ⨅ k, u k) F S ↔ ∀ k, EquicontinuousOn (uα := u k) F S := by simp_rw [EquicontinuousOn, equicontinuousWithinAt_iInf_rng, @forall_swap _ κ] theorem uniformEquicontinuous_iInf_rng {u : κ → UniformSpace α'} {F : ι → β → α'} : UniformEquicontinuous (uα := ⨅ k, u k) F ↔ ∀ k, UniformEquicontinuous (uα := u k) F := by simp_rw [uniformEquicontinuous_iff_uniformContinuous (uα := _)] rw [UniformFun.iInf_eq, uniformContinuous_iInf_rng] theorem uniformEquicontinuousOn_iInf_rng {u : κ → UniformSpace α'} {F : ι → β → α'} {S : Set β} : UniformEquicontinuousOn (uα := ⨅ k, u k) F S ↔ ∀ k, UniformEquicontinuousOn (uα := u k) F S := by simp_rw [uniformEquicontinuousOn_iff_uniformContinuousOn (uα := _)] unfold UniformContinuousOn rw [UniformFun.iInf_eq, iInf_uniformity, tendsto_iInf] theorem equicontinuousWithinAt_iInf_dom {t : κ → TopologicalSpace X'} {F : ι → X' → α} {S : Set X'} {x₀ : X'} {k : κ} (hk : EquicontinuousWithinAt (tX := t k) F S x₀) : EquicontinuousWithinAt (tX := ⨅ k, t k) F S x₀ := by simp [equicontinuousWithinAt_iff_continuousWithinAt (tX := _)] at hk ⊢ unfold ContinuousWithinAt nhdsWithin at hk ⊢ rw [nhds_iInf] exact hk.mono_left <| inf_le_inf_right _ <| iInf_le _ k theorem equicontinuousAt_iInf_dom {t : κ → TopologicalSpace X'} {F : ι → X' → α} {x₀ : X'} {k : κ} (hk : EquicontinuousAt (tX := t k) F x₀) : EquicontinuousAt (tX := ⨅ k, t k) F x₀ := by rw [← equicontinuousWithinAt_univ (tX := _)] at hk ⊢ exact equicontinuousWithinAt_iInf_dom hk theorem equicontinuous_iInf_dom {t : κ → TopologicalSpace X'} {F : ι → X' → α} {k : κ} (hk : Equicontinuous (tX := t k) F) : Equicontinuous (tX := ⨅ k, t k) F := fun x ↦ equicontinuousAt_iInf_dom (hk x) theorem equicontinuousOn_iInf_dom {t : κ → TopologicalSpace X'} {F : ι → X' → α} {S : Set X'} {k : κ} (hk : EquicontinuousOn (tX := t k) F S) : EquicontinuousOn (tX := ⨅ k, t k) F S := fun x hx ↦ equicontinuousWithinAt_iInf_dom (hk x hx) theorem uniformEquicontinuous_iInf_dom {u : κ → UniformSpace β'} {F : ι → β' → α} {k : κ} (hk : UniformEquicontinuous (uβ := u k) F) : UniformEquicontinuous (uβ := ⨅ k, u k) F := by simp_rw [uniformEquicontinuous_iff_uniformContinuous (uβ := _)] at hk ⊢ exact uniformContinuous_iInf_dom hk theorem uniformEquicontinuousOn_iInf_dom {u : κ → UniformSpace β'} {F : ι → β' → α} {S : Set β'} {k : κ} (hk : UniformEquicontinuousOn (uβ := u k) F S) : UniformEquicontinuousOn (uβ := ⨅ k, u k) F S := by simp_rw [uniformEquicontinuousOn_iff_uniformContinuousOn (uβ := _)] at hk ⊢ unfold UniformContinuousOn rw [iInf_uniformity] exact hk.mono_left <| inf_le_inf_right _ <| iInf_le _ k theorem Filter.HasBasis.equicontinuousAt_iff_left {p : κ → Prop} {s : κ → Set X} {F : ι → X → α} {x₀ : X} (hX : (𝓝 x₀).HasBasis p s) : EquicontinuousAt F x₀ ↔ ∀ U ∈ 𝓤 α, ∃ k, p k ∧ ∀ x ∈ s k, ∀ i, (F i x₀, F i x) ∈ U := by rw [equicontinuousAt_iff_continuousAt, ContinuousAt, hX.tendsto_iff (UniformFun.hasBasis_nhds ι α _)] rfl #align filter.has_basis.equicontinuous_at_iff_left Filter.HasBasis.equicontinuousAt_iff_left theorem Filter.HasBasis.equicontinuousWithinAt_iff_left {p : κ → Prop} {s : κ → Set X} {F : ι → X → α} {S : Set X} {x₀ : X} (hX : (𝓝[S] x₀).HasBasis p s) : EquicontinuousWithinAt F S x₀ ↔ ∀ U ∈ 𝓤 α, ∃ k, p k ∧ ∀ x ∈ s k, ∀ i, (F i x₀, F i x) ∈ U := by rw [equicontinuousWithinAt_iff_continuousWithinAt, ContinuousWithinAt, hX.tendsto_iff (UniformFun.hasBasis_nhds ι α _)] rfl theorem Filter.HasBasis.equicontinuousAt_iff_right {p : κ → Prop} {s : κ → Set (α × α)} {F : ι → X → α} {x₀ : X} (hα : (𝓤 α).HasBasis p s) : EquicontinuousAt F x₀ ↔ ∀ k, p k → ∀ᶠ x in 𝓝 x₀, ∀ i, (F i x₀, F i x) ∈ s k := by rw [equicontinuousAt_iff_continuousAt, ContinuousAt, (UniformFun.hasBasis_nhds_of_basis ι α _ hα).tendsto_right_iff] rfl #align filter.has_basis.equicontinuous_at_iff_right Filter.HasBasis.equicontinuousAt_iff_right theorem Filter.HasBasis.equicontinuousWithinAt_iff_right {p : κ → Prop} {s : κ → Set (α × α)} {F : ι → X → α} {S : Set X} {x₀ : X} (hα : (𝓤 α).HasBasis p s) : EquicontinuousWithinAt F S x₀ ↔ ∀ k, p k → ∀ᶠ x in 𝓝[S] x₀, ∀ i, (F i x₀, F i x) ∈ s k := by rw [equicontinuousWithinAt_iff_continuousWithinAt, ContinuousWithinAt, (UniformFun.hasBasis_nhds_of_basis ι α _ hα).tendsto_right_iff] rfl theorem Filter.HasBasis.equicontinuousAt_iff {κ₁ κ₂ : Type*} {p₁ : κ₁ → Prop} {s₁ : κ₁ → Set X} {p₂ : κ₂ → Prop} {s₂ : κ₂ → Set (α × α)} {F : ι → X → α} {x₀ : X} (hX : (𝓝 x₀).HasBasis p₁ s₁) (hα : (𝓤 α).HasBasis p₂ s₂) : EquicontinuousAt F x₀ ↔ ∀ k₂, p₂ k₂ → ∃ k₁, p₁ k₁ ∧ ∀ x ∈ s₁ k₁, ∀ i, (F i x₀, F i x) ∈ s₂ k₂ := by rw [equicontinuousAt_iff_continuousAt, ContinuousAt, hX.tendsto_iff (UniformFun.hasBasis_nhds_of_basis ι α _ hα)] rfl #align filter.has_basis.equicontinuous_at_iff Filter.HasBasis.equicontinuousAt_iff theorem Filter.HasBasis.equicontinuousWithinAt_iff {κ₁ κ₂ : Type*} {p₁ : κ₁ → Prop} {s₁ : κ₁ → Set X} {p₂ : κ₂ → Prop} {s₂ : κ₂ → Set (α × α)} {F : ι → X → α} {S : Set X} {x₀ : X} (hX : (𝓝[S] x₀).HasBasis p₁ s₁) (hα : (𝓤 α).HasBasis p₂ s₂) : EquicontinuousWithinAt F S x₀ ↔ ∀ k₂, p₂ k₂ → ∃ k₁, p₁ k₁ ∧ ∀ x ∈ s₁ k₁, ∀ i, (F i x₀, F i x) ∈ s₂ k₂ := by rw [equicontinuousWithinAt_iff_continuousWithinAt, ContinuousWithinAt, hX.tendsto_iff (UniformFun.hasBasis_nhds_of_basis ι α _ hα)] rfl theorem Filter.HasBasis.uniformEquicontinuous_iff_left {p : κ → Prop} {s : κ → Set (β × β)} {F : ι → β → α} (hβ : (𝓤 β).HasBasis p s) : UniformEquicontinuous F ↔ ∀ U ∈ 𝓤 α, ∃ k, p k ∧ ∀ x y, (x, y) ∈ s k → ∀ i, (F i x, F i y) ∈ U := by rw [uniformEquicontinuous_iff_uniformContinuous, UniformContinuous, hβ.tendsto_iff (UniformFun.hasBasis_uniformity ι α)] simp only [Prod.forall] rfl #align filter.has_basis.uniform_equicontinuous_iff_left Filter.HasBasis.uniformEquicontinuous_iff_left theorem Filter.HasBasis.uniformEquicontinuousOn_iff_left {p : κ → Prop} {s : κ → Set (β × β)} {F : ι → β → α} {S : Set β} (hβ : (𝓤 β ⊓ 𝓟 (S ×ˢ S)).HasBasis p s) : UniformEquicontinuousOn F S ↔ ∀ U ∈ 𝓤 α, ∃ k, p k ∧ ∀ x y, (x, y) ∈ s k → ∀ i, (F i x, F i y) ∈ U := by rw [uniformEquicontinuousOn_iff_uniformContinuousOn, UniformContinuousOn, hβ.tendsto_iff (UniformFun.hasBasis_uniformity ι α)] simp only [Prod.forall] rfl theorem Filter.HasBasis.uniformEquicontinuous_iff_right {p : κ → Prop} {s : κ → Set (α × α)} {F : ι → β → α} (hα : (𝓤 α).HasBasis p s) : UniformEquicontinuous F ↔ ∀ k, p k → ∀ᶠ xy : β × β in 𝓤 β, ∀ i, (F i xy.1, F i xy.2) ∈ s k := by rw [uniformEquicontinuous_iff_uniformContinuous, UniformContinuous, (UniformFun.hasBasis_uniformity_of_basis ι α hα).tendsto_right_iff] rfl #align filter.has_basis.uniform_equicontinuous_iff_right Filter.HasBasis.uniformEquicontinuous_iff_right theorem Filter.HasBasis.uniformEquicontinuousOn_iff_right {p : κ → Prop} {s : κ → Set (α × α)} {F : ι → β → α} {S : Set β} (hα : (𝓤 α).HasBasis p s) : UniformEquicontinuousOn F S ↔ ∀ k, p k → ∀ᶠ xy : β × β in 𝓤 β ⊓ 𝓟 (S ×ˢ S), ∀ i, (F i xy.1, F i xy.2) ∈ s k := by rw [uniformEquicontinuousOn_iff_uniformContinuousOn, UniformContinuousOn, (UniformFun.hasBasis_uniformity_of_basis ι α hα).tendsto_right_iff] rfl theorem Filter.HasBasis.uniformEquicontinuous_iff {κ₁ κ₂ : Type*} {p₁ : κ₁ → Prop} {s₁ : κ₁ → Set (β × β)} {p₂ : κ₂ → Prop} {s₂ : κ₂ → Set (α × α)} {F : ι → β → α} (hβ : (𝓤 β).HasBasis p₁ s₁) (hα : (𝓤 α).HasBasis p₂ s₂) : UniformEquicontinuous F ↔ ∀ k₂, p₂ k₂ → ∃ k₁, p₁ k₁ ∧ ∀ x y, (x, y) ∈ s₁ k₁ → ∀ i, (F i x, F i y) ∈ s₂ k₂ := by rw [uniformEquicontinuous_iff_uniformContinuous, UniformContinuous, hβ.tendsto_iff (UniformFun.hasBasis_uniformity_of_basis ι α hα)] simp only [Prod.forall] rfl #align filter.has_basis.uniform_equicontinuous_iff Filter.HasBasis.uniformEquicontinuous_iff theorem Filter.HasBasis.uniformEquicontinuousOn_iff {κ₁ κ₂ : Type*} {p₁ : κ₁ → Prop} {s₁ : κ₁ → Set (β × β)} {p₂ : κ₂ → Prop} {s₂ : κ₂ → Set (α × α)} {F : ι → β → α} {S : Set β} (hβ : (𝓤 β ⊓ 𝓟 (S ×ˢ S)).HasBasis p₁ s₁) (hα : (𝓤 α).HasBasis p₂ s₂) : UniformEquicontinuousOn F S ↔ ∀ k₂, p₂ k₂ → ∃ k₁, p₁ k₁ ∧ ∀ x y, (x, y) ∈ s₁ k₁ → ∀ i, (F i x, F i y) ∈ s₂ k₂ := by rw [uniformEquicontinuousOn_iff_uniformContinuousOn, UniformContinuousOn, hβ.tendsto_iff (UniformFun.hasBasis_uniformity_of_basis ι α hα)] simp only [Prod.forall] rfl theorem UniformInducing.equicontinuousAt_iff {F : ι → X → α} {x₀ : X} {u : α → β} (hu : UniformInducing u) : EquicontinuousAt F x₀ ↔ EquicontinuousAt ((u ∘ ·) ∘ F) x₀ := by have := (UniformFun.postcomp_uniformInducing (α := ι) hu).inducing rw [equicontinuousAt_iff_continuousAt, equicontinuousAt_iff_continuousAt, this.continuousAt_iff] rfl #align uniform_inducing.equicontinuous_at_iff UniformInducing.equicontinuousAt_iff theorem UniformInducing.equicontinuousWithinAt_iff {F : ι → X → α} {S : Set X} {x₀ : X} {u : α → β} (hu : UniformInducing u) : EquicontinuousWithinAt F S x₀ ↔ EquicontinuousWithinAt ((u ∘ ·) ∘ F) S x₀ := by have := (UniformFun.postcomp_uniformInducing (α := ι) hu).inducing simp only [equicontinuousWithinAt_iff_continuousWithinAt, this.continuousWithinAt_iff] rfl theorem UniformInducing.equicontinuous_iff {F : ι → X → α} {u : α → β} (hu : UniformInducing u) : Equicontinuous F ↔ Equicontinuous ((u ∘ ·) ∘ F) := by congrm ∀ x, ?_ rw [hu.equicontinuousAt_iff] #align uniform_inducing.equicontinuous_iff UniformInducing.equicontinuous_iff theorem UniformInducing.equicontinuousOn_iff {F : ι → X → α} {S : Set X} {u : α → β} (hu : UniformInducing u) : EquicontinuousOn F S ↔ EquicontinuousOn ((u ∘ ·) ∘ F) S := by congrm ∀ x ∈ S, ?_ rw [hu.equicontinuousWithinAt_iff] theorem UniformInducing.uniformEquicontinuous_iff {F : ι → β → α} {u : α → γ} (hu : UniformInducing u) : UniformEquicontinuous F ↔ UniformEquicontinuous ((u ∘ ·) ∘ F) := by have := UniformFun.postcomp_uniformInducing (α := ι) hu simp only [uniformEquicontinuous_iff_uniformContinuous, this.uniformContinuous_iff] rfl #align uniform_inducing.uniform_equicontinuous_iff UniformInducing.uniformEquicontinuous_iff theorem UniformInducing.uniformEquicontinuousOn_iff {F : ι → β → α} {S : Set β} {u : α → γ} (hu : UniformInducing u) : UniformEquicontinuousOn F S ↔ UniformEquicontinuousOn ((u ∘ ·) ∘ F) S := by have := UniformFun.postcomp_uniformInducing (α := ι) hu simp only [uniformEquicontinuousOn_iff_uniformContinuousOn, this.uniformContinuousOn_iff] rfl theorem EquicontinuousWithinAt.closure' {A : Set Y} {u : Y → X → α} {S : Set X} {x₀ : X} (hA : EquicontinuousWithinAt (u ∘ (↑) : A → X → α) S x₀) (hu₁ : Continuous (S.restrict ∘ u)) (hu₂ : Continuous (eval x₀ ∘ u)) : EquicontinuousWithinAt (u ∘ (↑) : closure A → X → α) S x₀ := by intro U hU rcases mem_uniformity_isClosed hU with ⟨V, hV, hVclosed, hVU⟩ filter_upwards [hA V hV, eventually_mem_nhdsWithin] with x hx hxS rw [SetCoe.forall] at * change A ⊆ (fun f => (u f x₀, u f x)) ⁻¹' V at hx refine (closure_minimal hx <| hVclosed.preimage <| hu₂.prod_mk ?_).trans (preimage_mono hVU) exact (continuous_apply ⟨x, hxS⟩).comp hu₁ theorem EquicontinuousAt.closure' {A : Set Y} {u : Y → X → α} {x₀ : X} (hA : EquicontinuousAt (u ∘ (↑) : A → X → α) x₀) (hu : Continuous u) : EquicontinuousAt (u ∘ (↑) : closure A → X → α) x₀ := by rw [← equicontinuousWithinAt_univ] at hA ⊢ exact hA.closure' (Pi.continuous_restrict _ |>.comp hu) (continuous_apply x₀ |>.comp hu) #align equicontinuous_at.closure' EquicontinuousAt.closure' protected theorem Set.EquicontinuousAt.closure {A : Set (X → α)} {x₀ : X} (hA : A.EquicontinuousAt x₀) : (closure A).EquicontinuousAt x₀ := hA.closure' (u := id) continuous_id #align equicontinuous_at.closure Set.EquicontinuousAt.closure protected theorem Set.EquicontinuousWithinAt.closure {A : Set (X → α)} {S : Set X} {x₀ : X} (hA : A.EquicontinuousWithinAt S x₀) : (closure A).EquicontinuousWithinAt S x₀ := hA.closure' (u := id) (Pi.continuous_restrict _) (continuous_apply _) theorem Equicontinuous.closure' {A : Set Y} {u : Y → X → α} (hA : Equicontinuous (u ∘ (↑) : A → X → α)) (hu : Continuous u) : Equicontinuous (u ∘ (↑) : closure A → X → α) := fun x ↦ (hA x).closure' hu #align equicontinuous.closure' Equicontinuous.closure' theorem EquicontinuousOn.closure' {A : Set Y} {u : Y → X → α} {S : Set X} (hA : EquicontinuousOn (u ∘ (↑) : A → X → α) S) (hu : Continuous (S.restrict ∘ u)) : EquicontinuousOn (u ∘ (↑) : closure A → X → α) S := fun x hx ↦ (hA x hx).closure' hu <| by exact continuous_apply ⟨x, hx⟩ |>.comp hu protected theorem Set.Equicontinuous.closure {A : Set <| X → α} (hA : A.Equicontinuous) : (closure A).Equicontinuous := fun x ↦ Set.EquicontinuousAt.closure (hA x) #align equicontinuous.closure Set.Equicontinuous.closure protected theorem Set.EquicontinuousOn.closure {A : Set <| X → α} {S : Set X} (hA : A.EquicontinuousOn S) : (closure A).EquicontinuousOn S := fun x hx ↦ Set.EquicontinuousWithinAt.closure (hA x hx) theorem UniformEquicontinuousOn.closure' {A : Set Y} {u : Y → β → α} {S : Set β} (hA : UniformEquicontinuousOn (u ∘ (↑) : A → β → α) S) (hu : Continuous (S.restrict ∘ u)) : UniformEquicontinuousOn (u ∘ (↑) : closure A → β → α) S := by intro U hU rcases mem_uniformity_isClosed hU with ⟨V, hV, hVclosed, hVU⟩ filter_upwards [hA V hV, mem_inf_of_right (mem_principal_self _)] rintro ⟨x, y⟩ hxy ⟨hxS, hyS⟩ rw [SetCoe.forall] at * change A ⊆ (fun f => (u f x, u f y)) ⁻¹' V at hxy refine (closure_minimal hxy <| hVclosed.preimage <| .prod_mk ?_ ?_).trans (preimage_mono hVU) · exact (continuous_apply ⟨x, hxS⟩).comp hu · exact (continuous_apply ⟨y, hyS⟩).comp hu theorem UniformEquicontinuous.closure' {A : Set Y} {u : Y → β → α} (hA : UniformEquicontinuous (u ∘ (↑) : A → β → α)) (hu : Continuous u) : UniformEquicontinuous (u ∘ (↑) : closure A → β → α) := by rw [← uniformEquicontinuousOn_univ] at hA ⊢ exact hA.closure' (Pi.continuous_restrict _ |>.comp hu) #align uniform_equicontinuous.closure' UniformEquicontinuous.closure' protected theorem Set.UniformEquicontinuous.closure {A : Set <| β → α} (hA : A.UniformEquicontinuous) : (closure A).UniformEquicontinuous := UniformEquicontinuous.closure' (u := id) hA continuous_id #align uniform_equicontinuous.closure Set.UniformEquicontinuous.closure protected theorem Set.UniformEquicontinuousOn.closure {A : Set <| β → α} {S : Set β} (hA : A.UniformEquicontinuousOn S) : (closure A).UniformEquicontinuousOn S := UniformEquicontinuousOn.closure' (u := id) hA (Pi.continuous_restrict _) theorem Filter.Tendsto.continuousWithinAt_of_equicontinuousWithinAt {l : Filter ι} [l.NeBot] {F : ι → X → α} {f : X → α} {S : Set X} {x₀ : X} (h₁ : ∀ x ∈ S, Tendsto (F · x) l (𝓝 (f x))) (h₂ : Tendsto (F · x₀) l (𝓝 (f x₀))) (h₃ : EquicontinuousWithinAt F S x₀) : ContinuousWithinAt f S x₀ := by intro U hU; rw [mem_map] rcases UniformSpace.mem_nhds_iff.mp hU with ⟨V, hV, hVU⟩ rcases mem_uniformity_isClosed hV with ⟨W, hW, hWclosed, hWV⟩ filter_upwards [h₃ W hW, eventually_mem_nhdsWithin] with x hx hxS using hVU <| ball_mono hWV (f x₀) <| hWclosed.mem_of_tendsto (h₂.prod_mk_nhds (h₁ x hxS)) <| eventually_of_forall hx theorem Filter.Tendsto.continuousAt_of_equicontinuousAt {l : Filter ι} [l.NeBot] {F : ι → X → α} {f : X → α} {x₀ : X} (h₁ : Tendsto F l (𝓝 f)) (h₂ : EquicontinuousAt F x₀) : ContinuousAt f x₀ := by rw [← continuousWithinAt_univ, ← equicontinuousWithinAt_univ, tendsto_pi_nhds] at * exact continuousWithinAt_of_equicontinuousWithinAt (fun x _ ↦ h₁ x) (h₁ x₀) h₂ #align filter.tendsto.continuous_at_of_equicontinuous_at Filter.Tendsto.continuousAt_of_equicontinuousAt theorem Filter.Tendsto.continuous_of_equicontinuous {l : Filter ι} [l.NeBot] {F : ι → X → α} {f : X → α} (h₁ : Tendsto F l (𝓝 f)) (h₂ : Equicontinuous F) : Continuous f := continuous_iff_continuousAt.mpr fun x => h₁.continuousAt_of_equicontinuousAt (h₂ x) #align filter.tendsto.continuous_of_equicontinuous_at Filter.Tendsto.continuous_of_equicontinuous theorem Filter.Tendsto.continuousOn_of_equicontinuousOn {l : Filter ι} [l.NeBot] {F : ι → X → α} {f : X → α} {S : Set X} (h₁ : ∀ x ∈ S, Tendsto (F · x) l (𝓝 (f x))) (h₂ : EquicontinuousOn F S) : ContinuousOn f S := fun x hx ↦ Filter.Tendsto.continuousWithinAt_of_equicontinuousWithinAt h₁ (h₁ x hx) (h₂ x hx) theorem Filter.Tendsto.uniformContinuousOn_of_uniformEquicontinuousOn {l : Filter ι} [l.NeBot] {F : ι → β → α} {f : β → α} {S : Set β} (h₁ : ∀ x ∈ S, Tendsto (F · x) l (𝓝 (f x))) (h₂ : UniformEquicontinuousOn F S) : UniformContinuousOn f S := by intro U hU; rw [mem_map] rcases mem_uniformity_isClosed hU with ⟨V, hV, hVclosed, hVU⟩ filter_upwards [h₂ V hV, mem_inf_of_right (mem_principal_self _)] rintro ⟨x, y⟩ hxy ⟨hxS, hyS⟩ exact hVU <| hVclosed.mem_of_tendsto ((h₁ x hxS).prod_mk_nhds (h₁ y hyS)) <| eventually_of_forall hxy theorem Filter.Tendsto.uniformContinuous_of_uniformEquicontinuous {l : Filter ι} [l.NeBot] {F : ι → β → α} {f : β → α} (h₁ : Tendsto F l (𝓝 f)) (h₂ : UniformEquicontinuous F) : UniformContinuous f := by rw [← uniformContinuousOn_univ, ← uniformEquicontinuousOn_univ, tendsto_pi_nhds] at * exact uniformContinuousOn_of_uniformEquicontinuousOn (fun x _ ↦ h₁ x) h₂ #align filter.tendsto.uniform_continuous_of_uniform_equicontinuous Filter.Tendsto.uniformContinuous_of_uniformEquicontinuous
Mathlib/Topology/UniformSpace/Equicontinuity.lean
1,005
1,017
theorem EquicontinuousAt.tendsto_of_mem_closure {l : Filter ι} {F : ι → X → α} {f : X → α} {s : Set X} {x : X} {z : α} (hF : EquicontinuousAt F x) (hf : Tendsto f (𝓝[s] x) (𝓝 z)) (hs : ∀ y ∈ s, Tendsto (F · y) l (𝓝 (f y))) (hx : x ∈ closure s) : Tendsto (F · x) l (𝓝 z) := by
rw [(nhds_basis_uniformity (𝓤 α).basis_sets).tendsto_right_iff] at hf ⊢ intro U hU rcases comp_comp_symm_mem_uniformity_sets hU with ⟨V, hV, hVs, hVU⟩ rw [mem_closure_iff_nhdsWithin_neBot] at hx have : ∀ᶠ y in 𝓝[s] x, y ∈ s ∧ (∀ i, (F i x, F i y) ∈ V) ∧ (f y, z) ∈ V := eventually_mem_nhdsWithin.and <| ((hF V hV).filter_mono nhdsWithin_le_nhds).and (hf V hV) rcases this.exists with ⟨y, hys, hFy, hfy⟩ filter_upwards [hs y hys (ball_mem_nhds _ hV)] with i hi exact hVU ⟨_, ⟨_, hFy i, (mem_ball_symmetry hVs).2 hi⟩, hfy⟩
import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Algebra.Group.Int import Mathlib.Data.Nat.Dist import Mathlib.Data.Ordmap.Ordnode import Mathlib.Tactic.Abel import Mathlib.Tactic.Linarith #align_import data.ordmap.ordset from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69" variable {α : Type*} namespace Ordnode theorem not_le_delta {s} (H : 1 ≤ s) : ¬s ≤ delta * 0 := not_le_of_gt H #align ordnode.not_le_delta Ordnode.not_le_delta theorem delta_lt_false {a b : ℕ} (h₁ : delta * a < b) (h₂ : delta * b < a) : False := not_le_of_lt (lt_trans ((mul_lt_mul_left (by decide)).2 h₁) h₂) <| by simpa [mul_assoc] using Nat.mul_le_mul_right a (by decide : 1 ≤ delta * delta) #align ordnode.delta_lt_false Ordnode.delta_lt_false def realSize : Ordnode α → ℕ | nil => 0 | node _ l _ r => realSize l + realSize r + 1 #align ordnode.real_size Ordnode.realSize def Sized : Ordnode α → Prop | nil => True | node s l _ r => s = size l + size r + 1 ∧ Sized l ∧ Sized r #align ordnode.sized Ordnode.Sized theorem Sized.node' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (node' l x r) := ⟨rfl, hl, hr⟩ #align ordnode.sized.node' Ordnode.Sized.node' theorem Sized.eq_node' {s l x r} (h : @Sized α (node s l x r)) : node s l x r = .node' l x r := by rw [h.1] #align ordnode.sized.eq_node' Ordnode.Sized.eq_node' theorem Sized.size_eq {s l x r} (H : Sized (@node α s l x r)) : size (@node α s l x r) = size l + size r + 1 := H.1 #align ordnode.sized.size_eq Ordnode.Sized.size_eq @[elab_as_elim] theorem Sized.induction {t} (hl : @Sized α t) {C : Ordnode α → Prop} (H0 : C nil) (H1 : ∀ l x r, C l → C r → C (.node' l x r)) : C t := by induction t with | nil => exact H0 | node _ _ _ _ t_ih_l t_ih_r => rw [hl.eq_node'] exact H1 _ _ _ (t_ih_l hl.2.1) (t_ih_r hl.2.2) #align ordnode.sized.induction Ordnode.Sized.induction theorem size_eq_realSize : ∀ {t : Ordnode α}, Sized t → size t = realSize t | nil, _ => rfl | node s l x r, ⟨h₁, h₂, h₃⟩ => by rw [size, h₁, size_eq_realSize h₂, size_eq_realSize h₃]; rfl #align ordnode.size_eq_real_size Ordnode.size_eq_realSize @[simp] theorem Sized.size_eq_zero {t : Ordnode α} (ht : Sized t) : size t = 0 ↔ t = nil := by cases t <;> [simp;simp [ht.1]] #align ordnode.sized.size_eq_zero Ordnode.Sized.size_eq_zero theorem Sized.pos {s l x r} (h : Sized (@node α s l x r)) : 0 < s := by rw [h.1]; apply Nat.le_add_left #align ordnode.sized.pos Ordnode.Sized.pos theorem dual_dual : ∀ t : Ordnode α, dual (dual t) = t | nil => rfl | node s l x r => by rw [dual, dual, dual_dual l, dual_dual r] #align ordnode.dual_dual Ordnode.dual_dual @[simp] theorem size_dual (t : Ordnode α) : size (dual t) = size t := by cases t <;> rfl #align ordnode.size_dual Ordnode.size_dual def BalancedSz (l r : ℕ) : Prop := l + r ≤ 1 ∨ l ≤ delta * r ∧ r ≤ delta * l #align ordnode.balanced_sz Ordnode.BalancedSz instance BalancedSz.dec : DecidableRel BalancedSz := fun _ _ => Or.decidable #align ordnode.balanced_sz.dec Ordnode.BalancedSz.dec def Balanced : Ordnode α → Prop | nil => True | node _ l _ r => BalancedSz (size l) (size r) ∧ Balanced l ∧ Balanced r #align ordnode.balanced Ordnode.Balanced instance Balanced.dec : DecidablePred (@Balanced α) | nil => by unfold Balanced infer_instance | node _ l _ r => by unfold Balanced haveI := Balanced.dec l haveI := Balanced.dec r infer_instance #align ordnode.balanced.dec Ordnode.Balanced.dec @[symm] theorem BalancedSz.symm {l r : ℕ} : BalancedSz l r → BalancedSz r l := Or.imp (by rw [add_comm]; exact id) And.symm #align ordnode.balanced_sz.symm Ordnode.BalancedSz.symm theorem balancedSz_zero {l : ℕ} : BalancedSz l 0 ↔ l ≤ 1 := by simp (config := { contextual := true }) [BalancedSz] #align ordnode.balanced_sz_zero Ordnode.balancedSz_zero theorem balancedSz_up {l r₁ r₂ : ℕ} (h₁ : r₁ ≤ r₂) (h₂ : l + r₂ ≤ 1 ∨ r₂ ≤ delta * l) (H : BalancedSz l r₁) : BalancedSz l r₂ := by refine or_iff_not_imp_left.2 fun h => ?_ refine ⟨?_, h₂.resolve_left h⟩ cases H with | inl H => cases r₂ · cases h (le_trans (Nat.add_le_add_left (Nat.zero_le _) _) H) · exact le_trans (le_trans (Nat.le_add_right _ _) H) (Nat.le_add_left 1 _) | inr H => exact le_trans H.1 (Nat.mul_le_mul_left _ h₁) #align ordnode.balanced_sz_up Ordnode.balancedSz_up theorem balancedSz_down {l r₁ r₂ : ℕ} (h₁ : r₁ ≤ r₂) (h₂ : l + r₂ ≤ 1 ∨ l ≤ delta * r₁) (H : BalancedSz l r₂) : BalancedSz l r₁ := have : l + r₂ ≤ 1 → BalancedSz l r₁ := fun H => Or.inl (le_trans (Nat.add_le_add_left h₁ _) H) Or.casesOn H this fun H => Or.casesOn h₂ this fun h₂ => Or.inr ⟨h₂, le_trans h₁ H.2⟩ #align ordnode.balanced_sz_down Ordnode.balancedSz_down theorem Balanced.dual : ∀ {t : Ordnode α}, Balanced t → Balanced (dual t) | nil, _ => ⟨⟩ | node _ l _ r, ⟨b, bl, br⟩ => ⟨by rw [size_dual, size_dual]; exact b.symm, br.dual, bl.dual⟩ #align ordnode.balanced.dual Ordnode.Balanced.dual def node3L (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : Ordnode α := node' (node' l x m) y r #align ordnode.node3_l Ordnode.node3L def node3R (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : Ordnode α := node' l x (node' m y r) #align ordnode.node3_r Ordnode.node3R def node4L : Ordnode α → α → Ordnode α → α → Ordnode α → Ordnode α | l, x, node _ ml y mr, z, r => node' (node' l x ml) y (node' mr z r) | l, x, nil, z, r => node3L l x nil z r #align ordnode.node4_l Ordnode.node4L -- should not happen def node4R : Ordnode α → α → Ordnode α → α → Ordnode α → Ordnode α | l, x, node _ ml y mr, z, r => node' (node' l x ml) y (node' mr z r) | l, x, nil, z, r => node3R l x nil z r #align ordnode.node4_r Ordnode.node4R -- should not happen def rotateL : Ordnode α → α → Ordnode α → Ordnode α | l, x, node _ m y r => if size m < ratio * size r then node3L l x m y r else node4L l x m y r | l, x, nil => node' l x nil #align ordnode.rotate_l Ordnode.rotateL -- Porting note (#11467): during the port we marked these lemmas with `@[eqns]` -- to emulate the old Lean 3 behaviour. theorem rotateL_node (l : Ordnode α) (x : α) (sz : ℕ) (m : Ordnode α) (y : α) (r : Ordnode α) : rotateL l x (node sz m y r) = if size m < ratio * size r then node3L l x m y r else node4L l x m y r := rfl theorem rotateL_nil (l : Ordnode α) (x : α) : rotateL l x nil = node' l x nil := rfl -- should not happen def rotateR : Ordnode α → α → Ordnode α → Ordnode α | node _ l x m, y, r => if size m < ratio * size l then node3R l x m y r else node4R l x m y r | nil, y, r => node' nil y r #align ordnode.rotate_r Ordnode.rotateR -- Porting note (#11467): during the port we marked these lemmas with `@[eqns]` -- to emulate the old Lean 3 behaviour. theorem rotateR_node (sz : ℕ) (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : rotateR (node sz l x m) y r = if size m < ratio * size l then node3R l x m y r else node4R l x m y r := rfl theorem rotateR_nil (y : α) (r : Ordnode α) : rotateR nil y r = node' nil y r := rfl -- should not happen def balanceL' (l : Ordnode α) (x : α) (r : Ordnode α) : Ordnode α := if size l + size r ≤ 1 then node' l x r else if size l > delta * size r then rotateR l x r else node' l x r #align ordnode.balance_l' Ordnode.balanceL' def balanceR' (l : Ordnode α) (x : α) (r : Ordnode α) : Ordnode α := if size l + size r ≤ 1 then node' l x r else if size r > delta * size l then rotateL l x r else node' l x r #align ordnode.balance_r' Ordnode.balanceR' def balance' (l : Ordnode α) (x : α) (r : Ordnode α) : Ordnode α := if size l + size r ≤ 1 then node' l x r else if size r > delta * size l then rotateL l x r else if size l > delta * size r then rotateR l x r else node' l x r #align ordnode.balance' Ordnode.balance' theorem dual_node' (l : Ordnode α) (x : α) (r : Ordnode α) : dual (node' l x r) = node' (dual r) x (dual l) := by simp [node', add_comm] #align ordnode.dual_node' Ordnode.dual_node' theorem dual_node3L (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : dual (node3L l x m y r) = node3R (dual r) y (dual m) x (dual l) := by simp [node3L, node3R, dual_node', add_comm] #align ordnode.dual_node3_l Ordnode.dual_node3L theorem dual_node3R (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : dual (node3R l x m y r) = node3L (dual r) y (dual m) x (dual l) := by simp [node3L, node3R, dual_node', add_comm] #align ordnode.dual_node3_r Ordnode.dual_node3R theorem dual_node4L (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : dual (node4L l x m y r) = node4R (dual r) y (dual m) x (dual l) := by cases m <;> simp [node4L, node4R, node3R, dual_node3L, dual_node', add_comm] #align ordnode.dual_node4_l Ordnode.dual_node4L theorem dual_node4R (l : Ordnode α) (x : α) (m : Ordnode α) (y : α) (r : Ordnode α) : dual (node4R l x m y r) = node4L (dual r) y (dual m) x (dual l) := by cases m <;> simp [node4L, node4R, node3L, dual_node3R, dual_node', add_comm] #align ordnode.dual_node4_r Ordnode.dual_node4R theorem dual_rotateL (l : Ordnode α) (x : α) (r : Ordnode α) : dual (rotateL l x r) = rotateR (dual r) x (dual l) := by cases r <;> simp [rotateL, rotateR, dual_node']; split_ifs <;> simp [dual_node3L, dual_node4L, node3R, add_comm] #align ordnode.dual_rotate_l Ordnode.dual_rotateL theorem dual_rotateR (l : Ordnode α) (x : α) (r : Ordnode α) : dual (rotateR l x r) = rotateL (dual r) x (dual l) := by rw [← dual_dual (rotateL _ _ _), dual_rotateL, dual_dual, dual_dual] #align ordnode.dual_rotate_r Ordnode.dual_rotateR theorem dual_balance' (l : Ordnode α) (x : α) (r : Ordnode α) : dual (balance' l x r) = balance' (dual r) x (dual l) := by simp [balance', add_comm]; split_ifs with h h_1 h_2 <;> simp [dual_node', dual_rotateL, dual_rotateR, add_comm] cases delta_lt_false h_1 h_2 #align ordnode.dual_balance' Ordnode.dual_balance' theorem dual_balanceL (l : Ordnode α) (x : α) (r : Ordnode α) : dual (balanceL l x r) = balanceR (dual r) x (dual l) := by unfold balanceL balanceR cases' r with rs rl rx rr · cases' l with ls ll lx lr; · rfl cases' ll with lls lll llx llr <;> cases' lr with lrs lrl lrx lrr <;> dsimp only [dual, id] <;> try rfl split_ifs with h <;> repeat simp [h, add_comm] · cases' l with ls ll lx lr; · rfl dsimp only [dual, id] split_ifs; swap; · simp [add_comm] cases' ll with lls lll llx llr <;> cases' lr with lrs lrl lrx lrr <;> try rfl dsimp only [dual, id] split_ifs with h <;> simp [h, add_comm] #align ordnode.dual_balance_l Ordnode.dual_balanceL theorem dual_balanceR (l : Ordnode α) (x : α) (r : Ordnode α) : dual (balanceR l x r) = balanceL (dual r) x (dual l) := by rw [← dual_dual (balanceL _ _ _), dual_balanceL, dual_dual, dual_dual] #align ordnode.dual_balance_r Ordnode.dual_balanceR theorem Sized.node3L {l x m y r} (hl : @Sized α l) (hm : Sized m) (hr : Sized r) : Sized (node3L l x m y r) := (hl.node' hm).node' hr #align ordnode.sized.node3_l Ordnode.Sized.node3L theorem Sized.node3R {l x m y r} (hl : @Sized α l) (hm : Sized m) (hr : Sized r) : Sized (node3R l x m y r) := hl.node' (hm.node' hr) #align ordnode.sized.node3_r Ordnode.Sized.node3R theorem Sized.node4L {l x m y r} (hl : @Sized α l) (hm : Sized m) (hr : Sized r) : Sized (node4L l x m y r) := by cases m <;> [exact (hl.node' hm).node' hr; exact (hl.node' hm.2.1).node' (hm.2.2.node' hr)] #align ordnode.sized.node4_l Ordnode.Sized.node4L theorem node3L_size {l x m y r} : size (@node3L α l x m y r) = size l + size m + size r + 2 := by dsimp [node3L, node', size]; rw [add_right_comm _ 1] #align ordnode.node3_l_size Ordnode.node3L_size theorem node3R_size {l x m y r} : size (@node3R α l x m y r) = size l + size m + size r + 2 := by dsimp [node3R, node', size]; rw [← add_assoc, ← add_assoc] #align ordnode.node3_r_size Ordnode.node3R_size theorem node4L_size {l x m y r} (hm : Sized m) : size (@node4L α l x m y r) = size l + size m + size r + 2 := by cases m <;> simp [node4L, node3L, node'] <;> [abel; (simp [size, hm.1]; abel)] #align ordnode.node4_l_size Ordnode.node4L_size theorem Sized.dual : ∀ {t : Ordnode α}, Sized t → Sized (dual t) | nil, _ => ⟨⟩ | node _ l _ r, ⟨rfl, sl, sr⟩ => ⟨by simp [size_dual, add_comm], Sized.dual sr, Sized.dual sl⟩ #align ordnode.sized.dual Ordnode.Sized.dual theorem Sized.dual_iff {t : Ordnode α} : Sized (.dual t) ↔ Sized t := ⟨fun h => by rw [← dual_dual t]; exact h.dual, Sized.dual⟩ #align ordnode.sized.dual_iff Ordnode.Sized.dual_iff theorem Sized.rotateL {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (rotateL l x r) := by cases r; · exact hl.node' hr rw [Ordnode.rotateL_node]; split_ifs · exact hl.node3L hr.2.1 hr.2.2 · exact hl.node4L hr.2.1 hr.2.2 #align ordnode.sized.rotate_l Ordnode.Sized.rotateL theorem Sized.rotateR {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (rotateR l x r) := Sized.dual_iff.1 <| by rw [dual_rotateR]; exact hr.dual.rotateL hl.dual #align ordnode.sized.rotate_r Ordnode.Sized.rotateR theorem Sized.rotateL_size {l x r} (hm : Sized r) : size (@Ordnode.rotateL α l x r) = size l + size r + 1 := by cases r <;> simp [Ordnode.rotateL] simp only [hm.1] split_ifs <;> simp [node3L_size, node4L_size hm.2.1] <;> abel #align ordnode.sized.rotate_l_size Ordnode.Sized.rotateL_size theorem Sized.rotateR_size {l x r} (hl : Sized l) : size (@Ordnode.rotateR α l x r) = size l + size r + 1 := by rw [← size_dual, dual_rotateR, hl.dual.rotateL_size, size_dual, size_dual, add_comm (size l)] #align ordnode.sized.rotate_r_size Ordnode.Sized.rotateR_size theorem Sized.balance' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (balance' l x r) := by unfold balance'; split_ifs · exact hl.node' hr · exact hl.rotateL hr · exact hl.rotateR hr · exact hl.node' hr #align ordnode.sized.balance' Ordnode.Sized.balance' theorem size_balance' {l x r} (hl : @Sized α l) (hr : Sized r) : size (@balance' α l x r) = size l + size r + 1 := by unfold balance'; split_ifs · rfl · exact hr.rotateL_size · exact hl.rotateR_size · rfl #align ordnode.size_balance' Ordnode.size_balance' theorem All.imp {P Q : α → Prop} (H : ∀ a, P a → Q a) : ∀ {t}, All P t → All Q t | nil, _ => ⟨⟩ | node _ _ _ _, ⟨h₁, h₂, h₃⟩ => ⟨h₁.imp H, H _ h₂, h₃.imp H⟩ #align ordnode.all.imp Ordnode.All.imp theorem Any.imp {P Q : α → Prop} (H : ∀ a, P a → Q a) : ∀ {t}, Any P t → Any Q t | nil => id | node _ _ _ _ => Or.imp (Any.imp H) <| Or.imp (H _) (Any.imp H) #align ordnode.any.imp Ordnode.Any.imp theorem all_singleton {P : α → Prop} {x : α} : All P (singleton x) ↔ P x := ⟨fun h => h.2.1, fun h => ⟨⟨⟩, h, ⟨⟩⟩⟩ #align ordnode.all_singleton Ordnode.all_singleton theorem any_singleton {P : α → Prop} {x : α} : Any P (singleton x) ↔ P x := ⟨by rintro (⟨⟨⟩⟩ | h | ⟨⟨⟩⟩); exact h, fun h => Or.inr (Or.inl h)⟩ #align ordnode.any_singleton Ordnode.any_singleton theorem all_dual {P : α → Prop} : ∀ {t : Ordnode α}, All P (dual t) ↔ All P t | nil => Iff.rfl | node _ _l _x _r => ⟨fun ⟨hr, hx, hl⟩ => ⟨all_dual.1 hl, hx, all_dual.1 hr⟩, fun ⟨hl, hx, hr⟩ => ⟨all_dual.2 hr, hx, all_dual.2 hl⟩⟩ #align ordnode.all_dual Ordnode.all_dual theorem all_iff_forall {P : α → Prop} : ∀ {t}, All P t ↔ ∀ x, Emem x t → P x | nil => (iff_true_intro <| by rintro _ ⟨⟩).symm | node _ l x r => by simp [All, Emem, all_iff_forall, Any, or_imp, forall_and] #align ordnode.all_iff_forall Ordnode.all_iff_forall theorem any_iff_exists {P : α → Prop} : ∀ {t}, Any P t ↔ ∃ x, Emem x t ∧ P x | nil => ⟨by rintro ⟨⟩, by rintro ⟨_, ⟨⟩, _⟩⟩ | node _ l x r => by simp only [Emem]; simp [Any, any_iff_exists, or_and_right, exists_or] #align ordnode.any_iff_exists Ordnode.any_iff_exists theorem emem_iff_all {x : α} {t} : Emem x t ↔ ∀ P, All P t → P x := ⟨fun h _ al => all_iff_forall.1 al _ h, fun H => H _ <| all_iff_forall.2 fun _ => id⟩ #align ordnode.emem_iff_all Ordnode.emem_iff_all theorem all_node' {P l x r} : @All α P (node' l x r) ↔ All P l ∧ P x ∧ All P r := Iff.rfl #align ordnode.all_node' Ordnode.all_node' theorem all_node3L {P l x m y r} : @All α P (node3L l x m y r) ↔ All P l ∧ P x ∧ All P m ∧ P y ∧ All P r := by simp [node3L, all_node', and_assoc] #align ordnode.all_node3_l Ordnode.all_node3L theorem all_node3R {P l x m y r} : @All α P (node3R l x m y r) ↔ All P l ∧ P x ∧ All P m ∧ P y ∧ All P r := Iff.rfl #align ordnode.all_node3_r Ordnode.all_node3R theorem all_node4L {P l x m y r} : @All α P (node4L l x m y r) ↔ All P l ∧ P x ∧ All P m ∧ P y ∧ All P r := by cases m <;> simp [node4L, all_node', All, all_node3L, and_assoc] #align ordnode.all_node4_l Ordnode.all_node4L theorem all_node4R {P l x m y r} : @All α P (node4R l x m y r) ↔ All P l ∧ P x ∧ All P m ∧ P y ∧ All P r := by cases m <;> simp [node4R, all_node', All, all_node3R, and_assoc] #align ordnode.all_node4_r Ordnode.all_node4R theorem all_rotateL {P l x r} : @All α P (rotateL l x r) ↔ All P l ∧ P x ∧ All P r := by cases r <;> simp [rotateL, all_node']; split_ifs <;> simp [all_node3L, all_node4L, All, and_assoc] #align ordnode.all_rotate_l Ordnode.all_rotateL theorem all_rotateR {P l x r} : @All α P (rotateR l x r) ↔ All P l ∧ P x ∧ All P r := by rw [← all_dual, dual_rotateR, all_rotateL]; simp [all_dual, and_comm, and_left_comm, and_assoc] #align ordnode.all_rotate_r Ordnode.all_rotateR theorem all_balance' {P l x r} : @All α P (balance' l x r) ↔ All P l ∧ P x ∧ All P r := by rw [balance']; split_ifs <;> simp [all_node', all_rotateL, all_rotateR] #align ordnode.all_balance' Ordnode.all_balance' theorem foldr_cons_eq_toList : ∀ (t : Ordnode α) (r : List α), t.foldr List.cons r = toList t ++ r | nil, r => rfl | node _ l x r, r' => by rw [foldr, foldr_cons_eq_toList l, foldr_cons_eq_toList r, ← List.cons_append, ← List.append_assoc, ← foldr_cons_eq_toList l]; rfl #align ordnode.foldr_cons_eq_to_list Ordnode.foldr_cons_eq_toList @[simp] theorem toList_nil : toList (@nil α) = [] := rfl #align ordnode.to_list_nil Ordnode.toList_nil @[simp] theorem toList_node (s l x r) : toList (@node α s l x r) = toList l ++ x :: toList r := by rw [toList, foldr, foldr_cons_eq_toList]; rfl #align ordnode.to_list_node Ordnode.toList_node theorem emem_iff_mem_toList {x : α} {t} : Emem x t ↔ x ∈ toList t := by unfold Emem; induction t <;> simp [Any, *, or_assoc] #align ordnode.emem_iff_mem_to_list Ordnode.emem_iff_mem_toList theorem length_toList' : ∀ t : Ordnode α, (toList t).length = t.realSize | nil => rfl | node _ l _ r => by rw [toList_node, List.length_append, List.length_cons, length_toList' l, length_toList' r]; rfl #align ordnode.length_to_list' Ordnode.length_toList' theorem length_toList {t : Ordnode α} (h : Sized t) : (toList t).length = t.size := by rw [length_toList', size_eq_realSize h] #align ordnode.length_to_list Ordnode.length_toList theorem equiv_iff {t₁ t₂ : Ordnode α} (h₁ : Sized t₁) (h₂ : Sized t₂) : Equiv t₁ t₂ ↔ toList t₁ = toList t₂ := and_iff_right_of_imp fun h => by rw [← length_toList h₁, h, length_toList h₂] #align ordnode.equiv_iff Ordnode.equiv_iff theorem pos_size_of_mem [LE α] [@DecidableRel α (· ≤ ·)] {x : α} {t : Ordnode α} (h : Sized t) (h_mem : x ∈ t) : 0 < size t := by cases t; · { contradiction }; · { simp [h.1] } #align ordnode.pos_size_of_mem Ordnode.pos_size_of_mem theorem findMin'_dual : ∀ (t) (x : α), findMin' (dual t) x = findMax' x t | nil, _ => rfl | node _ _ x r, _ => findMin'_dual r x #align ordnode.find_min'_dual Ordnode.findMin'_dual theorem findMax'_dual (t) (x : α) : findMax' x (dual t) = findMin' t x := by rw [← findMin'_dual, dual_dual] #align ordnode.find_max'_dual Ordnode.findMax'_dual theorem findMin_dual : ∀ t : Ordnode α, findMin (dual t) = findMax t | nil => rfl | node _ _ _ _ => congr_arg some <| findMin'_dual _ _ #align ordnode.find_min_dual Ordnode.findMin_dual theorem findMax_dual (t : Ordnode α) : findMax (dual t) = findMin t := by rw [← findMin_dual, dual_dual] #align ordnode.find_max_dual Ordnode.findMax_dual theorem dual_eraseMin : ∀ t : Ordnode α, dual (eraseMin t) = eraseMax (dual t) | nil => rfl | node _ nil x r => rfl | node _ (node sz l' y r') x r => by rw [eraseMin, dual_balanceR, dual_eraseMin (node sz l' y r'), dual, dual, dual, eraseMax] #align ordnode.dual_erase_min Ordnode.dual_eraseMin theorem dual_eraseMax (t : Ordnode α) : dual (eraseMax t) = eraseMin (dual t) := by rw [← dual_dual (eraseMin _), dual_eraseMin, dual_dual] #align ordnode.dual_erase_max Ordnode.dual_eraseMax theorem splitMin_eq : ∀ (s l) (x : α) (r), splitMin' l x r = (findMin' l x, eraseMin (node s l x r)) | _, nil, x, r => rfl | _, node ls ll lx lr, x, r => by rw [splitMin', splitMin_eq ls ll lx lr, findMin', eraseMin] #align ordnode.split_min_eq Ordnode.splitMin_eq theorem splitMax_eq : ∀ (s l) (x : α) (r), splitMax' l x r = (eraseMax (node s l x r), findMax' x r) | _, l, x, nil => rfl | _, l, x, node ls ll lx lr => by rw [splitMax', splitMax_eq ls ll lx lr, findMax', eraseMax] #align ordnode.split_max_eq Ordnode.splitMax_eq -- @[elab_as_elim] -- Porting note: unexpected eliminator resulting type theorem findMin'_all {P : α → Prop} : ∀ (t) (x : α), All P t → P x → P (findMin' t x) | nil, _x, _, hx => hx | node _ ll lx _, _, ⟨h₁, h₂, _⟩, _ => findMin'_all ll lx h₁ h₂ #align ordnode.find_min'_all Ordnode.findMin'_all -- @[elab_as_elim] -- Porting note: unexpected eliminator resulting type theorem findMax'_all {P : α → Prop} : ∀ (x : α) (t), P x → All P t → P (findMax' x t) | _x, nil, hx, _ => hx | _, node _ _ lx lr, _, ⟨_, h₂, h₃⟩ => findMax'_all lx lr h₂ h₃ #align ordnode.find_max'_all Ordnode.findMax'_all @[simp] theorem merge_nil_left (t : Ordnode α) : merge t nil = t := by cases t <;> rfl #align ordnode.merge_nil_left Ordnode.merge_nil_left @[simp] theorem merge_nil_right (t : Ordnode α) : merge nil t = t := rfl #align ordnode.merge_nil_right Ordnode.merge_nil_right @[simp] theorem merge_node {ls ll lx lr rs rl rx rr} : merge (@node α ls ll lx lr) (node rs rl rx rr) = if delta * ls < rs then balanceL (merge (node ls ll lx lr) rl) rx rr else if delta * rs < ls then balanceR ll lx (merge lr (node rs rl rx rr)) else glue (node ls ll lx lr) (node rs rl rx rr) := rfl #align ordnode.merge_node Ordnode.merge_node theorem dual_insert [Preorder α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] (x : α) : ∀ t : Ordnode α, dual (Ordnode.insert x t) = @Ordnode.insert αᵒᵈ _ _ x (dual t) | nil => rfl | node _ l y r => by have : @cmpLE αᵒᵈ _ _ x y = cmpLE y x := rfl rw [Ordnode.insert, dual, Ordnode.insert, this, ← cmpLE_swap x y] cases cmpLE x y <;> simp [Ordering.swap, Ordnode.insert, dual_balanceL, dual_balanceR, dual_insert] #align ordnode.dual_insert Ordnode.dual_insert theorem balance_eq_balance' {l x r} (hl : Balanced l) (hr : Balanced r) (sl : Sized l) (sr : Sized r) : @balance α l x r = balance' l x r := by cases' l with ls ll lx lr · cases' r with rs rl rx rr · rfl · rw [sr.eq_node'] at hr ⊢ cases' rl with rls rll rlx rlr <;> cases' rr with rrs rrl rrx rrr <;> dsimp [balance, balance'] · rfl · have : size rrl = 0 ∧ size rrr = 0 := by have := balancedSz_zero.1 hr.1.symm rwa [size, sr.2.2.1, Nat.succ_le_succ_iff, Nat.le_zero, add_eq_zero_iff] at this cases sr.2.2.2.1.size_eq_zero.1 this.1 cases sr.2.2.2.2.size_eq_zero.1 this.2 obtain rfl : rrs = 1 := sr.2.2.1 rw [if_neg, if_pos, rotateL_node, if_pos]; · rfl all_goals dsimp only [size]; decide · have : size rll = 0 ∧ size rlr = 0 := by have := balancedSz_zero.1 hr.1 rwa [size, sr.2.1.1, Nat.succ_le_succ_iff, Nat.le_zero, add_eq_zero_iff] at this cases sr.2.1.2.1.size_eq_zero.1 this.1 cases sr.2.1.2.2.size_eq_zero.1 this.2 obtain rfl : rls = 1 := sr.2.1.1 rw [if_neg, if_pos, rotateL_node, if_neg]; · rfl all_goals dsimp only [size]; decide · symm; rw [zero_add, if_neg, if_pos, rotateL] · dsimp only [size_node]; split_ifs · simp [node3L, node']; abel · simp [node4L, node', sr.2.1.1]; abel · apply Nat.zero_lt_succ · exact not_le_of_gt (Nat.succ_lt_succ (add_pos sr.2.1.pos sr.2.2.pos)) · cases' r with rs rl rx rr · rw [sl.eq_node'] at hl ⊢ cases' ll with lls lll llx llr <;> cases' lr with lrs lrl lrx lrr <;> dsimp [balance, balance'] · rfl · have : size lrl = 0 ∧ size lrr = 0 := by have := balancedSz_zero.1 hl.1.symm rwa [size, sl.2.2.1, Nat.succ_le_succ_iff, Nat.le_zero, add_eq_zero_iff] at this cases sl.2.2.2.1.size_eq_zero.1 this.1 cases sl.2.2.2.2.size_eq_zero.1 this.2 obtain rfl : lrs = 1 := sl.2.2.1 rw [if_neg, if_neg, if_pos, rotateR_node, if_neg]; · rfl all_goals dsimp only [size]; decide · have : size lll = 0 ∧ size llr = 0 := by have := balancedSz_zero.1 hl.1 rwa [size, sl.2.1.1, Nat.succ_le_succ_iff, Nat.le_zero, add_eq_zero_iff] at this cases sl.2.1.2.1.size_eq_zero.1 this.1 cases sl.2.1.2.2.size_eq_zero.1 this.2 obtain rfl : lls = 1 := sl.2.1.1 rw [if_neg, if_neg, if_pos, rotateR_node, if_pos]; · rfl all_goals dsimp only [size]; decide · symm; rw [if_neg, if_neg, if_pos, rotateR] · dsimp only [size_node]; split_ifs · simp [node3R, node']; abel · simp [node4R, node', sl.2.2.1]; abel · apply Nat.zero_lt_succ · apply Nat.not_lt_zero · exact not_le_of_gt (Nat.succ_lt_succ (add_pos sl.2.1.pos sl.2.2.pos)) · simp [balance, balance'] symm; rw [if_neg] · split_ifs with h h_1 · have rd : delta ≤ size rl + size rr := by have := lt_of_le_of_lt (Nat.mul_le_mul_left _ sl.pos) h rwa [sr.1, Nat.lt_succ_iff] at this cases' rl with rls rll rlx rlr · rw [size, zero_add] at rd exact absurd (le_trans rd (balancedSz_zero.1 hr.1.symm)) (by decide) cases' rr with rrs rrl rrx rrr · exact absurd (le_trans rd (balancedSz_zero.1 hr.1)) (by decide) dsimp [rotateL]; split_ifs · simp [node3L, node', sr.1]; abel · simp [node4L, node', sr.1, sr.2.1.1]; abel · have ld : delta ≤ size ll + size lr := by have := lt_of_le_of_lt (Nat.mul_le_mul_left _ sr.pos) h_1 rwa [sl.1, Nat.lt_succ_iff] at this cases' ll with lls lll llx llr · rw [size, zero_add] at ld exact absurd (le_trans ld (balancedSz_zero.1 hl.1.symm)) (by decide) cases' lr with lrs lrl lrx lrr · exact absurd (le_trans ld (balancedSz_zero.1 hl.1)) (by decide) dsimp [rotateR]; split_ifs · simp [node3R, node', sl.1]; abel · simp [node4R, node', sl.1, sl.2.2.1]; abel · simp [node'] · exact not_le_of_gt (add_le_add (Nat.succ_le_of_lt sl.pos) (Nat.succ_le_of_lt sr.pos)) #align ordnode.balance_eq_balance' Ordnode.balance_eq_balance' theorem balanceL_eq_balance {l x r} (sl : Sized l) (sr : Sized r) (H1 : size l = 0 → size r ≤ 1) (H2 : 1 ≤ size l → 1 ≤ size r → size r ≤ delta * size l) : @balanceL α l x r = balance l x r := by cases' r with rs rl rx rr · rfl · cases' l with ls ll lx lr · have : size rl = 0 ∧ size rr = 0 := by have := H1 rfl rwa [size, sr.1, Nat.succ_le_succ_iff, Nat.le_zero, add_eq_zero_iff] at this cases sr.2.1.size_eq_zero.1 this.1 cases sr.2.2.size_eq_zero.1 this.2 rw [sr.eq_node']; rfl · replace H2 : ¬rs > delta * ls := not_lt_of_le (H2 sl.pos sr.pos) simp [balanceL, balance, H2]; split_ifs <;> simp [add_comm] #align ordnode.balance_l_eq_balance Ordnode.balanceL_eq_balance def Raised (n m : ℕ) : Prop := m = n ∨ m = n + 1 #align ordnode.raised Ordnode.Raised theorem raised_iff {n m} : Raised n m ↔ n ≤ m ∧ m ≤ n + 1 := by constructor · rintro (rfl | rfl) · exact ⟨le_rfl, Nat.le_succ _⟩ · exact ⟨Nat.le_succ _, le_rfl⟩ · rintro ⟨h₁, h₂⟩ rcases eq_or_lt_of_le h₁ with (rfl | h₁) · exact Or.inl rfl · exact Or.inr (le_antisymm h₂ h₁) #align ordnode.raised_iff Ordnode.raised_iff theorem Raised.dist_le {n m} (H : Raised n m) : Nat.dist n m ≤ 1 := by cases' raised_iff.1 H with H1 H2; rwa [Nat.dist_eq_sub_of_le H1, tsub_le_iff_left] #align ordnode.raised.dist_le Ordnode.Raised.dist_le theorem Raised.dist_le' {n m} (H : Raised n m) : Nat.dist m n ≤ 1 := by rw [Nat.dist_comm]; exact H.dist_le #align ordnode.raised.dist_le' Ordnode.Raised.dist_le' theorem Raised.add_left (k) {n m} (H : Raised n m) : Raised (k + n) (k + m) := by rcases H with (rfl | rfl) · exact Or.inl rfl · exact Or.inr rfl #align ordnode.raised.add_left Ordnode.Raised.add_left theorem Raised.add_right (k) {n m} (H : Raised n m) : Raised (n + k) (m + k) := by rw [add_comm, add_comm m]; exact H.add_left _ #align ordnode.raised.add_right Ordnode.Raised.add_right theorem Raised.right {l x₁ x₂ r₁ r₂} (H : Raised (size r₁) (size r₂)) : Raised (size (@node' α l x₁ r₁)) (size (@node' α l x₂ r₂)) := by rw [node', size_node, size_node]; generalize size r₂ = m at H ⊢ rcases H with (rfl | rfl) · exact Or.inl rfl · exact Or.inr rfl #align ordnode.raised.right Ordnode.Raised.right theorem balanceL_eq_balance' {l x r} (hl : Balanced l) (hr : Balanced r) (sl : Sized l) (sr : Sized r) (H : (∃ l', Raised l' (size l) ∧ BalancedSz l' (size r)) ∨ ∃ r', Raised (size r) r' ∧ BalancedSz (size l) r') : @balanceL α l x r = balance' l x r := by rw [← balance_eq_balance' hl hr sl sr, balanceL_eq_balance sl sr] · intro l0; rw [l0] at H rcases H with (⟨_, ⟨⟨⟩⟩ | ⟨⟨⟩⟩, H⟩ | ⟨r', e, H⟩) · exact balancedSz_zero.1 H.symm exact le_trans (raised_iff.1 e).1 (balancedSz_zero.1 H.symm) · intro l1 _ rcases H with (⟨l', e, H | ⟨_, H₂⟩⟩ | ⟨r', e, H | ⟨_, H₂⟩⟩) · exact le_trans (le_trans (Nat.le_add_left _ _) H) (mul_pos (by decide) l1 : (0 : ℕ) < _) · exact le_trans H₂ (Nat.mul_le_mul_left _ (raised_iff.1 e).1) · cases raised_iff.1 e; unfold delta; omega · exact le_trans (raised_iff.1 e).1 H₂ #align ordnode.balance_l_eq_balance' Ordnode.balanceL_eq_balance' theorem balance_sz_dual {l r} (H : (∃ l', Raised (@size α l) l' ∧ BalancedSz l' (@size α r)) ∨ ∃ r', Raised r' (size r) ∧ BalancedSz (size l) r') : (∃ l', Raised l' (size (dual r)) ∧ BalancedSz l' (size (dual l))) ∨ ∃ r', Raised (size (dual l)) r' ∧ BalancedSz (size (dual r)) r' := by rw [size_dual, size_dual] exact H.symm.imp (Exists.imp fun _ => And.imp_right BalancedSz.symm) (Exists.imp fun _ => And.imp_right BalancedSz.symm) #align ordnode.balance_sz_dual Ordnode.balance_sz_dual theorem size_balanceL {l x r} (hl : Balanced l) (hr : Balanced r) (sl : Sized l) (sr : Sized r) (H : (∃ l', Raised l' (size l) ∧ BalancedSz l' (size r)) ∨ ∃ r', Raised (size r) r' ∧ BalancedSz (size l) r') : size (@balanceL α l x r) = size l + size r + 1 := by rw [balanceL_eq_balance' hl hr sl sr H, size_balance' sl sr] #align ordnode.size_balance_l Ordnode.size_balanceL theorem all_balanceL {P l x r} (hl : Balanced l) (hr : Balanced r) (sl : Sized l) (sr : Sized r) (H : (∃ l', Raised l' (size l) ∧ BalancedSz l' (size r)) ∨ ∃ r', Raised (size r) r' ∧ BalancedSz (size l) r') : All P (@balanceL α l x r) ↔ All P l ∧ P x ∧ All P r := by rw [balanceL_eq_balance' hl hr sl sr H, all_balance'] #align ordnode.all_balance_l Ordnode.all_balanceL theorem balanceR_eq_balance' {l x r} (hl : Balanced l) (hr : Balanced r) (sl : Sized l) (sr : Sized r) (H : (∃ l', Raised (size l) l' ∧ BalancedSz l' (size r)) ∨ ∃ r', Raised r' (size r) ∧ BalancedSz (size l) r') : @balanceR α l x r = balance' l x r := by rw [← dual_dual (balanceR l x r), dual_balanceR, balanceL_eq_balance' hr.dual hl.dual sr.dual sl.dual (balance_sz_dual H), ← dual_balance', dual_dual] #align ordnode.balance_r_eq_balance' Ordnode.balanceR_eq_balance' theorem size_balanceR {l x r} (hl : Balanced l) (hr : Balanced r) (sl : Sized l) (sr : Sized r) (H : (∃ l', Raised (size l) l' ∧ BalancedSz l' (size r)) ∨ ∃ r', Raised r' (size r) ∧ BalancedSz (size l) r') : size (@balanceR α l x r) = size l + size r + 1 := by rw [balanceR_eq_balance' hl hr sl sr H, size_balance' sl sr] #align ordnode.size_balance_r Ordnode.size_balanceR theorem all_balanceR {P l x r} (hl : Balanced l) (hr : Balanced r) (sl : Sized l) (sr : Sized r) (H : (∃ l', Raised (size l) l' ∧ BalancedSz l' (size r)) ∨ ∃ r', Raised r' (size r) ∧ BalancedSz (size l) r') : All P (@balanceR α l x r) ↔ All P l ∧ P x ∧ All P r := by rw [balanceR_eq_balance' hl hr sl sr H, all_balance'] #align ordnode.all_balance_r Ordnode.all_balanceR section variable [Preorder α] def Bounded : Ordnode α → WithBot α → WithTop α → Prop | nil, some a, some b => a < b | nil, _, _ => True | node _ l x r, o₁, o₂ => Bounded l o₁ x ∧ Bounded r (↑x) o₂ #align ordnode.bounded Ordnode.Bounded theorem Bounded.dual : ∀ {t : Ordnode α} {o₁ o₂}, Bounded t o₁ o₂ → @Bounded αᵒᵈ _ (dual t) o₂ o₁ | nil, o₁, o₂, h => by cases o₁ <;> cases o₂ <;> trivial | node _ l x r, _, _, ⟨ol, Or⟩ => ⟨Or.dual, ol.dual⟩ #align ordnode.bounded.dual Ordnode.Bounded.dual theorem Bounded.dual_iff {t : Ordnode α} {o₁ o₂} : Bounded t o₁ o₂ ↔ @Bounded αᵒᵈ _ (.dual t) o₂ o₁ := ⟨Bounded.dual, fun h => by have := Bounded.dual h; rwa [dual_dual, OrderDual.Preorder.dual_dual] at this⟩ #align ordnode.bounded.dual_iff Ordnode.Bounded.dual_iff theorem Bounded.weak_left : ∀ {t : Ordnode α} {o₁ o₂}, Bounded t o₁ o₂ → Bounded t ⊥ o₂ | nil, o₁, o₂, h => by cases o₂ <;> trivial | node _ l x r, _, _, ⟨ol, Or⟩ => ⟨ol.weak_left, Or⟩ #align ordnode.bounded.weak_left Ordnode.Bounded.weak_left theorem Bounded.weak_right : ∀ {t : Ordnode α} {o₁ o₂}, Bounded t o₁ o₂ → Bounded t o₁ ⊤ | nil, o₁, o₂, h => by cases o₁ <;> trivial | node _ l x r, _, _, ⟨ol, Or⟩ => ⟨ol, Or.weak_right⟩ #align ordnode.bounded.weak_right Ordnode.Bounded.weak_right theorem Bounded.weak {t : Ordnode α} {o₁ o₂} (h : Bounded t o₁ o₂) : Bounded t ⊥ ⊤ := h.weak_left.weak_right #align ordnode.bounded.weak Ordnode.Bounded.weak theorem Bounded.mono_left {x y : α} (xy : x ≤ y) : ∀ {t : Ordnode α} {o}, Bounded t y o → Bounded t x o | nil, none, _ => ⟨⟩ | nil, some _, h => lt_of_le_of_lt xy h | node _ _ _ _, _o, ⟨ol, or⟩ => ⟨ol.mono_left xy, or⟩ #align ordnode.bounded.mono_left Ordnode.Bounded.mono_left theorem Bounded.mono_right {x y : α} (xy : x ≤ y) : ∀ {t : Ordnode α} {o}, Bounded t o x → Bounded t o y | nil, none, _ => ⟨⟩ | nil, some _, h => lt_of_lt_of_le h xy | node _ _ _ _, _o, ⟨ol, or⟩ => ⟨ol, or.mono_right xy⟩ #align ordnode.bounded.mono_right Ordnode.Bounded.mono_right theorem Bounded.to_lt : ∀ {t : Ordnode α} {x y : α}, Bounded t x y → x < y | nil, _, _, h => h | node _ _ _ _, _, _, ⟨h₁, h₂⟩ => lt_trans h₁.to_lt h₂.to_lt #align ordnode.bounded.to_lt Ordnode.Bounded.to_lt theorem Bounded.to_nil {t : Ordnode α} : ∀ {o₁ o₂}, Bounded t o₁ o₂ → Bounded nil o₁ o₂ | none, _, _ => ⟨⟩ | some _, none, _ => ⟨⟩ | some _, some _, h => h.to_lt #align ordnode.bounded.to_nil Ordnode.Bounded.to_nil theorem Bounded.trans_left {t₁ t₂ : Ordnode α} {x : α} : ∀ {o₁ o₂}, Bounded t₁ o₁ x → Bounded t₂ x o₂ → Bounded t₂ o₁ o₂ | none, _, _, h₂ => h₂.weak_left | some _, _, h₁, h₂ => h₂.mono_left (le_of_lt h₁.to_lt) #align ordnode.bounded.trans_left Ordnode.Bounded.trans_left theorem Bounded.trans_right {t₁ t₂ : Ordnode α} {x : α} : ∀ {o₁ o₂}, Bounded t₁ o₁ x → Bounded t₂ x o₂ → Bounded t₁ o₁ o₂ | _, none, h₁, _ => h₁.weak_right | _, some _, h₁, h₂ => h₁.mono_right (le_of_lt h₂.to_lt) #align ordnode.bounded.trans_right Ordnode.Bounded.trans_right theorem Bounded.mem_lt : ∀ {t o} {x : α}, Bounded t o x → All (· < x) t | nil, _, _, _ => ⟨⟩ | node _ _ _ _, _, _, ⟨h₁, h₂⟩ => ⟨h₁.mem_lt.imp fun _ h => lt_trans h h₂.to_lt, h₂.to_lt, h₂.mem_lt⟩ #align ordnode.bounded.mem_lt Ordnode.Bounded.mem_lt theorem Bounded.mem_gt : ∀ {t o} {x : α}, Bounded t x o → All (· > x) t | nil, _, _, _ => ⟨⟩ | node _ _ _ _, _, _, ⟨h₁, h₂⟩ => ⟨h₁.mem_gt, h₁.to_lt, h₂.mem_gt.imp fun _ => lt_trans h₁.to_lt⟩ #align ordnode.bounded.mem_gt Ordnode.Bounded.mem_gt theorem Bounded.of_lt : ∀ {t o₁ o₂} {x : α}, Bounded t o₁ o₂ → Bounded nil o₁ x → All (· < x) t → Bounded t o₁ x | nil, _, _, _, _, hn, _ => hn | node _ _ _ _, _, _, _, ⟨h₁, h₂⟩, _, ⟨_, al₂, al₃⟩ => ⟨h₁, h₂.of_lt al₂ al₃⟩ #align ordnode.bounded.of_lt Ordnode.Bounded.of_lt theorem Bounded.of_gt : ∀ {t o₁ o₂} {x : α}, Bounded t o₁ o₂ → Bounded nil x o₂ → All (· > x) t → Bounded t x o₂ | nil, _, _, _, _, hn, _ => hn | node _ _ _ _, _, _, _, ⟨h₁, h₂⟩, _, ⟨al₁, al₂, _⟩ => ⟨h₁.of_gt al₂ al₁, h₂⟩ #align ordnode.bounded.of_gt Ordnode.Bounded.of_gt theorem Bounded.to_sep {t₁ t₂ o₁ o₂} {x : α} (h₁ : Bounded t₁ o₁ (x : WithTop α)) (h₂ : Bounded t₂ (x : WithBot α) o₂) : t₁.All fun y => t₂.All fun z : α => y < z := by refine h₁.mem_lt.imp fun y yx => ?_ exact h₂.mem_gt.imp fun z xz => lt_trans yx xz #align ordnode.bounded.to_sep Ordnode.Bounded.to_sep end section variable [Preorder α] structure Valid' (lo : WithBot α) (t : Ordnode α) (hi : WithTop α) : Prop where ord : t.Bounded lo hi sz : t.Sized bal : t.Balanced #align ordnode.valid' Ordnode.Valid' #align ordnode.valid'.ord Ordnode.Valid'.ord #align ordnode.valid'.sz Ordnode.Valid'.sz #align ordnode.valid'.bal Ordnode.Valid'.bal def Valid (t : Ordnode α) : Prop := Valid' ⊥ t ⊤ #align ordnode.valid Ordnode.Valid theorem Valid'.mono_left {x y : α} (xy : x ≤ y) {t : Ordnode α} {o} (h : Valid' y t o) : Valid' x t o := ⟨h.1.mono_left xy, h.2, h.3⟩ #align ordnode.valid'.mono_left Ordnode.Valid'.mono_left theorem Valid'.mono_right {x y : α} (xy : x ≤ y) {t : Ordnode α} {o} (h : Valid' o t x) : Valid' o t y := ⟨h.1.mono_right xy, h.2, h.3⟩ #align ordnode.valid'.mono_right Ordnode.Valid'.mono_right theorem Valid'.trans_left {t₁ t₂ : Ordnode α} {x : α} {o₁ o₂} (h : Bounded t₁ o₁ x) (H : Valid' x t₂ o₂) : Valid' o₁ t₂ o₂ := ⟨h.trans_left H.1, H.2, H.3⟩ #align ordnode.valid'.trans_left Ordnode.Valid'.trans_left theorem Valid'.trans_right {t₁ t₂ : Ordnode α} {x : α} {o₁ o₂} (H : Valid' o₁ t₁ x) (h : Bounded t₂ x o₂) : Valid' o₁ t₁ o₂ := ⟨H.1.trans_right h, H.2, H.3⟩ #align ordnode.valid'.trans_right Ordnode.Valid'.trans_right theorem Valid'.of_lt {t : Ordnode α} {x : α} {o₁ o₂} (H : Valid' o₁ t o₂) (h₁ : Bounded nil o₁ x) (h₂ : All (· < x) t) : Valid' o₁ t x := ⟨H.1.of_lt h₁ h₂, H.2, H.3⟩ #align ordnode.valid'.of_lt Ordnode.Valid'.of_lt theorem Valid'.of_gt {t : Ordnode α} {x : α} {o₁ o₂} (H : Valid' o₁ t o₂) (h₁ : Bounded nil x o₂) (h₂ : All (· > x) t) : Valid' x t o₂ := ⟨H.1.of_gt h₁ h₂, H.2, H.3⟩ #align ordnode.valid'.of_gt Ordnode.Valid'.of_gt theorem Valid'.valid {t o₁ o₂} (h : @Valid' α _ o₁ t o₂) : Valid t := ⟨h.1.weak, h.2, h.3⟩ #align ordnode.valid'.valid Ordnode.Valid'.valid theorem valid'_nil {o₁ o₂} (h : Bounded nil o₁ o₂) : Valid' o₁ (@nil α) o₂ := ⟨h, ⟨⟩, ⟨⟩⟩ #align ordnode.valid'_nil Ordnode.valid'_nil theorem valid_nil : Valid (@nil α) := valid'_nil ⟨⟩ #align ordnode.valid_nil Ordnode.valid_nil theorem Valid'.node {s l} {x : α} {r o₁ o₂} (hl : Valid' o₁ l x) (hr : Valid' x r o₂) (H : BalancedSz (size l) (size r)) (hs : s = size l + size r + 1) : Valid' o₁ (@node α s l x r) o₂ := ⟨⟨hl.1, hr.1⟩, ⟨hs, hl.2, hr.2⟩, ⟨H, hl.3, hr.3⟩⟩ #align ordnode.valid'.node Ordnode.Valid'.node theorem Valid'.dual : ∀ {t : Ordnode α} {o₁ o₂}, Valid' o₁ t o₂ → @Valid' αᵒᵈ _ o₂ (dual t) o₁ | .nil, o₁, o₂, h => valid'_nil h.1.dual | .node _ l x r, o₁, o₂, ⟨⟨ol, Or⟩, ⟨rfl, sl, sr⟩, ⟨b, bl, br⟩⟩ => let ⟨ol', sl', bl'⟩ := Valid'.dual ⟨ol, sl, bl⟩ let ⟨or', sr', br'⟩ := Valid'.dual ⟨Or, sr, br⟩ ⟨⟨or', ol'⟩, ⟨by simp [size_dual, add_comm], sr', sl'⟩, ⟨by rw [size_dual, size_dual]; exact b.symm, br', bl'⟩⟩ #align ordnode.valid'.dual Ordnode.Valid'.dual theorem Valid'.dual_iff {t : Ordnode α} {o₁ o₂} : Valid' o₁ t o₂ ↔ @Valid' αᵒᵈ _ o₂ (.dual t) o₁ := ⟨Valid'.dual, fun h => by have := Valid'.dual h; rwa [dual_dual, OrderDual.Preorder.dual_dual] at this⟩ #align ordnode.valid'.dual_iff Ordnode.Valid'.dual_iff theorem Valid.dual {t : Ordnode α} : Valid t → @Valid αᵒᵈ _ (.dual t) := Valid'.dual #align ordnode.valid.dual Ordnode.Valid.dual theorem Valid.dual_iff {t : Ordnode α} : Valid t ↔ @Valid αᵒᵈ _ (.dual t) := Valid'.dual_iff #align ordnode.valid.dual_iff Ordnode.Valid.dual_iff theorem Valid'.left {s l x r o₁ o₂} (H : Valid' o₁ (@Ordnode.node α s l x r) o₂) : Valid' o₁ l x := ⟨H.1.1, H.2.2.1, H.3.2.1⟩ #align ordnode.valid'.left Ordnode.Valid'.left theorem Valid'.right {s l x r o₁ o₂} (H : Valid' o₁ (@Ordnode.node α s l x r) o₂) : Valid' x r o₂ := ⟨H.1.2, H.2.2.2, H.3.2.2⟩ #align ordnode.valid'.right Ordnode.Valid'.right nonrec theorem Valid.left {s l x r} (H : Valid (@node α s l x r)) : Valid l := H.left.valid #align ordnode.valid.left Ordnode.Valid.left nonrec theorem Valid.right {s l x r} (H : Valid (@node α s l x r)) : Valid r := H.right.valid #align ordnode.valid.right Ordnode.Valid.right theorem Valid.size_eq {s l x r} (H : Valid (@node α s l x r)) : size (@node α s l x r) = size l + size r + 1 := H.2.1 #align ordnode.valid.size_eq Ordnode.Valid.size_eq theorem Valid'.node' {l} {x : α} {r o₁ o₂} (hl : Valid' o₁ l x) (hr : Valid' x r o₂) (H : BalancedSz (size l) (size r)) : Valid' o₁ (@node' α l x r) o₂ := hl.node hr H rfl #align ordnode.valid'.node' Ordnode.Valid'.node' theorem valid'_singleton {x : α} {o₁ o₂} (h₁ : Bounded nil o₁ x) (h₂ : Bounded nil x o₂) : Valid' o₁ (singleton x : Ordnode α) o₂ := (valid'_nil h₁).node (valid'_nil h₂) (Or.inl zero_le_one) rfl #align ordnode.valid'_singleton Ordnode.valid'_singleton theorem valid_singleton {x : α} : Valid (singleton x : Ordnode α) := valid'_singleton ⟨⟩ ⟨⟩ #align ordnode.valid_singleton Ordnode.valid_singleton theorem Valid'.node3L {l} {x : α} {m} {y : α} {r o₁ o₂} (hl : Valid' o₁ l x) (hm : Valid' x m y) (hr : Valid' y r o₂) (H1 : BalancedSz (size l) (size m)) (H2 : BalancedSz (size l + size m + 1) (size r)) : Valid' o₁ (@node3L α l x m y r) o₂ := (hl.node' hm H1).node' hr H2 #align ordnode.valid'.node3_l Ordnode.Valid'.node3L theorem Valid'.node3R {l} {x : α} {m} {y : α} {r o₁ o₂} (hl : Valid' o₁ l x) (hm : Valid' x m y) (hr : Valid' y r o₂) (H1 : BalancedSz (size l) (size m + size r + 1)) (H2 : BalancedSz (size m) (size r)) : Valid' o₁ (@node3R α l x m y r) o₂ := hl.node' (hm.node' hr H2) H1 #align ordnode.valid'.node3_r Ordnode.Valid'.node3R theorem Valid'.node4L_lemma₁ {a b c d : ℕ} (lr₂ : 3 * (b + c + 1 + d) ≤ 16 * a + 9) (mr₂ : b + c + 1 ≤ 3 * d) (mm₁ : b ≤ 3 * c) : b < 3 * a + 1 := by omega #align ordnode.valid'.node4_l_lemma₁ Ordnode.Valid'.node4L_lemma₁ theorem Valid'.node4L_lemma₂ {b c d : ℕ} (mr₂ : b + c + 1 ≤ 3 * d) : c ≤ 3 * d := by omega #align ordnode.valid'.node4_l_lemma₂ Ordnode.Valid'.node4L_lemma₂ theorem Valid'.node4L_lemma₃ {b c d : ℕ} (mr₁ : 2 * d ≤ b + c + 1) (mm₁ : b ≤ 3 * c) : d ≤ 3 * c := by omega #align ordnode.valid'.node4_l_lemma₃ Ordnode.Valid'.node4L_lemma₃ theorem Valid'.node4L_lemma₄ {a b c d : ℕ} (lr₁ : 3 * a ≤ b + c + 1 + d) (mr₂ : b + c + 1 ≤ 3 * d) (mm₁ : b ≤ 3 * c) : a + b + 1 ≤ 3 * (c + d + 1) := by omega #align ordnode.valid'.node4_l_lemma₄ Ordnode.Valid'.node4L_lemma₄
Mathlib/Data/Ordmap/Ordset.lean
1,159
1,160
theorem Valid'.node4L_lemma₅ {a b c d : ℕ} (lr₂ : 3 * (b + c + 1 + d) ≤ 16 * a + 9) (mr₁ : 2 * d ≤ b + c + 1) (mm₂ : c ≤ 3 * b) : c + d + 1 ≤ 3 * (a + b + 1) := by
omega
import Mathlib.MeasureTheory.Function.L1Space import Mathlib.Analysis.NormedSpace.IndicatorFunction #align_import measure_theory.integral.integrable_on from "leanprover-community/mathlib"@"8b8ba04e2f326f3f7cf24ad129beda58531ada61" noncomputable section open Set Filter TopologicalSpace MeasureTheory Function open scoped Classical Topology Interval Filter ENNReal MeasureTheory variable {α β E F : Type*} [MeasurableSpace α] section variable [TopologicalSpace β] {l l' : Filter α} {f g : α → β} {μ ν : Measure α} def StronglyMeasurableAtFilter (f : α → β) (l : Filter α) (μ : Measure α := by volume_tac) := ∃ s ∈ l, AEStronglyMeasurable f (μ.restrict s) #align strongly_measurable_at_filter StronglyMeasurableAtFilter @[simp] theorem stronglyMeasurableAt_bot {f : α → β} : StronglyMeasurableAtFilter f ⊥ μ := ⟨∅, mem_bot, by simp⟩ #align strongly_measurable_at_bot stronglyMeasurableAt_bot protected theorem StronglyMeasurableAtFilter.eventually (h : StronglyMeasurableAtFilter f l μ) : ∀ᶠ s in l.smallSets, AEStronglyMeasurable f (μ.restrict s) := (eventually_smallSets' fun _ _ => AEStronglyMeasurable.mono_set).2 h #align strongly_measurable_at_filter.eventually StronglyMeasurableAtFilter.eventually protected theorem StronglyMeasurableAtFilter.filter_mono (h : StronglyMeasurableAtFilter f l μ) (h' : l' ≤ l) : StronglyMeasurableAtFilter f l' μ := let ⟨s, hsl, hs⟩ := h ⟨s, h' hsl, hs⟩ #align strongly_measurable_at_filter.filter_mono StronglyMeasurableAtFilter.filter_mono protected theorem MeasureTheory.AEStronglyMeasurable.stronglyMeasurableAtFilter (h : AEStronglyMeasurable f μ) : StronglyMeasurableAtFilter f l μ := ⟨univ, univ_mem, by rwa [Measure.restrict_univ]⟩ #align measure_theory.ae_strongly_measurable.strongly_measurable_at_filter MeasureTheory.AEStronglyMeasurable.stronglyMeasurableAtFilter theorem AeStronglyMeasurable.stronglyMeasurableAtFilter_of_mem {s} (h : AEStronglyMeasurable f (μ.restrict s)) (hl : s ∈ l) : StronglyMeasurableAtFilter f l μ := ⟨s, hl, h⟩ #align ae_strongly_measurable.strongly_measurable_at_filter_of_mem AeStronglyMeasurable.stronglyMeasurableAtFilter_of_mem protected theorem MeasureTheory.StronglyMeasurable.stronglyMeasurableAtFilter (h : StronglyMeasurable f) : StronglyMeasurableAtFilter f l μ := h.aestronglyMeasurable.stronglyMeasurableAtFilter #align measure_theory.strongly_measurable.strongly_measurable_at_filter MeasureTheory.StronglyMeasurable.stronglyMeasurableAtFilter end namespace MeasureTheory section NormedAddCommGroup theorem hasFiniteIntegral_restrict_of_bounded [NormedAddCommGroup E] {f : α → E} {s : Set α} {μ : Measure α} {C} (hs : μ s < ∞) (hf : ∀ᵐ x ∂μ.restrict s, ‖f x‖ ≤ C) : HasFiniteIntegral f (μ.restrict s) := haveI : IsFiniteMeasure (μ.restrict s) := ⟨by rwa [Measure.restrict_apply_univ]⟩ hasFiniteIntegral_of_bounded hf #align measure_theory.has_finite_integral_restrict_of_bounded MeasureTheory.hasFiniteIntegral_restrict_of_bounded variable [NormedAddCommGroup E] {f g : α → E} {s t : Set α} {μ ν : Measure α} def IntegrableOn (f : α → E) (s : Set α) (μ : Measure α := by volume_tac) : Prop := Integrable f (μ.restrict s) #align measure_theory.integrable_on MeasureTheory.IntegrableOn theorem IntegrableOn.integrable (h : IntegrableOn f s μ) : Integrable f (μ.restrict s) := h #align measure_theory.integrable_on.integrable MeasureTheory.IntegrableOn.integrable @[simp] theorem integrableOn_empty : IntegrableOn f ∅ μ := by simp [IntegrableOn, integrable_zero_measure] #align measure_theory.integrable_on_empty MeasureTheory.integrableOn_empty @[simp] theorem integrableOn_univ : IntegrableOn f univ μ ↔ Integrable f μ := by rw [IntegrableOn, Measure.restrict_univ] #align measure_theory.integrable_on_univ MeasureTheory.integrableOn_univ theorem integrableOn_zero : IntegrableOn (fun _ => (0 : E)) s μ := integrable_zero _ _ _ #align measure_theory.integrable_on_zero MeasureTheory.integrableOn_zero @[simp] theorem integrableOn_const {C : E} : IntegrableOn (fun _ => C) s μ ↔ C = 0 ∨ μ s < ∞ := integrable_const_iff.trans <| by rw [Measure.restrict_apply_univ] #align measure_theory.integrable_on_const MeasureTheory.integrableOn_const theorem IntegrableOn.mono (h : IntegrableOn f t ν) (hs : s ⊆ t) (hμ : μ ≤ ν) : IntegrableOn f s μ := h.mono_measure <| Measure.restrict_mono hs hμ #align measure_theory.integrable_on.mono MeasureTheory.IntegrableOn.mono theorem IntegrableOn.mono_set (h : IntegrableOn f t μ) (hst : s ⊆ t) : IntegrableOn f s μ := h.mono hst le_rfl #align measure_theory.integrable_on.mono_set MeasureTheory.IntegrableOn.mono_set theorem IntegrableOn.mono_measure (h : IntegrableOn f s ν) (hμ : μ ≤ ν) : IntegrableOn f s μ := h.mono (Subset.refl _) hμ #align measure_theory.integrable_on.mono_measure MeasureTheory.IntegrableOn.mono_measure theorem IntegrableOn.mono_set_ae (h : IntegrableOn f t μ) (hst : s ≤ᵐ[μ] t) : IntegrableOn f s μ := h.integrable.mono_measure <| Measure.restrict_mono_ae hst #align measure_theory.integrable_on.mono_set_ae MeasureTheory.IntegrableOn.mono_set_ae theorem IntegrableOn.congr_set_ae (h : IntegrableOn f t μ) (hst : s =ᵐ[μ] t) : IntegrableOn f s μ := h.mono_set_ae hst.le #align measure_theory.integrable_on.congr_set_ae MeasureTheory.IntegrableOn.congr_set_ae theorem IntegrableOn.congr_fun_ae (h : IntegrableOn f s μ) (hst : f =ᵐ[μ.restrict s] g) : IntegrableOn g s μ := Integrable.congr h hst #align measure_theory.integrable_on.congr_fun_ae MeasureTheory.IntegrableOn.congr_fun_ae theorem integrableOn_congr_fun_ae (hst : f =ᵐ[μ.restrict s] g) : IntegrableOn f s μ ↔ IntegrableOn g s μ := ⟨fun h => h.congr_fun_ae hst, fun h => h.congr_fun_ae hst.symm⟩ #align measure_theory.integrable_on_congr_fun_ae MeasureTheory.integrableOn_congr_fun_ae theorem IntegrableOn.congr_fun (h : IntegrableOn f s μ) (hst : EqOn f g s) (hs : MeasurableSet s) : IntegrableOn g s μ := h.congr_fun_ae ((ae_restrict_iff' hs).2 (eventually_of_forall hst)) #align measure_theory.integrable_on.congr_fun MeasureTheory.IntegrableOn.congr_fun theorem integrableOn_congr_fun (hst : EqOn f g s) (hs : MeasurableSet s) : IntegrableOn f s μ ↔ IntegrableOn g s μ := ⟨fun h => h.congr_fun hst hs, fun h => h.congr_fun hst.symm hs⟩ #align measure_theory.integrable_on_congr_fun MeasureTheory.integrableOn_congr_fun theorem Integrable.integrableOn (h : Integrable f μ) : IntegrableOn f s μ := h.mono_measure <| Measure.restrict_le_self #align measure_theory.integrable.integrable_on MeasureTheory.Integrable.integrableOn theorem IntegrableOn.restrict (h : IntegrableOn f s μ) (hs : MeasurableSet s) : IntegrableOn f s (μ.restrict t) := by rw [IntegrableOn, Measure.restrict_restrict hs]; exact h.mono_set inter_subset_left #align measure_theory.integrable_on.restrict MeasureTheory.IntegrableOn.restrict theorem IntegrableOn.inter_of_restrict (h : IntegrableOn f s (μ.restrict t)) : IntegrableOn f (s ∩ t) μ := by have := h.mono_set (inter_subset_left (t := t)) rwa [IntegrableOn, μ.restrict_restrict_of_subset inter_subset_right] at this lemma Integrable.piecewise [DecidablePred (· ∈ s)] (hs : MeasurableSet s) (hf : IntegrableOn f s μ) (hg : IntegrableOn g sᶜ μ) : Integrable (s.piecewise f g) μ := by rw [IntegrableOn] at hf hg rw [← memℒp_one_iff_integrable] at hf hg ⊢ exact Memℒp.piecewise hs hf hg theorem IntegrableOn.left_of_union (h : IntegrableOn f (s ∪ t) μ) : IntegrableOn f s μ := h.mono_set subset_union_left #align measure_theory.integrable_on.left_of_union MeasureTheory.IntegrableOn.left_of_union theorem IntegrableOn.right_of_union (h : IntegrableOn f (s ∪ t) μ) : IntegrableOn f t μ := h.mono_set subset_union_right #align measure_theory.integrable_on.right_of_union MeasureTheory.IntegrableOn.right_of_union theorem IntegrableOn.union (hs : IntegrableOn f s μ) (ht : IntegrableOn f t μ) : IntegrableOn f (s ∪ t) μ := (hs.add_measure ht).mono_measure <| Measure.restrict_union_le _ _ #align measure_theory.integrable_on.union MeasureTheory.IntegrableOn.union @[simp] theorem integrableOn_union : IntegrableOn f (s ∪ t) μ ↔ IntegrableOn f s μ ∧ IntegrableOn f t μ := ⟨fun h => ⟨h.left_of_union, h.right_of_union⟩, fun h => h.1.union h.2⟩ #align measure_theory.integrable_on_union MeasureTheory.integrableOn_union @[simp] theorem integrableOn_singleton_iff {x : α} [MeasurableSingletonClass α] : IntegrableOn f {x} μ ↔ f x = 0 ∨ μ {x} < ∞ := by have : f =ᵐ[μ.restrict {x}] fun _ => f x := by filter_upwards [ae_restrict_mem (measurableSet_singleton x)] with _ ha simp only [mem_singleton_iff.1 ha] rw [IntegrableOn, integrable_congr this, integrable_const_iff] simp #align measure_theory.integrable_on_singleton_iff MeasureTheory.integrableOn_singleton_iff @[simp] theorem integrableOn_finite_biUnion {s : Set β} (hs : s.Finite) {t : β → Set α} : IntegrableOn f (⋃ i ∈ s, t i) μ ↔ ∀ i ∈ s, IntegrableOn f (t i) μ := by refine hs.induction_on ?_ ?_ · simp · intro a s _ _ hf; simp [hf, or_imp, forall_and] #align measure_theory.integrable_on_finite_bUnion MeasureTheory.integrableOn_finite_biUnion @[simp] theorem integrableOn_finset_iUnion {s : Finset β} {t : β → Set α} : IntegrableOn f (⋃ i ∈ s, t i) μ ↔ ∀ i ∈ s, IntegrableOn f (t i) μ := integrableOn_finite_biUnion s.finite_toSet #align measure_theory.integrable_on_finset_Union MeasureTheory.integrableOn_finset_iUnion @[simp] theorem integrableOn_finite_iUnion [Finite β] {t : β → Set α} : IntegrableOn f (⋃ i, t i) μ ↔ ∀ i, IntegrableOn f (t i) μ := by cases nonempty_fintype β simpa using @integrableOn_finset_iUnion _ _ _ _ _ f μ Finset.univ t #align measure_theory.integrable_on_finite_Union MeasureTheory.integrableOn_finite_iUnion theorem IntegrableOn.add_measure (hμ : IntegrableOn f s μ) (hν : IntegrableOn f s ν) : IntegrableOn f s (μ + ν) := by delta IntegrableOn; rw [Measure.restrict_add]; exact hμ.integrable.add_measure hν #align measure_theory.integrable_on.add_measure MeasureTheory.IntegrableOn.add_measure @[simp] theorem integrableOn_add_measure : IntegrableOn f s (μ + ν) ↔ IntegrableOn f s μ ∧ IntegrableOn f s ν := ⟨fun h => ⟨h.mono_measure (Measure.le_add_right le_rfl), h.mono_measure (Measure.le_add_left le_rfl)⟩, fun h => h.1.add_measure h.2⟩ #align measure_theory.integrable_on_add_measure MeasureTheory.integrableOn_add_measure theorem _root_.MeasurableEmbedding.integrableOn_map_iff [MeasurableSpace β] {e : α → β} (he : MeasurableEmbedding e) {f : β → E} {μ : Measure α} {s : Set β} : IntegrableOn f s (μ.map e) ↔ IntegrableOn (f ∘ e) (e ⁻¹' s) μ := by simp_rw [IntegrableOn, he.restrict_map, he.integrable_map_iff] #align measurable_embedding.integrable_on_map_iff MeasurableEmbedding.integrableOn_map_iff theorem _root_.MeasurableEmbedding.integrableOn_iff_comap [MeasurableSpace β] {e : α → β} (he : MeasurableEmbedding e) {f : β → E} {μ : Measure β} {s : Set β} (hs : s ⊆ range e) : IntegrableOn f s μ ↔ IntegrableOn (f ∘ e) (e ⁻¹' s) (μ.comap e) := by simp_rw [← he.integrableOn_map_iff, he.map_comap, IntegrableOn, Measure.restrict_restrict_of_subset hs] theorem integrableOn_map_equiv [MeasurableSpace β] (e : α ≃ᵐ β) {f : β → E} {μ : Measure α} {s : Set β} : IntegrableOn f s (μ.map e) ↔ IntegrableOn (f ∘ e) (e ⁻¹' s) μ := by simp only [IntegrableOn, e.restrict_map, integrable_map_equiv e] #align measure_theory.integrable_on_map_equiv MeasureTheory.integrableOn_map_equiv theorem MeasurePreserving.integrableOn_comp_preimage [MeasurableSpace β] {e : α → β} {ν} (h₁ : MeasurePreserving e μ ν) (h₂ : MeasurableEmbedding e) {f : β → E} {s : Set β} : IntegrableOn (f ∘ e) (e ⁻¹' s) μ ↔ IntegrableOn f s ν := (h₁.restrict_preimage_emb h₂ s).integrable_comp_emb h₂ #align measure_theory.measure_preserving.integrable_on_comp_preimage MeasureTheory.MeasurePreserving.integrableOn_comp_preimage theorem MeasurePreserving.integrableOn_image [MeasurableSpace β] {e : α → β} {ν} (h₁ : MeasurePreserving e μ ν) (h₂ : MeasurableEmbedding e) {f : β → E} {s : Set α} : IntegrableOn f (e '' s) ν ↔ IntegrableOn (f ∘ e) s μ := ((h₁.restrict_image_emb h₂ s).integrable_comp_emb h₂).symm #align measure_theory.measure_preserving.integrable_on_image MeasureTheory.MeasurePreserving.integrableOn_image
Mathlib/MeasureTheory/Integral/IntegrableOn.lean
268
271
theorem integrable_indicator_iff (hs : MeasurableSet s) : Integrable (indicator s f) μ ↔ IntegrableOn f s μ := by
simp [IntegrableOn, Integrable, HasFiniteIntegral, nnnorm_indicator_eq_indicator_nnnorm, ENNReal.coe_indicator, lintegral_indicator _ hs, aestronglyMeasurable_indicator_iff hs]
import Mathlib.Algebra.ModEq import Mathlib.Algebra.Module.Defs import Mathlib.Algebra.Order.Archimedean import Mathlib.Algebra.Periodic import Mathlib.Data.Int.SuccPred import Mathlib.GroupTheory.QuotientGroup import Mathlib.Order.Circular import Mathlib.Data.List.TFAE import Mathlib.Data.Set.Lattice #align_import algebra.order.to_interval_mod from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec" noncomputable section section LinearOrderedAddCommGroup variable {α : Type*} [LinearOrderedAddCommGroup α] [hα : Archimedean α] {p : α} (hp : 0 < p) {a b c : α} {n : ℤ} def toIcoDiv (a b : α) : ℤ := (existsUnique_sub_zsmul_mem_Ico hp b a).choose #align to_Ico_div toIcoDiv theorem sub_toIcoDiv_zsmul_mem_Ico (a b : α) : b - toIcoDiv hp a b • p ∈ Set.Ico a (a + p) := (existsUnique_sub_zsmul_mem_Ico hp b a).choose_spec.1 #align sub_to_Ico_div_zsmul_mem_Ico sub_toIcoDiv_zsmul_mem_Ico theorem toIcoDiv_eq_of_sub_zsmul_mem_Ico (h : b - n • p ∈ Set.Ico a (a + p)) : toIcoDiv hp a b = n := ((existsUnique_sub_zsmul_mem_Ico hp b a).choose_spec.2 _ h).symm #align to_Ico_div_eq_of_sub_zsmul_mem_Ico toIcoDiv_eq_of_sub_zsmul_mem_Ico def toIocDiv (a b : α) : ℤ := (existsUnique_sub_zsmul_mem_Ioc hp b a).choose #align to_Ioc_div toIocDiv theorem sub_toIocDiv_zsmul_mem_Ioc (a b : α) : b - toIocDiv hp a b • p ∈ Set.Ioc a (a + p) := (existsUnique_sub_zsmul_mem_Ioc hp b a).choose_spec.1 #align sub_to_Ioc_div_zsmul_mem_Ioc sub_toIocDiv_zsmul_mem_Ioc theorem toIocDiv_eq_of_sub_zsmul_mem_Ioc (h : b - n • p ∈ Set.Ioc a (a + p)) : toIocDiv hp a b = n := ((existsUnique_sub_zsmul_mem_Ioc hp b a).choose_spec.2 _ h).symm #align to_Ioc_div_eq_of_sub_zsmul_mem_Ioc toIocDiv_eq_of_sub_zsmul_mem_Ioc def toIcoMod (a b : α) : α := b - toIcoDiv hp a b • p #align to_Ico_mod toIcoMod def toIocMod (a b : α) : α := b - toIocDiv hp a b • p #align to_Ioc_mod toIocMod theorem toIcoMod_mem_Ico (a b : α) : toIcoMod hp a b ∈ Set.Ico a (a + p) := sub_toIcoDiv_zsmul_mem_Ico hp a b #align to_Ico_mod_mem_Ico toIcoMod_mem_Ico theorem toIcoMod_mem_Ico' (b : α) : toIcoMod hp 0 b ∈ Set.Ico 0 p := by convert toIcoMod_mem_Ico hp 0 b exact (zero_add p).symm #align to_Ico_mod_mem_Ico' toIcoMod_mem_Ico' theorem toIocMod_mem_Ioc (a b : α) : toIocMod hp a b ∈ Set.Ioc a (a + p) := sub_toIocDiv_zsmul_mem_Ioc hp a b #align to_Ioc_mod_mem_Ioc toIocMod_mem_Ioc theorem left_le_toIcoMod (a b : α) : a ≤ toIcoMod hp a b := (Set.mem_Ico.1 (toIcoMod_mem_Ico hp a b)).1 #align left_le_to_Ico_mod left_le_toIcoMod theorem left_lt_toIocMod (a b : α) : a < toIocMod hp a b := (Set.mem_Ioc.1 (toIocMod_mem_Ioc hp a b)).1 #align left_lt_to_Ioc_mod left_lt_toIocMod theorem toIcoMod_lt_right (a b : α) : toIcoMod hp a b < a + p := (Set.mem_Ico.1 (toIcoMod_mem_Ico hp a b)).2 #align to_Ico_mod_lt_right toIcoMod_lt_right theorem toIocMod_le_right (a b : α) : toIocMod hp a b ≤ a + p := (Set.mem_Ioc.1 (toIocMod_mem_Ioc hp a b)).2 #align to_Ioc_mod_le_right toIocMod_le_right @[simp] theorem self_sub_toIcoDiv_zsmul (a b : α) : b - toIcoDiv hp a b • p = toIcoMod hp a b := rfl #align self_sub_to_Ico_div_zsmul self_sub_toIcoDiv_zsmul @[simp] theorem self_sub_toIocDiv_zsmul (a b : α) : b - toIocDiv hp a b • p = toIocMod hp a b := rfl #align self_sub_to_Ioc_div_zsmul self_sub_toIocDiv_zsmul @[simp] theorem toIcoDiv_zsmul_sub_self (a b : α) : toIcoDiv hp a b • p - b = -toIcoMod hp a b := by rw [toIcoMod, neg_sub] #align to_Ico_div_zsmul_sub_self toIcoDiv_zsmul_sub_self @[simp] theorem toIocDiv_zsmul_sub_self (a b : α) : toIocDiv hp a b • p - b = -toIocMod hp a b := by rw [toIocMod, neg_sub] #align to_Ioc_div_zsmul_sub_self toIocDiv_zsmul_sub_self @[simp] theorem toIcoMod_sub_self (a b : α) : toIcoMod hp a b - b = -toIcoDiv hp a b • p := by rw [toIcoMod, sub_sub_cancel_left, neg_smul] #align to_Ico_mod_sub_self toIcoMod_sub_self @[simp]
Mathlib/Algebra/Order/ToIntervalMod.lean
138
139
theorem toIocMod_sub_self (a b : α) : toIocMod hp a b - b = -toIocDiv hp a b • p := by
rw [toIocMod, sub_sub_cancel_left, neg_smul]
import Mathlib.Analysis.Normed.Group.Seminorm import Mathlib.Order.LiminfLimsup import Mathlib.Topology.Instances.Rat import Mathlib.Topology.MetricSpace.Algebra import Mathlib.Topology.MetricSpace.IsometricSMul import Mathlib.Topology.Sequences #align_import analysis.normed.group.basic from "leanprover-community/mathlib"@"41bef4ae1254365bc190aee63b947674d2977f01" variable {𝓕 𝕜 α ι κ E F G : Type*} open Filter Function Metric Bornology open ENNReal Filter NNReal Uniformity Pointwise Topology @[notation_class] class Norm (E : Type*) where norm : E → ℝ #align has_norm Norm @[notation_class] class NNNorm (E : Type*) where nnnorm : E → ℝ≥0 #align has_nnnorm NNNorm export Norm (norm) export NNNorm (nnnorm) @[inherit_doc] notation "‖" e "‖" => norm e @[inherit_doc] notation "‖" e "‖₊" => nnnorm e class SeminormedAddGroup (E : Type*) extends Norm E, AddGroup E, PseudoMetricSpace E where dist := fun x y => ‖x - y‖ dist_eq : ∀ x y, dist x y = ‖x - y‖ := by aesop #align seminormed_add_group SeminormedAddGroup @[to_additive] class SeminormedGroup (E : Type*) extends Norm E, Group E, PseudoMetricSpace E where dist := fun x y => ‖x / y‖ dist_eq : ∀ x y, dist x y = ‖x / y‖ := by aesop #align seminormed_group SeminormedGroup class NormedAddGroup (E : Type*) extends Norm E, AddGroup E, MetricSpace E where dist := fun x y => ‖x - y‖ dist_eq : ∀ x y, dist x y = ‖x - y‖ := by aesop #align normed_add_group NormedAddGroup @[to_additive] class NormedGroup (E : Type*) extends Norm E, Group E, MetricSpace E where dist := fun x y => ‖x / y‖ dist_eq : ∀ x y, dist x y = ‖x / y‖ := by aesop #align normed_group NormedGroup class SeminormedAddCommGroup (E : Type*) extends Norm E, AddCommGroup E, PseudoMetricSpace E where dist := fun x y => ‖x - y‖ dist_eq : ∀ x y, dist x y = ‖x - y‖ := by aesop #align seminormed_add_comm_group SeminormedAddCommGroup @[to_additive] class SeminormedCommGroup (E : Type*) extends Norm E, CommGroup E, PseudoMetricSpace E where dist := fun x y => ‖x / y‖ dist_eq : ∀ x y, dist x y = ‖x / y‖ := by aesop #align seminormed_comm_group SeminormedCommGroup class NormedAddCommGroup (E : Type*) extends Norm E, AddCommGroup E, MetricSpace E where dist := fun x y => ‖x - y‖ dist_eq : ∀ x y, dist x y = ‖x - y‖ := by aesop #align normed_add_comm_group NormedAddCommGroup @[to_additive] class NormedCommGroup (E : Type*) extends Norm E, CommGroup E, MetricSpace E where dist := fun x y => ‖x / y‖ dist_eq : ∀ x y, dist x y = ‖x / y‖ := by aesop #align normed_comm_group NormedCommGroup -- See note [lower instance priority] @[to_additive] instance (priority := 100) NormedGroup.toSeminormedGroup [NormedGroup E] : SeminormedGroup E := { ‹NormedGroup E› with } #align normed_group.to_seminormed_group NormedGroup.toSeminormedGroup #align normed_add_group.to_seminormed_add_group NormedAddGroup.toSeminormedAddGroup -- See note [lower instance priority] @[to_additive] instance (priority := 100) NormedCommGroup.toSeminormedCommGroup [NormedCommGroup E] : SeminormedCommGroup E := { ‹NormedCommGroup E› with } #align normed_comm_group.to_seminormed_comm_group NormedCommGroup.toSeminormedCommGroup #align normed_add_comm_group.to_seminormed_add_comm_group NormedAddCommGroup.toSeminormedAddCommGroup -- See note [lower instance priority] @[to_additive] instance (priority := 100) SeminormedCommGroup.toSeminormedGroup [SeminormedCommGroup E] : SeminormedGroup E := { ‹SeminormedCommGroup E› with } #align seminormed_comm_group.to_seminormed_group SeminormedCommGroup.toSeminormedGroup #align seminormed_add_comm_group.to_seminormed_add_group SeminormedAddCommGroup.toSeminormedAddGroup -- See note [lower instance priority] @[to_additive] instance (priority := 100) NormedCommGroup.toNormedGroup [NormedCommGroup E] : NormedGroup E := { ‹NormedCommGroup E› with } #align normed_comm_group.to_normed_group NormedCommGroup.toNormedGroup #align normed_add_comm_group.to_normed_add_group NormedAddCommGroup.toNormedAddGroup -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a `NormedAddGroup` from a `SeminormedAddGroup` satisfying `∀ x, ‖x‖ = 0 → x = 0`. This avoids having to go back to the `(Pseudo)MetricSpace` level when declaring a `NormedAddGroup` instance as a special case of a more general `SeminormedAddGroup` instance."] def NormedGroup.ofSeparation [SeminormedGroup E] (h : ∀ x : E, ‖x‖ = 0 → x = 1) : NormedGroup E where dist_eq := ‹SeminormedGroup E›.dist_eq toMetricSpace := { eq_of_dist_eq_zero := fun hxy => div_eq_one.1 <| h _ <| by exact (‹SeminormedGroup E›.dist_eq _ _).symm.trans hxy } -- Porting note: the `rwa` no longer worked, but it was easy enough to provide the term. -- however, notice that if you make `x` and `y` accessible, then the following does work: -- `have := ‹SeminormedGroup E›.dist_eq x y; rwa [← this]`, so I'm not sure why the `rwa` -- was broken. #align normed_group.of_separation NormedGroup.ofSeparation #align normed_add_group.of_separation NormedAddGroup.ofSeparation -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a `NormedAddCommGroup` from a `SeminormedAddCommGroup` satisfying `∀ x, ‖x‖ = 0 → x = 0`. This avoids having to go back to the `(Pseudo)MetricSpace` level when declaring a `NormedAddCommGroup` instance as a special case of a more general `SeminormedAddCommGroup` instance."] def NormedCommGroup.ofSeparation [SeminormedCommGroup E] (h : ∀ x : E, ‖x‖ = 0 → x = 1) : NormedCommGroup E := { ‹SeminormedCommGroup E›, NormedGroup.ofSeparation h with } #align normed_comm_group.of_separation NormedCommGroup.ofSeparation #align normed_add_comm_group.of_separation NormedAddCommGroup.ofSeparation -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a seminormed group from a translation-invariant distance."] def SeminormedGroup.ofMulDist [Norm E] [Group E] [PseudoMetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist x y ≤ dist (x * z) (y * z)) : SeminormedGroup E where dist_eq x y := by rw [h₁]; apply le_antisymm · simpa only [div_eq_mul_inv, ← mul_right_inv y] using h₂ _ _ _ · simpa only [div_mul_cancel, one_mul] using h₂ (x / y) 1 y #align seminormed_group.of_mul_dist SeminormedGroup.ofMulDist #align seminormed_add_group.of_add_dist SeminormedAddGroup.ofAddDist -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a seminormed group from a translation-invariant pseudodistance."] def SeminormedGroup.ofMulDist' [Norm E] [Group E] [PseudoMetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist (x * z) (y * z) ≤ dist x y) : SeminormedGroup E where dist_eq x y := by rw [h₁]; apply le_antisymm · simpa only [div_mul_cancel, one_mul] using h₂ (x / y) 1 y · simpa only [div_eq_mul_inv, ← mul_right_inv y] using h₂ _ _ _ #align seminormed_group.of_mul_dist' SeminormedGroup.ofMulDist' #align seminormed_add_group.of_add_dist' SeminormedAddGroup.ofAddDist' -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a seminormed group from a translation-invariant pseudodistance."] def SeminormedCommGroup.ofMulDist [Norm E] [CommGroup E] [PseudoMetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist x y ≤ dist (x * z) (y * z)) : SeminormedCommGroup E := { SeminormedGroup.ofMulDist h₁ h₂ with mul_comm := mul_comm } #align seminormed_comm_group.of_mul_dist SeminormedCommGroup.ofMulDist #align seminormed_add_comm_group.of_add_dist SeminormedAddCommGroup.ofAddDist -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a seminormed group from a translation-invariant pseudodistance."] def SeminormedCommGroup.ofMulDist' [Norm E] [CommGroup E] [PseudoMetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist (x * z) (y * z) ≤ dist x y) : SeminormedCommGroup E := { SeminormedGroup.ofMulDist' h₁ h₂ with mul_comm := mul_comm } #align seminormed_comm_group.of_mul_dist' SeminormedCommGroup.ofMulDist' #align seminormed_add_comm_group.of_add_dist' SeminormedAddCommGroup.ofAddDist' -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a normed group from a translation-invariant distance."] def NormedGroup.ofMulDist [Norm E] [Group E] [MetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist x y ≤ dist (x * z) (y * z)) : NormedGroup E := { SeminormedGroup.ofMulDist h₁ h₂ with eq_of_dist_eq_zero := eq_of_dist_eq_zero } #align normed_group.of_mul_dist NormedGroup.ofMulDist #align normed_add_group.of_add_dist NormedAddGroup.ofAddDist -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a normed group from a translation-invariant pseudodistance."] def NormedGroup.ofMulDist' [Norm E] [Group E] [MetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist (x * z) (y * z) ≤ dist x y) : NormedGroup E := { SeminormedGroup.ofMulDist' h₁ h₂ with eq_of_dist_eq_zero := eq_of_dist_eq_zero } #align normed_group.of_mul_dist' NormedGroup.ofMulDist' #align normed_add_group.of_add_dist' NormedAddGroup.ofAddDist' -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a normed group from a translation-invariant pseudodistance."] def NormedCommGroup.ofMulDist [Norm E] [CommGroup E] [MetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist x y ≤ dist (x * z) (y * z)) : NormedCommGroup E := { NormedGroup.ofMulDist h₁ h₂ with mul_comm := mul_comm } #align normed_comm_group.of_mul_dist NormedCommGroup.ofMulDist #align normed_add_comm_group.of_add_dist NormedAddCommGroup.ofAddDist -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a normed group from a translation-invariant pseudodistance."] def NormedCommGroup.ofMulDist' [Norm E] [CommGroup E] [MetricSpace E] (h₁ : ∀ x : E, ‖x‖ = dist x 1) (h₂ : ∀ x y z : E, dist (x * z) (y * z) ≤ dist x y) : NormedCommGroup E := { NormedGroup.ofMulDist' h₁ h₂ with mul_comm := mul_comm } #align normed_comm_group.of_mul_dist' NormedCommGroup.ofMulDist' #align normed_add_comm_group.of_add_dist' NormedAddCommGroup.ofAddDist' -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a seminormed group from a seminorm, i.e., registering the pseudodistance and the pseudometric space structure from the seminorm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`)."] def GroupSeminorm.toSeminormedGroup [Group E] (f : GroupSeminorm E) : SeminormedGroup E where dist x y := f (x / y) norm := f dist_eq x y := rfl dist_self x := by simp only [div_self', map_one_eq_zero] dist_triangle := le_map_div_add_map_div f dist_comm := map_div_rev f edist_dist x y := by exact ENNReal.coe_nnreal_eq _ -- Porting note: how did `mathlib3` solve this automatically? #align group_seminorm.to_seminormed_group GroupSeminorm.toSeminormedGroup #align add_group_seminorm.to_seminormed_add_group AddGroupSeminorm.toSeminormedAddGroup -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a seminormed group from a seminorm, i.e., registering the pseudodistance and the pseudometric space structure from the seminorm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`)."] def GroupSeminorm.toSeminormedCommGroup [CommGroup E] (f : GroupSeminorm E) : SeminormedCommGroup E := { f.toSeminormedGroup with mul_comm := mul_comm } #align group_seminorm.to_seminormed_comm_group GroupSeminorm.toSeminormedCommGroup #align add_group_seminorm.to_seminormed_add_comm_group AddGroupSeminorm.toSeminormedAddCommGroup -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a normed group from a norm, i.e., registering the distance and the metric space structure from the norm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`)."] def GroupNorm.toNormedGroup [Group E] (f : GroupNorm E) : NormedGroup E := { f.toGroupSeminorm.toSeminormedGroup with eq_of_dist_eq_zero := fun h => div_eq_one.1 <| eq_one_of_map_eq_zero f h } #align group_norm.to_normed_group GroupNorm.toNormedGroup #align add_group_norm.to_normed_add_group AddGroupNorm.toNormedAddGroup -- See note [reducible non-instances] @[to_additive (attr := reducible) "Construct a normed group from a norm, i.e., registering the distance and the metric space structure from the norm properties. Note that in most cases this instance creates bad definitional equalities (e.g., it does not take into account a possibly existing `UniformSpace` instance on `E`)."] def GroupNorm.toNormedCommGroup [CommGroup E] (f : GroupNorm E) : NormedCommGroup E := { f.toNormedGroup with mul_comm := mul_comm } #align group_norm.to_normed_comm_group GroupNorm.toNormedCommGroup #align add_group_norm.to_normed_add_comm_group AddGroupNorm.toNormedAddCommGroup instance PUnit.normedAddCommGroup : NormedAddCommGroup PUnit where norm := Function.const _ 0 dist_eq _ _ := rfl @[simp] theorem PUnit.norm_eq_zero (r : PUnit) : ‖r‖ = 0 := rfl #align punit.norm_eq_zero PUnit.norm_eq_zero section SeminormedGroup variable [SeminormedGroup E] [SeminormedGroup F] [SeminormedGroup G] {s : Set E} {a a₁ a₂ b b₁ b₂ : E} {r r₁ r₂ : ℝ} @[to_additive] theorem dist_eq_norm_div (a b : E) : dist a b = ‖a / b‖ := SeminormedGroup.dist_eq _ _ #align dist_eq_norm_div dist_eq_norm_div #align dist_eq_norm_sub dist_eq_norm_sub @[to_additive] theorem dist_eq_norm_div' (a b : E) : dist a b = ‖b / a‖ := by rw [dist_comm, dist_eq_norm_div] #align dist_eq_norm_div' dist_eq_norm_div' #align dist_eq_norm_sub' dist_eq_norm_sub' alias dist_eq_norm := dist_eq_norm_sub #align dist_eq_norm dist_eq_norm alias dist_eq_norm' := dist_eq_norm_sub' #align dist_eq_norm' dist_eq_norm' @[to_additive] instance NormedGroup.to_isometricSMul_right : IsometricSMul Eᵐᵒᵖ E := ⟨fun a => Isometry.of_dist_eq fun b c => by simp [dist_eq_norm_div]⟩ #align normed_group.to_has_isometric_smul_right NormedGroup.to_isometricSMul_right #align normed_add_group.to_has_isometric_vadd_right NormedAddGroup.to_isometricVAdd_right @[to_additive (attr := simp)] theorem dist_one_right (a : E) : dist a 1 = ‖a‖ := by rw [dist_eq_norm_div, div_one] #align dist_one_right dist_one_right #align dist_zero_right dist_zero_right @[to_additive] theorem inseparable_one_iff_norm {a : E} : Inseparable a 1 ↔ ‖a‖ = 0 := by rw [Metric.inseparable_iff, dist_one_right] @[to_additive (attr := simp)] theorem dist_one_left : dist (1 : E) = norm := funext fun a => by rw [dist_comm, dist_one_right] #align dist_one_left dist_one_left #align dist_zero_left dist_zero_left @[to_additive] theorem Isometry.norm_map_of_map_one {f : E → F} (hi : Isometry f) (h₁ : f 1 = 1) (x : E) : ‖f x‖ = ‖x‖ := by rw [← dist_one_right, ← h₁, hi.dist_eq, dist_one_right] #align isometry.norm_map_of_map_one Isometry.norm_map_of_map_one #align isometry.norm_map_of_map_zero Isometry.norm_map_of_map_zero @[to_additive (attr := simp) comap_norm_atTop] theorem comap_norm_atTop' : comap norm atTop = cobounded E := by simpa only [dist_one_right] using comap_dist_right_atTop (1 : E) @[to_additive Filter.HasBasis.cobounded_of_norm] lemma Filter.HasBasis.cobounded_of_norm' {ι : Sort*} {p : ι → Prop} {s : ι → Set ℝ} (h : HasBasis atTop p s) : HasBasis (cobounded E) p fun i ↦ norm ⁻¹' s i := comap_norm_atTop' (E := E) ▸ h.comap _ @[to_additive Filter.hasBasis_cobounded_norm] lemma Filter.hasBasis_cobounded_norm' : HasBasis (cobounded E) (fun _ ↦ True) ({x | · ≤ ‖x‖}) := atTop_basis.cobounded_of_norm' @[to_additive (attr := simp) tendsto_norm_atTop_iff_cobounded] theorem tendsto_norm_atTop_iff_cobounded' {f : α → E} {l : Filter α} : Tendsto (‖f ·‖) l atTop ↔ Tendsto f l (cobounded E) := by rw [← comap_norm_atTop', tendsto_comap_iff]; rfl @[to_additive tendsto_norm_cobounded_atTop] theorem tendsto_norm_cobounded_atTop' : Tendsto norm (cobounded E) atTop := tendsto_norm_atTop_iff_cobounded'.2 tendsto_id @[to_additive eventually_cobounded_le_norm] lemma eventually_cobounded_le_norm' (a : ℝ) : ∀ᶠ x in cobounded E, a ≤ ‖x‖ := tendsto_norm_cobounded_atTop'.eventually_ge_atTop a @[to_additive tendsto_norm_cocompact_atTop] theorem tendsto_norm_cocompact_atTop' [ProperSpace E] : Tendsto norm (cocompact E) atTop := cobounded_eq_cocompact (α := E) ▸ tendsto_norm_cobounded_atTop' #align tendsto_norm_cocompact_at_top' tendsto_norm_cocompact_atTop' #align tendsto_norm_cocompact_at_top tendsto_norm_cocompact_atTop @[to_additive] theorem norm_div_rev (a b : E) : ‖a / b‖ = ‖b / a‖ := by simpa only [dist_eq_norm_div] using dist_comm a b #align norm_div_rev norm_div_rev #align norm_sub_rev norm_sub_rev @[to_additive (attr := simp) norm_neg] theorem norm_inv' (a : E) : ‖a⁻¹‖ = ‖a‖ := by simpa using norm_div_rev 1 a #align norm_inv' norm_inv' #align norm_neg norm_neg open scoped symmDiff in @[to_additive] theorem dist_mulIndicator (s t : Set α) (f : α → E) (x : α) : dist (s.mulIndicator f x) (t.mulIndicator f x) = ‖(s ∆ t).mulIndicator f x‖ := by rw [dist_eq_norm_div, Set.apply_mulIndicator_symmDiff norm_inv'] @[to_additive (attr := simp)] theorem dist_mul_self_right (a b : E) : dist b (a * b) = ‖a‖ := by rw [← dist_one_left, ← dist_mul_right 1 a b, one_mul] #align dist_mul_self_right dist_mul_self_right #align dist_add_self_right dist_add_self_right @[to_additive (attr := simp)] theorem dist_mul_self_left (a b : E) : dist (a * b) b = ‖a‖ := by rw [dist_comm, dist_mul_self_right] #align dist_mul_self_left dist_mul_self_left #align dist_add_self_left dist_add_self_left @[to_additive (attr := simp)] theorem dist_div_eq_dist_mul_left (a b c : E) : dist (a / b) c = dist a (c * b) := by rw [← dist_mul_right _ _ b, div_mul_cancel] #align dist_div_eq_dist_mul_left dist_div_eq_dist_mul_left #align dist_sub_eq_dist_add_left dist_sub_eq_dist_add_left @[to_additive (attr := simp)] theorem dist_div_eq_dist_mul_right (a b c : E) : dist a (b / c) = dist (a * c) b := by rw [← dist_mul_right _ _ c, div_mul_cancel] #align dist_div_eq_dist_mul_right dist_div_eq_dist_mul_right #align dist_sub_eq_dist_add_right dist_sub_eq_dist_add_right @[to_additive (attr := simp)] lemma Filter.inv_cobounded : (cobounded E)⁻¹ = cobounded E := by simp only [← comap_norm_atTop', ← Filter.comap_inv, comap_comap, (· ∘ ·), norm_inv'] @[to_additive "In a (semi)normed group, negation `x ↦ -x` tends to infinity at infinity."] theorem Filter.tendsto_inv_cobounded : Tendsto Inv.inv (cobounded E) (cobounded E) := inv_cobounded.le #align filter.tendsto_inv_cobounded Filter.tendsto_inv_cobounded #align filter.tendsto_neg_cobounded Filter.tendsto_neg_cobounded @[to_additive norm_add_le "**Triangle inequality** for the norm."] theorem norm_mul_le' (a b : E) : ‖a * b‖ ≤ ‖a‖ + ‖b‖ := by simpa [dist_eq_norm_div] using dist_triangle a 1 b⁻¹ #align norm_mul_le' norm_mul_le' #align norm_add_le norm_add_le @[to_additive] theorem norm_mul_le_of_le (h₁ : ‖a₁‖ ≤ r₁) (h₂ : ‖a₂‖ ≤ r₂) : ‖a₁ * a₂‖ ≤ r₁ + r₂ := (norm_mul_le' a₁ a₂).trans <| add_le_add h₁ h₂ #align norm_mul_le_of_le norm_mul_le_of_le #align norm_add_le_of_le norm_add_le_of_le @[to_additive norm_add₃_le] theorem norm_mul₃_le (a b c : E) : ‖a * b * c‖ ≤ ‖a‖ + ‖b‖ + ‖c‖ := norm_mul_le_of_le (norm_mul_le' _ _) le_rfl #align norm_mul₃_le norm_mul₃_le #align norm_add₃_le norm_add₃_le @[to_additive] lemma norm_div_le_norm_div_add_norm_div (a b c : E) : ‖a / c‖ ≤ ‖a / b‖ + ‖b / c‖ := by simpa only [dist_eq_norm_div] using dist_triangle a b c @[to_additive (attr := simp) norm_nonneg] theorem norm_nonneg' (a : E) : 0 ≤ ‖a‖ := by rw [← dist_one_right] exact dist_nonneg #align norm_nonneg' norm_nonneg' #align norm_nonneg norm_nonneg @[to_additive (attr := simp) abs_norm] theorem abs_norm' (z : E) : |‖z‖| = ‖z‖ := abs_of_nonneg <| norm_nonneg' _ #align abs_norm abs_norm @[to_additive (attr := simp) norm_zero] theorem norm_one' : ‖(1 : E)‖ = 0 := by rw [← dist_one_right, dist_self] #align norm_one' norm_one' #align norm_zero norm_zero @[to_additive] theorem ne_one_of_norm_ne_zero : ‖a‖ ≠ 0 → a ≠ 1 := mt <| by rintro rfl exact norm_one' #align ne_one_of_norm_ne_zero ne_one_of_norm_ne_zero #align ne_zero_of_norm_ne_zero ne_zero_of_norm_ne_zero @[to_additive (attr := nontriviality) norm_of_subsingleton] theorem norm_of_subsingleton' [Subsingleton E] (a : E) : ‖a‖ = 0 := by rw [Subsingleton.elim a 1, norm_one'] #align norm_of_subsingleton' norm_of_subsingleton' #align norm_of_subsingleton norm_of_subsingleton @[to_additive zero_lt_one_add_norm_sq] theorem zero_lt_one_add_norm_sq' (x : E) : 0 < 1 + ‖x‖ ^ 2 := by positivity #align zero_lt_one_add_norm_sq' zero_lt_one_add_norm_sq' #align zero_lt_one_add_norm_sq zero_lt_one_add_norm_sq @[to_additive] theorem norm_div_le (a b : E) : ‖a / b‖ ≤ ‖a‖ + ‖b‖ := by simpa [dist_eq_norm_div] using dist_triangle a 1 b #align norm_div_le norm_div_le #align norm_sub_le norm_sub_le @[to_additive] theorem norm_div_le_of_le {r₁ r₂ : ℝ} (H₁ : ‖a₁‖ ≤ r₁) (H₂ : ‖a₂‖ ≤ r₂) : ‖a₁ / a₂‖ ≤ r₁ + r₂ := (norm_div_le a₁ a₂).trans <| add_le_add H₁ H₂ #align norm_div_le_of_le norm_div_le_of_le #align norm_sub_le_of_le norm_sub_le_of_le @[to_additive dist_le_norm_add_norm] theorem dist_le_norm_add_norm' (a b : E) : dist a b ≤ ‖a‖ + ‖b‖ := by rw [dist_eq_norm_div] apply norm_div_le #align dist_le_norm_add_norm' dist_le_norm_add_norm' #align dist_le_norm_add_norm dist_le_norm_add_norm @[to_additive abs_norm_sub_norm_le] theorem abs_norm_sub_norm_le' (a b : E) : |‖a‖ - ‖b‖| ≤ ‖a / b‖ := by simpa [dist_eq_norm_div] using abs_dist_sub_le a b 1 #align abs_norm_sub_norm_le' abs_norm_sub_norm_le' #align abs_norm_sub_norm_le abs_norm_sub_norm_le @[to_additive norm_sub_norm_le] theorem norm_sub_norm_le' (a b : E) : ‖a‖ - ‖b‖ ≤ ‖a / b‖ := (le_abs_self _).trans (abs_norm_sub_norm_le' a b) #align norm_sub_norm_le' norm_sub_norm_le' #align norm_sub_norm_le norm_sub_norm_le @[to_additive dist_norm_norm_le] theorem dist_norm_norm_le' (a b : E) : dist ‖a‖ ‖b‖ ≤ ‖a / b‖ := abs_norm_sub_norm_le' a b #align dist_norm_norm_le' dist_norm_norm_le' #align dist_norm_norm_le dist_norm_norm_le @[to_additive] theorem norm_le_norm_add_norm_div' (u v : E) : ‖u‖ ≤ ‖v‖ + ‖u / v‖ := by rw [add_comm] refine (norm_mul_le' _ _).trans_eq' ?_ rw [div_mul_cancel] #align norm_le_norm_add_norm_div' norm_le_norm_add_norm_div' #align norm_le_norm_add_norm_sub' norm_le_norm_add_norm_sub' @[to_additive] theorem norm_le_norm_add_norm_div (u v : E) : ‖v‖ ≤ ‖u‖ + ‖u / v‖ := by rw [norm_div_rev] exact norm_le_norm_add_norm_div' v u #align norm_le_norm_add_norm_div norm_le_norm_add_norm_div #align norm_le_norm_add_norm_sub norm_le_norm_add_norm_sub alias norm_le_insert' := norm_le_norm_add_norm_sub' #align norm_le_insert' norm_le_insert' alias norm_le_insert := norm_le_norm_add_norm_sub #align norm_le_insert norm_le_insert @[to_additive] theorem norm_le_mul_norm_add (u v : E) : ‖u‖ ≤ ‖u * v‖ + ‖v‖ := calc ‖u‖ = ‖u * v / v‖ := by rw [mul_div_cancel_right] _ ≤ ‖u * v‖ + ‖v‖ := norm_div_le _ _ #align norm_le_mul_norm_add norm_le_mul_norm_add #align norm_le_add_norm_add norm_le_add_norm_add @[to_additive ball_eq] theorem ball_eq' (y : E) (ε : ℝ) : ball y ε = { x | ‖x / y‖ < ε } := Set.ext fun a => by simp [dist_eq_norm_div] #align ball_eq' ball_eq' #align ball_eq ball_eq @[to_additive] theorem ball_one_eq (r : ℝ) : ball (1 : E) r = { x | ‖x‖ < r } := Set.ext fun a => by simp #align ball_one_eq ball_one_eq #align ball_zero_eq ball_zero_eq @[to_additive mem_ball_iff_norm] theorem mem_ball_iff_norm'' : b ∈ ball a r ↔ ‖b / a‖ < r := by rw [mem_ball, dist_eq_norm_div] #align mem_ball_iff_norm'' mem_ball_iff_norm'' #align mem_ball_iff_norm mem_ball_iff_norm @[to_additive mem_ball_iff_norm'] theorem mem_ball_iff_norm''' : b ∈ ball a r ↔ ‖a / b‖ < r := by rw [mem_ball', dist_eq_norm_div] #align mem_ball_iff_norm''' mem_ball_iff_norm''' #align mem_ball_iff_norm' mem_ball_iff_norm' @[to_additive] -- Porting note (#10618): `simp` can prove it theorem mem_ball_one_iff : a ∈ ball (1 : E) r ↔ ‖a‖ < r := by rw [mem_ball, dist_one_right] #align mem_ball_one_iff mem_ball_one_iff #align mem_ball_zero_iff mem_ball_zero_iff @[to_additive mem_closedBall_iff_norm] theorem mem_closedBall_iff_norm'' : b ∈ closedBall a r ↔ ‖b / a‖ ≤ r := by rw [mem_closedBall, dist_eq_norm_div] #align mem_closed_ball_iff_norm'' mem_closedBall_iff_norm'' #align mem_closed_ball_iff_norm mem_closedBall_iff_norm @[to_additive] -- Porting note (#10618): `simp` can prove it theorem mem_closedBall_one_iff : a ∈ closedBall (1 : E) r ↔ ‖a‖ ≤ r := by rw [mem_closedBall, dist_one_right] #align mem_closed_ball_one_iff mem_closedBall_one_iff #align mem_closed_ball_zero_iff mem_closedBall_zero_iff @[to_additive mem_closedBall_iff_norm'] theorem mem_closedBall_iff_norm''' : b ∈ closedBall a r ↔ ‖a / b‖ ≤ r := by rw [mem_closedBall', dist_eq_norm_div] #align mem_closed_ball_iff_norm''' mem_closedBall_iff_norm''' #align mem_closed_ball_iff_norm' mem_closedBall_iff_norm' @[to_additive norm_le_of_mem_closedBall] theorem norm_le_of_mem_closedBall' (h : b ∈ closedBall a r) : ‖b‖ ≤ ‖a‖ + r := (norm_le_norm_add_norm_div' _ _).trans <| add_le_add_left (by rwa [← dist_eq_norm_div]) _ #align norm_le_of_mem_closed_ball' norm_le_of_mem_closedBall' #align norm_le_of_mem_closed_ball norm_le_of_mem_closedBall @[to_additive norm_le_norm_add_const_of_dist_le] theorem norm_le_norm_add_const_of_dist_le' : dist a b ≤ r → ‖a‖ ≤ ‖b‖ + r := norm_le_of_mem_closedBall' #align norm_le_norm_add_const_of_dist_le' norm_le_norm_add_const_of_dist_le' #align norm_le_norm_add_const_of_dist_le norm_le_norm_add_const_of_dist_le @[to_additive norm_lt_of_mem_ball] theorem norm_lt_of_mem_ball' (h : b ∈ ball a r) : ‖b‖ < ‖a‖ + r := (norm_le_norm_add_norm_div' _ _).trans_lt <| add_lt_add_left (by rwa [← dist_eq_norm_div]) _ #align norm_lt_of_mem_ball' norm_lt_of_mem_ball' #align norm_lt_of_mem_ball norm_lt_of_mem_ball @[to_additive] theorem norm_div_sub_norm_div_le_norm_div (u v w : E) : ‖u / w‖ - ‖v / w‖ ≤ ‖u / v‖ := by simpa only [div_div_div_cancel_right'] using norm_sub_norm_le' (u / w) (v / w) #align norm_div_sub_norm_div_le_norm_div norm_div_sub_norm_div_le_norm_div #align norm_sub_sub_norm_sub_le_norm_sub norm_sub_sub_norm_sub_le_norm_sub @[to_additive isBounded_iff_forall_norm_le] theorem isBounded_iff_forall_norm_le' : Bornology.IsBounded s ↔ ∃ C, ∀ x ∈ s, ‖x‖ ≤ C := by simpa only [Set.subset_def, mem_closedBall_one_iff] using isBounded_iff_subset_closedBall (1 : E) #align bounded_iff_forall_norm_le' isBounded_iff_forall_norm_le' #align bounded_iff_forall_norm_le isBounded_iff_forall_norm_le alias ⟨Bornology.IsBounded.exists_norm_le', _⟩ := isBounded_iff_forall_norm_le' #align metric.bounded.exists_norm_le' Bornology.IsBounded.exists_norm_le' alias ⟨Bornology.IsBounded.exists_norm_le, _⟩ := isBounded_iff_forall_norm_le #align metric.bounded.exists_norm_le Bornology.IsBounded.exists_norm_le attribute [to_additive existing exists_norm_le] Bornology.IsBounded.exists_norm_le' @[to_additive exists_pos_norm_le] theorem Bornology.IsBounded.exists_pos_norm_le' (hs : IsBounded s) : ∃ R > 0, ∀ x ∈ s, ‖x‖ ≤ R := let ⟨R₀, hR₀⟩ := hs.exists_norm_le' ⟨max R₀ 1, by positivity, fun x hx => (hR₀ x hx).trans <| le_max_left _ _⟩ #align metric.bounded.exists_pos_norm_le' Bornology.IsBounded.exists_pos_norm_le' #align metric.bounded.exists_pos_norm_le Bornology.IsBounded.exists_pos_norm_le @[to_additive Bornology.IsBounded.exists_pos_norm_lt] theorem Bornology.IsBounded.exists_pos_norm_lt' (hs : IsBounded s) : ∃ R > 0, ∀ x ∈ s, ‖x‖ < R := let ⟨R, hR₀, hR⟩ := hs.exists_pos_norm_le' ⟨R + 1, by positivity, fun x hx ↦ (hR x hx).trans_lt (lt_add_one _)⟩ @[to_additive (attr := simp 1001) mem_sphere_iff_norm] -- Porting note: increase priority so the left-hand side doesn't reduce theorem mem_sphere_iff_norm' : b ∈ sphere a r ↔ ‖b / a‖ = r := by simp [dist_eq_norm_div] #align mem_sphere_iff_norm' mem_sphere_iff_norm' #align mem_sphere_iff_norm mem_sphere_iff_norm @[to_additive] -- `simp` can prove this theorem mem_sphere_one_iff_norm : a ∈ sphere (1 : E) r ↔ ‖a‖ = r := by simp [dist_eq_norm_div] #align mem_sphere_one_iff_norm mem_sphere_one_iff_norm #align mem_sphere_zero_iff_norm mem_sphere_zero_iff_norm @[to_additive (attr := simp) norm_eq_of_mem_sphere] theorem norm_eq_of_mem_sphere' (x : sphere (1 : E) r) : ‖(x : E)‖ = r := mem_sphere_one_iff_norm.mp x.2 #align norm_eq_of_mem_sphere' norm_eq_of_mem_sphere' #align norm_eq_of_mem_sphere norm_eq_of_mem_sphere @[to_additive] theorem ne_one_of_mem_sphere (hr : r ≠ 0) (x : sphere (1 : E) r) : (x : E) ≠ 1 := ne_one_of_norm_ne_zero <| by rwa [norm_eq_of_mem_sphere' x] #align ne_one_of_mem_sphere ne_one_of_mem_sphere #align ne_zero_of_mem_sphere ne_zero_of_mem_sphere @[to_additive ne_zero_of_mem_unit_sphere] theorem ne_one_of_mem_unit_sphere (x : sphere (1 : E) 1) : (x : E) ≠ 1 := ne_one_of_mem_sphere one_ne_zero _ #align ne_one_of_mem_unit_sphere ne_one_of_mem_unit_sphere #align ne_zero_of_mem_unit_sphere ne_zero_of_mem_unit_sphere variable (E) @[to_additive "The norm of a seminormed group as an additive group seminorm."] def normGroupSeminorm : GroupSeminorm E := ⟨norm, norm_one', norm_mul_le', norm_inv'⟩ #align norm_group_seminorm normGroupSeminorm #align norm_add_group_seminorm normAddGroupSeminorm @[to_additive (attr := simp)] theorem coe_normGroupSeminorm : ⇑(normGroupSeminorm E) = norm := rfl #align coe_norm_group_seminorm coe_normGroupSeminorm #align coe_norm_add_group_seminorm coe_normAddGroupSeminorm variable {E} @[to_additive] theorem NormedCommGroup.tendsto_nhds_one {f : α → E} {l : Filter α} : Tendsto f l (𝓝 1) ↔ ∀ ε > 0, ∀ᶠ x in l, ‖f x‖ < ε := Metric.tendsto_nhds.trans <| by simp only [dist_one_right] #align normed_comm_group.tendsto_nhds_one NormedCommGroup.tendsto_nhds_one #align normed_add_comm_group.tendsto_nhds_zero NormedAddCommGroup.tendsto_nhds_zero @[to_additive] theorem NormedCommGroup.tendsto_nhds_nhds {f : E → F} {x : E} {y : F} : Tendsto f (𝓝 x) (𝓝 y) ↔ ∀ ε > 0, ∃ δ > 0, ∀ x', ‖x' / x‖ < δ → ‖f x' / y‖ < ε := by simp_rw [Metric.tendsto_nhds_nhds, dist_eq_norm_div] #align normed_comm_group.tendsto_nhds_nhds NormedCommGroup.tendsto_nhds_nhds #align normed_add_comm_group.tendsto_nhds_nhds NormedAddCommGroup.tendsto_nhds_nhds @[to_additive] theorem NormedCommGroup.cauchySeq_iff [Nonempty α] [SemilatticeSup α] {u : α → E} : CauchySeq u ↔ ∀ ε > 0, ∃ N, ∀ m, N ≤ m → ∀ n, N ≤ n → ‖u m / u n‖ < ε := by simp [Metric.cauchySeq_iff, dist_eq_norm_div] #align normed_comm_group.cauchy_seq_iff NormedCommGroup.cauchySeq_iff #align normed_add_comm_group.cauchy_seq_iff NormedAddCommGroup.cauchySeq_iff @[to_additive] theorem NormedCommGroup.nhds_basis_norm_lt (x : E) : (𝓝 x).HasBasis (fun ε : ℝ => 0 < ε) fun ε => { y | ‖y / x‖ < ε } := by simp_rw [← ball_eq'] exact Metric.nhds_basis_ball #align normed_comm_group.nhds_basis_norm_lt NormedCommGroup.nhds_basis_norm_lt #align normed_add_comm_group.nhds_basis_norm_lt NormedAddCommGroup.nhds_basis_norm_lt @[to_additive] theorem NormedCommGroup.nhds_one_basis_norm_lt : (𝓝 (1 : E)).HasBasis (fun ε : ℝ => 0 < ε) fun ε => { y | ‖y‖ < ε } := by convert NormedCommGroup.nhds_basis_norm_lt (1 : E) simp #align normed_comm_group.nhds_one_basis_norm_lt NormedCommGroup.nhds_one_basis_norm_lt #align normed_add_comm_group.nhds_zero_basis_norm_lt NormedAddCommGroup.nhds_zero_basis_norm_lt @[to_additive] theorem NormedCommGroup.uniformity_basis_dist : (𝓤 E).HasBasis (fun ε : ℝ => 0 < ε) fun ε => { p : E × E | ‖p.fst / p.snd‖ < ε } := by convert Metric.uniformity_basis_dist (α := E) using 1 simp [dist_eq_norm_div] #align normed_comm_group.uniformity_basis_dist NormedCommGroup.uniformity_basis_dist #align normed_add_comm_group.uniformity_basis_dist NormedAddCommGroup.uniformity_basis_dist open Finset variable [FunLike 𝓕 E F] @[to_additive "A homomorphism `f` of seminormed groups is Lipschitz, if there exists a constant `C` such that for all `x`, one has `‖f x‖ ≤ C * ‖x‖`. The analogous condition for a linear map of (semi)normed spaces is in `Mathlib/Analysis/NormedSpace/OperatorNorm.lean`."] theorem MonoidHomClass.lipschitz_of_bound [MonoidHomClass 𝓕 E F] (f : 𝓕) (C : ℝ) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : LipschitzWith (Real.toNNReal C) f := LipschitzWith.of_dist_le' fun x y => by simpa only [dist_eq_norm_div, map_div] using h (x / y) #align monoid_hom_class.lipschitz_of_bound MonoidHomClass.lipschitz_of_bound #align add_monoid_hom_class.lipschitz_of_bound AddMonoidHomClass.lipschitz_of_bound @[to_additive] theorem lipschitzOnWith_iff_norm_div_le {f : E → F} {C : ℝ≥0} : LipschitzOnWith C f s ↔ ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → ‖f x / f y‖ ≤ C * ‖x / y‖ := by simp only [lipschitzOnWith_iff_dist_le_mul, dist_eq_norm_div] #align lipschitz_on_with_iff_norm_div_le lipschitzOnWith_iff_norm_div_le #align lipschitz_on_with_iff_norm_sub_le lipschitzOnWith_iff_norm_sub_le alias ⟨LipschitzOnWith.norm_div_le, _⟩ := lipschitzOnWith_iff_norm_div_le #align lipschitz_on_with.norm_div_le LipschitzOnWith.norm_div_le attribute [to_additive] LipschitzOnWith.norm_div_le @[to_additive] theorem LipschitzOnWith.norm_div_le_of_le {f : E → F} {C : ℝ≥0} (h : LipschitzOnWith C f s) (ha : a ∈ s) (hb : b ∈ s) (hr : ‖a / b‖ ≤ r) : ‖f a / f b‖ ≤ C * r := (h.norm_div_le ha hb).trans <| by gcongr #align lipschitz_on_with.norm_div_le_of_le LipschitzOnWith.norm_div_le_of_le #align lipschitz_on_with.norm_sub_le_of_le LipschitzOnWith.norm_sub_le_of_le @[to_additive] theorem lipschitzWith_iff_norm_div_le {f : E → F} {C : ℝ≥0} : LipschitzWith C f ↔ ∀ x y, ‖f x / f y‖ ≤ C * ‖x / y‖ := by simp only [lipschitzWith_iff_dist_le_mul, dist_eq_norm_div] #align lipschitz_with_iff_norm_div_le lipschitzWith_iff_norm_div_le #align lipschitz_with_iff_norm_sub_le lipschitzWith_iff_norm_sub_le alias ⟨LipschitzWith.norm_div_le, _⟩ := lipschitzWith_iff_norm_div_le #align lipschitz_with.norm_div_le LipschitzWith.norm_div_le attribute [to_additive] LipschitzWith.norm_div_le @[to_additive] theorem LipschitzWith.norm_div_le_of_le {f : E → F} {C : ℝ≥0} (h : LipschitzWith C f) (hr : ‖a / b‖ ≤ r) : ‖f a / f b‖ ≤ C * r := (h.norm_div_le _ _).trans <| by gcongr #align lipschitz_with.norm_div_le_of_le LipschitzWith.norm_div_le_of_le #align lipschitz_with.norm_sub_le_of_le LipschitzWith.norm_sub_le_of_le @[to_additive "A homomorphism `f` of seminormed groups is continuous, if there exists a constant `C` such that for all `x`, one has `‖f x‖ ≤ C * ‖x‖`"] theorem MonoidHomClass.continuous_of_bound [MonoidHomClass 𝓕 E F] (f : 𝓕) (C : ℝ) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : Continuous f := (MonoidHomClass.lipschitz_of_bound f C h).continuous #align monoid_hom_class.continuous_of_bound MonoidHomClass.continuous_of_bound #align add_monoid_hom_class.continuous_of_bound AddMonoidHomClass.continuous_of_bound @[to_additive] theorem MonoidHomClass.uniformContinuous_of_bound [MonoidHomClass 𝓕 E F] (f : 𝓕) (C : ℝ) (h : ∀ x, ‖f x‖ ≤ C * ‖x‖) : UniformContinuous f := (MonoidHomClass.lipschitz_of_bound f C h).uniformContinuous #align monoid_hom_class.uniform_continuous_of_bound MonoidHomClass.uniformContinuous_of_bound #align add_monoid_hom_class.uniform_continuous_of_bound AddMonoidHomClass.uniformContinuous_of_bound @[to_additive IsCompact.exists_bound_of_continuousOn] theorem IsCompact.exists_bound_of_continuousOn' [TopologicalSpace α] {s : Set α} (hs : IsCompact s) {f : α → E} (hf : ContinuousOn f s) : ∃ C, ∀ x ∈ s, ‖f x‖ ≤ C := (isBounded_iff_forall_norm_le'.1 (hs.image_of_continuousOn hf).isBounded).imp fun _C hC _x hx => hC _ <| Set.mem_image_of_mem _ hx #align is_compact.exists_bound_of_continuous_on' IsCompact.exists_bound_of_continuousOn' #align is_compact.exists_bound_of_continuous_on IsCompact.exists_bound_of_continuousOn @[to_additive] theorem HasCompactMulSupport.exists_bound_of_continuous [TopologicalSpace α] {f : α → E} (hf : HasCompactMulSupport f) (h'f : Continuous f) : ∃ C, ∀ x, ‖f x‖ ≤ C := by simpa using (hf.isCompact_range h'f).isBounded.exists_norm_le' @[to_additive] theorem MonoidHomClass.isometry_iff_norm [MonoidHomClass 𝓕 E F] (f : 𝓕) : Isometry f ↔ ∀ x, ‖f x‖ = ‖x‖ := by simp only [isometry_iff_dist_eq, dist_eq_norm_div, ← map_div] refine ⟨fun h x => ?_, fun h x y => h _⟩ simpa using h x 1 #align monoid_hom_class.isometry_iff_norm MonoidHomClass.isometry_iff_norm #align add_monoid_hom_class.isometry_iff_norm AddMonoidHomClass.isometry_iff_norm alias ⟨_, MonoidHomClass.isometry_of_norm⟩ := MonoidHomClass.isometry_iff_norm #align monoid_hom_class.isometry_of_norm MonoidHomClass.isometry_of_norm attribute [to_additive] MonoidHomClass.isometry_of_norm @[to_additive]
Mathlib/Analysis/Normed/Group/Basic.lean
1,160
1,162
theorem tendsto_iff_norm_div_tendsto_zero {f : α → E} {a : Filter α} {b : E} : Tendsto f a (𝓝 b) ↔ Tendsto (fun e => ‖f e / b‖) a (𝓝 0) := by
simp only [← dist_eq_norm_div, ← tendsto_iff_dist_tendsto_zero]
set_option autoImplicit true namespace Array @[simp] theorem extract_eq_nil_of_start_eq_end {a : Array α} : a.extract i i = #[] := by refine extract_empty_of_stop_le_start a ?h exact Nat.le_refl i theorem extract_append_left {a b : Array α} {i j : Nat} (h : j ≤ a.size) : (a ++ b).extract i j = a.extract i j := by apply ext · simp only [size_extract, size_append] omega · intro h1 h2 h3 rw [get_extract, get_append_left, get_extract] theorem extract_append_right {a b : Array α} {i j : Nat} (h : a.size ≤ i) : (a ++ b).extract i j = b.extract (i - a.size) (j - a.size) := by apply ext · rw [size_extract, size_extract, size_append] omega · intro k hi h2 rw [get_extract, get_extract, get_append_right (show size a ≤ i + k by omega)] congr omega
Mathlib/Data/Array/ExtractLemmas.lean
40
42
theorem extract_eq_of_size_le_end {a : Array α} (h : a.size ≤ l) : a.extract p l = a.extract p a.size := by
simp only [extract, Nat.min_eq_right h, Nat.sub_eq, mkEmpty_eq, Nat.min_self]
import Mathlib.Analysis.InnerProductSpace.Dual import Mathlib.Analysis.InnerProductSpace.Orientation import Mathlib.Data.Complex.Orientation import Mathlib.Tactic.LinearCombination #align_import analysis.inner_product_space.two_dim from "leanprover-community/mathlib"@"cd8fafa2fac98e1a67097e8a91ad9901cfde48af" noncomputable section open scoped RealInnerProductSpace ComplexConjugate open FiniteDimensional lemma FiniteDimensional.of_fact_finrank_eq_two {K V : Type*} [DivisionRing K] [AddCommGroup V] [Module K V] [Fact (finrank K V = 2)] : FiniteDimensional K V := .of_fact_finrank_eq_succ 1 attribute [local instance] FiniteDimensional.of_fact_finrank_eq_two @[deprecated (since := "2024-02-02")] alias FiniteDimensional.finiteDimensional_of_fact_finrank_eq_two := FiniteDimensional.of_fact_finrank_eq_two variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [Fact (finrank ℝ E = 2)] (o : Orientation ℝ E (Fin 2)) namespace Orientation irreducible_def areaForm : E →ₗ[ℝ] E →ₗ[ℝ] ℝ := by let z : E [⋀^Fin 0]→ₗ[ℝ] ℝ ≃ₗ[ℝ] ℝ := AlternatingMap.constLinearEquivOfIsEmpty.symm let y : E [⋀^Fin 1]→ₗ[ℝ] ℝ →ₗ[ℝ] E →ₗ[ℝ] ℝ := LinearMap.llcomp ℝ E (E [⋀^Fin 0]→ₗ[ℝ] ℝ) ℝ z ∘ₗ AlternatingMap.curryLeftLinearMap exact y ∘ₗ AlternatingMap.curryLeftLinearMap (R' := ℝ) o.volumeForm #align orientation.area_form Orientation.areaForm local notation "ω" => o.areaForm theorem areaForm_to_volumeForm (x y : E) : ω x y = o.volumeForm ![x, y] := by simp [areaForm] #align orientation.area_form_to_volume_form Orientation.areaForm_to_volumeForm @[simp] theorem areaForm_apply_self (x : E) : ω x x = 0 := by rw [areaForm_to_volumeForm] refine o.volumeForm.map_eq_zero_of_eq ![x, x] ?_ (?_ : (0 : Fin 2) ≠ 1) · simp · norm_num #align orientation.area_form_apply_self Orientation.areaForm_apply_self theorem areaForm_swap (x y : E) : ω x y = -ω y x := by simp only [areaForm_to_volumeForm] convert o.volumeForm.map_swap ![y, x] (_ : (0 : Fin 2) ≠ 1) · ext i fin_cases i <;> rfl · norm_num #align orientation.area_form_swap Orientation.areaForm_swap @[simp] theorem areaForm_neg_orientation : (-o).areaForm = -o.areaForm := by ext x y simp [areaForm_to_volumeForm] #align orientation.area_form_neg_orientation Orientation.areaForm_neg_orientation def areaForm' : E →L[ℝ] E →L[ℝ] ℝ := LinearMap.toContinuousLinearMap (↑(LinearMap.toContinuousLinearMap : (E →ₗ[ℝ] ℝ) ≃ₗ[ℝ] E →L[ℝ] ℝ) ∘ₗ o.areaForm) #align orientation.area_form' Orientation.areaForm' @[simp] theorem areaForm'_apply (x : E) : o.areaForm' x = LinearMap.toContinuousLinearMap (o.areaForm x) := rfl #align orientation.area_form'_apply Orientation.areaForm'_apply theorem abs_areaForm_le (x y : E) : |ω x y| ≤ ‖x‖ * ‖y‖ := by simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.abs_volumeForm_apply_le ![x, y] #align orientation.abs_area_form_le Orientation.abs_areaForm_le theorem areaForm_le (x y : E) : ω x y ≤ ‖x‖ * ‖y‖ := by simpa [areaForm_to_volumeForm, Fin.prod_univ_succ] using o.volumeForm_apply_le ![x, y] #align orientation.area_form_le Orientation.areaForm_le theorem abs_areaForm_of_orthogonal {x y : E} (h : ⟪x, y⟫ = 0) : |ω x y| = ‖x‖ * ‖y‖ := by rw [o.areaForm_to_volumeForm, o.abs_volumeForm_apply_of_pairwise_orthogonal] · simp [Fin.prod_univ_succ] intro i j hij fin_cases i <;> fin_cases j · simp_all · simpa using h · simpa [real_inner_comm] using h · simp_all #align orientation.abs_area_form_of_orthogonal Orientation.abs_areaForm_of_orthogonal
Mathlib/Analysis/InnerProductSpace/TwoDim.lean
161
168
theorem areaForm_map {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F] [hF : Fact (finrank ℝ F = 2)] (φ : E ≃ₗᵢ[ℝ] F) (x y : F) : (Orientation.map (Fin 2) φ.toLinearEquiv o).areaForm x y = o.areaForm (φ.symm x) (φ.symm y) := by
have : φ.symm ∘ ![x, y] = ![φ.symm x, φ.symm y] := by ext i fin_cases i <;> rfl simp [areaForm_to_volumeForm, volumeForm_map, this]
import Mathlib.Combinatorics.SimpleGraph.Subgraph import Mathlib.Data.List.Rotate #align_import combinatorics.simple_graph.connectivity from "leanprover-community/mathlib"@"b99e2d58a5e6861833fa8de11e51a81144258db4" open Function universe u v w namespace SimpleGraph variable {V : Type u} {V' : Type v} {V'' : Type w} variable (G : SimpleGraph V) (G' : SimpleGraph V') (G'' : SimpleGraph V'') inductive Walk : V → V → Type u | nil {u : V} : Walk u u | cons {u v w : V} (h : G.Adj u v) (p : Walk v w) : Walk u w deriving DecidableEq #align simple_graph.walk SimpleGraph.Walk attribute [refl] Walk.nil @[simps] instance Walk.instInhabited (v : V) : Inhabited (G.Walk v v) := ⟨Walk.nil⟩ #align simple_graph.walk.inhabited SimpleGraph.Walk.instInhabited @[match_pattern, reducible] def Adj.toWalk {G : SimpleGraph V} {u v : V} (h : G.Adj u v) : G.Walk u v := Walk.cons h Walk.nil #align simple_graph.adj.to_walk SimpleGraph.Adj.toWalk namespace Walk variable {G} @[match_pattern] abbrev nil' (u : V) : G.Walk u u := Walk.nil #align simple_graph.walk.nil' SimpleGraph.Walk.nil' @[match_pattern] abbrev cons' (u v w : V) (h : G.Adj u v) (p : G.Walk v w) : G.Walk u w := Walk.cons h p #align simple_graph.walk.cons' SimpleGraph.Walk.cons' protected def copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : G.Walk u' v' := hu ▸ hv ▸ p #align simple_graph.walk.copy SimpleGraph.Walk.copy @[simp] theorem copy_rfl_rfl {u v} (p : G.Walk u v) : p.copy rfl rfl = p := rfl #align simple_graph.walk.copy_rfl_rfl SimpleGraph.Walk.copy_rfl_rfl @[simp] theorem copy_copy {u v u' v' u'' v''} (p : G.Walk u v) (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') : (p.copy hu hv).copy hu' hv' = p.copy (hu.trans hu') (hv.trans hv') := by subst_vars rfl #align simple_graph.walk.copy_copy SimpleGraph.Walk.copy_copy @[simp] theorem copy_nil {u u'} (hu : u = u') : (Walk.nil : G.Walk u u).copy hu hu = Walk.nil := by subst_vars rfl #align simple_graph.walk.copy_nil SimpleGraph.Walk.copy_nil theorem copy_cons {u v w u' w'} (h : G.Adj u v) (p : G.Walk v w) (hu : u = u') (hw : w = w') : (Walk.cons h p).copy hu hw = Walk.cons (hu ▸ h) (p.copy rfl hw) := by subst_vars rfl #align simple_graph.walk.copy_cons SimpleGraph.Walk.copy_cons @[simp] theorem cons_copy {u v w v' w'} (h : G.Adj u v) (p : G.Walk v' w') (hv : v' = v) (hw : w' = w) : Walk.cons h (p.copy hv hw) = (Walk.cons (hv ▸ h) p).copy rfl hw := by subst_vars rfl #align simple_graph.walk.cons_copy SimpleGraph.Walk.cons_copy theorem exists_eq_cons_of_ne {u v : V} (hne : u ≠ v) : ∀ (p : G.Walk u v), ∃ (w : V) (h : G.Adj u w) (p' : G.Walk w v), p = cons h p' | nil => (hne rfl).elim | cons h p' => ⟨_, h, p', rfl⟩ #align simple_graph.walk.exists_eq_cons_of_ne SimpleGraph.Walk.exists_eq_cons_of_ne def length {u v : V} : G.Walk u v → ℕ | nil => 0 | cons _ q => q.length.succ #align simple_graph.walk.length SimpleGraph.Walk.length @[trans] def append {u v w : V} : G.Walk u v → G.Walk v w → G.Walk u w | nil, q => q | cons h p, q => cons h (p.append q) #align simple_graph.walk.append SimpleGraph.Walk.append def concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : G.Walk u w := p.append (cons h nil) #align simple_graph.walk.concat SimpleGraph.Walk.concat theorem concat_eq_append {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : p.concat h = p.append (cons h nil) := rfl #align simple_graph.walk.concat_eq_append SimpleGraph.Walk.concat_eq_append protected def reverseAux {u v w : V} : G.Walk u v → G.Walk u w → G.Walk v w | nil, q => q | cons h p, q => Walk.reverseAux p (cons (G.symm h) q) #align simple_graph.walk.reverse_aux SimpleGraph.Walk.reverseAux @[symm] def reverse {u v : V} (w : G.Walk u v) : G.Walk v u := w.reverseAux nil #align simple_graph.walk.reverse SimpleGraph.Walk.reverse def getVert {u v : V} : G.Walk u v → ℕ → V | nil, _ => u | cons _ _, 0 => u | cons _ q, n + 1 => q.getVert n #align simple_graph.walk.get_vert SimpleGraph.Walk.getVert @[simp] theorem getVert_zero {u v} (w : G.Walk u v) : w.getVert 0 = u := by cases w <;> rfl #align simple_graph.walk.get_vert_zero SimpleGraph.Walk.getVert_zero theorem getVert_of_length_le {u v} (w : G.Walk u v) {i : ℕ} (hi : w.length ≤ i) : w.getVert i = v := by induction w generalizing i with | nil => rfl | cons _ _ ih => cases i · cases hi · exact ih (Nat.succ_le_succ_iff.1 hi) #align simple_graph.walk.get_vert_of_length_le SimpleGraph.Walk.getVert_of_length_le @[simp] theorem getVert_length {u v} (w : G.Walk u v) : w.getVert w.length = v := w.getVert_of_length_le rfl.le #align simple_graph.walk.get_vert_length SimpleGraph.Walk.getVert_length theorem adj_getVert_succ {u v} (w : G.Walk u v) {i : ℕ} (hi : i < w.length) : G.Adj (w.getVert i) (w.getVert (i + 1)) := by induction w generalizing i with | nil => cases hi | cons hxy _ ih => cases i · simp [getVert, hxy] · exact ih (Nat.succ_lt_succ_iff.1 hi) #align simple_graph.walk.adj_get_vert_succ SimpleGraph.Walk.adj_getVert_succ @[simp] theorem cons_append {u v w x : V} (h : G.Adj u v) (p : G.Walk v w) (q : G.Walk w x) : (cons h p).append q = cons h (p.append q) := rfl #align simple_graph.walk.cons_append SimpleGraph.Walk.cons_append @[simp] theorem cons_nil_append {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h nil).append p = cons h p := rfl #align simple_graph.walk.cons_nil_append SimpleGraph.Walk.cons_nil_append @[simp] theorem append_nil {u v : V} (p : G.Walk u v) : p.append nil = p := by induction p with | nil => rfl | cons _ _ ih => rw [cons_append, ih] #align simple_graph.walk.append_nil SimpleGraph.Walk.append_nil @[simp] theorem nil_append {u v : V} (p : G.Walk u v) : nil.append p = p := rfl #align simple_graph.walk.nil_append SimpleGraph.Walk.nil_append theorem append_assoc {u v w x : V} (p : G.Walk u v) (q : G.Walk v w) (r : G.Walk w x) : p.append (q.append r) = (p.append q).append r := by induction p with | nil => rfl | cons h p' ih => dsimp only [append] rw [ih] #align simple_graph.walk.append_assoc SimpleGraph.Walk.append_assoc @[simp] theorem append_copy_copy {u v w u' v' w'} (p : G.Walk u v) (q : G.Walk v w) (hu : u = u') (hv : v = v') (hw : w = w') : (p.copy hu hv).append (q.copy hv hw) = (p.append q).copy hu hw := by subst_vars rfl #align simple_graph.walk.append_copy_copy SimpleGraph.Walk.append_copy_copy theorem concat_nil {u v : V} (h : G.Adj u v) : nil.concat h = cons h nil := rfl #align simple_graph.walk.concat_nil SimpleGraph.Walk.concat_nil @[simp] theorem concat_cons {u v w x : V} (h : G.Adj u v) (p : G.Walk v w) (h' : G.Adj w x) : (cons h p).concat h' = cons h (p.concat h') := rfl #align simple_graph.walk.concat_cons SimpleGraph.Walk.concat_cons theorem append_concat {u v w x : V} (p : G.Walk u v) (q : G.Walk v w) (h : G.Adj w x) : p.append (q.concat h) = (p.append q).concat h := append_assoc _ _ _ #align simple_graph.walk.append_concat SimpleGraph.Walk.append_concat theorem concat_append {u v w x : V} (p : G.Walk u v) (h : G.Adj v w) (q : G.Walk w x) : (p.concat h).append q = p.append (cons h q) := by rw [concat_eq_append, ← append_assoc, cons_nil_append] #align simple_graph.walk.concat_append SimpleGraph.Walk.concat_append theorem exists_cons_eq_concat {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : ∃ (x : V) (q : G.Walk u x) (h' : G.Adj x w), cons h p = q.concat h' := by induction p generalizing u with | nil => exact ⟨_, nil, h, rfl⟩ | cons h' p ih => obtain ⟨y, q, h'', hc⟩ := ih h' refine ⟨y, cons h q, h'', ?_⟩ rw [concat_cons, hc] #align simple_graph.walk.exists_cons_eq_concat SimpleGraph.Walk.exists_cons_eq_concat theorem exists_concat_eq_cons {u v w : V} : ∀ (p : G.Walk u v) (h : G.Adj v w), ∃ (x : V) (h' : G.Adj u x) (q : G.Walk x w), p.concat h = cons h' q | nil, h => ⟨_, h, nil, rfl⟩ | cons h' p, h => ⟨_, h', Walk.concat p h, concat_cons _ _ _⟩ #align simple_graph.walk.exists_concat_eq_cons SimpleGraph.Walk.exists_concat_eq_cons @[simp] theorem reverse_nil {u : V} : (nil : G.Walk u u).reverse = nil := rfl #align simple_graph.walk.reverse_nil SimpleGraph.Walk.reverse_nil theorem reverse_singleton {u v : V} (h : G.Adj u v) : (cons h nil).reverse = cons (G.symm h) nil := rfl #align simple_graph.walk.reverse_singleton SimpleGraph.Walk.reverse_singleton @[simp] theorem cons_reverseAux {u v w x : V} (p : G.Walk u v) (q : G.Walk w x) (h : G.Adj w u) : (cons h p).reverseAux q = p.reverseAux (cons (G.symm h) q) := rfl #align simple_graph.walk.cons_reverse_aux SimpleGraph.Walk.cons_reverseAux @[simp] protected theorem append_reverseAux {u v w x : V} (p : G.Walk u v) (q : G.Walk v w) (r : G.Walk u x) : (p.append q).reverseAux r = q.reverseAux (p.reverseAux r) := by induction p with | nil => rfl | cons h _ ih => exact ih q (cons (G.symm h) r) #align simple_graph.walk.append_reverse_aux SimpleGraph.Walk.append_reverseAux @[simp] protected theorem reverseAux_append {u v w x : V} (p : G.Walk u v) (q : G.Walk u w) (r : G.Walk w x) : (p.reverseAux q).append r = p.reverseAux (q.append r) := by induction p with | nil => rfl | cons h _ ih => simp [ih (cons (G.symm h) q)] #align simple_graph.walk.reverse_aux_append SimpleGraph.Walk.reverseAux_append protected theorem reverseAux_eq_reverse_append {u v w : V} (p : G.Walk u v) (q : G.Walk u w) : p.reverseAux q = p.reverse.append q := by simp [reverse] #align simple_graph.walk.reverse_aux_eq_reverse_append SimpleGraph.Walk.reverseAux_eq_reverse_append @[simp] theorem reverse_cons {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h p).reverse = p.reverse.append (cons (G.symm h) nil) := by simp [reverse] #align simple_graph.walk.reverse_cons SimpleGraph.Walk.reverse_cons @[simp] theorem reverse_copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : (p.copy hu hv).reverse = p.reverse.copy hv hu := by subst_vars rfl #align simple_graph.walk.reverse_copy SimpleGraph.Walk.reverse_copy @[simp] theorem reverse_append {u v w : V} (p : G.Walk u v) (q : G.Walk v w) : (p.append q).reverse = q.reverse.append p.reverse := by simp [reverse] #align simple_graph.walk.reverse_append SimpleGraph.Walk.reverse_append @[simp] theorem reverse_concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : (p.concat h).reverse = cons (G.symm h) p.reverse := by simp [concat_eq_append] #align simple_graph.walk.reverse_concat SimpleGraph.Walk.reverse_concat @[simp] theorem reverse_reverse {u v : V} (p : G.Walk u v) : p.reverse.reverse = p := by induction p with | nil => rfl | cons _ _ ih => simp [ih] #align simple_graph.walk.reverse_reverse SimpleGraph.Walk.reverse_reverse @[simp] theorem length_nil {u : V} : (nil : G.Walk u u).length = 0 := rfl #align simple_graph.walk.length_nil SimpleGraph.Walk.length_nil @[simp] theorem length_cons {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h p).length = p.length + 1 := rfl #align simple_graph.walk.length_cons SimpleGraph.Walk.length_cons @[simp] theorem length_copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : (p.copy hu hv).length = p.length := by subst_vars rfl #align simple_graph.walk.length_copy SimpleGraph.Walk.length_copy @[simp] theorem length_append {u v w : V} (p : G.Walk u v) (q : G.Walk v w) : (p.append q).length = p.length + q.length := by induction p with | nil => simp | cons _ _ ih => simp [ih, add_comm, add_left_comm, add_assoc] #align simple_graph.walk.length_append SimpleGraph.Walk.length_append @[simp] theorem length_concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : (p.concat h).length = p.length + 1 := length_append _ _ #align simple_graph.walk.length_concat SimpleGraph.Walk.length_concat @[simp] protected theorem length_reverseAux {u v w : V} (p : G.Walk u v) (q : G.Walk u w) : (p.reverseAux q).length = p.length + q.length := by induction p with | nil => simp! | cons _ _ ih => simp [ih, Nat.succ_add, Nat.add_assoc] #align simple_graph.walk.length_reverse_aux SimpleGraph.Walk.length_reverseAux @[simp] theorem length_reverse {u v : V} (p : G.Walk u v) : p.reverse.length = p.length := by simp [reverse] #align simple_graph.walk.length_reverse SimpleGraph.Walk.length_reverse theorem eq_of_length_eq_zero {u v : V} : ∀ {p : G.Walk u v}, p.length = 0 → u = v | nil, _ => rfl #align simple_graph.walk.eq_of_length_eq_zero SimpleGraph.Walk.eq_of_length_eq_zero theorem adj_of_length_eq_one {u v : V} : ∀ {p : G.Walk u v}, p.length = 1 → G.Adj u v | cons h nil, _ => h @[simp] theorem exists_length_eq_zero_iff {u v : V} : (∃ p : G.Walk u v, p.length = 0) ↔ u = v := by constructor · rintro ⟨p, hp⟩ exact eq_of_length_eq_zero hp · rintro rfl exact ⟨nil, rfl⟩ #align simple_graph.walk.exists_length_eq_zero_iff SimpleGraph.Walk.exists_length_eq_zero_iff @[simp] theorem length_eq_zero_iff {u : V} {p : G.Walk u u} : p.length = 0 ↔ p = nil := by cases p <;> simp #align simple_graph.walk.length_eq_zero_iff SimpleGraph.Walk.length_eq_zero_iff theorem getVert_append {u v w : V} (p : G.Walk u v) (q : G.Walk v w) (i : ℕ) : (p.append q).getVert i = if i < p.length then p.getVert i else q.getVert (i - p.length) := by induction p generalizing i with | nil => simp | cons h p ih => cases i <;> simp [getVert, ih, Nat.succ_lt_succ_iff] theorem getVert_reverse {u v : V} (p : G.Walk u v) (i : ℕ) : p.reverse.getVert i = p.getVert (p.length - i) := by induction p with | nil => rfl | cons h p ih => simp only [reverse_cons, getVert_append, length_reverse, ih, length_cons] split_ifs next hi => rw [Nat.succ_sub hi.le] simp [getVert] next hi => obtain rfl | hi' := Nat.eq_or_lt_of_not_lt hi · simp [getVert] · rw [Nat.eq_add_of_sub_eq (Nat.sub_pos_of_lt hi') rfl, Nat.sub_eq_zero_of_le hi'] simp [getVert] theorem concat_ne_nil {u v : V} (p : G.Walk u v) (h : G.Adj v u) : p.concat h ≠ nil := by cases p <;> simp [concat] #align simple_graph.walk.concat_ne_nil SimpleGraph.Walk.concat_ne_nil theorem concat_inj {u v v' w : V} {p : G.Walk u v} {h : G.Adj v w} {p' : G.Walk u v'} {h' : G.Adj v' w} (he : p.concat h = p'.concat h') : ∃ hv : v = v', p.copy rfl hv = p' := by induction p with | nil => cases p' · exact ⟨rfl, rfl⟩ · exfalso simp only [concat_nil, concat_cons, cons.injEq] at he obtain ⟨rfl, he⟩ := he simp only [heq_iff_eq] at he exact concat_ne_nil _ _ he.symm | cons _ _ ih => rw [concat_cons] at he cases p' · exfalso simp only [concat_nil, cons.injEq] at he obtain ⟨rfl, he⟩ := he rw [heq_iff_eq] at he exact concat_ne_nil _ _ he · rw [concat_cons, cons.injEq] at he obtain ⟨rfl, he⟩ := he rw [heq_iff_eq] at he obtain ⟨rfl, rfl⟩ := ih he exact ⟨rfl, rfl⟩ #align simple_graph.walk.concat_inj SimpleGraph.Walk.concat_inj def support {u v : V} : G.Walk u v → List V | nil => [u] | cons _ p => u :: p.support #align simple_graph.walk.support SimpleGraph.Walk.support def darts {u v : V} : G.Walk u v → List G.Dart | nil => [] | cons h p => ⟨(u, _), h⟩ :: p.darts #align simple_graph.walk.darts SimpleGraph.Walk.darts def edges {u v : V} (p : G.Walk u v) : List (Sym2 V) := p.darts.map Dart.edge #align simple_graph.walk.edges SimpleGraph.Walk.edges @[simp] theorem support_nil {u : V} : (nil : G.Walk u u).support = [u] := rfl #align simple_graph.walk.support_nil SimpleGraph.Walk.support_nil @[simp] theorem support_cons {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h p).support = u :: p.support := rfl #align simple_graph.walk.support_cons SimpleGraph.Walk.support_cons @[simp] theorem support_concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : (p.concat h).support = p.support.concat w := by induction p <;> simp [*, concat_nil] #align simple_graph.walk.support_concat SimpleGraph.Walk.support_concat @[simp] theorem support_copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : (p.copy hu hv).support = p.support := by subst_vars rfl #align simple_graph.walk.support_copy SimpleGraph.Walk.support_copy theorem support_append {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : (p.append p').support = p.support ++ p'.support.tail := by induction p <;> cases p' <;> simp [*] #align simple_graph.walk.support_append SimpleGraph.Walk.support_append @[simp] theorem support_reverse {u v : V} (p : G.Walk u v) : p.reverse.support = p.support.reverse := by induction p <;> simp [support_append, *] #align simple_graph.walk.support_reverse SimpleGraph.Walk.support_reverse @[simp] theorem support_ne_nil {u v : V} (p : G.Walk u v) : p.support ≠ [] := by cases p <;> simp #align simple_graph.walk.support_ne_nil SimpleGraph.Walk.support_ne_nil theorem tail_support_append {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : (p.append p').support.tail = p.support.tail ++ p'.support.tail := by rw [support_append, List.tail_append_of_ne_nil _ _ (support_ne_nil _)] #align simple_graph.walk.tail_support_append SimpleGraph.Walk.tail_support_append theorem support_eq_cons {u v : V} (p : G.Walk u v) : p.support = u :: p.support.tail := by cases p <;> simp #align simple_graph.walk.support_eq_cons SimpleGraph.Walk.support_eq_cons @[simp] theorem start_mem_support {u v : V} (p : G.Walk u v) : u ∈ p.support := by cases p <;> simp #align simple_graph.walk.start_mem_support SimpleGraph.Walk.start_mem_support @[simp] theorem end_mem_support {u v : V} (p : G.Walk u v) : v ∈ p.support := by induction p <;> simp [*] #align simple_graph.walk.end_mem_support SimpleGraph.Walk.end_mem_support @[simp] theorem support_nonempty {u v : V} (p : G.Walk u v) : { w | w ∈ p.support }.Nonempty := ⟨u, by simp⟩ #align simple_graph.walk.support_nonempty SimpleGraph.Walk.support_nonempty theorem mem_support_iff {u v w : V} (p : G.Walk u v) : w ∈ p.support ↔ w = u ∨ w ∈ p.support.tail := by cases p <;> simp #align simple_graph.walk.mem_support_iff SimpleGraph.Walk.mem_support_iff theorem mem_support_nil_iff {u v : V} : u ∈ (nil : G.Walk v v).support ↔ u = v := by simp #align simple_graph.walk.mem_support_nil_iff SimpleGraph.Walk.mem_support_nil_iff @[simp] theorem mem_tail_support_append_iff {t u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : t ∈ (p.append p').support.tail ↔ t ∈ p.support.tail ∨ t ∈ p'.support.tail := by rw [tail_support_append, List.mem_append] #align simple_graph.walk.mem_tail_support_append_iff SimpleGraph.Walk.mem_tail_support_append_iff @[simp] theorem end_mem_tail_support_of_ne {u v : V} (h : u ≠ v) (p : G.Walk u v) : v ∈ p.support.tail := by obtain ⟨_, _, _, rfl⟩ := exists_eq_cons_of_ne h p simp #align simple_graph.walk.end_mem_tail_support_of_ne SimpleGraph.Walk.end_mem_tail_support_of_ne @[simp, nolint unusedHavesSuffices] theorem mem_support_append_iff {t u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : t ∈ (p.append p').support ↔ t ∈ p.support ∨ t ∈ p'.support := by simp only [mem_support_iff, mem_tail_support_append_iff] obtain rfl | h := eq_or_ne t v <;> obtain rfl | h' := eq_or_ne t u <;> -- this `have` triggers the unusedHavesSuffices linter: (try have := h'.symm) <;> simp [*] #align simple_graph.walk.mem_support_append_iff SimpleGraph.Walk.mem_support_append_iff @[simp] theorem subset_support_append_left {V : Type u} {G : SimpleGraph V} {u v w : V} (p : G.Walk u v) (q : G.Walk v w) : p.support ⊆ (p.append q).support := by simp only [Walk.support_append, List.subset_append_left] #align simple_graph.walk.subset_support_append_left SimpleGraph.Walk.subset_support_append_left @[simp] theorem subset_support_append_right {V : Type u} {G : SimpleGraph V} {u v w : V} (p : G.Walk u v) (q : G.Walk v w) : q.support ⊆ (p.append q).support := by intro h simp (config := { contextual := true }) only [mem_support_append_iff, or_true_iff, imp_true_iff] #align simple_graph.walk.subset_support_append_right SimpleGraph.Walk.subset_support_append_right theorem coe_support {u v : V} (p : G.Walk u v) : (p.support : Multiset V) = {u} + p.support.tail := by cases p <;> rfl #align simple_graph.walk.coe_support SimpleGraph.Walk.coe_support theorem coe_support_append {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : ((p.append p').support : Multiset V) = {u} + p.support.tail + p'.support.tail := by rw [support_append, ← Multiset.coe_add, coe_support] #align simple_graph.walk.coe_support_append SimpleGraph.Walk.coe_support_append theorem coe_support_append' [DecidableEq V] {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : ((p.append p').support : Multiset V) = p.support + p'.support - {v} := by rw [support_append, ← Multiset.coe_add] simp only [coe_support] rw [add_comm ({v} : Multiset V)] simp only [← add_assoc, add_tsub_cancel_right] #align simple_graph.walk.coe_support_append' SimpleGraph.Walk.coe_support_append' theorem chain_adj_support {u v w : V} (h : G.Adj u v) : ∀ (p : G.Walk v w), List.Chain G.Adj u p.support | nil => List.Chain.cons h List.Chain.nil | cons h' p => List.Chain.cons h (chain_adj_support h' p) #align simple_graph.walk.chain_adj_support SimpleGraph.Walk.chain_adj_support theorem chain'_adj_support {u v : V} : ∀ (p : G.Walk u v), List.Chain' G.Adj p.support | nil => List.Chain.nil | cons h p => chain_adj_support h p #align simple_graph.walk.chain'_adj_support SimpleGraph.Walk.chain'_adj_support theorem chain_dartAdj_darts {d : G.Dart} {v w : V} (h : d.snd = v) (p : G.Walk v w) : List.Chain G.DartAdj d p.darts := by induction p generalizing d with | nil => exact List.Chain.nil -- Porting note: needed to defer `h` and `rfl` to help elaboration | cons h' p ih => exact List.Chain.cons (by exact h) (ih (by rfl)) #align simple_graph.walk.chain_dart_adj_darts SimpleGraph.Walk.chain_dartAdj_darts theorem chain'_dartAdj_darts {u v : V} : ∀ (p : G.Walk u v), List.Chain' G.DartAdj p.darts | nil => trivial -- Porting note: needed to defer `rfl` to help elaboration | cons h p => chain_dartAdj_darts (by rfl) p #align simple_graph.walk.chain'_dart_adj_darts SimpleGraph.Walk.chain'_dartAdj_darts theorem edges_subset_edgeSet {u v : V} : ∀ (p : G.Walk u v) ⦃e : Sym2 V⦄, e ∈ p.edges → e ∈ G.edgeSet | cons h' p', e, h => by cases h · exact h' next h' => exact edges_subset_edgeSet p' h' #align simple_graph.walk.edges_subset_edge_set SimpleGraph.Walk.edges_subset_edgeSet theorem adj_of_mem_edges {u v x y : V} (p : G.Walk u v) (h : s(x, y) ∈ p.edges) : G.Adj x y := edges_subset_edgeSet p h #align simple_graph.walk.adj_of_mem_edges SimpleGraph.Walk.adj_of_mem_edges @[simp] theorem darts_nil {u : V} : (nil : G.Walk u u).darts = [] := rfl #align simple_graph.walk.darts_nil SimpleGraph.Walk.darts_nil @[simp] theorem darts_cons {u v w : V} (h : G.Adj u v) (p : G.Walk v w) : (cons h p).darts = ⟨(u, v), h⟩ :: p.darts := rfl #align simple_graph.walk.darts_cons SimpleGraph.Walk.darts_cons @[simp] theorem darts_concat {u v w : V} (p : G.Walk u v) (h : G.Adj v w) : (p.concat h).darts = p.darts.concat ⟨(v, w), h⟩ := by induction p <;> simp [*, concat_nil] #align simple_graph.walk.darts_concat SimpleGraph.Walk.darts_concat @[simp] theorem darts_copy {u v u' v'} (p : G.Walk u v) (hu : u = u') (hv : v = v') : (p.copy hu hv).darts = p.darts := by subst_vars rfl #align simple_graph.walk.darts_copy SimpleGraph.Walk.darts_copy @[simp] theorem darts_append {u v w : V} (p : G.Walk u v) (p' : G.Walk v w) : (p.append p').darts = p.darts ++ p'.darts := by induction p <;> simp [*] #align simple_graph.walk.darts_append SimpleGraph.Walk.darts_append @[simp] theorem darts_reverse {u v : V} (p : G.Walk u v) : p.reverse.darts = (p.darts.map Dart.symm).reverse := by induction p <;> simp [*, Sym2.eq_swap] #align simple_graph.walk.darts_reverse SimpleGraph.Walk.darts_reverse theorem mem_darts_reverse {u v : V} {d : G.Dart} {p : G.Walk u v} : d ∈ p.reverse.darts ↔ d.symm ∈ p.darts := by simp #align simple_graph.walk.mem_darts_reverse SimpleGraph.Walk.mem_darts_reverse theorem cons_map_snd_darts {u v : V} (p : G.Walk u v) : (u :: p.darts.map (·.snd)) = p.support := by induction p <;> simp! [*] #align simple_graph.walk.cons_map_snd_darts SimpleGraph.Walk.cons_map_snd_darts
Mathlib/Combinatorics/SimpleGraph/Connectivity.lean
743
744
theorem map_snd_darts {u v : V} (p : G.Walk u v) : p.darts.map (·.snd) = p.support.tail := by
simpa using congr_arg List.tail (cons_map_snd_darts p)
import Mathlib.Data.Real.Sqrt import Mathlib.Analysis.NormedSpace.Star.Basic import Mathlib.Analysis.NormedSpace.ContinuousLinearMap import Mathlib.Analysis.NormedSpace.Basic #align_import data.is_R_or_C.basic from "leanprover-community/mathlib"@"baa88307f3e699fa7054ef04ec79fa4f056169cb" section local notation "𝓚" => algebraMap ℝ _ open ComplexConjugate class RCLike (K : semiOutParam Type*) extends DenselyNormedField K, StarRing K, NormedAlgebra ℝ K, CompleteSpace K where re : K →+ ℝ im : K →+ ℝ I : K I_re_ax : re I = 0 I_mul_I_ax : I = 0 ∨ I * I = -1 re_add_im_ax : ∀ z : K, 𝓚 (re z) + 𝓚 (im z) * I = z ofReal_re_ax : ∀ r : ℝ, re (𝓚 r) = r ofReal_im_ax : ∀ r : ℝ, im (𝓚 r) = 0 mul_re_ax : ∀ z w : K, re (z * w) = re z * re w - im z * im w mul_im_ax : ∀ z w : K, im (z * w) = re z * im w + im z * re w conj_re_ax : ∀ z : K, re (conj z) = re z conj_im_ax : ∀ z : K, im (conj z) = -im z conj_I_ax : conj I = -I norm_sq_eq_def_ax : ∀ z : K, ‖z‖ ^ 2 = re z * re z + im z * im z mul_im_I_ax : ∀ z : K, im z * im I = im z [toPartialOrder : PartialOrder K] le_iff_re_im {z w : K} : z ≤ w ↔ re z ≤ re w ∧ im z = im w -- note we cannot put this in the `extends` clause [toDecidableEq : DecidableEq K] #align is_R_or_C RCLike scoped[ComplexOrder] attribute [instance 100] RCLike.toPartialOrder attribute [instance 100] RCLike.toDecidableEq end variable {K E : Type*} [RCLike K] namespace RCLike open ComplexConjugate @[coe] abbrev ofReal : ℝ → K := Algebra.cast noncomputable instance (priority := 900) algebraMapCoe : CoeTC ℝ K := ⟨ofReal⟩ #align is_R_or_C.algebra_map_coe RCLike.algebraMapCoe theorem ofReal_alg (x : ℝ) : (x : K) = x • (1 : K) := Algebra.algebraMap_eq_smul_one x #align is_R_or_C.of_real_alg RCLike.ofReal_alg theorem real_smul_eq_coe_mul (r : ℝ) (z : K) : r • z = (r : K) * z := Algebra.smul_def r z #align is_R_or_C.real_smul_eq_coe_mul RCLike.real_smul_eq_coe_mul theorem real_smul_eq_coe_smul [AddCommGroup E] [Module K E] [Module ℝ E] [IsScalarTower ℝ K E] (r : ℝ) (x : E) : r • x = (r : K) • x := by rw [RCLike.ofReal_alg, smul_one_smul] #align is_R_or_C.real_smul_eq_coe_smul RCLike.real_smul_eq_coe_smul theorem algebraMap_eq_ofReal : ⇑(algebraMap ℝ K) = ofReal := rfl #align is_R_or_C.algebra_map_eq_of_real RCLike.algebraMap_eq_ofReal @[simp, rclike_simps] theorem re_add_im (z : K) : (re z : K) + im z * I = z := RCLike.re_add_im_ax z #align is_R_or_C.re_add_im RCLike.re_add_im @[simp, norm_cast, rclike_simps] theorem ofReal_re : ∀ r : ℝ, re (r : K) = r := RCLike.ofReal_re_ax #align is_R_or_C.of_real_re RCLike.ofReal_re @[simp, norm_cast, rclike_simps] theorem ofReal_im : ∀ r : ℝ, im (r : K) = 0 := RCLike.ofReal_im_ax #align is_R_or_C.of_real_im RCLike.ofReal_im @[simp, rclike_simps] theorem mul_re : ∀ z w : K, re (z * w) = re z * re w - im z * im w := RCLike.mul_re_ax #align is_R_or_C.mul_re RCLike.mul_re @[simp, rclike_simps] theorem mul_im : ∀ z w : K, im (z * w) = re z * im w + im z * re w := RCLike.mul_im_ax #align is_R_or_C.mul_im RCLike.mul_im theorem ext_iff {z w : K} : z = w ↔ re z = re w ∧ im z = im w := ⟨fun h => h ▸ ⟨rfl, rfl⟩, fun ⟨h₁, h₂⟩ => re_add_im z ▸ re_add_im w ▸ h₁ ▸ h₂ ▸ rfl⟩ #align is_R_or_C.ext_iff RCLike.ext_iff theorem ext {z w : K} (hre : re z = re w) (him : im z = im w) : z = w := ext_iff.2 ⟨hre, him⟩ #align is_R_or_C.ext RCLike.ext @[norm_cast] theorem ofReal_zero : ((0 : ℝ) : K) = 0 := algebraMap.coe_zero #align is_R_or_C.of_real_zero RCLike.ofReal_zero @[rclike_simps] theorem zero_re' : re (0 : K) = (0 : ℝ) := map_zero re #align is_R_or_C.zero_re' RCLike.zero_re' @[norm_cast] theorem ofReal_one : ((1 : ℝ) : K) = 1 := map_one (algebraMap ℝ K) #align is_R_or_C.of_real_one RCLike.ofReal_one @[simp, rclike_simps] theorem one_re : re (1 : K) = 1 := by rw [← ofReal_one, ofReal_re] #align is_R_or_C.one_re RCLike.one_re @[simp, rclike_simps] theorem one_im : im (1 : K) = 0 := by rw [← ofReal_one, ofReal_im] #align is_R_or_C.one_im RCLike.one_im theorem ofReal_injective : Function.Injective ((↑) : ℝ → K) := (algebraMap ℝ K).injective #align is_R_or_C.of_real_injective RCLike.ofReal_injective @[norm_cast] theorem ofReal_inj {z w : ℝ} : (z : K) = (w : K) ↔ z = w := algebraMap.coe_inj #align is_R_or_C.of_real_inj RCLike.ofReal_inj -- replaced by `RCLike.ofNat_re` #noalign is_R_or_C.bit0_re #noalign is_R_or_C.bit1_re -- replaced by `RCLike.ofNat_im` #noalign is_R_or_C.bit0_im #noalign is_R_or_C.bit1_im theorem ofReal_eq_zero {x : ℝ} : (x : K) = 0 ↔ x = 0 := algebraMap.lift_map_eq_zero_iff x #align is_R_or_C.of_real_eq_zero RCLike.ofReal_eq_zero theorem ofReal_ne_zero {x : ℝ} : (x : K) ≠ 0 ↔ x ≠ 0 := ofReal_eq_zero.not #align is_R_or_C.of_real_ne_zero RCLike.ofReal_ne_zero @[simp, rclike_simps, norm_cast] theorem ofReal_add (r s : ℝ) : ((r + s : ℝ) : K) = r + s := algebraMap.coe_add _ _ #align is_R_or_C.of_real_add RCLike.ofReal_add -- replaced by `RCLike.ofReal_ofNat` #noalign is_R_or_C.of_real_bit0 #noalign is_R_or_C.of_real_bit1 @[simp, norm_cast, rclike_simps] theorem ofReal_neg (r : ℝ) : ((-r : ℝ) : K) = -r := algebraMap.coe_neg r #align is_R_or_C.of_real_neg RCLike.ofReal_neg @[simp, norm_cast, rclike_simps] theorem ofReal_sub (r s : ℝ) : ((r - s : ℝ) : K) = r - s := map_sub (algebraMap ℝ K) r s #align is_R_or_C.of_real_sub RCLike.ofReal_sub @[simp, rclike_simps, norm_cast] theorem ofReal_sum {α : Type*} (s : Finset α) (f : α → ℝ) : ((∑ i ∈ s, f i : ℝ) : K) = ∑ i ∈ s, (f i : K) := map_sum (algebraMap ℝ K) _ _ #align is_R_or_C.of_real_sum RCLike.ofReal_sum @[simp, rclike_simps, norm_cast] theorem ofReal_finsupp_sum {α M : Type*} [Zero M] (f : α →₀ M) (g : α → M → ℝ) : ((f.sum fun a b => g a b : ℝ) : K) = f.sum fun a b => (g a b : K) := map_finsupp_sum (algebraMap ℝ K) f g #align is_R_or_C.of_real_finsupp_sum RCLike.ofReal_finsupp_sum @[simp, norm_cast, rclike_simps] theorem ofReal_mul (r s : ℝ) : ((r * s : ℝ) : K) = r * s := algebraMap.coe_mul _ _ #align is_R_or_C.of_real_mul RCLike.ofReal_mul @[simp, norm_cast, rclike_simps] theorem ofReal_pow (r : ℝ) (n : ℕ) : ((r ^ n : ℝ) : K) = (r : K) ^ n := map_pow (algebraMap ℝ K) r n #align is_R_or_C.of_real_pow RCLike.ofReal_pow @[simp, rclike_simps, norm_cast] theorem ofReal_prod {α : Type*} (s : Finset α) (f : α → ℝ) : ((∏ i ∈ s, f i : ℝ) : K) = ∏ i ∈ s, (f i : K) := map_prod (algebraMap ℝ K) _ _ #align is_R_or_C.of_real_prod RCLike.ofReal_prod @[simp, rclike_simps, norm_cast] theorem ofReal_finsupp_prod {α M : Type*} [Zero M] (f : α →₀ M) (g : α → M → ℝ) : ((f.prod fun a b => g a b : ℝ) : K) = f.prod fun a b => (g a b : K) := map_finsupp_prod _ f g #align is_R_or_C.of_real_finsupp_prod RCLike.ofReal_finsupp_prod @[simp, norm_cast, rclike_simps] theorem real_smul_ofReal (r x : ℝ) : r • (x : K) = (r : K) * (x : K) := real_smul_eq_coe_mul _ _ #align is_R_or_C.real_smul_of_real RCLike.real_smul_ofReal @[rclike_simps] theorem re_ofReal_mul (r : ℝ) (z : K) : re (↑r * z) = r * re z := by simp only [mul_re, ofReal_im, zero_mul, ofReal_re, sub_zero] #align is_R_or_C.of_real_mul_re RCLike.re_ofReal_mul @[rclike_simps] theorem im_ofReal_mul (r : ℝ) (z : K) : im (↑r * z) = r * im z := by simp only [add_zero, ofReal_im, zero_mul, ofReal_re, mul_im] #align is_R_or_C.of_real_mul_im RCLike.im_ofReal_mul @[rclike_simps] theorem smul_re (r : ℝ) (z : K) : re (r • z) = r * re z := by rw [real_smul_eq_coe_mul, re_ofReal_mul] #align is_R_or_C.smul_re RCLike.smul_re @[rclike_simps] theorem smul_im (r : ℝ) (z : K) : im (r • z) = r * im z := by rw [real_smul_eq_coe_mul, im_ofReal_mul] #align is_R_or_C.smul_im RCLike.smul_im @[simp, norm_cast, rclike_simps] theorem norm_ofReal (r : ℝ) : ‖(r : K)‖ = |r| := norm_algebraMap' K r #align is_R_or_C.norm_of_real RCLike.norm_ofReal -- see Note [lower instance priority] instance (priority := 100) charZero_rclike : CharZero K := (RingHom.charZero_iff (algebraMap ℝ K).injective).1 inferInstance set_option linter.uppercaseLean3 false in #align is_R_or_C.char_zero_R_or_C RCLike.charZero_rclike @[simp, rclike_simps] theorem I_re : re (I : K) = 0 := I_re_ax set_option linter.uppercaseLean3 false in #align is_R_or_C.I_re RCLike.I_re @[simp, rclike_simps] theorem I_im (z : K) : im z * im (I : K) = im z := mul_im_I_ax z set_option linter.uppercaseLean3 false in #align is_R_or_C.I_im RCLike.I_im @[simp, rclike_simps] theorem I_im' (z : K) : im (I : K) * im z = im z := by rw [mul_comm, I_im] set_option linter.uppercaseLean3 false in #align is_R_or_C.I_im' RCLike.I_im' @[rclike_simps] -- porting note (#10618): was `simp` theorem I_mul_re (z : K) : re (I * z) = -im z := by simp only [I_re, zero_sub, I_im', zero_mul, mul_re] set_option linter.uppercaseLean3 false in #align is_R_or_C.I_mul_re RCLike.I_mul_re theorem I_mul_I : (I : K) = 0 ∨ (I : K) * I = -1 := I_mul_I_ax set_option linter.uppercaseLean3 false in #align is_R_or_C.I_mul_I RCLike.I_mul_I variable (𝕜) in lemma I_eq_zero_or_im_I_eq_one : (I : K) = 0 ∨ im (I : K) = 1 := I_mul_I (K := K) |>.imp_right fun h ↦ by simpa [h] using (I_mul_re (I : K)).symm @[simp, rclike_simps] theorem conj_re (z : K) : re (conj z) = re z := RCLike.conj_re_ax z #align is_R_or_C.conj_re RCLike.conj_re @[simp, rclike_simps] theorem conj_im (z : K) : im (conj z) = -im z := RCLike.conj_im_ax z #align is_R_or_C.conj_im RCLike.conj_im @[simp, rclike_simps] theorem conj_I : conj (I : K) = -I := RCLike.conj_I_ax set_option linter.uppercaseLean3 false in #align is_R_or_C.conj_I RCLike.conj_I @[simp, rclike_simps] theorem conj_ofReal (r : ℝ) : conj (r : K) = (r : K) := by rw [ext_iff] simp only [ofReal_im, conj_im, eq_self_iff_true, conj_re, and_self_iff, neg_zero] #align is_R_or_C.conj_of_real RCLike.conj_ofReal -- replaced by `RCLike.conj_ofNat` #noalign is_R_or_C.conj_bit0 #noalign is_R_or_C.conj_bit1 theorem conj_nat_cast (n : ℕ) : conj (n : K) = n := map_natCast _ _ -- See note [no_index around OfNat.ofNat] theorem conj_ofNat (n : ℕ) [n.AtLeastTwo] : conj (no_index (OfNat.ofNat n : K)) = OfNat.ofNat n := map_ofNat _ _ @[rclike_simps] -- Porting note (#10618): was a `simp` but `simp` can prove it theorem conj_neg_I : conj (-I) = (I : K) := by rw [map_neg, conj_I, neg_neg] set_option linter.uppercaseLean3 false in #align is_R_or_C.conj_neg_I RCLike.conj_neg_I theorem conj_eq_re_sub_im (z : K) : conj z = re z - im z * I := (congr_arg conj (re_add_im z).symm).trans <| by rw [map_add, map_mul, conj_I, conj_ofReal, conj_ofReal, mul_neg, sub_eq_add_neg] #align is_R_or_C.conj_eq_re_sub_im RCLike.conj_eq_re_sub_im theorem sub_conj (z : K) : z - conj z = 2 * im z * I := calc z - conj z = re z + im z * I - (re z - im z * I) := by rw [re_add_im, ← conj_eq_re_sub_im] _ = 2 * im z * I := by rw [add_sub_sub_cancel, ← two_mul, mul_assoc] #align is_R_or_C.sub_conj RCLike.sub_conj @[rclike_simps] theorem conj_smul (r : ℝ) (z : K) : conj (r • z) = r • conj z := by rw [conj_eq_re_sub_im, conj_eq_re_sub_im, smul_re, smul_im, ofReal_mul, ofReal_mul, real_smul_eq_coe_mul r (_ - _), mul_sub, mul_assoc] #align is_R_or_C.conj_smul RCLike.conj_smul theorem add_conj (z : K) : z + conj z = 2 * re z := calc z + conj z = re z + im z * I + (re z - im z * I) := by rw [re_add_im, conj_eq_re_sub_im] _ = 2 * re z := by rw [add_add_sub_cancel, two_mul] #align is_R_or_C.add_conj RCLike.add_conj theorem re_eq_add_conj (z : K) : ↑(re z) = (z + conj z) / 2 := by rw [add_conj, mul_div_cancel_left₀ (re z : K) two_ne_zero] #align is_R_or_C.re_eq_add_conj RCLike.re_eq_add_conj theorem im_eq_conj_sub (z : K) : ↑(im z) = I * (conj z - z) / 2 := by rw [← neg_inj, ← ofReal_neg, ← I_mul_re, re_eq_add_conj, map_mul, conj_I, ← neg_div, ← mul_neg, neg_sub, mul_sub, neg_mul, sub_eq_add_neg] #align is_R_or_C.im_eq_conj_sub RCLike.im_eq_conj_sub open List in theorem is_real_TFAE (z : K) : TFAE [conj z = z, ∃ r : ℝ, (r : K) = z, ↑(re z) = z, im z = 0] := by tfae_have 1 → 4 · intro h rw [← @ofReal_inj K, im_eq_conj_sub, h, sub_self, mul_zero, zero_div, ofReal_zero] tfae_have 4 → 3 · intro h conv_rhs => rw [← re_add_im z, h, ofReal_zero, zero_mul, add_zero] tfae_have 3 → 2 · exact fun h => ⟨_, h⟩ tfae_have 2 → 1 · exact fun ⟨r, hr⟩ => hr ▸ conj_ofReal _ tfae_finish #align is_R_or_C.is_real_tfae RCLike.is_real_TFAE theorem conj_eq_iff_real {z : K} : conj z = z ↔ ∃ r : ℝ, z = (r : K) := ((is_real_TFAE z).out 0 1).trans <| by simp only [eq_comm] #align is_R_or_C.conj_eq_iff_real RCLike.conj_eq_iff_real theorem conj_eq_iff_re {z : K} : conj z = z ↔ (re z : K) = z := (is_real_TFAE z).out 0 2 #align is_R_or_C.conj_eq_iff_re RCLike.conj_eq_iff_re theorem conj_eq_iff_im {z : K} : conj z = z ↔ im z = 0 := (is_real_TFAE z).out 0 3 #align is_R_or_C.conj_eq_iff_im RCLike.conj_eq_iff_im @[simp] theorem star_def : (Star.star : K → K) = conj := rfl #align is_R_or_C.star_def RCLike.star_def variable (K) abbrev conjToRingEquiv : K ≃+* Kᵐᵒᵖ := starRingEquiv #align is_R_or_C.conj_to_ring_equiv RCLike.conjToRingEquiv variable {K} {z : K} def normSq : K →*₀ ℝ where toFun z := re z * re z + im z * im z map_zero' := by simp only [add_zero, mul_zero, map_zero] map_one' := by simp only [one_im, add_zero, mul_one, one_re, mul_zero] map_mul' z w := by simp only [mul_im, mul_re] ring #align is_R_or_C.norm_sq RCLike.normSq theorem normSq_apply (z : K) : normSq z = re z * re z + im z * im z := rfl #align is_R_or_C.norm_sq_apply RCLike.normSq_apply theorem norm_sq_eq_def {z : K} : ‖z‖ ^ 2 = re z * re z + im z * im z := norm_sq_eq_def_ax z #align is_R_or_C.norm_sq_eq_def RCLike.norm_sq_eq_def theorem normSq_eq_def' (z : K) : normSq z = ‖z‖ ^ 2 := norm_sq_eq_def.symm #align is_R_or_C.norm_sq_eq_def' RCLike.normSq_eq_def' @[rclike_simps] theorem normSq_zero : normSq (0 : K) = 0 := normSq.map_zero #align is_R_or_C.norm_sq_zero RCLike.normSq_zero @[rclike_simps] theorem normSq_one : normSq (1 : K) = 1 := normSq.map_one #align is_R_or_C.norm_sq_one RCLike.normSq_one theorem normSq_nonneg (z : K) : 0 ≤ normSq z := add_nonneg (mul_self_nonneg _) (mul_self_nonneg _) #align is_R_or_C.norm_sq_nonneg RCLike.normSq_nonneg @[rclike_simps] -- porting note (#10618): was `simp` theorem normSq_eq_zero {z : K} : normSq z = 0 ↔ z = 0 := map_eq_zero _ #align is_R_or_C.norm_sq_eq_zero RCLike.normSq_eq_zero @[simp, rclike_simps] theorem normSq_pos {z : K} : 0 < normSq z ↔ z ≠ 0 := by rw [lt_iff_le_and_ne, Ne, eq_comm]; simp [normSq_nonneg] #align is_R_or_C.norm_sq_pos RCLike.normSq_pos @[simp, rclike_simps] theorem normSq_neg (z : K) : normSq (-z) = normSq z := by simp only [normSq_eq_def', norm_neg] #align is_R_or_C.norm_sq_neg RCLike.normSq_neg @[simp, rclike_simps] theorem normSq_conj (z : K) : normSq (conj z) = normSq z := by simp only [normSq_apply, neg_mul, mul_neg, neg_neg, rclike_simps] #align is_R_or_C.norm_sq_conj RCLike.normSq_conj @[rclike_simps] -- porting note (#10618): was `simp` theorem normSq_mul (z w : K) : normSq (z * w) = normSq z * normSq w := map_mul _ z w #align is_R_or_C.norm_sq_mul RCLike.normSq_mul theorem normSq_add (z w : K) : normSq (z + w) = normSq z + normSq w + 2 * re (z * conj w) := by simp only [normSq_apply, map_add, rclike_simps] ring #align is_R_or_C.norm_sq_add RCLike.normSq_add theorem re_sq_le_normSq (z : K) : re z * re z ≤ normSq z := le_add_of_nonneg_right (mul_self_nonneg _) #align is_R_or_C.re_sq_le_norm_sq RCLike.re_sq_le_normSq theorem im_sq_le_normSq (z : K) : im z * im z ≤ normSq z := le_add_of_nonneg_left (mul_self_nonneg _) #align is_R_or_C.im_sq_le_norm_sq RCLike.im_sq_le_normSq theorem mul_conj (z : K) : z * conj z = ‖z‖ ^ 2 := by apply ext <;> simp [← ofReal_pow, norm_sq_eq_def, mul_comm] #align is_R_or_C.mul_conj RCLike.mul_conj theorem conj_mul (z : K) : conj z * z = ‖z‖ ^ 2 := by rw [mul_comm, mul_conj] #align is_R_or_C.conj_mul RCLike.conj_mul lemma inv_eq_conj (hz : ‖z‖ = 1) : z⁻¹ = conj z := inv_eq_of_mul_eq_one_left $ by simp_rw [conj_mul, hz, algebraMap.coe_one, one_pow] theorem normSq_sub (z w : K) : normSq (z - w) = normSq z + normSq w - 2 * re (z * conj w) := by simp only [normSq_add, sub_eq_add_neg, map_neg, mul_neg, normSq_neg, map_neg] #align is_R_or_C.norm_sq_sub RCLike.normSq_sub theorem sqrt_normSq_eq_norm {z : K} : √(normSq z) = ‖z‖ := by rw [normSq_eq_def', Real.sqrt_sq (norm_nonneg _)] #align is_R_or_C.sqrt_norm_sq_eq_norm RCLike.sqrt_normSq_eq_norm @[simp, norm_cast, rclike_simps] theorem ofReal_inv (r : ℝ) : ((r⁻¹ : ℝ) : K) = (r : K)⁻¹ := map_inv₀ _ r #align is_R_or_C.of_real_inv RCLike.ofReal_inv theorem inv_def (z : K) : z⁻¹ = conj z * ((‖z‖ ^ 2)⁻¹ : ℝ) := by rcases eq_or_ne z 0 with (rfl | h₀) · simp · apply inv_eq_of_mul_eq_one_right rw [← mul_assoc, mul_conj, ofReal_inv, ofReal_pow, mul_inv_cancel] simpa #align is_R_or_C.inv_def RCLike.inv_def @[simp, rclike_simps] theorem inv_re (z : K) : re z⁻¹ = re z / normSq z := by rw [inv_def, normSq_eq_def', mul_comm, re_ofReal_mul, conj_re, div_eq_inv_mul] #align is_R_or_C.inv_re RCLike.inv_re @[simp, rclike_simps] theorem inv_im (z : K) : im z⁻¹ = -im z / normSq z := by rw [inv_def, normSq_eq_def', mul_comm, im_ofReal_mul, conj_im, div_eq_inv_mul] #align is_R_or_C.inv_im RCLike.inv_im theorem div_re (z w : K) : re (z / w) = re z * re w / normSq w + im z * im w / normSq w := by simp only [div_eq_mul_inv, mul_assoc, sub_eq_add_neg, neg_mul, mul_neg, neg_neg, map_neg, rclike_simps] #align is_R_or_C.div_re RCLike.div_re theorem div_im (z w : K) : im (z / w) = im z * re w / normSq w - re z * im w / normSq w := by simp only [div_eq_mul_inv, mul_assoc, sub_eq_add_neg, add_comm, neg_mul, mul_neg, map_neg, rclike_simps] #align is_R_or_C.div_im RCLike.div_im @[rclike_simps] -- porting note (#10618): was `simp` theorem conj_inv (x : K) : conj x⁻¹ = (conj x)⁻¹ := star_inv' _ #align is_R_or_C.conj_inv RCLike.conj_inv lemma conj_div (x y : K) : conj (x / y) = conj x / conj y := map_div' conj conj_inv _ _ --TODO: Do we rather want the map as an explicit definition? lemma exists_norm_eq_mul_self (x : K) : ∃ c, ‖c‖ = 1 ∧ ↑‖x‖ = c * x := by obtain rfl | hx := eq_or_ne x 0 · exact ⟨1, by simp⟩ · exact ⟨‖x‖ / x, by simp [norm_ne_zero_iff.2, hx]⟩ lemma exists_norm_mul_eq_self (x : K) : ∃ c, ‖c‖ = 1 ∧ c * ‖x‖ = x := by obtain rfl | hx := eq_or_ne x 0 · exact ⟨1, by simp⟩ · exact ⟨x / ‖x‖, by simp [norm_ne_zero_iff.2, hx]⟩ @[simp, norm_cast, rclike_simps] theorem ofReal_div (r s : ℝ) : ((r / s : ℝ) : K) = r / s := map_div₀ (algebraMap ℝ K) r s #align is_R_or_C.of_real_div RCLike.ofReal_div theorem div_re_ofReal {z : K} {r : ℝ} : re (z / r) = re z / r := by rw [div_eq_inv_mul, div_eq_inv_mul, ← ofReal_inv, re_ofReal_mul] #align is_R_or_C.div_re_of_real RCLike.div_re_ofReal @[simp, norm_cast, rclike_simps] theorem ofReal_zpow (r : ℝ) (n : ℤ) : ((r ^ n : ℝ) : K) = (r : K) ^ n := map_zpow₀ (algebraMap ℝ K) r n #align is_R_or_C.of_real_zpow RCLike.ofReal_zpow theorem I_mul_I_of_nonzero : (I : K) ≠ 0 → (I : K) * I = -1 := I_mul_I_ax.resolve_left set_option linter.uppercaseLean3 false in #align is_R_or_C.I_mul_I_of_nonzero RCLike.I_mul_I_of_nonzero @[simp, rclike_simps] theorem inv_I : (I : K)⁻¹ = -I := by by_cases h : (I : K) = 0 · simp [h] · field_simp [I_mul_I_of_nonzero h] set_option linter.uppercaseLean3 false in #align is_R_or_C.inv_I RCLike.inv_I @[simp, rclike_simps]
Mathlib/Analysis/RCLike/Basic.lean
606
606
theorem div_I (z : K) : z / I = -(z * I) := by
rw [div_eq_mul_inv, inv_I, mul_neg]
import Mathlib.Algebra.FreeMonoid.Basic import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.GroupTheory.Congruence.Basic import Mathlib.GroupTheory.FreeGroup.IsFreeGroup import Mathlib.Data.List.Chain import Mathlib.SetTheory.Cardinal.Basic import Mathlib.Data.Set.Pointwise.SMul #align_import group_theory.free_product from "leanprover-community/mathlib"@"9114ddffa023340c9ec86965e00cdd6fe26fcdf6" open Set variable {ι : Type*} (M : ι → Type*) [∀ i, Monoid (M i)] inductive Monoid.CoprodI.Rel : FreeMonoid (Σi, M i) → FreeMonoid (Σi, M i) → Prop | of_one (i : ι) : Monoid.CoprodI.Rel (FreeMonoid.of ⟨i, 1⟩) 1 | of_mul {i : ι} (x y : M i) : Monoid.CoprodI.Rel (FreeMonoid.of ⟨i, x⟩ * FreeMonoid.of ⟨i, y⟩) (FreeMonoid.of ⟨i, x * y⟩) #align free_product.rel Monoid.CoprodI.Rel def Monoid.CoprodI : Type _ := (conGen (Monoid.CoprodI.Rel M)).Quotient #align free_product Monoid.CoprodI -- Porting note: could not de derived instance : Monoid (Monoid.CoprodI M) := by delta Monoid.CoprodI; infer_instance instance : Inhabited (Monoid.CoprodI M) := ⟨1⟩ namespace Monoid.CoprodI @[ext] structure Word where toList : List (Σi, M i) ne_one : ∀ l ∈ toList, Sigma.snd l ≠ 1 chain_ne : toList.Chain' fun l l' => Sigma.fst l ≠ Sigma.fst l' #align free_product.word Monoid.CoprodI.Word variable {M} def of {i : ι} : M i →* CoprodI M where toFun x := Con.mk' _ (FreeMonoid.of <| Sigma.mk i x) map_one' := (Con.eq _).mpr (ConGen.Rel.of _ _ (CoprodI.Rel.of_one i)) map_mul' x y := Eq.symm <| (Con.eq _).mpr (ConGen.Rel.of _ _ (CoprodI.Rel.of_mul x y)) #align free_product.of Monoid.CoprodI.of theorem of_apply {i} (m : M i) : of m = Con.mk' _ (FreeMonoid.of <| Sigma.mk i m) := rfl #align free_product.of_apply Monoid.CoprodI.of_apply variable {N : Type*} [Monoid N] -- Porting note: higher `ext` priority @[ext 1100] theorem ext_hom (f g : CoprodI M →* N) (h : ∀ i, f.comp (of : M i →* _) = g.comp of) : f = g := (MonoidHom.cancel_right Con.mk'_surjective).mp <| FreeMonoid.hom_eq fun ⟨i, x⟩ => by -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [MonoidHom.comp_apply, MonoidHom.comp_apply, ← of_apply, ← MonoidHom.comp_apply, ← MonoidHom.comp_apply, h]; rfl #align free_product.ext_hom Monoid.CoprodI.ext_hom @[simps symm_apply] def lift : (∀ i, M i →* N) ≃ (CoprodI M →* N) where toFun fi := Con.lift _ (FreeMonoid.lift fun p : Σi, M i => fi p.fst p.snd) <| Con.conGen_le <| by simp_rw [Con.ker_rel] rintro _ _ (i | ⟨x, y⟩) · change FreeMonoid.lift _ (FreeMonoid.of _) = FreeMonoid.lift _ 1 simp only [MonoidHom.map_one, FreeMonoid.lift_eval_of] · change FreeMonoid.lift _ (FreeMonoid.of _ * FreeMonoid.of _) = FreeMonoid.lift _ (FreeMonoid.of _) simp only [MonoidHom.map_mul, FreeMonoid.lift_eval_of] invFun f i := f.comp of left_inv := by intro fi ext i x -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644 erw [MonoidHom.comp_apply, of_apply, Con.lift_mk', FreeMonoid.lift_eval_of] right_inv := by intro f ext i x rfl #align free_product.lift Monoid.CoprodI.lift @[simp] theorem lift_comp_of {N} [Monoid N] (fi : ∀ i, M i →* N) i : (lift fi).comp of = fi i := congr_fun (lift.symm_apply_apply fi) i @[simp] theorem lift_of {N} [Monoid N] (fi : ∀ i, M i →* N) {i} (m : M i) : lift fi (of m) = fi i m := DFunLike.congr_fun (lift_comp_of ..) m #align free_product.lift_of Monoid.CoprodI.lift_of @[simp] theorem lift_comp_of' {N} [Monoid N] (f : CoprodI M →* N) : lift (fun i ↦ f.comp (of (i := i))) = f := lift.apply_symm_apply f @[simp] theorem lift_of' : lift (fun i ↦ (of : M i →* CoprodI M)) = .id (CoprodI M) := lift_comp_of' (.id _) theorem of_leftInverse [DecidableEq ι] (i : ι) : Function.LeftInverse (lift <| Pi.mulSingle i (MonoidHom.id (M i))) of := fun x => by simp only [lift_of, Pi.mulSingle_eq_same, MonoidHom.id_apply] #align free_product.of_left_inverse Monoid.CoprodI.of_leftInverse theorem of_injective (i : ι) : Function.Injective (of : M i →* _) := by classical exact (of_leftInverse i).injective #align free_product.of_injective Monoid.CoprodI.of_injective theorem mrange_eq_iSup {N} [Monoid N] (f : ∀ i, M i →* N) : MonoidHom.mrange (lift f) = ⨆ i, MonoidHom.mrange (f i) := by rw [lift, Equiv.coe_fn_mk, Con.lift_range, FreeMonoid.mrange_lift, range_sigma_eq_iUnion_range, Submonoid.closure_iUnion] simp only [MonoidHom.mclosure_range] #align free_product.mrange_eq_supr Monoid.CoprodI.mrange_eq_iSup theorem lift_mrange_le {N} [Monoid N] (f : ∀ i, M i →* N) {s : Submonoid N} : MonoidHom.mrange (lift f) ≤ s ↔ ∀ i, MonoidHom.mrange (f i) ≤ s := by simp [mrange_eq_iSup] #align free_product.lift_mrange_le Monoid.CoprodI.lift_mrange_le @[simp] theorem iSup_mrange_of : ⨆ i, MonoidHom.mrange (of : M i →* CoprodI M) = ⊤ := by simp [← mrange_eq_iSup] @[simp] theorem mclosure_iUnion_range_of : Submonoid.closure (⋃ i, Set.range (of : M i →* CoprodI M)) = ⊤ := by simp [Submonoid.closure_iUnion] @[elab_as_elim] theorem induction_left {C : CoprodI M → Prop} (m : CoprodI M) (one : C 1) (mul : ∀ {i} (m : M i) x, C x → C (of m * x)) : C m := by induction m using Submonoid.induction_of_closure_eq_top_left mclosure_iUnion_range_of with | one => exact one | mul x hx y ihy => obtain ⟨i, m, rfl⟩ : ∃ (i : ι) (m : M i), of m = x := by simpa using hx exact mul m y ihy @[elab_as_elim] theorem induction_on {C : CoprodI M → Prop} (m : CoprodI M) (h_one : C 1) (h_of : ∀ (i) (m : M i), C (of m)) (h_mul : ∀ x y, C x → C y → C (x * y)) : C m := by induction m using CoprodI.induction_left with | one => exact h_one | mul m x hx => exact h_mul _ _ (h_of _ _) hx #align free_product.induction_on Monoid.CoprodI.induction_on namespace Word @[simps] def empty : Word M where toList := [] ne_one := by simp chain_ne := List.chain'_nil #align free_product.word.empty Monoid.CoprodI.Word.empty instance : Inhabited (Word M) := ⟨empty⟩ def prod (w : Word M) : CoprodI M := List.prod (w.toList.map fun l => of l.snd) #align free_product.word.prod Monoid.CoprodI.Word.prod @[simp] theorem prod_empty : prod (empty : Word M) = 1 := rfl #align free_product.word.prod_empty Monoid.CoprodI.Word.prod_empty def fstIdx (w : Word M) : Option ι := w.toList.head?.map Sigma.fst #align free_product.word.fst_idx Monoid.CoprodI.Word.fstIdx theorem fstIdx_ne_iff {w : Word M} {i} : fstIdx w ≠ some i ↔ ∀ l ∈ w.toList.head?, i ≠ Sigma.fst l := not_iff_not.mp <| by simp [fstIdx] #align free_product.word.fst_idx_ne_iff Monoid.CoprodI.Word.fstIdx_ne_iff variable (M) @[ext] structure Pair (i : ι) where head : M i tail : Word M fstIdx_ne : fstIdx tail ≠ some i #align free_product.word.pair Monoid.CoprodI.Word.Pair instance (i : ι) : Inhabited (Pair M i) := ⟨⟨1, empty, by tauto⟩⟩ variable {M} variable [∀ i, DecidableEq (M i)] @[simps] def cons {i} (m : M i) (w : Word M) (hmw : w.fstIdx ≠ some i) (h1 : m ≠ 1) : Word M := { toList := ⟨i, m⟩ :: w.toList, ne_one := by simp only [List.mem_cons] rintro l (rfl | hl) · exact h1 · exact w.ne_one l hl chain_ne := w.chain_ne.cons' (fstIdx_ne_iff.mp hmw) } def rcons {i} (p : Pair M i) : Word M := if h : p.head = 1 then p.tail else cons p.head p.tail p.fstIdx_ne h #align free_product.word.rcons Monoid.CoprodI.Word.rcons #noalign free_product.word.cons_eq_rcons @[simp] theorem prod_rcons {i} (p : Pair M i) : prod (rcons p) = of p.head * prod p.tail := if hm : p.head = 1 then by rw [rcons, dif_pos hm, hm, MonoidHom.map_one, one_mul] else by rw [rcons, dif_neg hm, cons, prod, List.map_cons, List.prod_cons, prod] #align free_product.word.prod_rcons Monoid.CoprodI.Word.prod_rcons theorem rcons_inj {i} : Function.Injective (rcons : Pair M i → Word M) := by rintro ⟨m, w, h⟩ ⟨m', w', h'⟩ he by_cases hm : m = 1 <;> by_cases hm' : m' = 1 · simp only [rcons, dif_pos hm, dif_pos hm'] at he aesop · exfalso simp only [rcons, dif_pos hm, dif_neg hm'] at he rw [he] at h exact h rfl · exfalso simp only [rcons, dif_pos hm', dif_neg hm] at he rw [← he] at h' exact h' rfl · have : m = m' ∧ w.toList = w'.toList := by simpa [cons, rcons, dif_neg hm, dif_neg hm', true_and_iff, eq_self_iff_true, Subtype.mk_eq_mk, heq_iff_eq, ← Subtype.ext_iff_val] using he rcases this with ⟨rfl, h⟩ congr exact Word.ext _ _ h #align free_product.word.rcons_inj Monoid.CoprodI.Word.rcons_inj theorem mem_rcons_iff {i j : ι} (p : Pair M i) (m : M j) : ⟨_, m⟩ ∈ (rcons p).toList ↔ ⟨_, m⟩ ∈ p.tail.toList ∨ m ≠ 1 ∧ (∃ h : i = j, m = h ▸ p.head) := by simp only [rcons, cons, ne_eq] by_cases hij : i = j · subst i by_cases hm : m = p.head · subst m split_ifs <;> simp_all · split_ifs <;> simp_all · split_ifs <;> simp_all [Ne.symm hij] @[simp] theorem fstIdx_cons {i} (m : M i) (w : Word M) (hmw : w.fstIdx ≠ some i) (h1 : m ≠ 1) : fstIdx (cons m w hmw h1) = some i := by simp [cons, fstIdx] @[simp] theorem prod_cons (i) (m : M i) (w : Word M) (h1 : m ≠ 1) (h2 : w.fstIdx ≠ some i) : prod (cons m w h2 h1) = of m * prod w := by simp [cons, prod, List.map_cons, List.prod_cons] @[elab_as_elim] def consRecOn {motive : Word M → Sort*} (w : Word M) (h_empty : motive empty) (h_cons : ∀ (i) (m : M i) (w) h1 h2, motive w → motive (cons m w h1 h2)) : motive w := by rcases w with ⟨w, h1, h2⟩ induction w with | nil => exact h_empty | cons m w ih => refine h_cons m.1 m.2 ⟨w, fun _ hl => h1 _ (List.mem_cons_of_mem _ hl), h2.tail⟩ ?_ ?_ (ih _ _) · rw [List.chain'_cons'] at h2 simp only [fstIdx, ne_eq, Option.map_eq_some', Sigma.exists, exists_and_right, exists_eq_right, not_exists] intro m' hm' exact h2.1 _ hm' rfl · exact h1 _ (List.mem_cons_self _ _) @[simp] theorem consRecOn_empty {motive : Word M → Sort*} (h_empty : motive empty) (h_cons : ∀ (i) (m : M i) (w) h1 h2, motive w → motive (cons m w h1 h2)) : consRecOn empty h_empty h_cons = h_empty := rfl @[simp] theorem consRecOn_cons {motive : Word M → Sort*} (i) (m : M i) (w : Word M) h1 h2 (h_empty : motive empty) (h_cons : ∀ (i) (m : M i) (w) h1 h2, motive w → motive (cons m w h1 h2)) : consRecOn (cons m w h1 h2) h_empty h_cons = h_cons i m w h1 h2 (consRecOn w h_empty h_cons) := rfl variable [DecidableEq ι] -- This definition is computable but not very nice to look at. Thankfully we don't have to inspect -- it, since `rcons` is known to be injective. private def equivPairAux (i) (w : Word M) : { p : Pair M i // rcons p = w } := consRecOn w ⟨⟨1, .empty, by simp [fstIdx, empty]⟩, by simp [rcons]⟩ <| fun j m w h1 h2 _ => if ij : i = j then { val := { head := ij ▸ m tail := w fstIdx_ne := ij ▸ h1 } property := by subst ij; simp [rcons, h2] } else ⟨⟨1, cons m w h1 h2, by simp [cons, fstIdx, Ne.symm ij]⟩, by simp [rcons]⟩ def equivPair (i) : Word M ≃ Pair M i where toFun w := (equivPairAux i w).val invFun := rcons left_inv w := (equivPairAux i w).property right_inv _ := rcons_inj (equivPairAux i _).property #align free_product.word.equiv_pair Monoid.CoprodI.Word.equivPair theorem equivPair_symm (i) (p : Pair M i) : (equivPair i).symm p = rcons p := rfl #align free_product.word.equiv_pair_symm Monoid.CoprodI.Word.equivPair_symm theorem equivPair_eq_of_fstIdx_ne {i} {w : Word M} (h : fstIdx w ≠ some i) : equivPair i w = ⟨1, w, h⟩ := (equivPair i).apply_eq_iff_eq_symm_apply.mpr <| Eq.symm (dif_pos rfl) #align free_product.word.equiv_pair_eq_of_fst_idx_ne Monoid.CoprodI.Word.equivPair_eq_of_fstIdx_ne theorem mem_equivPair_tail_iff {i j : ι} {w : Word M} (m : M i) : (⟨i, m⟩ ∈ (equivPair j w).tail.toList) ↔ ⟨i, m⟩ ∈ w.toList.tail ∨ i ≠ j ∧ ∃ h : w.toList ≠ [], w.toList.head h = ⟨i, m⟩ := by simp only [equivPair, equivPairAux, ne_eq, Equiv.coe_fn_mk] induction w using consRecOn with | h_empty => simp | h_cons k g tail h1 h2 ih => simp only [consRecOn_cons] split_ifs with h · subst k by_cases hij : j = i <;> simp_all · by_cases hik : i = k · subst i; simp_all [@eq_comm _ m g, @eq_comm _ k j, or_comm] · simp [hik, Ne.symm hik] theorem mem_of_mem_equivPair_tail {i j : ι} {w : Word M} (m : M i) : (⟨i, m⟩ ∈ (equivPair j w).tail.toList) → ⟨i, m⟩ ∈ w.toList := by rw [mem_equivPair_tail_iff] rintro (h | h) · exact List.mem_of_mem_tail h · revert h; cases w.toList <;> simp (config := {contextual := true}) theorem equivPair_head {i : ι} {w : Word M} : (equivPair i w).head = if h : ∃ (h : w.toList ≠ []), (w.toList.head h).1 = i then h.snd ▸ (w.toList.head h.1).2 else 1 := by simp only [equivPair, equivPairAux] induction w using consRecOn with | h_empty => simp | h_cons head => by_cases hi : i = head · subst hi; simp · simp [hi, Ne.symm hi] instance summandAction (i) : MulAction (M i) (Word M) where smul m w := rcons { equivPair i w with head := m * (equivPair i w).head } one_smul w := by apply (equivPair i).symm_apply_eq.mpr simp [equivPair] mul_smul m m' w := by dsimp [instHSMul] simp [mul_assoc, ← equivPair_symm, Equiv.apply_symm_apply] #align free_product.word.summand_action Monoid.CoprodI.Word.summandAction instance : MulAction (CoprodI M) (Word M) := MulAction.ofEndHom (lift fun _ => MulAction.toEndHom) theorem smul_def {i} (m : M i) (w : Word M) : m • w = rcons { equivPair i w with head := m * (equivPair i w).head } := rfl theorem of_smul_def (i) (w : Word M) (m : M i) : of m • w = rcons { equivPair i w with head := m * (equivPair i w).head } := rfl #align free_product.word.of_smul_def Monoid.CoprodI.Word.of_smul_def theorem equivPair_smul_same {i} (m : M i) (w : Word M) : equivPair i (of m • w) = ⟨m * (equivPair i w).head, (equivPair i w).tail, (equivPair i w).fstIdx_ne⟩ := by rw [of_smul_def, ← equivPair_symm] simp @[simp] theorem equivPair_tail {i} (p : Pair M i) : equivPair i p.tail = ⟨1, p.tail, p.fstIdx_ne⟩ := equivPair_eq_of_fstIdx_ne _ theorem smul_eq_of_smul {i} (m : M i) (w : Word M) : m • w = of m • w := rfl theorem mem_smul_iff {i j : ι} {m₁ : M i} {m₂ : M j} {w : Word M} : ⟨_, m₁⟩ ∈ (of m₂ • w).toList ↔ (¬i = j ∧ ⟨i, m₁⟩ ∈ w.toList) ∨ (m₁ ≠ 1 ∧ ∃ (hij : i = j),(⟨i, m₁⟩ ∈ w.toList.tail) ∨ (∃ m', ⟨j, m'⟩ ∈ w.toList.head? ∧ m₁ = hij ▸ (m₂ * m')) ∨ (w.fstIdx ≠ some j ∧ m₁ = hij ▸ m₂)) := by rw [of_smul_def, mem_rcons_iff, mem_equivPair_tail_iff, equivPair_head, or_assoc] by_cases hij : i = j · subst i simp only [not_true, ne_eq, false_and, exists_prop, true_and, false_or] by_cases hw : ⟨j, m₁⟩ ∈ w.toList.tail · simp [hw, show m₁ ≠ 1 from w.ne_one _ (List.mem_of_mem_tail hw)] · simp only [hw, false_or, Option.mem_def, ne_eq, and_congr_right_iff] intro hm1 split_ifs with h · rcases h with ⟨hnil, rfl⟩ simp only [List.head?_eq_head _ hnil, Option.some.injEq, ne_eq] constructor · rintro rfl exact Or.inl ⟨_, rfl, rfl⟩ · rintro (⟨_, h, rfl⟩ | hm') · simp [Sigma.ext_iff] at h subst h rfl · simp only [fstIdx, Option.map_eq_some', Sigma.exists, exists_and_right, exists_eq_right, not_exists, ne_eq] at hm' exact (hm'.1 (w.toList.head hnil).2 (by rw [List.head?_eq_head])).elim · revert h rw [fstIdx] cases w.toList · simp · simp (config := {contextual := true}) [Sigma.ext_iff] · rcases w with ⟨_ | _, _, _⟩ <;> simp [or_comm, hij, Ne.symm hij]; rw [eq_comm]
Mathlib/GroupTheory/CoprodI.lean
584
586
theorem mem_smul_iff_of_ne {i j : ι} (hij : i ≠ j) {m₁ : M i} {m₂ : M j} {w : Word M} : ⟨_, m₁⟩ ∈ (of m₂ • w).toList ↔ ⟨i, m₁⟩ ∈ w.toList := by
simp [mem_smul_iff, *]
import Mathlib.Order.SuccPred.Basic import Mathlib.Order.BoundedOrder #align_import order.succ_pred.limit from "leanprover-community/mathlib"@"1e05171a5e8cf18d98d9cf7b207540acb044acae" variable {α : Type*} namespace Order open Function Set OrderDual section LT variable [LT α] def IsSuccLimit (a : α) : Prop := ∀ b, ¬b ⋖ a #align order.is_succ_limit Order.IsSuccLimit
Mathlib/Order/SuccPred/Limit.lean
46
47
theorem not_isSuccLimit_iff_exists_covBy (a : α) : ¬IsSuccLimit a ↔ ∃ b, b ⋖ a := by
simp [IsSuccLimit]
import Mathlib.Algebra.BigOperators.Group.Finset #align_import data.nat.gcd.big_operators from "leanprover-community/mathlib"@"008205aa645b3f194c1da47025c5f110c8406eab" namespace Nat variable {ι : Type*} theorem coprime_list_prod_left_iff {l : List ℕ} {k : ℕ} : Coprime l.prod k ↔ ∀ n ∈ l, Coprime n k := by induction l <;> simp [Nat.coprime_mul_iff_left, *] theorem coprime_list_prod_right_iff {k : ℕ} {l : List ℕ} : Coprime k l.prod ↔ ∀ n ∈ l, Coprime k n := by simp_rw [coprime_comm (n := k), coprime_list_prod_left_iff] theorem coprime_multiset_prod_left_iff {m : Multiset ℕ} {k : ℕ} : Coprime m.prod k ↔ ∀ n ∈ m, Coprime n k := by induction m using Quotient.inductionOn; simpa using coprime_list_prod_left_iff theorem coprime_multiset_prod_right_iff {k : ℕ} {m : Multiset ℕ} : Coprime k m.prod ↔ ∀ n ∈ m, Coprime k n := by induction m using Quotient.inductionOn; simpa using coprime_list_prod_right_iff theorem coprime_prod_left_iff {t : Finset ι} {s : ι → ℕ} {x : ℕ} : Coprime (∏ i ∈ t, s i) x ↔ ∀ i ∈ t, Coprime (s i) x := by simpa using coprime_multiset_prod_left_iff (m := t.val.map s) theorem coprime_prod_right_iff {x : ℕ} {t : Finset ι} {s : ι → ℕ} : Coprime x (∏ i ∈ t, s i) ↔ ∀ i ∈ t, Coprime x (s i) := by simpa using coprime_multiset_prod_right_iff (m := t.val.map s) alias ⟨_, Coprime.prod_left⟩ := coprime_prod_left_iff #align nat.coprime_prod_left Nat.Coprime.prod_left alias ⟨_, Coprime.prod_right⟩ := coprime_prod_right_iff #align nat.coprime_prod_right Nat.Coprime.prod_right theorem coprime_fintype_prod_left_iff [Fintype ι] {s : ι → ℕ} {x : ℕ} : Coprime (∏ i, s i) x ↔ ∀ i, Coprime (s i) x := by simp [coprime_prod_left_iff]
Mathlib/Data/Nat/GCD/BigOperators.lean
56
58
theorem coprime_fintype_prod_right_iff [Fintype ι] {x : ℕ} {s : ι → ℕ} : Coprime x (∏ i, s i) ↔ ∀ i, Coprime x (s i) := by
simp [coprime_prod_right_iff]
import Mathlib.Topology.Order.IsLUB open Set Filter TopologicalSpace Topology Function open OrderDual (toDual ofDual) variable {α β γ : Type*} section DenselyOrdered variable [TopologicalSpace α] [LinearOrder α] [OrderTopology α] [DenselyOrdered α] {a b : α} {s : Set α} theorem closure_Ioi' {a : α} (h : (Ioi a).Nonempty) : closure (Ioi a) = Ici a := by apply Subset.antisymm · exact closure_minimal Ioi_subset_Ici_self isClosed_Ici · rw [← diff_subset_closure_iff, Ici_diff_Ioi_same, singleton_subset_iff] exact isGLB_Ioi.mem_closure h #align closure_Ioi' closure_Ioi' @[simp] theorem closure_Ioi (a : α) [NoMaxOrder α] : closure (Ioi a) = Ici a := closure_Ioi' nonempty_Ioi #align closure_Ioi closure_Ioi theorem closure_Iio' (h : (Iio a).Nonempty) : closure (Iio a) = Iic a := closure_Ioi' (α := αᵒᵈ) h #align closure_Iio' closure_Iio' @[simp] theorem closure_Iio (a : α) [NoMinOrder α] : closure (Iio a) = Iic a := closure_Iio' nonempty_Iio #align closure_Iio closure_Iio @[simp] theorem closure_Ioo {a b : α} (hab : a ≠ b) : closure (Ioo a b) = Icc a b := by apply Subset.antisymm · exact closure_minimal Ioo_subset_Icc_self isClosed_Icc · cases' hab.lt_or_lt with hab hab · rw [← diff_subset_closure_iff, Icc_diff_Ioo_same hab.le] have hab' : (Ioo a b).Nonempty := nonempty_Ioo.2 hab simp only [insert_subset_iff, singleton_subset_iff] exact ⟨(isGLB_Ioo hab).mem_closure hab', (isLUB_Ioo hab).mem_closure hab'⟩ · rw [Icc_eq_empty_of_lt hab] exact empty_subset _ #align closure_Ioo closure_Ioo @[simp] theorem closure_Ioc {a b : α} (hab : a ≠ b) : closure (Ioc a b) = Icc a b := by apply Subset.antisymm · exact closure_minimal Ioc_subset_Icc_self isClosed_Icc · apply Subset.trans _ (closure_mono Ioo_subset_Ioc_self) rw [closure_Ioo hab] #align closure_Ioc closure_Ioc @[simp] theorem closure_Ico {a b : α} (hab : a ≠ b) : closure (Ico a b) = Icc a b := by apply Subset.antisymm · exact closure_minimal Ico_subset_Icc_self isClosed_Icc · apply Subset.trans _ (closure_mono Ioo_subset_Ico_self) rw [closure_Ioo hab] #align closure_Ico closure_Ico @[simp] theorem interior_Ici' {a : α} (ha : (Iio a).Nonempty) : interior (Ici a) = Ioi a := by rw [← compl_Iio, interior_compl, closure_Iio' ha, compl_Iic] #align interior_Ici' interior_Ici' theorem interior_Ici [NoMinOrder α] {a : α} : interior (Ici a) = Ioi a := interior_Ici' nonempty_Iio #align interior_Ici interior_Ici @[simp] theorem interior_Iic' {a : α} (ha : (Ioi a).Nonempty) : interior (Iic a) = Iio a := interior_Ici' (α := αᵒᵈ) ha #align interior_Iic' interior_Iic' theorem interior_Iic [NoMaxOrder α] {a : α} : interior (Iic a) = Iio a := interior_Iic' nonempty_Ioi #align interior_Iic interior_Iic @[simp] theorem interior_Icc [NoMinOrder α] [NoMaxOrder α] {a b : α} : interior (Icc a b) = Ioo a b := by rw [← Ici_inter_Iic, interior_inter, interior_Ici, interior_Iic, Ioi_inter_Iio] #align interior_Icc interior_Icc @[simp] theorem Icc_mem_nhds_iff [NoMinOrder α] [NoMaxOrder α] {a b x : α} : Icc a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by rw [← interior_Icc, mem_interior_iff_mem_nhds] @[simp] theorem interior_Ico [NoMinOrder α] {a b : α} : interior (Ico a b) = Ioo a b := by rw [← Ici_inter_Iio, interior_inter, interior_Ici, interior_Iio, Ioi_inter_Iio] #align interior_Ico interior_Ico @[simp] theorem Ico_mem_nhds_iff [NoMinOrder α] {a b x : α} : Ico a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by rw [← interior_Ico, mem_interior_iff_mem_nhds] @[simp] theorem interior_Ioc [NoMaxOrder α] {a b : α} : interior (Ioc a b) = Ioo a b := by rw [← Ioi_inter_Iic, interior_inter, interior_Ioi, interior_Iic, Ioi_inter_Iio] #align interior_Ioc interior_Ioc @[simp] theorem Ioc_mem_nhds_iff [NoMaxOrder α] {a b x : α} : Ioc a b ∈ 𝓝 x ↔ x ∈ Ioo a b := by rw [← interior_Ioc, mem_interior_iff_mem_nhds] theorem closure_interior_Icc {a b : α} (h : a ≠ b) : closure (interior (Icc a b)) = Icc a b := (closure_minimal interior_subset isClosed_Icc).antisymm <| calc Icc a b = closure (Ioo a b) := (closure_Ioo h).symm _ ⊆ closure (interior (Icc a b)) := closure_mono (interior_maximal Ioo_subset_Icc_self isOpen_Ioo) #align closure_interior_Icc closure_interior_Icc theorem Ioc_subset_closure_interior (a b : α) : Ioc a b ⊆ closure (interior (Ioc a b)) := by rcases eq_or_ne a b with (rfl | h) · simp · calc Ioc a b ⊆ Icc a b := Ioc_subset_Icc_self _ = closure (Ioo a b) := (closure_Ioo h).symm _ ⊆ closure (interior (Ioc a b)) := closure_mono (interior_maximal Ioo_subset_Ioc_self isOpen_Ioo) #align Ioc_subset_closure_interior Ioc_subset_closure_interior theorem Ico_subset_closure_interior (a b : α) : Ico a b ⊆ closure (interior (Ico a b)) := by simpa only [dual_Ioc] using Ioc_subset_closure_interior (OrderDual.toDual b) (OrderDual.toDual a) #align Ico_subset_closure_interior Ico_subset_closure_interior @[simp] theorem frontier_Ici' {a : α} (ha : (Iio a).Nonempty) : frontier (Ici a) = {a} := by simp [frontier, ha] #align frontier_Ici' frontier_Ici' theorem frontier_Ici [NoMinOrder α] {a : α} : frontier (Ici a) = {a} := frontier_Ici' nonempty_Iio #align frontier_Ici frontier_Ici @[simp] theorem frontier_Iic' {a : α} (ha : (Ioi a).Nonempty) : frontier (Iic a) = {a} := by simp [frontier, ha] #align frontier_Iic' frontier_Iic' theorem frontier_Iic [NoMaxOrder α] {a : α} : frontier (Iic a) = {a} := frontier_Iic' nonempty_Ioi #align frontier_Iic frontier_Iic @[simp] theorem frontier_Ioi' {a : α} (ha : (Ioi a).Nonempty) : frontier (Ioi a) = {a} := by simp [frontier, closure_Ioi' ha, Iic_diff_Iio, Icc_self] #align frontier_Ioi' frontier_Ioi' theorem frontier_Ioi [NoMaxOrder α] {a : α} : frontier (Ioi a) = {a} := frontier_Ioi' nonempty_Ioi #align frontier_Ioi frontier_Ioi @[simp] theorem frontier_Iio' {a : α} (ha : (Iio a).Nonempty) : frontier (Iio a) = {a} := by simp [frontier, closure_Iio' ha, Iic_diff_Iio, Icc_self] #align frontier_Iio' frontier_Iio' theorem frontier_Iio [NoMinOrder α] {a : α} : frontier (Iio a) = {a} := frontier_Iio' nonempty_Iio #align frontier_Iio frontier_Iio @[simp] theorem frontier_Icc [NoMinOrder α] [NoMaxOrder α] {a b : α} (h : a ≤ b) : frontier (Icc a b) = {a, b} := by simp [frontier, h, Icc_diff_Ioo_same] #align frontier_Icc frontier_Icc @[simp] theorem frontier_Ioo {a b : α} (h : a < b) : frontier (Ioo a b) = {a, b} := by rw [frontier, closure_Ioo h.ne, interior_Ioo, Icc_diff_Ioo_same h.le] #align frontier_Ioo frontier_Ioo @[simp] theorem frontier_Ico [NoMinOrder α] {a b : α} (h : a < b) : frontier (Ico a b) = {a, b} := by rw [frontier, closure_Ico h.ne, interior_Ico, Icc_diff_Ioo_same h.le] #align frontier_Ico frontier_Ico @[simp] theorem frontier_Ioc [NoMaxOrder α] {a b : α} (h : a < b) : frontier (Ioc a b) = {a, b} := by rw [frontier, closure_Ioc h.ne, interior_Ioc, Icc_diff_Ioo_same h.le] #align frontier_Ioc frontier_Ioc theorem nhdsWithin_Ioi_neBot' {a b : α} (H₁ : (Ioi a).Nonempty) (H₂ : a ≤ b) : NeBot (𝓝[Ioi a] b) := mem_closure_iff_nhdsWithin_neBot.1 <| by rwa [closure_Ioi' H₁] #align nhds_within_Ioi_ne_bot' nhdsWithin_Ioi_neBot' theorem nhdsWithin_Ioi_neBot [NoMaxOrder α] {a b : α} (H : a ≤ b) : NeBot (𝓝[Ioi a] b) := nhdsWithin_Ioi_neBot' nonempty_Ioi H #align nhds_within_Ioi_ne_bot nhdsWithin_Ioi_neBot theorem nhdsWithin_Ioi_self_neBot' {a : α} (H : (Ioi a).Nonempty) : NeBot (𝓝[>] a) := nhdsWithin_Ioi_neBot' H (le_refl a) #align nhds_within_Ioi_self_ne_bot' nhdsWithin_Ioi_self_neBot' instance nhdsWithin_Ioi_self_neBot [NoMaxOrder α] (a : α) : NeBot (𝓝[>] a) := nhdsWithin_Ioi_neBot (le_refl a) #align nhds_within_Ioi_self_ne_bot nhdsWithin_Ioi_self_neBot theorem nhdsWithin_Iio_neBot' {b c : α} (H₁ : (Iio c).Nonempty) (H₂ : b ≤ c) : NeBot (𝓝[Iio c] b) := mem_closure_iff_nhdsWithin_neBot.1 <| by rwa [closure_Iio' H₁] #align nhds_within_Iio_ne_bot' nhdsWithin_Iio_neBot' theorem nhdsWithin_Iio_neBot [NoMinOrder α] {a b : α} (H : a ≤ b) : NeBot (𝓝[Iio b] a) := nhdsWithin_Iio_neBot' nonempty_Iio H #align nhds_within_Iio_ne_bot nhdsWithin_Iio_neBot theorem nhdsWithin_Iio_self_neBot' {b : α} (H : (Iio b).Nonempty) : NeBot (𝓝[<] b) := nhdsWithin_Iio_neBot' H (le_refl b) #align nhds_within_Iio_self_ne_bot' nhdsWithin_Iio_self_neBot' instance nhdsWithin_Iio_self_neBot [NoMinOrder α] (a : α) : NeBot (𝓝[<] a) := nhdsWithin_Iio_neBot (le_refl a) #align nhds_within_Iio_self_ne_bot nhdsWithin_Iio_self_neBot theorem right_nhdsWithin_Ico_neBot {a b : α} (H : a < b) : NeBot (𝓝[Ico a b] b) := (isLUB_Ico H).nhdsWithin_neBot (nonempty_Ico.2 H) #align right_nhds_within_Ico_ne_bot right_nhdsWithin_Ico_neBot theorem left_nhdsWithin_Ioc_neBot {a b : α} (H : a < b) : NeBot (𝓝[Ioc a b] a) := (isGLB_Ioc H).nhdsWithin_neBot (nonempty_Ioc.2 H) #align left_nhds_within_Ioc_ne_bot left_nhdsWithin_Ioc_neBot theorem left_nhdsWithin_Ioo_neBot {a b : α} (H : a < b) : NeBot (𝓝[Ioo a b] a) := (isGLB_Ioo H).nhdsWithin_neBot (nonempty_Ioo.2 H) #align left_nhds_within_Ioo_ne_bot left_nhdsWithin_Ioo_neBot theorem right_nhdsWithin_Ioo_neBot {a b : α} (H : a < b) : NeBot (𝓝[Ioo a b] b) := (isLUB_Ioo H).nhdsWithin_neBot (nonempty_Ioo.2 H) #align right_nhds_within_Ioo_ne_bot right_nhdsWithin_Ioo_neBot theorem comap_coe_nhdsWithin_Iio_of_Ioo_subset (hb : s ⊆ Iio b) (hs : s.Nonempty → ∃ a < b, Ioo a b ⊆ s) : comap ((↑) : s → α) (𝓝[<] b) = atTop := by nontriviality haveI : Nonempty s := nontrivial_iff_nonempty.1 ‹_› rcases hs (nonempty_subtype.1 ‹_›) with ⟨a, h, hs⟩ ext u; constructor · rintro ⟨t, ht, hts⟩ obtain ⟨x, ⟨hxa : a ≤ x, hxb : x < b⟩, hxt : Ioo x b ⊆ t⟩ := (mem_nhdsWithin_Iio_iff_exists_mem_Ico_Ioo_subset h).mp ht obtain ⟨y, hxy, hyb⟩ := exists_between hxb refine mem_of_superset (mem_atTop ⟨y, hs ⟨hxa.trans_lt hxy, hyb⟩⟩) ?_ rintro ⟨z, hzs⟩ (hyz : y ≤ z) exact hts (hxt ⟨hxy.trans_le hyz, hb hzs⟩) · intro hu obtain ⟨x : s, hx : ∀ z, x ≤ z → z ∈ u⟩ := mem_atTop_sets.1 hu exact ⟨Ioo x b, Ioo_mem_nhdsWithin_Iio' (hb x.2), fun z hz => hx _ hz.1.le⟩ #align comap_coe_nhds_within_Iio_of_Ioo_subset comap_coe_nhdsWithin_Iio_of_Ioo_subset set_option backward.isDefEq.lazyWhnfCore false in -- See https://github.com/leanprover-community/mathlib4/issues/12534 theorem comap_coe_nhdsWithin_Ioi_of_Ioo_subset (ha : s ⊆ Ioi a) (hs : s.Nonempty → ∃ b > a, Ioo a b ⊆ s) : comap ((↑) : s → α) (𝓝[>] a) = atBot := comap_coe_nhdsWithin_Iio_of_Ioo_subset (show ofDual ⁻¹' s ⊆ Iio (toDual a) from ha) fun h => by simpa only [OrderDual.exists, dual_Ioo] using hs h #align comap_coe_nhds_within_Ioi_of_Ioo_subset comap_coe_nhdsWithin_Ioi_of_Ioo_subset theorem map_coe_atTop_of_Ioo_subset (hb : s ⊆ Iio b) (hs : ∀ a' < b, ∃ a < b, Ioo a b ⊆ s) : map ((↑) : s → α) atTop = 𝓝[<] b := by rcases eq_empty_or_nonempty (Iio b) with (hb' | ⟨a, ha⟩) · have : IsEmpty s := ⟨fun x => hb'.subset (hb x.2)⟩ rw [filter_eq_bot_of_isEmpty atTop, Filter.map_bot, hb', nhdsWithin_empty] · rw [← comap_coe_nhdsWithin_Iio_of_Ioo_subset hb fun _ => hs a ha, map_comap_of_mem] rw [Subtype.range_val] exact (mem_nhdsWithin_Iio_iff_exists_Ioo_subset' ha).2 (hs a ha) #align map_coe_at_top_of_Ioo_subset map_coe_atTop_of_Ioo_subset theorem map_coe_atBot_of_Ioo_subset (ha : s ⊆ Ioi a) (hs : ∀ b' > a, ∃ b > a, Ioo a b ⊆ s) : map ((↑) : s → α) atBot = 𝓝[>] a := by -- the elaborator gets stuck without `(... : _)` refine (map_coe_atTop_of_Ioo_subset (show ofDual ⁻¹' s ⊆ Iio (toDual a) from ha) fun b' hb' => ?_ : _) simpa only [OrderDual.exists, dual_Ioo] using hs b' hb' #align map_coe_at_bot_of_Ioo_subset map_coe_atBot_of_Ioo_subset theorem comap_coe_Ioo_nhdsWithin_Iio (a b : α) : comap ((↑) : Ioo a b → α) (𝓝[<] b) = atTop := comap_coe_nhdsWithin_Iio_of_Ioo_subset Ioo_subset_Iio_self fun h => ⟨a, nonempty_Ioo.1 h, Subset.refl _⟩ #align comap_coe_Ioo_nhds_within_Iio comap_coe_Ioo_nhdsWithin_Iio theorem comap_coe_Ioo_nhdsWithin_Ioi (a b : α) : comap ((↑) : Ioo a b → α) (𝓝[>] a) = atBot := comap_coe_nhdsWithin_Ioi_of_Ioo_subset Ioo_subset_Ioi_self fun h => ⟨b, nonempty_Ioo.1 h, Subset.refl _⟩ #align comap_coe_Ioo_nhds_within_Ioi comap_coe_Ioo_nhdsWithin_Ioi theorem comap_coe_Ioi_nhdsWithin_Ioi (a : α) : comap ((↑) : Ioi a → α) (𝓝[>] a) = atBot := comap_coe_nhdsWithin_Ioi_of_Ioo_subset (Subset.refl _) fun ⟨x, hx⟩ => ⟨x, hx, Ioo_subset_Ioi_self⟩ #align comap_coe_Ioi_nhds_within_Ioi comap_coe_Ioi_nhdsWithin_Ioi theorem comap_coe_Iio_nhdsWithin_Iio (a : α) : comap ((↑) : Iio a → α) (𝓝[<] a) = atTop := comap_coe_Ioi_nhdsWithin_Ioi (α := αᵒᵈ) a #align comap_coe_Iio_nhds_within_Iio comap_coe_Iio_nhdsWithin_Iio @[simp] theorem map_coe_Ioo_atTop {a b : α} (h : a < b) : map ((↑) : Ioo a b → α) atTop = 𝓝[<] b := map_coe_atTop_of_Ioo_subset Ioo_subset_Iio_self fun _ _ => ⟨_, h, Subset.refl _⟩ #align map_coe_Ioo_at_top map_coe_Ioo_atTop @[simp] theorem map_coe_Ioo_atBot {a b : α} (h : a < b) : map ((↑) : Ioo a b → α) atBot = 𝓝[>] a := map_coe_atBot_of_Ioo_subset Ioo_subset_Ioi_self fun _ _ => ⟨_, h, Subset.refl _⟩ #align map_coe_Ioo_at_bot map_coe_Ioo_atBot @[simp] theorem map_coe_Ioi_atBot (a : α) : map ((↑) : Ioi a → α) atBot = 𝓝[>] a := map_coe_atBot_of_Ioo_subset (Subset.refl _) fun b hb => ⟨b, hb, Ioo_subset_Ioi_self⟩ #align map_coe_Ioi_at_bot map_coe_Ioi_atBot @[simp] theorem map_coe_Iio_atTop (a : α) : map ((↑) : Iio a → α) atTop = 𝓝[<] a := map_coe_Ioi_atBot (α := αᵒᵈ) _ #align map_coe_Iio_at_top map_coe_Iio_atTop variable {l : Filter β} {f : α → β} @[simp] theorem tendsto_comp_coe_Ioo_atTop (h : a < b) : Tendsto (fun x : Ioo a b => f x) atTop l ↔ Tendsto f (𝓝[<] b) l := by rw [← map_coe_Ioo_atTop h, tendsto_map'_iff]; rfl #align tendsto_comp_coe_Ioo_at_top tendsto_comp_coe_Ioo_atTop @[simp] theorem tendsto_comp_coe_Ioo_atBot (h : a < b) : Tendsto (fun x : Ioo a b => f x) atBot l ↔ Tendsto f (𝓝[>] a) l := by rw [← map_coe_Ioo_atBot h, tendsto_map'_iff]; rfl #align tendsto_comp_coe_Ioo_at_bot tendsto_comp_coe_Ioo_atBot -- Porting note (#11215): TODO: `simpNF` claims that `simp` can't use -- this lemma to simplify LHS but it can @[simp, nolint simpNF]
Mathlib/Topology/Order/DenselyOrdered.lean
358
360
theorem tendsto_comp_coe_Ioi_atBot : Tendsto (fun x : Ioi a => f x) atBot l ↔ Tendsto f (𝓝[>] a) l := by
rw [← map_coe_Ioi_atBot, tendsto_map'_iff]; rfl
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Reverse import Mathlib.Algebra.Polynomial.Inductions import Mathlib.RingTheory.Localization.Basic #align_import data.polynomial.laurent from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" open Polynomial Function AddMonoidAlgebra Finsupp noncomputable section variable {R : Type*} abbrev LaurentPolynomial (R : Type*) [Semiring R] := AddMonoidAlgebra R ℤ #align laurent_polynomial LaurentPolynomial @[nolint docBlame] scoped[LaurentPolynomial] notation:9000 R "[T;T⁻¹]" => LaurentPolynomial R open LaurentPolynomial -- Porting note: `ext` no longer applies `Finsupp.ext` automatically @[ext] theorem LaurentPolynomial.ext [Semiring R] {p q : R[T;T⁻¹]} (h : ∀ a, p a = q a) : p = q := Finsupp.ext h def Polynomial.toLaurent [Semiring R] : R[X] →+* R[T;T⁻¹] := (mapDomainRingHom R Int.ofNatHom).comp (toFinsuppIso R) #align polynomial.to_laurent Polynomial.toLaurent theorem Polynomial.toLaurent_apply [Semiring R] (p : R[X]) : toLaurent p = p.toFinsupp.mapDomain (↑) := rfl #align polynomial.to_laurent_apply Polynomial.toLaurent_apply def Polynomial.toLaurentAlg [CommSemiring R] : R[X] →ₐ[R] R[T;T⁻¹] := (mapDomainAlgHom R R Int.ofNatHom).comp (toFinsuppIsoAlg R).toAlgHom #align polynomial.to_laurent_alg Polynomial.toLaurentAlg @[simp] lemma Polynomial.coe_toLaurentAlg [CommSemiring R] : (toLaurentAlg : R[X] → R[T;T⁻¹]) = toLaurent := rfl theorem Polynomial.toLaurentAlg_apply [CommSemiring R] (f : R[X]) : toLaurentAlg f = toLaurent f := rfl #align polynomial.to_laurent_alg_apply Polynomial.toLaurentAlg_apply namespace LaurentPolynomial section Semiring variable [Semiring R] theorem single_zero_one_eq_one : (Finsupp.single 0 1 : R[T;T⁻¹]) = (1 : R[T;T⁻¹]) := rfl #align laurent_polynomial.single_zero_one_eq_one LaurentPolynomial.single_zero_one_eq_one def C : R →+* R[T;T⁻¹] := singleZeroRingHom set_option linter.uppercaseLean3 false in #align laurent_polynomial.C LaurentPolynomial.C theorem algebraMap_apply {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (r : R) : algebraMap R (LaurentPolynomial A) r = C (algebraMap R A r) := rfl #align laurent_polynomial.algebra_map_apply LaurentPolynomial.algebraMap_apply theorem C_eq_algebraMap {R : Type*} [CommSemiring R] (r : R) : C r = algebraMap R R[T;T⁻¹] r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.C_eq_algebra_map LaurentPolynomial.C_eq_algebraMap theorem single_eq_C (r : R) : Finsupp.single 0 r = C r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.single_eq_C LaurentPolynomial.single_eq_C @[simp] lemma C_apply (t : R) (n : ℤ) : C t n = if n = 0 then t else 0 := by rw [← single_eq_C, Finsupp.single_apply]; aesop def T (n : ℤ) : R[T;T⁻¹] := Finsupp.single n 1 set_option linter.uppercaseLean3 false in #align laurent_polynomial.T LaurentPolynomial.T @[simp] lemma T_apply (m n : ℤ) : (T n : R[T;T⁻¹]) m = if n = m then 1 else 0 := Finsupp.single_apply @[simp] theorem T_zero : (T 0 : R[T;T⁻¹]) = 1 := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_zero LaurentPolynomial.T_zero theorem T_add (m n : ℤ) : (T (m + n) : R[T;T⁻¹]) = T m * T n := by -- Porting note: was `convert single_mul_single.symm` simp [T, single_mul_single] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_add LaurentPolynomial.T_add theorem T_sub (m n : ℤ) : (T (m - n) : R[T;T⁻¹]) = T m * T (-n) := by rw [← T_add, sub_eq_add_neg] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_sub LaurentPolynomial.T_sub @[simp] theorem T_pow (m : ℤ) (n : ℕ) : (T m ^ n : R[T;T⁻¹]) = T (n * m) := by rw [T, T, single_pow n, one_pow, nsmul_eq_mul] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_pow LaurentPolynomial.T_pow @[simp] theorem mul_T_assoc (f : R[T;T⁻¹]) (m n : ℤ) : f * T m * T n = f * T (m + n) := by simp [← T_add, mul_assoc] set_option linter.uppercaseLean3 false in #align laurent_polynomial.mul_T_assoc LaurentPolynomial.mul_T_assoc @[simp] theorem single_eq_C_mul_T (r : R) (n : ℤ) : (Finsupp.single n r : R[T;T⁻¹]) = (C r * T n : R[T;T⁻¹]) := by -- Porting note: was `convert single_mul_single.symm` simp [C, T, single_mul_single] set_option linter.uppercaseLean3 false in #align laurent_polynomial.single_eq_C_mul_T LaurentPolynomial.single_eq_C_mul_T -- This lemma locks in the right changes and is what Lean proved directly. -- The actual `simp`-normal form of a Laurent monomial is `C a * T n`, whenever it can be reached. @[simp] theorem _root_.Polynomial.toLaurent_C_mul_T (n : ℕ) (r : R) : (toLaurent (Polynomial.monomial n r) : R[T;T⁻¹]) = C r * T n := show Finsupp.mapDomain (↑) (monomial n r).toFinsupp = (C r * T n : R[T;T⁻¹]) by rw [toFinsupp_monomial, Finsupp.mapDomain_single, single_eq_C_mul_T] set_option linter.uppercaseLean3 false in #align polynomial.to_laurent_C_mul_T Polynomial.toLaurent_C_mul_T @[simp] theorem _root_.Polynomial.toLaurent_C (r : R) : toLaurent (Polynomial.C r) = C r := by convert Polynomial.toLaurent_C_mul_T 0 r simp only [Int.ofNat_zero, T_zero, mul_one] set_option linter.uppercaseLean3 false in #align polynomial.to_laurent_C Polynomial.toLaurent_C @[simp] theorem _root_.Polynomial.toLaurent_comp_C : toLaurent (R := R) ∘ Polynomial.C = C := funext Polynomial.toLaurent_C @[simp] theorem _root_.Polynomial.toLaurent_X : (toLaurent Polynomial.X : R[T;T⁻¹]) = T 1 := by have : (Polynomial.X : R[X]) = monomial 1 1 := by simp [← C_mul_X_pow_eq_monomial] simp [this, Polynomial.toLaurent_C_mul_T] set_option linter.uppercaseLean3 false in #align polynomial.to_laurent_X Polynomial.toLaurent_X -- @[simp] -- Porting note (#10618): simp can prove this theorem _root_.Polynomial.toLaurent_one : (Polynomial.toLaurent : R[X] → R[T;T⁻¹]) 1 = 1 := map_one Polynomial.toLaurent #align polynomial.to_laurent_one Polynomial.toLaurent_one -- @[simp] -- Porting note (#10618): simp can prove this theorem _root_.Polynomial.toLaurent_C_mul_eq (r : R) (f : R[X]) : toLaurent (Polynomial.C r * f) = C r * toLaurent f := by simp only [_root_.map_mul, Polynomial.toLaurent_C] set_option linter.uppercaseLean3 false in #align polynomial.to_laurent_C_mul_eq Polynomial.toLaurent_C_mul_eq -- @[simp] -- Porting note (#10618): simp can prove this theorem _root_.Polynomial.toLaurent_X_pow (n : ℕ) : toLaurent (X ^ n : R[X]) = T n := by simp only [map_pow, Polynomial.toLaurent_X, T_pow, mul_one] set_option linter.uppercaseLean3 false in #align polynomial.to_laurent_X_pow Polynomial.toLaurent_X_pow -- @[simp] -- Porting note (#10618): simp can prove this theorem _root_.Polynomial.toLaurent_C_mul_X_pow (n : ℕ) (r : R) : toLaurent (Polynomial.C r * X ^ n) = C r * T n := by simp only [_root_.map_mul, Polynomial.toLaurent_C, Polynomial.toLaurent_X_pow] set_option linter.uppercaseLean3 false in #align polynomial.to_laurent_C_mul_X_pow Polynomial.toLaurent_C_mul_X_pow instance invertibleT (n : ℤ) : Invertible (T n : R[T;T⁻¹]) where invOf := T (-n) invOf_mul_self := by rw [← T_add, add_left_neg, T_zero] mul_invOf_self := by rw [← T_add, add_right_neg, T_zero] set_option linter.uppercaseLean3 false in #align laurent_polynomial.invertible_T LaurentPolynomial.invertibleT @[simp] theorem invOf_T (n : ℤ) : ⅟ (T n : R[T;T⁻¹]) = T (-n) := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.inv_of_T LaurentPolynomial.invOf_T theorem isUnit_T (n : ℤ) : IsUnit (T n : R[T;T⁻¹]) := isUnit_of_invertible _ set_option linter.uppercaseLean3 false in #align laurent_polynomial.is_unit_T LaurentPolynomial.isUnit_T @[elab_as_elim] protected theorem induction_on {M : R[T;T⁻¹] → Prop} (p : R[T;T⁻¹]) (h_C : ∀ a, M (C a)) (h_add : ∀ {p q}, M p → M q → M (p + q)) (h_C_mul_T : ∀ (n : ℕ) (a : R), M (C a * T n) → M (C a * T (n + 1))) (h_C_mul_T_Z : ∀ (n : ℕ) (a : R), M (C a * T (-n)) → M (C a * T (-n - 1))) : M p := by have A : ∀ {n : ℤ} {a : R}, M (C a * T n) := by intro n a refine Int.induction_on n ?_ ?_ ?_ · simpa only [T_zero, mul_one] using h_C a · exact fun m => h_C_mul_T m a · exact fun m => h_C_mul_T_Z m a have B : ∀ s : Finset ℤ, M (s.sum fun n : ℤ => C (p.toFun n) * T n) := by apply Finset.induction · convert h_C 0 simp only [Finset.sum_empty, _root_.map_zero] · intro n s ns ih rw [Finset.sum_insert ns] exact h_add A ih convert B p.support ext a simp_rw [← single_eq_C_mul_T] -- Porting note: did not make progress in `simp_rw` rw [Finset.sum_apply'] simp_rw [Finsupp.single_apply, Finset.sum_ite_eq'] split_ifs with h · rfl · exact Finsupp.not_mem_support_iff.mp h #align laurent_polynomial.induction_on LaurentPolynomial.induction_on @[elab_as_elim] protected theorem induction_on' {M : R[T;T⁻¹] → Prop} (p : R[T;T⁻¹]) (h_add : ∀ p q, M p → M q → M (p + q)) (h_C_mul_T : ∀ (n : ℤ) (a : R), M (C a * T n)) : M p := by refine p.induction_on (fun a => ?_) (fun {p q} => h_add p q) ?_ ?_ <;> try exact fun n f _ => h_C_mul_T _ f convert h_C_mul_T 0 a exact (mul_one _).symm #align laurent_polynomial.induction_on' LaurentPolynomial.induction_on' theorem commute_T (n : ℤ) (f : R[T;T⁻¹]) : Commute (T n) f := f.induction_on' (fun p q Tp Tq => Commute.add_right Tp Tq) fun m a => show T n * _ = _ by rw [T, T, ← single_eq_C, single_mul_single, single_mul_single, single_mul_single] simp [add_comm] set_option linter.uppercaseLean3 false in #align laurent_polynomial.commute_T LaurentPolynomial.commute_T @[simp] theorem T_mul (n : ℤ) (f : R[T;T⁻¹]) : T n * f = f * T n := (commute_T n f).eq set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_mul LaurentPolynomial.T_mul def trunc : R[T;T⁻¹] →+ R[X] := (toFinsuppIso R).symm.toAddMonoidHom.comp <| comapDomain.addMonoidHom fun _ _ => Int.ofNat.inj #align laurent_polynomial.trunc LaurentPolynomial.trunc @[simp] theorem trunc_C_mul_T (n : ℤ) (r : R) : trunc (C r * T n) = ite (0 ≤ n) (monomial n.toNat r) 0 := by apply (toFinsuppIso R).injective rw [← single_eq_C_mul_T, trunc, AddMonoidHom.coe_comp, Function.comp_apply] -- Porting note (#10691): was `rw` erw [comapDomain.addMonoidHom_apply Int.ofNat_injective] rw [toFinsuppIso_apply] -- Porting note: rewrote proof below relative to mathlib3. by_cases n0 : 0 ≤ n · lift n to ℕ using n0 erw [comapDomain_single] simp only [Nat.cast_nonneg, Int.toNat_ofNat, ite_true, toFinsupp_monomial] · lift -n to ℕ using (neg_pos.mpr (not_le.mp n0)).le with m rw [toFinsupp_inj, if_neg n0] ext a have := ((not_le.mp n0).trans_le (Int.ofNat_zero_le a)).ne simp only [coeff_ofFinsupp, comapDomain_apply, Int.ofNat_eq_coe, coeff_zero, single_eq_of_ne this] set_option linter.uppercaseLean3 false in #align laurent_polynomial.trunc_C_mul_T LaurentPolynomial.trunc_C_mul_T @[simp] theorem leftInverse_trunc_toLaurent : Function.LeftInverse (trunc : R[T;T⁻¹] → R[X]) Polynomial.toLaurent := by refine fun f => f.induction_on' ?_ ?_ · intro f g hf hg simp only [hf, hg, _root_.map_add] · intro n r simp only [Polynomial.toLaurent_C_mul_T, trunc_C_mul_T, Int.natCast_nonneg, Int.toNat_natCast, if_true] #align laurent_polynomial.left_inverse_trunc_to_laurent LaurentPolynomial.leftInverse_trunc_toLaurent @[simp] theorem _root_.Polynomial.trunc_toLaurent (f : R[X]) : trunc (toLaurent f) = f := leftInverse_trunc_toLaurent _ #align polynomial.trunc_to_laurent Polynomial.trunc_toLaurent theorem _root_.Polynomial.toLaurent_injective : Function.Injective (Polynomial.toLaurent : R[X] → R[T;T⁻¹]) := leftInverse_trunc_toLaurent.injective #align polynomial.to_laurent_injective Polynomial.toLaurent_injective @[simp] theorem _root_.Polynomial.toLaurent_inj (f g : R[X]) : toLaurent f = toLaurent g ↔ f = g := ⟨fun h => Polynomial.toLaurent_injective h, congr_arg _⟩ #align polynomial.to_laurent_inj Polynomial.toLaurent_inj theorem _root_.Polynomial.toLaurent_ne_zero {f : R[X]} : f ≠ 0 ↔ toLaurent f ≠ 0 := (map_ne_zero_iff _ Polynomial.toLaurent_injective).symm #align polynomial.to_laurent_ne_zero Polynomial.toLaurent_ne_zero theorem exists_T_pow (f : R[T;T⁻¹]) : ∃ (n : ℕ) (f' : R[X]), toLaurent f' = f * T n := by refine f.induction_on' ?_ fun n a => ?_ <;> clear f · rintro f g ⟨m, fn, hf⟩ ⟨n, gn, hg⟩ refine ⟨m + n, fn * X ^ n + gn * X ^ m, ?_⟩ simp only [hf, hg, add_mul, add_comm (n : ℤ), map_add, map_mul, Polynomial.toLaurent_X_pow, mul_T_assoc, Int.ofNat_add] · cases' n with n n · exact ⟨0, Polynomial.C a * X ^ n, by simp⟩ · refine ⟨n + 1, Polynomial.C a, ?_⟩ simp only [Int.negSucc_eq, Polynomial.toLaurent_C, Int.ofNat_succ, mul_T_assoc, add_left_neg, T_zero, mul_one] set_option linter.uppercaseLean3 false in #align laurent_polynomial.exists_T_pow LaurentPolynomial.exists_T_pow @[elab_as_elim] theorem induction_on_mul_T {Q : R[T;T⁻¹] → Prop} (f : R[T;T⁻¹]) (Qf : ∀ {f : R[X]} {n : ℕ}, Q (toLaurent f * T (-n))) : Q f := by rcases f.exists_T_pow with ⟨n, f', hf⟩ rw [← mul_one f, ← T_zero, ← Nat.cast_zero, ← Nat.sub_self n, Nat.cast_sub rfl.le, T_sub, ← mul_assoc, ← hf] exact Qf set_option linter.uppercaseLean3 false in #align laurent_polynomial.induction_on_mul_T LaurentPolynomial.induction_on_mul_T theorem reduce_to_polynomial_of_mul_T (f : R[T;T⁻¹]) {Q : R[T;T⁻¹] → Prop} (Qf : ∀ f : R[X], Q (toLaurent f)) (QT : ∀ f, Q (f * T 1) → Q f) : Q f := by induction' f using LaurentPolynomial.induction_on_mul_T with f n induction' n with n hn · simpa only [Nat.zero_eq, Nat.cast_zero, neg_zero, T_zero, mul_one] using Qf _ · convert QT _ _ simpa using hn set_option linter.uppercaseLean3 false in #align laurent_polynomial.reduce_to_polynomial_of_mul_T LaurentPolynomial.reduce_to_polynomial_of_mul_T section Degrees def degree (f : R[T;T⁻¹]) : WithBot ℤ := f.support.max #align laurent_polynomial.degree LaurentPolynomial.degree @[simp] theorem degree_zero : degree (0 : R[T;T⁻¹]) = ⊥ := rfl #align laurent_polynomial.degree_zero LaurentPolynomial.degree_zero @[simp] theorem degree_eq_bot_iff {f : R[T;T⁻¹]} : f.degree = ⊥ ↔ f = 0 := by refine ⟨fun h => ?_, fun h => by rw [h, degree_zero]⟩ rw [degree, Finset.max_eq_sup_withBot] at h ext n refine not_not.mp fun f0 => ?_ simp_rw [Finset.sup_eq_bot_iff, Finsupp.mem_support_iff, Ne, WithBot.coe_ne_bot] at h exact h n f0 #align laurent_polynomial.degree_eq_bot_iff LaurentPolynomial.degree_eq_bot_iff section ExactDegrees @[simp] theorem degree_C_mul_T (n : ℤ) (a : R) (a0 : a ≠ 0) : degree (C a * T n) = n := by rw [degree] -- Porting note: was `convert Finset.max_singleton` have : Finsupp.support (C a * T n) = {n} := by refine support_eq_singleton.mpr ?_ rw [← single_eq_C_mul_T] simp only [single_eq_same, a0, Ne, not_false_iff, eq_self_iff_true, and_self_iff] rw [this] exact Finset.max_singleton set_option linter.uppercaseLean3 false in #align laurent_polynomial.degree_C_mul_T LaurentPolynomial.degree_C_mul_T
Mathlib/Algebra/Polynomial/Laurent.lean
522
526
theorem degree_C_mul_T_ite [DecidableEq R] (n : ℤ) (a : R) : degree (C a * T n) = if a = 0 then ⊥ else ↑n := by
split_ifs with h <;> simp only [h, map_zero, zero_mul, degree_zero, degree_C_mul_T, Ne, not_false_iff]
import Mathlib.Algebra.Algebra.Tower import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.GroupTheory.MonoidLocalization import Mathlib.RingTheory.Ideal.Basic import Mathlib.GroupTheory.GroupAction.Ring #align_import ring_theory.localization.basic from "leanprover-community/mathlib"@"b69c9a770ecf37eb21f7b8cf4fa00de3b62694ec" open Function section CommSemiring variable {R : Type*} [CommSemiring R] (M : Submonoid R) (S : Type*) [CommSemiring S] variable [Algebra R S] {P : Type*} [CommSemiring P] @[mk_iff] class IsLocalization : Prop where -- Porting note: add ' to fields, and made new versions of these with either `S` or `M` explicit. map_units' : ∀ y : M, IsUnit (algebraMap R S y) surj' : ∀ z : S, ∃ x : R × M, z * algebraMap R S x.2 = algebraMap R S x.1 exists_of_eq : ∀ {x y}, algebraMap R S x = algebraMap R S y → ∃ c : M, ↑c * x = ↑c * y #align is_localization IsLocalization variable {M} namespace IsLocalization section IsLocalization variable [IsLocalization M S] section @[inherit_doc IsLocalization.map_units'] theorem map_units : ∀ y : M, IsUnit (algebraMap R S y) := IsLocalization.map_units' variable (M) {S} @[inherit_doc IsLocalization.surj'] theorem surj : ∀ z : S, ∃ x : R × M, z * algebraMap R S x.2 = algebraMap R S x.1 := IsLocalization.surj' variable (S) @[inherit_doc IsLocalization.exists_of_eq] theorem eq_iff_exists {x y} : algebraMap R S x = algebraMap R S y ↔ ∃ c : M, ↑c * x = ↑c * y := Iff.intro IsLocalization.exists_of_eq fun ⟨c, h⟩ ↦ by apply_fun algebraMap R S at h rw [map_mul, map_mul] at h exact (IsLocalization.map_units S c).mul_right_inj.mp h variable {S}
Mathlib/RingTheory/Localization/Basic.lean
135
144
theorem of_le (N : Submonoid R) (h₁ : M ≤ N) (h₂ : ∀ r ∈ N, IsUnit (algebraMap R S r)) : IsLocalization N S where map_units' r := h₂ r r.2 surj' s := have ⟨⟨x, y, hy⟩, H⟩ := IsLocalization.surj M s ⟨⟨x, y, h₁ hy⟩, H⟩ exists_of_eq {x y} := by
rw [IsLocalization.eq_iff_exists M] rintro ⟨c, hc⟩ exact ⟨⟨c, h₁ c.2⟩, hc⟩
import Mathlib.Algebra.Module.BigOperators import Mathlib.Data.Fintype.Perm import Mathlib.GroupTheory.Perm.Finite import Mathlib.GroupTheory.Perm.List #align_import group_theory.perm.cycle.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3" open Equiv Function Finset variable {ι α β : Type*} namespace Equiv.Perm section SameCycle variable {f g : Perm α} {p : α → Prop} {x y z : α} def SameCycle (f : Perm α) (x y : α) : Prop := ∃ i : ℤ, (f ^ i) x = y #align equiv.perm.same_cycle Equiv.Perm.SameCycle @[refl] theorem SameCycle.refl (f : Perm α) (x : α) : SameCycle f x x := ⟨0, rfl⟩ #align equiv.perm.same_cycle.refl Equiv.Perm.SameCycle.refl theorem SameCycle.rfl : SameCycle f x x := SameCycle.refl _ _ #align equiv.perm.same_cycle.rfl Equiv.Perm.SameCycle.rfl protected theorem _root_.Eq.sameCycle (h : x = y) (f : Perm α) : f.SameCycle x y := by rw [h] #align eq.same_cycle Eq.sameCycle @[symm] theorem SameCycle.symm : SameCycle f x y → SameCycle f y x := fun ⟨i, hi⟩ => ⟨-i, by rw [zpow_neg, ← hi, inv_apply_self]⟩ #align equiv.perm.same_cycle.symm Equiv.Perm.SameCycle.symm theorem sameCycle_comm : SameCycle f x y ↔ SameCycle f y x := ⟨SameCycle.symm, SameCycle.symm⟩ #align equiv.perm.same_cycle_comm Equiv.Perm.sameCycle_comm @[trans] theorem SameCycle.trans : SameCycle f x y → SameCycle f y z → SameCycle f x z := fun ⟨i, hi⟩ ⟨j, hj⟩ => ⟨j + i, by rw [zpow_add, mul_apply, hi, hj]⟩ #align equiv.perm.same_cycle.trans Equiv.Perm.SameCycle.trans variable (f) in theorem SameCycle.equivalence : Equivalence (SameCycle f) := ⟨SameCycle.refl f, SameCycle.symm, SameCycle.trans⟩ def SameCycle.setoid (f : Perm α) : Setoid α where iseqv := SameCycle.equivalence f @[simp] theorem sameCycle_one : SameCycle 1 x y ↔ x = y := by simp [SameCycle] #align equiv.perm.same_cycle_one Equiv.Perm.sameCycle_one @[simp] theorem sameCycle_inv : SameCycle f⁻¹ x y ↔ SameCycle f x y := (Equiv.neg _).exists_congr_left.trans <| by simp [SameCycle] #align equiv.perm.same_cycle_inv Equiv.Perm.sameCycle_inv alias ⟨SameCycle.of_inv, SameCycle.inv⟩ := sameCycle_inv #align equiv.perm.same_cycle.of_inv Equiv.Perm.SameCycle.of_inv #align equiv.perm.same_cycle.inv Equiv.Perm.SameCycle.inv @[simp] theorem sameCycle_conj : SameCycle (g * f * g⁻¹) x y ↔ SameCycle f (g⁻¹ x) (g⁻¹ y) := exists_congr fun i => by simp [conj_zpow, eq_inv_iff_eq] #align equiv.perm.same_cycle_conj Equiv.Perm.sameCycle_conj theorem SameCycle.conj : SameCycle f x y → SameCycle (g * f * g⁻¹) (g x) (g y) := by simp [sameCycle_conj] #align equiv.perm.same_cycle.conj Equiv.Perm.SameCycle.conj theorem SameCycle.apply_eq_self_iff : SameCycle f x y → (f x = x ↔ f y = y) := fun ⟨i, hi⟩ => by rw [← hi, ← mul_apply, ← zpow_one_add, add_comm, zpow_add_one, mul_apply, (f ^ i).injective.eq_iff] #align equiv.perm.same_cycle.apply_eq_self_iff Equiv.Perm.SameCycle.apply_eq_self_iff theorem SameCycle.eq_of_left (h : SameCycle f x y) (hx : IsFixedPt f x) : x = y := let ⟨_, hn⟩ := h (hx.perm_zpow _).eq.symm.trans hn #align equiv.perm.same_cycle.eq_of_left Equiv.Perm.SameCycle.eq_of_left theorem SameCycle.eq_of_right (h : SameCycle f x y) (hy : IsFixedPt f y) : x = y := h.eq_of_left <| h.apply_eq_self_iff.2 hy #align equiv.perm.same_cycle.eq_of_right Equiv.Perm.SameCycle.eq_of_right @[simp] theorem sameCycle_apply_left : SameCycle f (f x) y ↔ SameCycle f x y := (Equiv.addRight 1).exists_congr_left.trans <| by simp [zpow_sub, SameCycle, Int.add_neg_one, Function.comp] #align equiv.perm.same_cycle_apply_left Equiv.Perm.sameCycle_apply_left @[simp] theorem sameCycle_apply_right : SameCycle f x (f y) ↔ SameCycle f x y := by rw [sameCycle_comm, sameCycle_apply_left, sameCycle_comm] #align equiv.perm.same_cycle_apply_right Equiv.Perm.sameCycle_apply_right @[simp] theorem sameCycle_inv_apply_left : SameCycle f (f⁻¹ x) y ↔ SameCycle f x y := by rw [← sameCycle_apply_left, apply_inv_self] #align equiv.perm.same_cycle_inv_apply_left Equiv.Perm.sameCycle_inv_apply_left @[simp] theorem sameCycle_inv_apply_right : SameCycle f x (f⁻¹ y) ↔ SameCycle f x y := by rw [← sameCycle_apply_right, apply_inv_self] #align equiv.perm.same_cycle_inv_apply_right Equiv.Perm.sameCycle_inv_apply_right @[simp] theorem sameCycle_zpow_left {n : ℤ} : SameCycle f ((f ^ n) x) y ↔ SameCycle f x y := (Equiv.addRight (n : ℤ)).exists_congr_left.trans <| by simp [SameCycle, zpow_add] #align equiv.perm.same_cycle_zpow_left Equiv.Perm.sameCycle_zpow_left @[simp] theorem sameCycle_zpow_right {n : ℤ} : SameCycle f x ((f ^ n) y) ↔ SameCycle f x y := by rw [sameCycle_comm, sameCycle_zpow_left, sameCycle_comm] #align equiv.perm.same_cycle_zpow_right Equiv.Perm.sameCycle_zpow_right @[simp] theorem sameCycle_pow_left {n : ℕ} : SameCycle f ((f ^ n) x) y ↔ SameCycle f x y := by rw [← zpow_natCast, sameCycle_zpow_left] #align equiv.perm.same_cycle_pow_left Equiv.Perm.sameCycle_pow_left @[simp] theorem sameCycle_pow_right {n : ℕ} : SameCycle f x ((f ^ n) y) ↔ SameCycle f x y := by rw [← zpow_natCast, sameCycle_zpow_right] #align equiv.perm.same_cycle_pow_right Equiv.Perm.sameCycle_pow_right alias ⟨SameCycle.of_apply_left, SameCycle.apply_left⟩ := sameCycle_apply_left #align equiv.perm.same_cycle.of_apply_left Equiv.Perm.SameCycle.of_apply_left #align equiv.perm.same_cycle.apply_left Equiv.Perm.SameCycle.apply_left alias ⟨SameCycle.of_apply_right, SameCycle.apply_right⟩ := sameCycle_apply_right #align equiv.perm.same_cycle.of_apply_right Equiv.Perm.SameCycle.of_apply_right #align equiv.perm.same_cycle.apply_right Equiv.Perm.SameCycle.apply_right alias ⟨SameCycle.of_inv_apply_left, SameCycle.inv_apply_left⟩ := sameCycle_inv_apply_left #align equiv.perm.same_cycle.of_inv_apply_left Equiv.Perm.SameCycle.of_inv_apply_left #align equiv.perm.same_cycle.inv_apply_left Equiv.Perm.SameCycle.inv_apply_left alias ⟨SameCycle.of_inv_apply_right, SameCycle.inv_apply_right⟩ := sameCycle_inv_apply_right #align equiv.perm.same_cycle.of_inv_apply_right Equiv.Perm.SameCycle.of_inv_apply_right #align equiv.perm.same_cycle.inv_apply_right Equiv.Perm.SameCycle.inv_apply_right alias ⟨SameCycle.of_pow_left, SameCycle.pow_left⟩ := sameCycle_pow_left #align equiv.perm.same_cycle.of_pow_left Equiv.Perm.SameCycle.of_pow_left #align equiv.perm.same_cycle.pow_left Equiv.Perm.SameCycle.pow_left alias ⟨SameCycle.of_pow_right, SameCycle.pow_right⟩ := sameCycle_pow_right #align equiv.perm.same_cycle.of_pow_right Equiv.Perm.SameCycle.of_pow_right #align equiv.perm.same_cycle.pow_right Equiv.Perm.SameCycle.pow_right alias ⟨SameCycle.of_zpow_left, SameCycle.zpow_left⟩ := sameCycle_zpow_left #align equiv.perm.same_cycle.of_zpow_left Equiv.Perm.SameCycle.of_zpow_left #align equiv.perm.same_cycle.zpow_left Equiv.Perm.SameCycle.zpow_left alias ⟨SameCycle.of_zpow_right, SameCycle.zpow_right⟩ := sameCycle_zpow_right #align equiv.perm.same_cycle.of_zpow_right Equiv.Perm.SameCycle.of_zpow_right #align equiv.perm.same_cycle.zpow_right Equiv.Perm.SameCycle.zpow_right theorem SameCycle.of_pow {n : ℕ} : SameCycle (f ^ n) x y → SameCycle f x y := fun ⟨m, h⟩ => ⟨n * m, by simp [zpow_mul, h]⟩ #align equiv.perm.same_cycle.of_pow Equiv.Perm.SameCycle.of_pow theorem SameCycle.of_zpow {n : ℤ} : SameCycle (f ^ n) x y → SameCycle f x y := fun ⟨m, h⟩ => ⟨n * m, by simp [zpow_mul, h]⟩ #align equiv.perm.same_cycle.of_zpow Equiv.Perm.SameCycle.of_zpow @[simp] theorem sameCycle_subtypePerm {h} {x y : { x // p x }} : (f.subtypePerm h).SameCycle x y ↔ f.SameCycle x y := exists_congr fun n => by simp [Subtype.ext_iff] #align equiv.perm.same_cycle_subtype_perm Equiv.Perm.sameCycle_subtypePerm alias ⟨_, SameCycle.subtypePerm⟩ := sameCycle_subtypePerm #align equiv.perm.same_cycle.subtype_perm Equiv.Perm.SameCycle.subtypePerm @[simp] theorem sameCycle_extendDomain {p : β → Prop} [DecidablePred p] {f : α ≃ Subtype p} : SameCycle (g.extendDomain f) (f x) (f y) ↔ g.SameCycle x y := exists_congr fun n => by rw [← extendDomain_zpow, extendDomain_apply_image, Subtype.coe_inj, f.injective.eq_iff] #align equiv.perm.same_cycle_extend_domain Equiv.Perm.sameCycle_extendDomain alias ⟨_, SameCycle.extendDomain⟩ := sameCycle_extendDomain #align equiv.perm.same_cycle.extend_domain Equiv.Perm.SameCycle.extendDomain theorem SameCycle.exists_pow_eq' [Finite α] : SameCycle f x y → ∃ i < orderOf f, (f ^ i) x = y := by classical rintro ⟨k, rfl⟩ use (k % orderOf f).natAbs have h₀ := Int.natCast_pos.mpr (orderOf_pos f) have h₁ := Int.emod_nonneg k h₀.ne' rw [← zpow_natCast, Int.natAbs_of_nonneg h₁, zpow_mod_orderOf] refine ⟨?_, by rfl⟩ rw [← Int.ofNat_lt, Int.natAbs_of_nonneg h₁] exact Int.emod_lt_of_pos _ h₀ #align equiv.perm.same_cycle.exists_pow_eq' Equiv.Perm.SameCycle.exists_pow_eq'
Mathlib/GroupTheory/Perm/Cycle/Basic.lean
237
243
theorem SameCycle.exists_pow_eq'' [Finite α] (h : SameCycle f x y) : ∃ i : ℕ, 0 < i ∧ i ≤ orderOf f ∧ (f ^ i) x = y := by
classical obtain ⟨_ | i, hi, rfl⟩ := h.exists_pow_eq' · refine ⟨orderOf f, orderOf_pos f, le_rfl, ?_⟩ rw [pow_orderOf_eq_one, pow_zero] · exact ⟨i.succ, i.zero_lt_succ, hi.le, by rfl⟩
import Mathlib.MeasureTheory.Measure.VectorMeasure import Mathlib.MeasureTheory.Function.AEEqOfIntegral #align_import measure_theory.measure.with_density_vector_measure from "leanprover-community/mathlib"@"d1bd9c5df2867c1cb463bc6364446d57bdd9f7f1" noncomputable section open scoped Classical MeasureTheory NNReal ENNReal variable {α β : Type*} {m : MeasurableSpace α} namespace MeasureTheory open TopologicalSpace variable {μ ν : Measure α} variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] def Measure.withDensityᵥ {m : MeasurableSpace α} (μ : Measure α) (f : α → E) : VectorMeasure α E := if hf : Integrable f μ then { measureOf' := fun s => if MeasurableSet s then ∫ x in s, f x ∂μ else 0 empty' := by simp not_measurable' := fun s hs => if_neg hs m_iUnion' := fun s hs₁ hs₂ => by dsimp only convert hasSum_integral_iUnion hs₁ hs₂ hf.integrableOn with n · rw [if_pos (hs₁ n)] · rw [if_pos (MeasurableSet.iUnion hs₁)] } else 0 #align measure_theory.measure.with_densityᵥ MeasureTheory.Measure.withDensityᵥ open Measure variable {f g : α → E} theorem withDensityᵥ_apply (hf : Integrable f μ) {s : Set α} (hs : MeasurableSet s) : μ.withDensityᵥ f s = ∫ x in s, f x ∂μ := by rw [withDensityᵥ, dif_pos hf]; exact dif_pos hs #align measure_theory.with_densityᵥ_apply MeasureTheory.withDensityᵥ_apply @[simp]
Mathlib/MeasureTheory/Measure/WithDensityVectorMeasure.lean
64
65
theorem withDensityᵥ_zero : μ.withDensityᵥ (0 : α → E) = 0 := by
ext1 s hs; erw [withDensityᵥ_apply (integrable_zero α E μ) hs]; simp
import Mathlib.ModelTheory.Satisfiability import Mathlib.Combinatorics.SimpleGraph.Basic #align_import model_theory.graph from "leanprover-community/mathlib"@"e56b8fea84d60fe434632b9d3b829ee685fb0c8f" set_option linter.uppercaseLean3 false universe u v w w' namespace FirstOrder namespace Language open FirstOrder open Structure variable {L : Language.{u, v}} {α : Type w} {V : Type w'} {n : ℕ} protected def graph : Language := Language.mk₂ Empty Empty Empty Empty Unit #align first_order.language.graph FirstOrder.Language.graph def adj : Language.graph.Relations 2 := Unit.unit #align first_order.language.adj FirstOrder.Language.adj def _root_.SimpleGraph.structure (G : SimpleGraph V) : Language.graph.Structure V := Structure.mk₂ Empty.elim Empty.elim Empty.elim Empty.elim fun _ => G.Adj #align simple_graph.Structure SimpleGraph.structure protected def Theory.simpleGraph : Language.graph.Theory := {adj.irreflexive, adj.symmetric} #align first_order.language.Theory.simple_graph FirstOrder.Language.Theory.simpleGraph @[simp] theorem Theory.simpleGraph_model_iff [Language.graph.Structure V] : V ⊨ Theory.simpleGraph ↔ (Irreflexive fun x y : V => RelMap adj ![x, y]) ∧ Symmetric fun x y : V => RelMap adj ![x, y] := by simp [Theory.simpleGraph] #align first_order.language.Theory.simple_graph_model_iff FirstOrder.Language.Theory.simpleGraph_model_iff instance simpleGraph_model (G : SimpleGraph V) : @Theory.Model _ V G.structure Theory.simpleGraph := by simp only [@Theory.simpleGraph_model_iff _ G.structure, relMap_apply₂] exact ⟨G.loopless, G.symm⟩ #align first_order.language.simple_graph_model FirstOrder.Language.simpleGraph_model variable (V) @[simps] def simpleGraphOfStructure [Language.graph.Structure V] [V ⊨ Theory.simpleGraph] : SimpleGraph V where Adj x y := RelMap adj ![x, y] symm := Relations.realize_symmetric.1 (Theory.realize_sentence_of_mem Theory.simpleGraph (Set.mem_insert_of_mem _ (Set.mem_singleton _))) loopless := Relations.realize_irreflexive.1 (Theory.realize_sentence_of_mem Theory.simpleGraph (Set.mem_insert _ _)) #align first_order.language.simple_graph_of_structure FirstOrder.Language.simpleGraphOfStructure variable {V} @[simp]
Mathlib/ModelTheory/Graph.lean
107
110
theorem _root_.SimpleGraph.simpleGraphOfStructure (G : SimpleGraph V) : @simpleGraphOfStructure V G.structure _ = G := by
ext rfl
import Mathlib.Data.Set.Image import Mathlib.Order.SuccPred.Relation import Mathlib.Topology.Clopen import Mathlib.Topology.Irreducible #align_import topology.connected from "leanprover-community/mathlib"@"d101e93197bb5f6ea89bd7ba386b7f7dff1f3903" open Set Function Topology TopologicalSpace Relation open scoped Classical universe u v variable {α : Type u} {β : Type v} {ι : Type*} {π : ι → Type*} [TopologicalSpace α] {s t u v : Set α} section Preconnected def IsPreconnected (s : Set α) : Prop := ∀ u v : Set α, IsOpen u → IsOpen v → s ⊆ u ∪ v → (s ∩ u).Nonempty → (s ∩ v).Nonempty → (s ∩ (u ∩ v)).Nonempty #align is_preconnected IsPreconnected def IsConnected (s : Set α) : Prop := s.Nonempty ∧ IsPreconnected s #align is_connected IsConnected theorem IsConnected.nonempty {s : Set α} (h : IsConnected s) : s.Nonempty := h.1 #align is_connected.nonempty IsConnected.nonempty theorem IsConnected.isPreconnected {s : Set α} (h : IsConnected s) : IsPreconnected s := h.2 #align is_connected.is_preconnected IsConnected.isPreconnected theorem IsPreirreducible.isPreconnected {s : Set α} (H : IsPreirreducible s) : IsPreconnected s := fun _ _ hu hv _ => H _ _ hu hv #align is_preirreducible.is_preconnected IsPreirreducible.isPreconnected theorem IsIrreducible.isConnected {s : Set α} (H : IsIrreducible s) : IsConnected s := ⟨H.nonempty, H.isPreirreducible.isPreconnected⟩ #align is_irreducible.is_connected IsIrreducible.isConnected theorem isPreconnected_empty : IsPreconnected (∅ : Set α) := isPreirreducible_empty.isPreconnected #align is_preconnected_empty isPreconnected_empty theorem isConnected_singleton {x} : IsConnected ({x} : Set α) := isIrreducible_singleton.isConnected #align is_connected_singleton isConnected_singleton theorem isPreconnected_singleton {x} : IsPreconnected ({x} : Set α) := isConnected_singleton.isPreconnected #align is_preconnected_singleton isPreconnected_singleton theorem Set.Subsingleton.isPreconnected {s : Set α} (hs : s.Subsingleton) : IsPreconnected s := hs.induction_on isPreconnected_empty fun _ => isPreconnected_singleton #align set.subsingleton.is_preconnected Set.Subsingleton.isPreconnected theorem isPreconnected_of_forall {s : Set α} (x : α) (H : ∀ y ∈ s, ∃ t, t ⊆ s ∧ x ∈ t ∧ y ∈ t ∧ IsPreconnected t) : IsPreconnected s := by rintro u v hu hv hs ⟨z, zs, zu⟩ ⟨y, ys, yv⟩ have xs : x ∈ s := by rcases H y ys with ⟨t, ts, xt, -, -⟩ exact ts xt -- Porting note (#11215): TODO: use `wlog xu : x ∈ u := hs xs using u v y z, v u z y` cases hs xs with | inl xu => rcases H y ys with ⟨t, ts, xt, yt, ht⟩ have := ht u v hu hv (ts.trans hs) ⟨x, xt, xu⟩ ⟨y, yt, yv⟩ exact this.imp fun z hz => ⟨ts hz.1, hz.2⟩ | inr xv => rcases H z zs with ⟨t, ts, xt, zt, ht⟩ have := ht v u hv hu (ts.trans <| by rwa [union_comm]) ⟨x, xt, xv⟩ ⟨z, zt, zu⟩ exact this.imp fun _ h => ⟨ts h.1, h.2.2, h.2.1⟩ #align is_preconnected_of_forall isPreconnected_of_forall theorem isPreconnected_of_forall_pair {s : Set α} (H : ∀ x ∈ s, ∀ y ∈ s, ∃ t, t ⊆ s ∧ x ∈ t ∧ y ∈ t ∧ IsPreconnected t) : IsPreconnected s := by rcases eq_empty_or_nonempty s with (rfl | ⟨x, hx⟩) exacts [isPreconnected_empty, isPreconnected_of_forall x fun y => H x hx y] #align is_preconnected_of_forall_pair isPreconnected_of_forall_pair theorem isPreconnected_sUnion (x : α) (c : Set (Set α)) (H1 : ∀ s ∈ c, x ∈ s) (H2 : ∀ s ∈ c, IsPreconnected s) : IsPreconnected (⋃₀ c) := by apply isPreconnected_of_forall x rintro y ⟨s, sc, ys⟩ exact ⟨s, subset_sUnion_of_mem sc, H1 s sc, ys, H2 s sc⟩ #align is_preconnected_sUnion isPreconnected_sUnion theorem isPreconnected_iUnion {ι : Sort*} {s : ι → Set α} (h₁ : (⋂ i, s i).Nonempty) (h₂ : ∀ i, IsPreconnected (s i)) : IsPreconnected (⋃ i, s i) := Exists.elim h₁ fun f hf => isPreconnected_sUnion f _ hf (forall_mem_range.2 h₂) #align is_preconnected_Union isPreconnected_iUnion theorem IsPreconnected.union (x : α) {s t : Set α} (H1 : x ∈ s) (H2 : x ∈ t) (H3 : IsPreconnected s) (H4 : IsPreconnected t) : IsPreconnected (s ∪ t) := sUnion_pair s t ▸ isPreconnected_sUnion x {s, t} (by rintro r (rfl | rfl | h) <;> assumption) (by rintro r (rfl | rfl | h) <;> assumption) #align is_preconnected.union IsPreconnected.union theorem IsPreconnected.union' {s t : Set α} (H : (s ∩ t).Nonempty) (hs : IsPreconnected s) (ht : IsPreconnected t) : IsPreconnected (s ∪ t) := by rcases H with ⟨x, hxs, hxt⟩ exact hs.union x hxs hxt ht #align is_preconnected.union' IsPreconnected.union' theorem IsConnected.union {s t : Set α} (H : (s ∩ t).Nonempty) (Hs : IsConnected s) (Ht : IsConnected t) : IsConnected (s ∪ t) := by rcases H with ⟨x, hx⟩ refine ⟨⟨x, mem_union_left t (mem_of_mem_inter_left hx)⟩, ?_⟩ exact Hs.isPreconnected.union x (mem_of_mem_inter_left hx) (mem_of_mem_inter_right hx) Ht.isPreconnected #align is_connected.union IsConnected.union theorem IsPreconnected.sUnion_directed {S : Set (Set α)} (K : DirectedOn (· ⊆ ·) S) (H : ∀ s ∈ S, IsPreconnected s) : IsPreconnected (⋃₀ S) := by rintro u v hu hv Huv ⟨a, ⟨s, hsS, has⟩, hau⟩ ⟨b, ⟨t, htS, hbt⟩, hbv⟩ obtain ⟨r, hrS, hsr, htr⟩ : ∃ r ∈ S, s ⊆ r ∧ t ⊆ r := K s hsS t htS have Hnuv : (r ∩ (u ∩ v)).Nonempty := H _ hrS u v hu hv ((subset_sUnion_of_mem hrS).trans Huv) ⟨a, hsr has, hau⟩ ⟨b, htr hbt, hbv⟩ have Kruv : r ∩ (u ∩ v) ⊆ ⋃₀ S ∩ (u ∩ v) := inter_subset_inter_left _ (subset_sUnion_of_mem hrS) exact Hnuv.mono Kruv #align is_preconnected.sUnion_directed IsPreconnected.sUnion_directed theorem IsPreconnected.biUnion_of_reflTransGen {ι : Type*} {t : Set ι} {s : ι → Set α} (H : ∀ i ∈ t, IsPreconnected (s i)) (K : ∀ i, i ∈ t → ∀ j, j ∈ t → ReflTransGen (fun i j => (s i ∩ s j).Nonempty ∧ i ∈ t) i j) : IsPreconnected (⋃ n ∈ t, s n) := by let R := fun i j : ι => (s i ∩ s j).Nonempty ∧ i ∈ t have P : ∀ i, i ∈ t → ∀ j, j ∈ t → ReflTransGen R i j → ∃ p, p ⊆ t ∧ i ∈ p ∧ j ∈ p ∧ IsPreconnected (⋃ j ∈ p, s j) := fun i hi j hj h => by induction h with | refl => refine ⟨{i}, singleton_subset_iff.mpr hi, mem_singleton i, mem_singleton i, ?_⟩ rw [biUnion_singleton] exact H i hi | @tail j k _ hjk ih => obtain ⟨p, hpt, hip, hjp, hp⟩ := ih hjk.2 refine ⟨insert k p, insert_subset_iff.mpr ⟨hj, hpt⟩, mem_insert_of_mem k hip, mem_insert k p, ?_⟩ rw [biUnion_insert] refine (H k hj).union' (hjk.1.mono ?_) hp rw [inter_comm] exact inter_subset_inter_right _ (subset_biUnion_of_mem hjp) refine isPreconnected_of_forall_pair ?_ intro x hx y hy obtain ⟨i : ι, hi : i ∈ t, hxi : x ∈ s i⟩ := mem_iUnion₂.1 hx obtain ⟨j : ι, hj : j ∈ t, hyj : y ∈ s j⟩ := mem_iUnion₂.1 hy obtain ⟨p, hpt, hip, hjp, hp⟩ := P i hi j hj (K i hi j hj) exact ⟨⋃ j ∈ p, s j, biUnion_subset_biUnion_left hpt, mem_biUnion hip hxi, mem_biUnion hjp hyj, hp⟩ #align is_preconnected.bUnion_of_refl_trans_gen IsPreconnected.biUnion_of_reflTransGen theorem IsConnected.biUnion_of_reflTransGen {ι : Type*} {t : Set ι} {s : ι → Set α} (ht : t.Nonempty) (H : ∀ i ∈ t, IsConnected (s i)) (K : ∀ i, i ∈ t → ∀ j, j ∈ t → ReflTransGen (fun i j : ι => (s i ∩ s j).Nonempty ∧ i ∈ t) i j) : IsConnected (⋃ n ∈ t, s n) := ⟨nonempty_biUnion.2 <| ⟨ht.some, ht.some_mem, (H _ ht.some_mem).nonempty⟩, IsPreconnected.biUnion_of_reflTransGen (fun i hi => (H i hi).isPreconnected) K⟩ #align is_connected.bUnion_of_refl_trans_gen IsConnected.biUnion_of_reflTransGen theorem IsPreconnected.iUnion_of_reflTransGen {ι : Type*} {s : ι → Set α} (H : ∀ i, IsPreconnected (s i)) (K : ∀ i j, ReflTransGen (fun i j : ι => (s i ∩ s j).Nonempty) i j) : IsPreconnected (⋃ n, s n) := by rw [← biUnion_univ] exact IsPreconnected.biUnion_of_reflTransGen (fun i _ => H i) fun i _ j _ => by simpa [mem_univ] using K i j #align is_preconnected.Union_of_refl_trans_gen IsPreconnected.iUnion_of_reflTransGen theorem IsConnected.iUnion_of_reflTransGen {ι : Type*} [Nonempty ι] {s : ι → Set α} (H : ∀ i, IsConnected (s i)) (K : ∀ i j, ReflTransGen (fun i j : ι => (s i ∩ s j).Nonempty) i j) : IsConnected (⋃ n, s n) := ⟨nonempty_iUnion.2 <| Nonempty.elim ‹_› fun i : ι => ⟨i, (H _).nonempty⟩, IsPreconnected.iUnion_of_reflTransGen (fun i => (H i).isPreconnected) K⟩ #align is_connected.Union_of_refl_trans_gen IsConnected.iUnion_of_reflTransGen protected theorem IsPreconnected.subset_closure {s : Set α} {t : Set α} (H : IsPreconnected s) (Kst : s ⊆ t) (Ktcs : t ⊆ closure s) : IsPreconnected t := fun u v hu hv htuv ⟨_y, hyt, hyu⟩ ⟨_z, hzt, hzv⟩ => let ⟨p, hpu, hps⟩ := mem_closure_iff.1 (Ktcs hyt) u hu hyu let ⟨q, hqv, hqs⟩ := mem_closure_iff.1 (Ktcs hzt) v hv hzv let ⟨r, hrs, hruv⟩ := H u v hu hv (Subset.trans Kst htuv) ⟨p, hps, hpu⟩ ⟨q, hqs, hqv⟩ ⟨r, Kst hrs, hruv⟩ #align is_preconnected.subset_closure IsPreconnected.subset_closure protected theorem IsConnected.subset_closure {s : Set α} {t : Set α} (H : IsConnected s) (Kst : s ⊆ t) (Ktcs : t ⊆ closure s) : IsConnected t := ⟨Nonempty.mono Kst H.left, IsPreconnected.subset_closure H.right Kst Ktcs⟩ #align is_connected.subset_closure IsConnected.subset_closure protected theorem IsPreconnected.closure {s : Set α} (H : IsPreconnected s) : IsPreconnected (closure s) := IsPreconnected.subset_closure H subset_closure Subset.rfl #align is_preconnected.closure IsPreconnected.closure protected theorem IsConnected.closure {s : Set α} (H : IsConnected s) : IsConnected (closure s) := IsConnected.subset_closure H subset_closure <| Subset.rfl #align is_connected.closure IsConnected.closure protected theorem IsPreconnected.image [TopologicalSpace β] {s : Set α} (H : IsPreconnected s) (f : α → β) (hf : ContinuousOn f s) : IsPreconnected (f '' s) := by -- Unfold/destruct definitions in hypotheses rintro u v hu hv huv ⟨_, ⟨x, xs, rfl⟩, xu⟩ ⟨_, ⟨y, ys, rfl⟩, yv⟩ rcases continuousOn_iff'.1 hf u hu with ⟨u', hu', u'_eq⟩ rcases continuousOn_iff'.1 hf v hv with ⟨v', hv', v'_eq⟩ -- Reformulate `huv : f '' s ⊆ u ∪ v` in terms of `u'` and `v'` replace huv : s ⊆ u' ∪ v' := by rw [image_subset_iff, preimage_union] at huv replace huv := subset_inter huv Subset.rfl rw [union_inter_distrib_right, u'_eq, v'_eq, ← union_inter_distrib_right] at huv exact (subset_inter_iff.1 huv).1 -- Now `s ⊆ u' ∪ v'`, so we can apply `‹IsPreconnected s›` obtain ⟨z, hz⟩ : (s ∩ (u' ∩ v')).Nonempty := by refine H u' v' hu' hv' huv ⟨x, ?_⟩ ⟨y, ?_⟩ <;> rw [inter_comm] exacts [u'_eq ▸ ⟨xu, xs⟩, v'_eq ▸ ⟨yv, ys⟩] rw [← inter_self s, inter_assoc, inter_left_comm s u', ← inter_assoc, inter_comm s, inter_comm s, ← u'_eq, ← v'_eq] at hz exact ⟨f z, ⟨z, hz.1.2, rfl⟩, hz.1.1, hz.2.1⟩ #align is_preconnected.image IsPreconnected.image protected theorem IsConnected.image [TopologicalSpace β] {s : Set α} (H : IsConnected s) (f : α → β) (hf : ContinuousOn f s) : IsConnected (f '' s) := ⟨image_nonempty.mpr H.nonempty, H.isPreconnected.image f hf⟩ #align is_connected.image IsConnected.image theorem isPreconnected_closed_iff {s : Set α} : IsPreconnected s ↔ ∀ t t', IsClosed t → IsClosed t' → s ⊆ t ∪ t' → (s ∩ t).Nonempty → (s ∩ t').Nonempty → (s ∩ (t ∩ t')).Nonempty := ⟨by rintro h t t' ht ht' htt' ⟨x, xs, xt⟩ ⟨y, ys, yt'⟩ rw [← not_disjoint_iff_nonempty_inter, ← subset_compl_iff_disjoint_right, compl_inter] intro h' have xt' : x ∉ t' := (h' xs).resolve_left (absurd xt) have yt : y ∉ t := (h' ys).resolve_right (absurd yt') have := h _ _ ht.isOpen_compl ht'.isOpen_compl h' ⟨y, ys, yt⟩ ⟨x, xs, xt'⟩ rw [← compl_union] at this exact this.ne_empty htt'.disjoint_compl_right.inter_eq, by rintro h u v hu hv huv ⟨x, xs, xu⟩ ⟨y, ys, yv⟩ rw [← not_disjoint_iff_nonempty_inter, ← subset_compl_iff_disjoint_right, compl_inter] intro h' have xv : x ∉ v := (h' xs).elim (absurd xu) id have yu : y ∉ u := (h' ys).elim id (absurd yv) have := h _ _ hu.isClosed_compl hv.isClosed_compl h' ⟨y, ys, yu⟩ ⟨x, xs, xv⟩ rw [← compl_union] at this exact this.ne_empty huv.disjoint_compl_right.inter_eq⟩ #align is_preconnected_closed_iff isPreconnected_closed_iff theorem Inducing.isPreconnected_image [TopologicalSpace β] {s : Set α} {f : α → β} (hf : Inducing f) : IsPreconnected (f '' s) ↔ IsPreconnected s := by refine ⟨fun h => ?_, fun h => h.image _ hf.continuous.continuousOn⟩ rintro u v hu' hv' huv ⟨x, hxs, hxu⟩ ⟨y, hys, hyv⟩ rcases hf.isOpen_iff.1 hu' with ⟨u, hu, rfl⟩ rcases hf.isOpen_iff.1 hv' with ⟨v, hv, rfl⟩ replace huv : f '' s ⊆ u ∪ v := by rwa [image_subset_iff] rcases h u v hu hv huv ⟨f x, mem_image_of_mem _ hxs, hxu⟩ ⟨f y, mem_image_of_mem _ hys, hyv⟩ with ⟨_, ⟨z, hzs, rfl⟩, hzuv⟩ exact ⟨z, hzs, hzuv⟩ #align inducing.is_preconnected_image Inducing.isPreconnected_image theorem IsPreconnected.preimage_of_isOpenMap [TopologicalSpace β] {f : α → β} {s : Set β} (hs : IsPreconnected s) (hinj : Function.Injective f) (hf : IsOpenMap f) (hsf : s ⊆ range f) : IsPreconnected (f ⁻¹' s) := fun u v hu hv hsuv hsu hsv => by replace hsf : f '' (f ⁻¹' s) = s := image_preimage_eq_of_subset hsf obtain ⟨_, has, ⟨a, hau, rfl⟩, hav⟩ : (s ∩ (f '' u ∩ f '' v)).Nonempty := by refine hs (f '' u) (f '' v) (hf u hu) (hf v hv) ?_ ?_ ?_ · simpa only [hsf, image_union] using image_subset f hsuv · simpa only [image_preimage_inter] using hsu.image f · simpa only [image_preimage_inter] using hsv.image f · exact ⟨a, has, hau, hinj.mem_set_image.1 hav⟩ #align is_preconnected.preimage_of_open_map IsPreconnected.preimage_of_isOpenMap theorem IsPreconnected.preimage_of_isClosedMap [TopologicalSpace β] {s : Set β} (hs : IsPreconnected s) {f : α → β} (hinj : Function.Injective f) (hf : IsClosedMap f) (hsf : s ⊆ range f) : IsPreconnected (f ⁻¹' s) := isPreconnected_closed_iff.2 fun u v hu hv hsuv hsu hsv => by replace hsf : f '' (f ⁻¹' s) = s := image_preimage_eq_of_subset hsf obtain ⟨_, has, ⟨a, hau, rfl⟩, hav⟩ : (s ∩ (f '' u ∩ f '' v)).Nonempty := by refine isPreconnected_closed_iff.1 hs (f '' u) (f '' v) (hf u hu) (hf v hv) ?_ ?_ ?_ · simpa only [hsf, image_union] using image_subset f hsuv · simpa only [image_preimage_inter] using hsu.image f · simpa only [image_preimage_inter] using hsv.image f · exact ⟨a, has, hau, hinj.mem_set_image.1 hav⟩ #align is_preconnected.preimage_of_closed_map IsPreconnected.preimage_of_isClosedMap theorem IsConnected.preimage_of_isOpenMap [TopologicalSpace β] {s : Set β} (hs : IsConnected s) {f : α → β} (hinj : Function.Injective f) (hf : IsOpenMap f) (hsf : s ⊆ range f) : IsConnected (f ⁻¹' s) := ⟨hs.nonempty.preimage' hsf, hs.isPreconnected.preimage_of_isOpenMap hinj hf hsf⟩ #align is_connected.preimage_of_open_map IsConnected.preimage_of_isOpenMap theorem IsConnected.preimage_of_isClosedMap [TopologicalSpace β] {s : Set β} (hs : IsConnected s) {f : α → β} (hinj : Function.Injective f) (hf : IsClosedMap f) (hsf : s ⊆ range f) : IsConnected (f ⁻¹' s) := ⟨hs.nonempty.preimage' hsf, hs.isPreconnected.preimage_of_isClosedMap hinj hf hsf⟩ #align is_connected.preimage_of_closed_map IsConnected.preimage_of_isClosedMap theorem IsPreconnected.subset_or_subset (hu : IsOpen u) (hv : IsOpen v) (huv : Disjoint u v) (hsuv : s ⊆ u ∪ v) (hs : IsPreconnected s) : s ⊆ u ∨ s ⊆ v := by specialize hs u v hu hv hsuv obtain hsu | hsu := (s ∩ u).eq_empty_or_nonempty · exact Or.inr ((Set.disjoint_iff_inter_eq_empty.2 hsu).subset_right_of_subset_union hsuv) · replace hs := mt (hs hsu) simp_rw [Set.not_nonempty_iff_eq_empty, ← Set.disjoint_iff_inter_eq_empty, disjoint_iff_inter_eq_empty.1 huv] at hs exact Or.inl ((hs s.disjoint_empty).subset_left_of_subset_union hsuv) #align is_preconnected.subset_or_subset IsPreconnected.subset_or_subset theorem IsPreconnected.subset_left_of_subset_union (hu : IsOpen u) (hv : IsOpen v) (huv : Disjoint u v) (hsuv : s ⊆ u ∪ v) (hsu : (s ∩ u).Nonempty) (hs : IsPreconnected s) : s ⊆ u := Disjoint.subset_left_of_subset_union hsuv (by by_contra hsv rw [not_disjoint_iff_nonempty_inter] at hsv obtain ⟨x, _, hx⟩ := hs u v hu hv hsuv hsu hsv exact Set.disjoint_iff.1 huv hx) #align is_preconnected.subset_left_of_subset_union IsPreconnected.subset_left_of_subset_union theorem IsPreconnected.subset_right_of_subset_union (hu : IsOpen u) (hv : IsOpen v) (huv : Disjoint u v) (hsuv : s ⊆ u ∪ v) (hsv : (s ∩ v).Nonempty) (hs : IsPreconnected s) : s ⊆ v := hs.subset_left_of_subset_union hv hu huv.symm (union_comm u v ▸ hsuv) hsv #align is_preconnected.subset_right_of_subset_union IsPreconnected.subset_right_of_subset_union -- Porting note: moved up theorem IsPreconnected.subset_isClopen {s t : Set α} (hs : IsPreconnected s) (ht : IsClopen t) (hne : (s ∩ t).Nonempty) : s ⊆ t := hs.subset_left_of_subset_union ht.isOpen ht.compl.isOpen disjoint_compl_right (by simp) hne #align is_preconnected.subset_clopen IsPreconnected.subset_isClopen theorem IsPreconnected.subset_of_closure_inter_subset (hs : IsPreconnected s) (hu : IsOpen u) (h'u : (s ∩ u).Nonempty) (h : closure u ∩ s ⊆ u) : s ⊆ u := by have A : s ⊆ u ∪ (closure u)ᶜ := by intro x hx by_cases xu : x ∈ u · exact Or.inl xu · right intro h'x exact xu (h (mem_inter h'x hx)) apply hs.subset_left_of_subset_union hu isClosed_closure.isOpen_compl _ A h'u exact disjoint_compl_right.mono_right (compl_subset_compl.2 subset_closure) #align is_preconnected.subset_of_closure_inter_subset IsPreconnected.subset_of_closure_inter_subset theorem IsPreconnected.prod [TopologicalSpace β] {s : Set α} {t : Set β} (hs : IsPreconnected s) (ht : IsPreconnected t) : IsPreconnected (s ×ˢ t) := by apply isPreconnected_of_forall_pair rintro ⟨a₁, b₁⟩ ⟨ha₁, hb₁⟩ ⟨a₂, b₂⟩ ⟨ha₂, hb₂⟩ refine ⟨Prod.mk a₁ '' t ∪ flip Prod.mk b₂ '' s, ?_, .inl ⟨b₁, hb₁, rfl⟩, .inr ⟨a₂, ha₂, rfl⟩, ?_⟩ · rintro _ (⟨y, hy, rfl⟩ | ⟨x, hx, rfl⟩) exacts [⟨ha₁, hy⟩, ⟨hx, hb₂⟩] · exact (ht.image _ (Continuous.Prod.mk _).continuousOn).union (a₁, b₂) ⟨b₂, hb₂, rfl⟩ ⟨a₁, ha₁, rfl⟩ (hs.image _ (continuous_id.prod_mk continuous_const).continuousOn) #align is_preconnected.prod IsPreconnected.prod theorem IsConnected.prod [TopologicalSpace β] {s : Set α} {t : Set β} (hs : IsConnected s) (ht : IsConnected t) : IsConnected (s ×ˢ t) := ⟨hs.1.prod ht.1, hs.2.prod ht.2⟩ #align is_connected.prod IsConnected.prod theorem isPreconnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)} (hs : ∀ i, IsPreconnected (s i)) : IsPreconnected (pi univ s) := by rintro u v uo vo hsuv ⟨f, hfs, hfu⟩ ⟨g, hgs, hgv⟩ rcases exists_finset_piecewise_mem_of_mem_nhds (uo.mem_nhds hfu) g with ⟨I, hI⟩ induction' I using Finset.induction_on with i I _ ihI · refine ⟨g, hgs, ⟨?_, hgv⟩⟩ simpa using hI · rw [Finset.piecewise_insert] at hI have := I.piecewise_mem_set_pi hfs hgs refine (hsuv this).elim ihI fun h => ?_ set S := update (I.piecewise f g) i '' s i have hsub : S ⊆ pi univ s := by refine image_subset_iff.2 fun z hz => ?_ rwa [update_preimage_univ_pi] exact fun j _ => this j trivial have hconn : IsPreconnected S := (hs i).image _ (continuous_const.update i continuous_id).continuousOn have hSu : (S ∩ u).Nonempty := ⟨_, mem_image_of_mem _ (hfs _ trivial), hI⟩ have hSv : (S ∩ v).Nonempty := ⟨_, ⟨_, this _ trivial, update_eq_self _ _⟩, h⟩ refine (hconn u v uo vo (hsub.trans hsuv) hSu hSv).mono ?_ exact inter_subset_inter_left _ hsub #align is_preconnected_univ_pi isPreconnected_univ_pi @[simp] theorem isConnected_univ_pi [∀ i, TopologicalSpace (π i)] {s : ∀ i, Set (π i)} : IsConnected (pi univ s) ↔ ∀ i, IsConnected (s i) := by simp only [IsConnected, ← univ_pi_nonempty_iff, forall_and, and_congr_right_iff] refine fun hne => ⟨fun hc i => ?_, isPreconnected_univ_pi⟩ rw [← eval_image_univ_pi hne] exact hc.image _ (continuous_apply _).continuousOn #align is_connected_univ_pi isConnected_univ_pi theorem Sigma.isConnected_iff [∀ i, TopologicalSpace (π i)] {s : Set (Σi, π i)} : IsConnected s ↔ ∃ i t, IsConnected t ∧ s = Sigma.mk i '' t := by refine ⟨fun hs => ?_, ?_⟩ · obtain ⟨⟨i, x⟩, hx⟩ := hs.nonempty have : s ⊆ range (Sigma.mk i) := hs.isPreconnected.subset_isClopen isClopen_range_sigmaMk ⟨⟨i, x⟩, hx, x, rfl⟩ exact ⟨i, Sigma.mk i ⁻¹' s, hs.preimage_of_isOpenMap sigma_mk_injective isOpenMap_sigmaMk this, (Set.image_preimage_eq_of_subset this).symm⟩ · rintro ⟨i, t, ht, rfl⟩ exact ht.image _ continuous_sigmaMk.continuousOn #align sigma.is_connected_iff Sigma.isConnected_iff theorem Sigma.isPreconnected_iff [hι : Nonempty ι] [∀ i, TopologicalSpace (π i)] {s : Set (Σi, π i)} : IsPreconnected s ↔ ∃ i t, IsPreconnected t ∧ s = Sigma.mk i '' t := by refine ⟨fun hs => ?_, ?_⟩ · obtain rfl | h := s.eq_empty_or_nonempty · exact ⟨Classical.choice hι, ∅, isPreconnected_empty, (Set.image_empty _).symm⟩ · obtain ⟨a, t, ht, rfl⟩ := Sigma.isConnected_iff.1 ⟨h, hs⟩ exact ⟨a, t, ht.isPreconnected, rfl⟩ · rintro ⟨a, t, ht, rfl⟩ exact ht.image _ continuous_sigmaMk.continuousOn #align sigma.is_preconnected_iff Sigma.isPreconnected_iff theorem Sum.isConnected_iff [TopologicalSpace β] {s : Set (Sum α β)} : IsConnected s ↔ (∃ t, IsConnected t ∧ s = Sum.inl '' t) ∨ ∃ t, IsConnected t ∧ s = Sum.inr '' t := by refine ⟨fun hs => ?_, ?_⟩ · obtain ⟨x | x, hx⟩ := hs.nonempty · have h : s ⊆ range Sum.inl := hs.isPreconnected.subset_isClopen isClopen_range_inl ⟨.inl x, hx, x, rfl⟩ refine Or.inl ⟨Sum.inl ⁻¹' s, ?_, ?_⟩ · exact hs.preimage_of_isOpenMap Sum.inl_injective isOpenMap_inl h · exact (image_preimage_eq_of_subset h).symm · have h : s ⊆ range Sum.inr := hs.isPreconnected.subset_isClopen isClopen_range_inr ⟨.inr x, hx, x, rfl⟩ refine Or.inr ⟨Sum.inr ⁻¹' s, ?_, ?_⟩ · exact hs.preimage_of_isOpenMap Sum.inr_injective isOpenMap_inr h · exact (image_preimage_eq_of_subset h).symm · rintro (⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩) · exact ht.image _ continuous_inl.continuousOn · exact ht.image _ continuous_inr.continuousOn #align sum.is_connected_iff Sum.isConnected_iff theorem Sum.isPreconnected_iff [TopologicalSpace β] {s : Set (Sum α β)} : IsPreconnected s ↔ (∃ t, IsPreconnected t ∧ s = Sum.inl '' t) ∨ ∃ t, IsPreconnected t ∧ s = Sum.inr '' t := by refine ⟨fun hs => ?_, ?_⟩ · obtain rfl | h := s.eq_empty_or_nonempty · exact Or.inl ⟨∅, isPreconnected_empty, (Set.image_empty _).symm⟩ obtain ⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩ := Sum.isConnected_iff.1 ⟨h, hs⟩ · exact Or.inl ⟨t, ht.isPreconnected, rfl⟩ · exact Or.inr ⟨t, ht.isPreconnected, rfl⟩ · rintro (⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩) · exact ht.image _ continuous_inl.continuousOn · exact ht.image _ continuous_inr.continuousOn #align sum.is_preconnected_iff Sum.isPreconnected_iff def connectedComponent (x : α) : Set α := ⋃₀ { s : Set α | IsPreconnected s ∧ x ∈ s } #align connected_component connectedComponent def connectedComponentIn (F : Set α) (x : α) : Set α := if h : x ∈ F then (↑) '' connectedComponent (⟨x, h⟩ : F) else ∅ #align connected_component_in connectedComponentIn theorem connectedComponentIn_eq_image {F : Set α} {x : α} (h : x ∈ F) : connectedComponentIn F x = (↑) '' connectedComponent (⟨x, h⟩ : F) := dif_pos h #align connected_component_in_eq_image connectedComponentIn_eq_image theorem connectedComponentIn_eq_empty {F : Set α} {x : α} (h : x ∉ F) : connectedComponentIn F x = ∅ := dif_neg h #align connected_component_in_eq_empty connectedComponentIn_eq_empty theorem mem_connectedComponent {x : α} : x ∈ connectedComponent x := mem_sUnion_of_mem (mem_singleton x) ⟨isPreconnected_singleton, mem_singleton x⟩ #align mem_connected_component mem_connectedComponent theorem mem_connectedComponentIn {x : α} {F : Set α} (hx : x ∈ F) : x ∈ connectedComponentIn F x := by simp [connectedComponentIn_eq_image hx, mem_connectedComponent, hx] #align mem_connected_component_in mem_connectedComponentIn theorem connectedComponent_nonempty {x : α} : (connectedComponent x).Nonempty := ⟨x, mem_connectedComponent⟩ #align connected_component_nonempty connectedComponent_nonempty theorem connectedComponentIn_nonempty_iff {x : α} {F : Set α} : (connectedComponentIn F x).Nonempty ↔ x ∈ F := by rw [connectedComponentIn] split_ifs <;> simp [connectedComponent_nonempty, *] #align connected_component_in_nonempty_iff connectedComponentIn_nonempty_iff
Mathlib/Topology/Connected/Basic.lean
611
613
theorem connectedComponentIn_subset (F : Set α) (x : α) : connectedComponentIn F x ⊆ F := by
rw [connectedComponentIn] split_ifs <;> simp
import Mathlib.Geometry.Manifold.MFDeriv.Defs #align_import geometry.manifold.mfderiv from "leanprover-community/mathlib"@"e473c3198bb41f68560cab68a0529c854b618833" noncomputable section open scoped Topology Manifold open Set Bundle section DerivativesProperties variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H] (I : ModelWithCorners 𝕜 E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M] {E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H'] {I' : ModelWithCorners 𝕜 E' H'} {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M'] {E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H''] {I'' : ModelWithCorners 𝕜 E'' H''} {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M''] {f f₀ f₁ : M → M'} {x : M} {s t : Set M} {g : M' → M''} {u : Set M'} theorem uniqueMDiffWithinAt_univ : UniqueMDiffWithinAt I univ x := by unfold UniqueMDiffWithinAt simp only [preimage_univ, univ_inter] exact I.unique_diff _ (mem_range_self _) #align unique_mdiff_within_at_univ uniqueMDiffWithinAt_univ variable {I} theorem uniqueMDiffWithinAt_iff {s : Set M} {x : M} : UniqueMDiffWithinAt I s x ↔ UniqueDiffWithinAt 𝕜 ((extChartAt I x).symm ⁻¹' s ∩ (extChartAt I x).target) ((extChartAt I x) x) := by apply uniqueDiffWithinAt_congr rw [nhdsWithin_inter, nhdsWithin_inter, nhdsWithin_extChartAt_target_eq] #align unique_mdiff_within_at_iff uniqueMDiffWithinAt_iff nonrec theorem UniqueMDiffWithinAt.mono_nhds {s t : Set M} {x : M} (hs : UniqueMDiffWithinAt I s x) (ht : 𝓝[s] x ≤ 𝓝[t] x) : UniqueMDiffWithinAt I t x := hs.mono_nhds <| by simpa only [← map_extChartAt_nhdsWithin] using Filter.map_mono ht theorem UniqueMDiffWithinAt.mono_of_mem {s t : Set M} {x : M} (hs : UniqueMDiffWithinAt I s x) (ht : t ∈ 𝓝[s] x) : UniqueMDiffWithinAt I t x := hs.mono_nhds (nhdsWithin_le_iff.2 ht) theorem UniqueMDiffWithinAt.mono (h : UniqueMDiffWithinAt I s x) (st : s ⊆ t) : UniqueMDiffWithinAt I t x := UniqueDiffWithinAt.mono h <| inter_subset_inter (preimage_mono st) (Subset.refl _) #align unique_mdiff_within_at.mono UniqueMDiffWithinAt.mono theorem UniqueMDiffWithinAt.inter' (hs : UniqueMDiffWithinAt I s x) (ht : t ∈ 𝓝[s] x) : UniqueMDiffWithinAt I (s ∩ t) x := hs.mono_of_mem (Filter.inter_mem self_mem_nhdsWithin ht) #align unique_mdiff_within_at.inter' UniqueMDiffWithinAt.inter' theorem UniqueMDiffWithinAt.inter (hs : UniqueMDiffWithinAt I s x) (ht : t ∈ 𝓝 x) : UniqueMDiffWithinAt I (s ∩ t) x := hs.inter' (nhdsWithin_le_nhds ht) #align unique_mdiff_within_at.inter UniqueMDiffWithinAt.inter theorem IsOpen.uniqueMDiffWithinAt (hs : IsOpen s) (xs : x ∈ s) : UniqueMDiffWithinAt I s x := (uniqueMDiffWithinAt_univ I).mono_of_mem <| nhdsWithin_le_nhds <| hs.mem_nhds xs #align is_open.unique_mdiff_within_at IsOpen.uniqueMDiffWithinAt theorem UniqueMDiffOn.inter (hs : UniqueMDiffOn I s) (ht : IsOpen t) : UniqueMDiffOn I (s ∩ t) := fun _x hx => UniqueMDiffWithinAt.inter (hs _ hx.1) (ht.mem_nhds hx.2) #align unique_mdiff_on.inter UniqueMDiffOn.inter theorem IsOpen.uniqueMDiffOn (hs : IsOpen s) : UniqueMDiffOn I s := fun _x hx => hs.uniqueMDiffWithinAt hx #align is_open.unique_mdiff_on IsOpen.uniqueMDiffOn theorem uniqueMDiffOn_univ : UniqueMDiffOn I (univ : Set M) := isOpen_univ.uniqueMDiffOn #align unique_mdiff_on_univ uniqueMDiffOn_univ variable [Is : SmoothManifoldWithCorners I M] [I's : SmoothManifoldWithCorners I' M'] [I''s : SmoothManifoldWithCorners I'' M''] {f' f₀' f₁' : TangentSpace I x →L[𝕜] TangentSpace I' (f x)} {g' : TangentSpace I' (f x) →L[𝕜] TangentSpace I'' (g (f x))} nonrec theorem UniqueMDiffWithinAt.eq (U : UniqueMDiffWithinAt I s x) (h : HasMFDerivWithinAt I I' f s x f') (h₁ : HasMFDerivWithinAt I I' f s x f₁') : f' = f₁' := by -- Porting note: didn't need `convert` because of finding instances by unification convert U.eq h.2 h₁.2 #align unique_mdiff_within_at.eq UniqueMDiffWithinAt.eq theorem UniqueMDiffOn.eq (U : UniqueMDiffOn I s) (hx : x ∈ s) (h : HasMFDerivWithinAt I I' f s x f') (h₁ : HasMFDerivWithinAt I I' f s x f₁') : f' = f₁' := UniqueMDiffWithinAt.eq (U _ hx) h h₁ #align unique_mdiff_on.eq UniqueMDiffOn.eq nonrec theorem UniqueMDiffWithinAt.prod {x : M} {y : M'} {s t} (hs : UniqueMDiffWithinAt I s x) (ht : UniqueMDiffWithinAt I' t y) : UniqueMDiffWithinAt (I.prod I') (s ×ˢ t) (x, y) := by refine (hs.prod ht).mono ?_ rw [ModelWithCorners.range_prod, ← prod_inter_prod] rfl theorem UniqueMDiffOn.prod {s : Set M} {t : Set M'} (hs : UniqueMDiffOn I s) (ht : UniqueMDiffOn I' t) : UniqueMDiffOn (I.prod I') (s ×ˢ t) := fun x h ↦ (hs x.1 h.1).prod (ht x.2 h.2) theorem mdifferentiableWithinAt_iff {f : M → M'} {s : Set M} {x : M} : MDifferentiableWithinAt I I' f s x ↔ ContinuousWithinAt f s x ∧ DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I' x f) ((extChartAt I x).target ∩ (extChartAt I x).symm ⁻¹' s) ((extChartAt I x) x) := by rw [mdifferentiableWithinAt_iff'] refine and_congr Iff.rfl (exists_congr fun f' => ?_) rw [inter_comm] simp only [HasFDerivWithinAt, nhdsWithin_inter, nhdsWithin_extChartAt_target_eq] #align mdifferentiable_within_at_iff mdifferentiableWithinAt_iff theorem mdifferentiableWithinAt_iff_of_mem_source {x' : M} {y : M'} (hx : x' ∈ (chartAt H x).source) (hy : f x' ∈ (chartAt H' y).source) : MDifferentiableWithinAt I I' f s x' ↔ ContinuousWithinAt f s x' ∧ DifferentiableWithinAt 𝕜 (extChartAt I' y ∘ f ∘ (extChartAt I x).symm) ((extChartAt I x).symm ⁻¹' s ∩ Set.range I) ((extChartAt I x) x') := (differentiable_within_at_localInvariantProp I I').liftPropWithinAt_indep_chart (StructureGroupoid.chart_mem_maximalAtlas _ x) hx (StructureGroupoid.chart_mem_maximalAtlas _ y) hy #align mdifferentiable_within_at_iff_of_mem_source mdifferentiableWithinAt_iff_of_mem_source theorem mfderivWithin_zero_of_not_mdifferentiableWithinAt (h : ¬MDifferentiableWithinAt I I' f s x) : mfderivWithin I I' f s x = 0 := by simp only [mfderivWithin, h, if_neg, not_false_iff] #align mfderiv_within_zero_of_not_mdifferentiable_within_at mfderivWithin_zero_of_not_mdifferentiableWithinAt theorem mfderiv_zero_of_not_mdifferentiableAt (h : ¬MDifferentiableAt I I' f x) : mfderiv I I' f x = 0 := by simp only [mfderiv, h, if_neg, not_false_iff] #align mfderiv_zero_of_not_mdifferentiable_at mfderiv_zero_of_not_mdifferentiableAt theorem HasMFDerivWithinAt.mono (h : HasMFDerivWithinAt I I' f t x f') (hst : s ⊆ t) : HasMFDerivWithinAt I I' f s x f' := ⟨ContinuousWithinAt.mono h.1 hst, HasFDerivWithinAt.mono h.2 (inter_subset_inter (preimage_mono hst) (Subset.refl _))⟩ #align has_mfderiv_within_at.mono HasMFDerivWithinAt.mono theorem HasMFDerivAt.hasMFDerivWithinAt (h : HasMFDerivAt I I' f x f') : HasMFDerivWithinAt I I' f s x f' := ⟨ContinuousAt.continuousWithinAt h.1, HasFDerivWithinAt.mono h.2 inter_subset_right⟩ #align has_mfderiv_at.has_mfderiv_within_at HasMFDerivAt.hasMFDerivWithinAt theorem HasMFDerivWithinAt.mdifferentiableWithinAt (h : HasMFDerivWithinAt I I' f s x f') : MDifferentiableWithinAt I I' f s x := ⟨h.1, ⟨f', h.2⟩⟩ #align has_mfderiv_within_at.mdifferentiable_within_at HasMFDerivWithinAt.mdifferentiableWithinAt theorem HasMFDerivAt.mdifferentiableAt (h : HasMFDerivAt I I' f x f') : MDifferentiableAt I I' f x := by rw [mdifferentiableAt_iff] exact ⟨h.1, ⟨f', h.2⟩⟩ #align has_mfderiv_at.mdifferentiable_at HasMFDerivAt.mdifferentiableAt @[simp, mfld_simps] theorem hasMFDerivWithinAt_univ : HasMFDerivWithinAt I I' f univ x f' ↔ HasMFDerivAt I I' f x f' := by simp only [HasMFDerivWithinAt, HasMFDerivAt, continuousWithinAt_univ, mfld_simps] #align has_mfderiv_within_at_univ hasMFDerivWithinAt_univ theorem hasMFDerivAt_unique (h₀ : HasMFDerivAt I I' f x f₀') (h₁ : HasMFDerivAt I I' f x f₁') : f₀' = f₁' := by rw [← hasMFDerivWithinAt_univ] at h₀ h₁ exact (uniqueMDiffWithinAt_univ I).eq h₀ h₁ #align has_mfderiv_at_unique hasMFDerivAt_unique theorem hasMFDerivWithinAt_inter' (h : t ∈ 𝓝[s] x) : HasMFDerivWithinAt I I' f (s ∩ t) x f' ↔ HasMFDerivWithinAt I I' f s x f' := by rw [HasMFDerivWithinAt, HasMFDerivWithinAt, extChartAt_preimage_inter_eq, hasFDerivWithinAt_inter', continuousWithinAt_inter' h] exact extChartAt_preimage_mem_nhdsWithin I h #align has_mfderiv_within_at_inter' hasMFDerivWithinAt_inter' theorem hasMFDerivWithinAt_inter (h : t ∈ 𝓝 x) : HasMFDerivWithinAt I I' f (s ∩ t) x f' ↔ HasMFDerivWithinAt I I' f s x f' := by rw [HasMFDerivWithinAt, HasMFDerivWithinAt, extChartAt_preimage_inter_eq, hasFDerivWithinAt_inter, continuousWithinAt_inter h] exact extChartAt_preimage_mem_nhds I h #align has_mfderiv_within_at_inter hasMFDerivWithinAt_inter theorem HasMFDerivWithinAt.union (hs : HasMFDerivWithinAt I I' f s x f') (ht : HasMFDerivWithinAt I I' f t x f') : HasMFDerivWithinAt I I' f (s ∪ t) x f' := by constructor · exact ContinuousWithinAt.union hs.1 ht.1 · convert HasFDerivWithinAt.union hs.2 ht.2 using 1 simp only [union_inter_distrib_right, preimage_union] #align has_mfderiv_within_at.union HasMFDerivWithinAt.union theorem HasMFDerivWithinAt.mono_of_mem (h : HasMFDerivWithinAt I I' f s x f') (ht : s ∈ 𝓝[t] x) : HasMFDerivWithinAt I I' f t x f' := (hasMFDerivWithinAt_inter' ht).1 (h.mono inter_subset_right) #align has_mfderiv_within_at.nhds_within HasMFDerivWithinAt.mono_of_mem theorem HasMFDerivWithinAt.hasMFDerivAt (h : HasMFDerivWithinAt I I' f s x f') (hs : s ∈ 𝓝 x) : HasMFDerivAt I I' f x f' := by rwa [← univ_inter s, hasMFDerivWithinAt_inter hs, hasMFDerivWithinAt_univ] at h #align has_mfderiv_within_at.has_mfderiv_at HasMFDerivWithinAt.hasMFDerivAt theorem MDifferentiableWithinAt.hasMFDerivWithinAt (h : MDifferentiableWithinAt I I' f s x) : HasMFDerivWithinAt I I' f s x (mfderivWithin I I' f s x) := by refine ⟨h.1, ?_⟩ simp only [mfderivWithin, h, if_pos, mfld_simps] exact DifferentiableWithinAt.hasFDerivWithinAt h.2 #align mdifferentiable_within_at.has_mfderiv_within_at MDifferentiableWithinAt.hasMFDerivWithinAt protected theorem MDifferentiableWithinAt.mfderivWithin (h : MDifferentiableWithinAt I I' f s x) : mfderivWithin I I' f s x = fderivWithin 𝕜 (writtenInExtChartAt I I' x f : _) ((extChartAt I x).symm ⁻¹' s ∩ range I) ((extChartAt I x) x) := by simp only [mfderivWithin, h, if_pos] #align mdifferentiable_within_at.mfderiv_within MDifferentiableWithinAt.mfderivWithin theorem MDifferentiableAt.hasMFDerivAt (h : MDifferentiableAt I I' f x) : HasMFDerivAt I I' f x (mfderiv I I' f x) := by refine ⟨h.continuousAt, ?_⟩ simp only [mfderiv, h, if_pos, mfld_simps] exact DifferentiableWithinAt.hasFDerivWithinAt h.differentiableWithinAt_writtenInExtChartAt #align mdifferentiable_at.has_mfderiv_at MDifferentiableAt.hasMFDerivAt protected theorem MDifferentiableAt.mfderiv (h : MDifferentiableAt I I' f x) : mfderiv I I' f x = fderivWithin 𝕜 (writtenInExtChartAt I I' x f : _) (range I) ((extChartAt I x) x) := by simp only [mfderiv, h, if_pos] #align mdifferentiable_at.mfderiv MDifferentiableAt.mfderiv protected theorem HasMFDerivAt.mfderiv (h : HasMFDerivAt I I' f x f') : mfderiv I I' f x = f' := (hasMFDerivAt_unique h h.mdifferentiableAt.hasMFDerivAt).symm #align has_mfderiv_at.mfderiv HasMFDerivAt.mfderiv theorem HasMFDerivWithinAt.mfderivWithin (h : HasMFDerivWithinAt I I' f s x f') (hxs : UniqueMDiffWithinAt I s x) : mfderivWithin I I' f s x = f' := by ext rw [hxs.eq h h.mdifferentiableWithinAt.hasMFDerivWithinAt] #align has_mfderiv_within_at.mfderiv_within HasMFDerivWithinAt.mfderivWithin theorem MDifferentiable.mfderivWithin (h : MDifferentiableAt I I' f x) (hxs : UniqueMDiffWithinAt I s x) : mfderivWithin I I' f s x = mfderiv I I' f x := by apply HasMFDerivWithinAt.mfderivWithin _ hxs exact h.hasMFDerivAt.hasMFDerivWithinAt #align mdifferentiable.mfderiv_within MDifferentiable.mfderivWithin theorem mfderivWithin_subset (st : s ⊆ t) (hs : UniqueMDiffWithinAt I s x) (h : MDifferentiableWithinAt I I' f t x) : mfderivWithin I I' f s x = mfderivWithin I I' f t x := ((MDifferentiableWithinAt.hasMFDerivWithinAt h).mono st).mfderivWithin hs #align mfderiv_within_subset mfderivWithin_subset theorem MDifferentiableWithinAt.mono (hst : s ⊆ t) (h : MDifferentiableWithinAt I I' f t x) : MDifferentiableWithinAt I I' f s x := ⟨ContinuousWithinAt.mono h.1 hst, DifferentiableWithinAt.mono h.differentiableWithinAt_writtenInExtChartAt (inter_subset_inter_left _ (preimage_mono hst))⟩ #align mdifferentiable_within_at.mono MDifferentiableWithinAt.mono theorem mdifferentiableWithinAt_univ : MDifferentiableWithinAt I I' f univ x ↔ MDifferentiableAt I I' f x := by simp_rw [MDifferentiableWithinAt, MDifferentiableAt, ChartedSpace.LiftPropAt] #align mdifferentiable_within_at_univ mdifferentiableWithinAt_univ
Mathlib/Geometry/Manifold/MFDeriv/Basic.lean
297
300
theorem mdifferentiableWithinAt_inter (ht : t ∈ 𝓝 x) : MDifferentiableWithinAt I I' f (s ∩ t) x ↔ MDifferentiableWithinAt I I' f s x := by
rw [MDifferentiableWithinAt, MDifferentiableWithinAt, (differentiable_within_at_localInvariantProp I I').liftPropWithinAt_inter ht]
import Mathlib.Topology.UniformSpace.Cauchy import Mathlib.Topology.UniformSpace.Separation import Mathlib.Topology.DenseEmbedding #align_import topology.uniform_space.uniform_embedding from "leanprover-community/mathlib"@"195fcd60ff2bfe392543bceb0ec2adcdb472db4c" open Filter Function Set Uniformity Topology section universe u v w variable {α : Type u} {β : Type v} {γ : Type w} [UniformSpace α] [UniformSpace β] [UniformSpace γ] @[mk_iff] structure UniformInducing (f : α → β) : Prop where comap_uniformity : comap (fun x : α × α => (f x.1, f x.2)) (𝓤 β) = 𝓤 α #align uniform_inducing UniformInducing #align uniform_inducing_iff uniformInducing_iff lemma uniformInducing_iff_uniformSpace {f : α → β} : UniformInducing f ↔ ‹UniformSpace β›.comap f = ‹UniformSpace α› := by rw [uniformInducing_iff, UniformSpace.ext_iff, Filter.ext_iff] rfl protected alias ⟨UniformInducing.comap_uniformSpace, _⟩ := uniformInducing_iff_uniformSpace #align uniform_inducing.comap_uniform_space UniformInducing.comap_uniformSpace lemma uniformInducing_iff' {f : α → β} : UniformInducing f ↔ UniformContinuous f ∧ comap (Prod.map f f) (𝓤 β) ≤ 𝓤 α := by rw [uniformInducing_iff, UniformContinuous, tendsto_iff_comap, le_antisymm_iff, and_comm]; rfl #align uniform_inducing_iff' uniformInducing_iff' protected lemma Filter.HasBasis.uniformInducing_iff {ι ι'} {p : ι → Prop} {p' : ι' → Prop} {s s'} (h : (𝓤 α).HasBasis p s) (h' : (𝓤 β).HasBasis p' s') {f : α → β} : UniformInducing f ↔ (∀ i, p' i → ∃ j, p j ∧ ∀ x y, (x, y) ∈ s j → (f x, f y) ∈ s' i) ∧ (∀ j, p j → ∃ i, p' i ∧ ∀ x y, (f x, f y) ∈ s' i → (x, y) ∈ s j) := by simp [uniformInducing_iff', h.uniformContinuous_iff h', (h'.comap _).le_basis_iff h, subset_def] #align filter.has_basis.uniform_inducing_iff Filter.HasBasis.uniformInducing_iff theorem UniformInducing.mk' {f : α → β} (h : ∀ s, s ∈ 𝓤 α ↔ ∃ t ∈ 𝓤 β, ∀ x y : α, (f x, f y) ∈ t → (x, y) ∈ s) : UniformInducing f := ⟨by simp [eq_comm, Filter.ext_iff, subset_def, h]⟩ #align uniform_inducing.mk' UniformInducing.mk' theorem uniformInducing_id : UniformInducing (@id α) := ⟨by rw [← Prod.map_def, Prod.map_id, comap_id]⟩ #align uniform_inducing_id uniformInducing_id theorem UniformInducing.comp {g : β → γ} (hg : UniformInducing g) {f : α → β} (hf : UniformInducing f) : UniformInducing (g ∘ f) := ⟨by rw [← hf.1, ← hg.1, comap_comap]; rfl⟩ #align uniform_inducing.comp UniformInducing.comp theorem UniformInducing.of_comp_iff {g : β → γ} (hg : UniformInducing g) {f : α → β} : UniformInducing (g ∘ f) ↔ UniformInducing f := by refine ⟨fun h ↦ ?_, hg.comp⟩ rw [uniformInducing_iff, ← hg.comap_uniformity, comap_comap, ← h.comap_uniformity, Function.comp, Function.comp] theorem UniformInducing.basis_uniformity {f : α → β} (hf : UniformInducing f) {ι : Sort*} {p : ι → Prop} {s : ι → Set (β × β)} (H : (𝓤 β).HasBasis p s) : (𝓤 α).HasBasis p fun i => Prod.map f f ⁻¹' s i := hf.1 ▸ H.comap _ #align uniform_inducing.basis_uniformity UniformInducing.basis_uniformity theorem UniformInducing.cauchy_map_iff {f : α → β} (hf : UniformInducing f) {F : Filter α} : Cauchy (map f F) ↔ Cauchy F := by simp only [Cauchy, map_neBot_iff, prod_map_map_eq, map_le_iff_le_comap, ← hf.comap_uniformity] #align uniform_inducing.cauchy_map_iff UniformInducing.cauchy_map_iff theorem uniformInducing_of_compose {f : α → β} {g : β → γ} (hf : UniformContinuous f) (hg : UniformContinuous g) (hgf : UniformInducing (g ∘ f)) : UniformInducing f := by refine ⟨le_antisymm ?_ hf.le_comap⟩ rw [← hgf.1, ← Prod.map_def, ← Prod.map_def, ← Prod.map_comp_map f f g g, ← comap_comap] exact comap_mono hg.le_comap #align uniform_inducing_of_compose uniformInducing_of_compose theorem UniformInducing.uniformContinuous {f : α → β} (hf : UniformInducing f) : UniformContinuous f := (uniformInducing_iff'.1 hf).1 #align uniform_inducing.uniform_continuous UniformInducing.uniformContinuous theorem UniformInducing.uniformContinuous_iff {f : α → β} {g : β → γ} (hg : UniformInducing g) : UniformContinuous f ↔ UniformContinuous (g ∘ f) := by dsimp only [UniformContinuous, Tendsto] rw [← hg.comap_uniformity, ← map_le_iff_le_comap, Filter.map_map]; rfl #align uniform_inducing.uniform_continuous_iff UniformInducing.uniformContinuous_iff theorem UniformInducing.uniformContinuousOn_iff {f : α → β} {g : β → γ} {S : Set α} (hg : UniformInducing g) : UniformContinuousOn f S ↔ UniformContinuousOn (g ∘ f) S := by dsimp only [UniformContinuousOn, Tendsto] rw [← hg.comap_uniformity, ← map_le_iff_le_comap, Filter.map_map, comp_def, comp_def] theorem UniformInducing.inducing {f : α → β} (h : UniformInducing f) : Inducing f := by obtain rfl := h.comap_uniformSpace exact inducing_induced f #align uniform_inducing.inducing UniformInducing.inducing theorem UniformInducing.prod {α' : Type*} {β' : Type*} [UniformSpace α'] [UniformSpace β'] {e₁ : α → α'} {e₂ : β → β'} (h₁ : UniformInducing e₁) (h₂ : UniformInducing e₂) : UniformInducing fun p : α × β => (e₁ p.1, e₂ p.2) := ⟨by simp [(· ∘ ·), uniformity_prod, ← h₁.1, ← h₂.1, comap_inf, comap_comap]⟩ #align uniform_inducing.prod UniformInducing.prod theorem UniformInducing.denseInducing {f : α → β} (h : UniformInducing f) (hd : DenseRange f) : DenseInducing f := { dense := hd induced := h.inducing.induced } #align uniform_inducing.dense_inducing UniformInducing.denseInducing theorem SeparationQuotient.uniformInducing_mk : UniformInducing (mk : α → SeparationQuotient α) := ⟨comap_mk_uniformity⟩ protected theorem UniformInducing.injective [T0Space α] {f : α → β} (h : UniformInducing f) : Injective f := h.inducing.injective @[mk_iff] structure UniformEmbedding (f : α → β) extends UniformInducing f : Prop where inj : Function.Injective f #align uniform_embedding UniformEmbedding #align uniform_embedding_iff uniformEmbedding_iff theorem uniformEmbedding_iff' {f : α → β} : UniformEmbedding f ↔ Injective f ∧ UniformContinuous f ∧ comap (Prod.map f f) (𝓤 β) ≤ 𝓤 α := by rw [uniformEmbedding_iff, and_comm, uniformInducing_iff'] #align uniform_embedding_iff' uniformEmbedding_iff' theorem Filter.HasBasis.uniformEmbedding_iff' {ι ι'} {p : ι → Prop} {p' : ι' → Prop} {s s'} (h : (𝓤 α).HasBasis p s) (h' : (𝓤 β).HasBasis p' s') {f : α → β} : UniformEmbedding f ↔ Injective f ∧ (∀ i, p' i → ∃ j, p j ∧ ∀ x y, (x, y) ∈ s j → (f x, f y) ∈ s' i) ∧ (∀ j, p j → ∃ i, p' i ∧ ∀ x y, (f x, f y) ∈ s' i → (x, y) ∈ s j) := by rw [uniformEmbedding_iff, and_comm, h.uniformInducing_iff h'] #align filter.has_basis.uniform_embedding_iff' Filter.HasBasis.uniformEmbedding_iff' theorem Filter.HasBasis.uniformEmbedding_iff {ι ι'} {p : ι → Prop} {p' : ι' → Prop} {s s'} (h : (𝓤 α).HasBasis p s) (h' : (𝓤 β).HasBasis p' s') {f : α → β} : UniformEmbedding f ↔ Injective f ∧ UniformContinuous f ∧ (∀ j, p j → ∃ i, p' i ∧ ∀ x y, (f x, f y) ∈ s' i → (x, y) ∈ s j) := by simp only [h.uniformEmbedding_iff' h', h.uniformContinuous_iff h'] #align filter.has_basis.uniform_embedding_iff Filter.HasBasis.uniformEmbedding_iff theorem uniformEmbedding_subtype_val {p : α → Prop} : UniformEmbedding (Subtype.val : Subtype p → α) := { comap_uniformity := rfl inj := Subtype.val_injective } #align uniform_embedding_subtype_val uniformEmbedding_subtype_val #align uniform_embedding_subtype_coe uniformEmbedding_subtype_val theorem uniformEmbedding_set_inclusion {s t : Set α} (hst : s ⊆ t) : UniformEmbedding (inclusion hst) where comap_uniformity := by rw [uniformity_subtype, uniformity_subtype, comap_comap]; rfl inj := inclusion_injective hst #align uniform_embedding_set_inclusion uniformEmbedding_set_inclusion theorem UniformEmbedding.comp {g : β → γ} (hg : UniformEmbedding g) {f : α → β} (hf : UniformEmbedding f) : UniformEmbedding (g ∘ f) := { hg.toUniformInducing.comp hf.toUniformInducing with inj := hg.inj.comp hf.inj } #align uniform_embedding.comp UniformEmbedding.comp theorem UniformEmbedding.of_comp_iff {g : β → γ} (hg : UniformEmbedding g) {f : α → β} : UniformEmbedding (g ∘ f) ↔ UniformEmbedding f := by simp_rw [uniformEmbedding_iff, hg.toUniformInducing.of_comp_iff, hg.inj.of_comp_iff f] theorem Equiv.uniformEmbedding {α β : Type*} [UniformSpace α] [UniformSpace β] (f : α ≃ β) (h₁ : UniformContinuous f) (h₂ : UniformContinuous f.symm) : UniformEmbedding f := uniformEmbedding_iff'.2 ⟨f.injective, h₁, by rwa [← Equiv.prodCongr_apply, ← map_equiv_symm]⟩ #align equiv.uniform_embedding Equiv.uniformEmbedding theorem uniformEmbedding_inl : UniformEmbedding (Sum.inl : α → α ⊕ β) := uniformEmbedding_iff'.2 ⟨Sum.inl_injective, uniformContinuous_inl, fun s hs => ⟨Prod.map Sum.inl Sum.inl '' s ∪ range (Prod.map Sum.inr Sum.inr), union_mem_sup (image_mem_map hs) range_mem_map, fun x h => by simpa using h⟩⟩ #align uniform_embedding_inl uniformEmbedding_inl theorem uniformEmbedding_inr : UniformEmbedding (Sum.inr : β → α ⊕ β) := uniformEmbedding_iff'.2 ⟨Sum.inr_injective, uniformContinuous_inr, fun s hs => ⟨range (Prod.map Sum.inl Sum.inl) ∪ Prod.map Sum.inr Sum.inr '' s, union_mem_sup range_mem_map (image_mem_map hs), fun x h => by simpa using h⟩⟩ #align uniform_embedding_inr uniformEmbedding_inr protected theorem UniformInducing.uniformEmbedding [T0Space α] {f : α → β} (hf : UniformInducing f) : UniformEmbedding f := ⟨hf, hf.inducing.injective⟩ #align uniform_inducing.uniform_embedding UniformInducing.uniformEmbedding theorem uniformEmbedding_iff_uniformInducing [T0Space α] {f : α → β} : UniformEmbedding f ↔ UniformInducing f := ⟨UniformEmbedding.toUniformInducing, UniformInducing.uniformEmbedding⟩ #align uniform_embedding_iff_uniform_inducing uniformEmbedding_iff_uniformInducing theorem comap_uniformity_of_spaced_out {α} {f : α → β} {s : Set (β × β)} (hs : s ∈ 𝓤 β) (hf : Pairwise fun x y => (f x, f y) ∉ s) : comap (Prod.map f f) (𝓤 β) = 𝓟 idRel := by refine le_antisymm ?_ (@refl_le_uniformity α (UniformSpace.comap f _)) calc comap (Prod.map f f) (𝓤 β) ≤ comap (Prod.map f f) (𝓟 s) := comap_mono (le_principal_iff.2 hs) _ = 𝓟 (Prod.map f f ⁻¹' s) := comap_principal _ ≤ 𝓟 idRel := principal_mono.2 ?_ rintro ⟨x, y⟩; simpa [not_imp_not] using @hf x y #align comap_uniformity_of_spaced_out comap_uniformity_of_spaced_out theorem uniformEmbedding_of_spaced_out {α} {f : α → β} {s : Set (β × β)} (hs : s ∈ 𝓤 β) (hf : Pairwise fun x y => (f x, f y) ∉ s) : @UniformEmbedding α β ⊥ ‹_› f := by let _ : UniformSpace α := ⊥; have := discreteTopology_bot α exact UniformInducing.uniformEmbedding ⟨comap_uniformity_of_spaced_out hs hf⟩ #align uniform_embedding_of_spaced_out uniformEmbedding_of_spaced_out protected theorem UniformEmbedding.embedding {f : α → β} (h : UniformEmbedding f) : Embedding f := { toInducing := h.toUniformInducing.inducing inj := h.inj } #align uniform_embedding.embedding UniformEmbedding.embedding theorem UniformEmbedding.denseEmbedding {f : α → β} (h : UniformEmbedding f) (hd : DenseRange f) : DenseEmbedding f := { h.embedding with dense := hd } #align uniform_embedding.dense_embedding UniformEmbedding.denseEmbedding theorem closedEmbedding_of_spaced_out {α} [TopologicalSpace α] [DiscreteTopology α] [T0Space β] {f : α → β} {s : Set (β × β)} (hs : s ∈ 𝓤 β) (hf : Pairwise fun x y => (f x, f y) ∉ s) : ClosedEmbedding f := by rcases @DiscreteTopology.eq_bot α _ _ with rfl; let _ : UniformSpace α := ⊥ exact { (uniformEmbedding_of_spaced_out hs hf).embedding with isClosed_range := isClosed_range_of_spaced_out hs hf } #align closed_embedding_of_spaced_out closedEmbedding_of_spaced_out theorem closure_image_mem_nhds_of_uniformInducing {s : Set (α × α)} {e : α → β} (b : β) (he₁ : UniformInducing e) (he₂ : DenseInducing e) (hs : s ∈ 𝓤 α) : ∃ a, closure (e '' { a' | (a, a') ∈ s }) ∈ 𝓝 b := by obtain ⟨U, ⟨hU, hUo, hsymm⟩, hs⟩ : ∃ U, (U ∈ 𝓤 β ∧ IsOpen U ∧ SymmetricRel U) ∧ Prod.map e e ⁻¹' U ⊆ s := by rwa [← he₁.comap_uniformity, (uniformity_hasBasis_open_symmetric.comap _).mem_iff] at hs rcases he₂.dense.mem_nhds (UniformSpace.ball_mem_nhds b hU) with ⟨a, ha⟩ refine ⟨a, mem_of_superset ?_ (closure_mono <| image_subset _ <| ball_mono hs a)⟩ have ho : IsOpen (UniformSpace.ball (e a) U) := UniformSpace.isOpen_ball (e a) hUo refine mem_of_superset (ho.mem_nhds <| (mem_ball_symmetry hsymm).2 ha) fun y hy => ?_ refine mem_closure_iff_nhds.2 fun V hV => ?_ rcases he₂.dense.mem_nhds (inter_mem hV (ho.mem_nhds hy)) with ⟨x, hxV, hxU⟩ exact ⟨e x, hxV, mem_image_of_mem e hxU⟩ #align closure_image_mem_nhds_of_uniform_inducing closure_image_mem_nhds_of_uniformInducing theorem uniformEmbedding_subtypeEmb (p : α → Prop) {e : α → β} (ue : UniformEmbedding e) (de : DenseEmbedding e) : UniformEmbedding (DenseEmbedding.subtypeEmb p e) := { comap_uniformity := by simp [comap_comap, (· ∘ ·), DenseEmbedding.subtypeEmb, uniformity_subtype, ue.comap_uniformity.symm] inj := (de.subtype p).inj } #align uniform_embedding_subtype_emb uniformEmbedding_subtypeEmb theorem UniformEmbedding.prod {α' : Type*} {β' : Type*} [UniformSpace α'] [UniformSpace β'] {e₁ : α → α'} {e₂ : β → β'} (h₁ : UniformEmbedding e₁) (h₂ : UniformEmbedding e₂) : UniformEmbedding fun p : α × β => (e₁ p.1, e₂ p.2) := { h₁.toUniformInducing.prod h₂.toUniformInducing with inj := h₁.inj.prodMap h₂.inj } #align uniform_embedding.prod UniformEmbedding.prod theorem isComplete_image_iff {m : α → β} {s : Set α} (hm : UniformInducing m) : IsComplete (m '' s) ↔ IsComplete s := by have fact1 : SurjOn (map m) (Iic <| 𝓟 s) (Iic <| 𝓟 <| m '' s) := surjOn_image .. |>.filter_map_Iic have fact2 : MapsTo (map m) (Iic <| 𝓟 s) (Iic <| 𝓟 <| m '' s) := mapsTo_image .. |>.filter_map_Iic simp_rw [IsComplete, imp.swap (a := Cauchy _), ← mem_Iic (b := 𝓟 _), fact1.forall fact2, hm.cauchy_map_iff, exists_mem_image, map_le_iff_le_comap, hm.inducing.nhds_eq_comap] #align is_complete_image_iff isComplete_image_iff alias ⟨isComplete_of_complete_image, _⟩ := isComplete_image_iff #align is_complete_of_complete_image isComplete_of_complete_image theorem completeSpace_iff_isComplete_range {f : α → β} (hf : UniformInducing f) : CompleteSpace α ↔ IsComplete (range f) := by rw [completeSpace_iff_isComplete_univ, ← isComplete_image_iff hf, image_univ] #align complete_space_iff_is_complete_range completeSpace_iff_isComplete_range theorem UniformInducing.isComplete_range [CompleteSpace α] {f : α → β} (hf : UniformInducing f) : IsComplete (range f) := (completeSpace_iff_isComplete_range hf).1 ‹_› #align uniform_inducing.is_complete_range UniformInducing.isComplete_range theorem SeparationQuotient.completeSpace_iff : CompleteSpace (SeparationQuotient α) ↔ CompleteSpace α := by rw [completeSpace_iff_isComplete_univ, ← range_mk, ← completeSpace_iff_isComplete_range uniformInducing_mk] instance SeparationQuotient.instCompleteSpace [CompleteSpace α] : CompleteSpace (SeparationQuotient α) := completeSpace_iff.2 ‹_› #align uniform_space.complete_space_separation SeparationQuotient.instCompleteSpace
Mathlib/Topology/UniformSpace/UniformEmbedding.lean
326
329
theorem completeSpace_congr {e : α ≃ β} (he : UniformEmbedding e) : CompleteSpace α ↔ CompleteSpace β := by
rw [completeSpace_iff_isComplete_range he.toUniformInducing, e.range_eq_univ, completeSpace_iff_isComplete_univ]
import Mathlib.CategoryTheory.Limits.Shapes.NormalMono.Basic import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts #align_import category_theory.limits.shapes.normal_mono.equalizers from "leanprover-community/mathlib"@"3a061790136d13594ec10c7c90d202335ac5d854" noncomputable section open CategoryTheory open CategoryTheory.Limits variable {C : Type*} [Category C] [HasZeroMorphisms C] namespace CategoryTheory.NormalEpiCategory variable [HasFiniteCoproducts C] [HasCokernels C] [NormalEpiCategory C] @[irreducible, nolint defLemma] -- Porting note: made a def and re-added irreducible def pushout_of_epi {X Y Z : C} (a : X ⟶ Y) (b : X ⟶ Z) [Epi a] [Epi b] : HasColimit (span a b) := let ⟨P, f, hfa, i⟩ := normalEpiOfEpi a let ⟨Q, g, hgb, i'⟩ := normalEpiOfEpi b let ⟨a', ha'⟩ := CokernelCofork.IsColimit.desc' i (cokernel.π (coprod.desc f g)) <| calc f ≫ cokernel.π (coprod.desc f g) = coprod.inl ≫ coprod.desc f g ≫ cokernel.π (coprod.desc f g) := by rw [coprod.inl_desc_assoc] _ = coprod.inl ≫ (0 : P ⨿ Q ⟶ cokernel (coprod.desc f g)) := by rw [cokernel.condition] _ = 0 := HasZeroMorphisms.comp_zero _ _ let ⟨b', hb'⟩ := CokernelCofork.IsColimit.desc' i' (cokernel.π (coprod.desc f g)) <| calc g ≫ cokernel.π (coprod.desc f g) = coprod.inr ≫ coprod.desc f g ≫ cokernel.π (coprod.desc f g) := by rw [coprod.inr_desc_assoc] _ = coprod.inr ≫ (0 : P ⨿ Q ⟶ cokernel (coprod.desc f g)) := by rw [cokernel.condition] _ = 0 := HasZeroMorphisms.comp_zero _ _ HasColimit.mk { cocone := PushoutCocone.mk a' b' <| by simp only [Cofork.π_ofπ] at ha' hb' rw [ha', hb'] isColimit := PushoutCocone.IsColimit.mk _ (fun s => cokernel.desc (coprod.desc f g) (b ≫ PushoutCocone.inr s) <| coprod.hom_ext (calc coprod.inl ≫ coprod.desc f g ≫ b ≫ PushoutCocone.inr s = f ≫ b ≫ PushoutCocone.inr s := by rw [coprod.inl_desc_assoc] _ = f ≫ a ≫ PushoutCocone.inl s := by rw [PushoutCocone.condition] _ = 0 ≫ PushoutCocone.inl s := by rw [← Category.assoc, eq_whisker hfa] _ = coprod.inl ≫ 0 := by rw [comp_zero, zero_comp] ) (calc coprod.inr ≫ coprod.desc f g ≫ b ≫ PushoutCocone.inr s = g ≫ b ≫ PushoutCocone.inr s := by rw [coprod.inr_desc_assoc] _ = 0 ≫ PushoutCocone.inr s := by rw [← Category.assoc, eq_whisker hgb] _ = coprod.inr ≫ 0 := by rw [comp_zero, zero_comp] )) (fun s => (cancel_epi a).1 <| by rw [CokernelCofork.π_ofπ] at ha' have reassoced {W : C} (h : cokernel (coprod.desc f g) ⟶ W) : a ≫ a' ≫ h = cokernel.π (coprod.desc f g) ≫ h := by rw [← Category.assoc, eq_whisker ha'] simp [reassoced , PushoutCocone.condition s]) (fun s => (cancel_epi b).1 <| by rw [CokernelCofork.π_ofπ] at hb' have reassoced' {W : C} (h : cokernel (coprod.desc f g) ⟶ W) : b ≫ b' ≫ h = cokernel.π (coprod.desc f g) ≫ h := by rw [← Category.assoc, eq_whisker hb'] simp [reassoced']) fun s m h₁ _ => (cancel_epi (cokernel.π (coprod.desc f g))).1 <| calc cokernel.π (coprod.desc f g) ≫ m = (a ≫ a') ≫ m := by congr exact ha'.symm _ = a ≫ PushoutCocone.inl s := by rw [Category.assoc, h₁] _ = b ≫ PushoutCocone.inr s := PushoutCocone.condition s _ = cokernel.π (coprod.desc f g) ≫ cokernel.desc (coprod.desc f g) (b ≫ PushoutCocone.inr s) _ := by rw [cokernel.π_desc] } #align category_theory.normal_epi_category.pushout_of_epi CategoryTheory.NormalEpiCategory.pushout_of_epi section attribute [local instance] pushout_of_epi private abbrev Q {X Y : C} (f g : X ⟶ Y) [Epi (coprod.desc (𝟙 Y) f)] [Epi (coprod.desc (𝟙 Y) g)] : C := pushout (coprod.desc (𝟙 Y) f) (coprod.desc (𝟙 Y) g) @[irreducible, nolint defLemma] -- Porting note: changed to def and restored irreducible def hasColimit_parallelPair {X Y : C} (f g : X ⟶ Y) : HasColimit (parallelPair f g) := have huv : (pushout.inl : Y ⟶ Q f g) = pushout.inr := calc (pushout.inl : Y ⟶ Q f g) = 𝟙 _ ≫ pushout.inl := Eq.symm <| Category.id_comp _ _ = (coprod.inl ≫ coprod.desc (𝟙 Y) f) ≫ pushout.inl := by rw [coprod.inl_desc] _ = (coprod.inl ≫ coprod.desc (𝟙 Y) g) ≫ pushout.inr := by simp only [Category.assoc, pushout.condition] _ = pushout.inr := by rw [coprod.inl_desc, Category.id_comp] have hvu : f ≫ (pushout.inl : Y ⟶ Q f g) = g ≫ pushout.inr := calc f ≫ (pushout.inl : Y ⟶ Q f g) = (coprod.inr ≫ coprod.desc (𝟙 Y) f) ≫ pushout.inl := by rw [coprod.inr_desc] _ = (coprod.inr ≫ coprod.desc (𝟙 Y) g) ≫ pushout.inr := by simp only [Category.assoc, pushout.condition] _ = g ≫ pushout.inr := by rw [coprod.inr_desc] have huu : f ≫ (pushout.inl : Y ⟶ Q f g) = g ≫ pushout.inl := by rw [hvu, huv] HasColimit.mk { cocone := Cofork.ofπ pushout.inl huu isColimit := Cofork.IsColimit.mk _ (fun s => pushout.desc (Cofork.π s) (Cofork.π s) <| coprod.hom_ext (by simp only [coprod.inl_desc_assoc]) (by simp only [coprod.desc_comp, Cofork.condition s])) (fun s => by simp only [pushout.inl_desc, Cofork.π_ofπ]) fun s m h => pushout.hom_ext (by simpa only [pushout.inl_desc] using h) (by simpa only [huv.symm, pushout.inl_desc] using h) } #align category_theory.normal_epi_category.has_colimit_parallel_pair CategoryTheory.NormalEpiCategory.hasColimit_parallelPair end section attribute [local instance] hasColimit_parallelPair instance (priority := 100) hasCoequalizers : HasCoequalizers C := hasCoequalizers_of_hasColimit_parallelPair _ #align category_theory.normal_epi_category.has_coequalizers CategoryTheory.NormalEpiCategory.hasCoequalizers end
Mathlib/CategoryTheory/Limits/Shapes/NormalMono/Equalizers.lean
315
328
theorem mono_of_zero_kernel {X Y : C} (f : X ⟶ Y) (Z : C) (l : IsLimit (KernelFork.ofι (0 : Z ⟶ X) (show 0 ≫ f = 0 by simp))) : Mono f := ⟨fun u v huv => by obtain ⟨W, w, hw, hl⟩ := normalEpiOfEpi (coequalizer.π u v) obtain ⟨m, hm⟩ := coequalizer.desc' f huv have reassoced {W : C} (h : coequalizer u v ⟶ W) : w ≫ coequalizer.π u v ≫ h = 0 ≫ h := by
rw [← Category.assoc, eq_whisker hw] have hwf : w ≫ f = 0 := by rw [← hm, reassoced, zero_comp] obtain ⟨n, hn⟩ := KernelFork.IsLimit.lift' l _ hwf rw [Fork.ι_ofι, HasZeroMorphisms.comp_zero] at hn have : IsIso (coequalizer.π u v) := by apply isIso_colimit_cocone_parallelPair_of_eq hn.symm hl apply (cancel_mono (coequalizer.π u v)).1 exact coequalizer.condition _ _⟩
import Mathlib.Topology.UniformSpace.UniformConvergence import Mathlib.Topology.UniformSpace.Equicontinuity import Mathlib.Topology.Separation import Mathlib.Topology.Support #align_import topology.uniform_space.compact from "leanprover-community/mathlib"@"735b22f8f9ff9792cf4212d7cb051c4c994bc685" open scoped Classical open Uniformity Topology Filter UniformSpace Set variable {α β γ : Type*} [UniformSpace α] [UniformSpace β] theorem nhdsSet_diagonal_eq_uniformity [CompactSpace α] : 𝓝ˢ (diagonal α) = 𝓤 α := by refine nhdsSet_diagonal_le_uniformity.antisymm ?_ have : (𝓤 (α × α)).HasBasis (fun U => U ∈ 𝓤 α) fun U => (fun p : (α × α) × α × α => ((p.1.1, p.2.1), p.1.2, p.2.2)) ⁻¹' U ×ˢ U := by rw [uniformity_prod_eq_comap_prod] exact (𝓤 α).basis_sets.prod_self.comap _ refine (isCompact_diagonal.nhdsSet_basis_uniformity this).ge_iff.2 fun U hU => ?_ exact mem_of_superset hU fun ⟨x, y⟩ hxy => mem_iUnion₂.2 ⟨(x, x), rfl, refl_mem_uniformity hU, hxy⟩ #align nhds_set_diagonal_eq_uniformity nhdsSet_diagonal_eq_uniformity theorem compactSpace_uniformity [CompactSpace α] : 𝓤 α = ⨆ x, 𝓝 (x, x) := nhdsSet_diagonal_eq_uniformity.symm.trans (nhdsSet_diagonal _) #align compact_space_uniformity compactSpace_uniformity theorem unique_uniformity_of_compact [t : TopologicalSpace γ] [CompactSpace γ] {u u' : UniformSpace γ} (h : u.toTopologicalSpace = t) (h' : u'.toTopologicalSpace = t) : u = u' := by refine UniformSpace.ext ?_ have : @CompactSpace γ u.toTopologicalSpace := by rwa [h] have : @CompactSpace γ u'.toTopologicalSpace := by rwa [h'] rw [@compactSpace_uniformity _ u, compactSpace_uniformity, h, h'] #align unique_uniformity_of_compact unique_uniformity_of_compact def uniformSpaceOfCompactT2 [TopologicalSpace γ] [CompactSpace γ] [T2Space γ] : UniformSpace γ where uniformity := 𝓝ˢ (diagonal γ) symm := continuous_swap.tendsto_nhdsSet fun x => Eq.symm comp := by set 𝓝Δ := 𝓝ˢ (diagonal γ) -- The filter of neighborhoods of Δ set F := 𝓝Δ.lift' fun s : Set (γ × γ) => s ○ s -- Compositions of neighborhoods of Δ -- If this weren't true, then there would be V ∈ 𝓝Δ such that F ⊓ 𝓟 Vᶜ ≠ ⊥ rw [le_iff_forall_inf_principal_compl] intro V V_in by_contra H haveI : NeBot (F ⊓ 𝓟 Vᶜ) := ⟨H⟩ -- Hence compactness would give us a cluster point (x, y) for F ⊓ 𝓟 Vᶜ obtain ⟨⟨x, y⟩, hxy⟩ : ∃ p : γ × γ, ClusterPt p (F ⊓ 𝓟 Vᶜ) := exists_clusterPt_of_compactSpace _ -- In particular (x, y) is a cluster point of 𝓟 Vᶜ, hence is not in the interior of V, -- and a fortiori not in Δ, so x ≠ y have clV : ClusterPt (x, y) (𝓟 <| Vᶜ) := hxy.of_inf_right have : (x, y) ∉ interior V := by have : (x, y) ∈ closure Vᶜ := by rwa [mem_closure_iff_clusterPt] rwa [closure_compl] at this have diag_subset : diagonal γ ⊆ interior V := subset_interior_iff_mem_nhdsSet.2 V_in have x_ne_y : x ≠ y := mt (@diag_subset (x, y)) this -- Since γ is compact and Hausdorff, it is T₄, hence T₃. -- So there are closed neighborhoods V₁ and V₂ of x and y contained in -- disjoint open neighborhoods U₁ and U₂. obtain ⟨U₁, _, V₁, V₁_in, U₂, _, V₂, V₂_in, V₁_cl, V₂_cl, U₁_op, U₂_op, VU₁, VU₂, hU₁₂⟩ := disjoint_nested_nhds x_ne_y -- We set U₃ := (V₁ ∪ V₂)ᶜ so that W := U₁ ×ˢ U₁ ∪ U₂ ×ˢ U₂ ∪ U₃ ×ˢ U₃ is an open -- neighborhood of Δ. let U₃ := (V₁ ∪ V₂)ᶜ have U₃_op : IsOpen U₃ := (V₁_cl.union V₂_cl).isOpen_compl let W := U₁ ×ˢ U₁ ∪ U₂ ×ˢ U₂ ∪ U₃ ×ˢ U₃ have W_in : W ∈ 𝓝Δ := by rw [mem_nhdsSet_iff_forall] rintro ⟨z, z'⟩ (rfl : z = z') refine IsOpen.mem_nhds ?_ ?_ · apply_rules [IsOpen.union, IsOpen.prod] · simp only [W, mem_union, mem_prod, and_self_iff] exact (_root_.em _).imp_left fun h => union_subset_union VU₁ VU₂ h -- So W ○ W ∈ F by definition of F have : W ○ W ∈ F := @mem_lift' _ _ _ (fun s => s ○ s) _ W_in -- Porting note: was `by simpa only using mem_lift' W_in` -- And V₁ ×ˢ V₂ ∈ 𝓝 (x, y) have hV₁₂ : V₁ ×ˢ V₂ ∈ 𝓝 (x, y) := prod_mem_nhds V₁_in V₂_in -- But (x, y) is also a cluster point of F so (V₁ ×ˢ V₂) ∩ (W ○ W) ≠ ∅ -- However the construction of W implies (V₁ ×ˢ V₂) ∩ (W ○ W) = ∅. -- Indeed assume for contradiction there is some (u, v) in the intersection. obtain ⟨⟨u, v⟩, ⟨u_in, v_in⟩, w, huw, hwv⟩ := clusterPt_iff.mp hxy.of_inf_left hV₁₂ this -- So u ∈ V₁, v ∈ V₂, and there exists some w such that (u, w) ∈ W and (w ,v) ∈ W. -- Because u is in V₁ which is disjoint from U₂ and U₃, (u, w) ∈ W forces (u, w) ∈ U₁ ×ˢ U₁. have uw_in : (u, w) ∈ U₁ ×ˢ U₁ := (huw.resolve_right fun h => h.1 <| Or.inl u_in).resolve_right fun h => hU₁₂.le_bot ⟨VU₁ u_in, h.1⟩ -- Similarly, because v ∈ V₂, (w ,v) ∈ W forces (w, v) ∈ U₂ ×ˢ U₂. have wv_in : (w, v) ∈ U₂ ×ˢ U₂ := (hwv.resolve_right fun h => h.2 <| Or.inr v_in).resolve_left fun h => hU₁₂.le_bot ⟨h.2, VU₂ v_in⟩ -- Hence w ∈ U₁ ∩ U₂ which is empty. -- So we have a contradiction exact hU₁₂.le_bot ⟨uw_in.2, wv_in.1⟩ nhds_eq_comap_uniformity x := by simp_rw [nhdsSet_diagonal, comap_iSup, nhds_prod_eq, comap_prod, (· ∘ ·), comap_id'] rw [iSup_split_single _ x, comap_const_of_mem fun V => mem_of_mem_nhds] suffices ∀ y ≠ x, comap (fun _ : γ ↦ x) (𝓝 y) ⊓ 𝓝 y ≤ 𝓝 x by simpa intro y hxy simp [comap_const_of_not_mem (compl_singleton_mem_nhds hxy) (not_not_intro rfl)] #align uniform_space_of_compact_t2 uniformSpaceOfCompactT2 theorem CompactSpace.uniformContinuous_of_continuous [CompactSpace α] {f : α → β} (h : Continuous f) : UniformContinuous f := calc map (Prod.map f f) (𝓤 α) = map (Prod.map f f) (𝓝ˢ (diagonal α)) := by rw [nhdsSet_diagonal_eq_uniformity] _ ≤ 𝓝ˢ (diagonal β) := (h.prod_map h).tendsto_nhdsSet mapsTo_prod_map_diagonal _ ≤ 𝓤 β := nhdsSet_diagonal_le_uniformity #align compact_space.uniform_continuous_of_continuous CompactSpace.uniformContinuous_of_continuous theorem IsCompact.uniformContinuousOn_of_continuous {s : Set α} {f : α → β} (hs : IsCompact s) (hf : ContinuousOn f s) : UniformContinuousOn f s := by rw [uniformContinuousOn_iff_restrict] rw [isCompact_iff_compactSpace] at hs rw [continuousOn_iff_continuous_restrict] at hf exact CompactSpace.uniformContinuous_of_continuous hf #align is_compact.uniform_continuous_on_of_continuous IsCompact.uniformContinuousOn_of_continuous theorem IsCompact.uniformContinuousAt_of_continuousAt {r : Set (β × β)} {s : Set α} (hs : IsCompact s) (f : α → β) (hf : ∀ a ∈ s, ContinuousAt f a) (hr : r ∈ 𝓤 β) : { x : α × α | x.1 ∈ s → (f x.1, f x.2) ∈ r } ∈ 𝓤 α := by obtain ⟨t, ht, htsymm, htr⟩ := comp_symm_mem_uniformity_sets hr choose U hU T hT hb using fun a ha => exists_mem_nhds_ball_subset_of_mem_nhds ((hf a ha).preimage_mem_nhds <| mem_nhds_left _ ht) obtain ⟨fs, hsU⟩ := hs.elim_nhds_subcover' U hU apply mem_of_superset ((biInter_finset_mem fs).2 fun a _ => hT a a.2) rintro ⟨a₁, a₂⟩ h h₁ obtain ⟨a, ha, haU⟩ := Set.mem_iUnion₂.1 (hsU h₁) apply htr refine ⟨f a, htsymm.mk_mem_comm.1 (hb _ _ _ haU ?_), hb _ _ _ haU ?_⟩ exacts [mem_ball_self _ (hT a a.2), mem_iInter₂.1 h a ha] #align is_compact.uniform_continuous_at_of_continuous_at IsCompact.uniformContinuousAt_of_continuousAt theorem Continuous.uniformContinuous_of_tendsto_cocompact {f : α → β} {x : β} (h_cont : Continuous f) (hx : Tendsto f (cocompact α) (𝓝 x)) : UniformContinuous f := uniformContinuous_def.2 fun r hr => by obtain ⟨t, ht, htsymm, htr⟩ := comp_symm_mem_uniformity_sets hr obtain ⟨s, hs, hst⟩ := mem_cocompact.1 (hx <| mem_nhds_left _ ht) apply mem_of_superset (symmetrize_mem_uniformity <| (hs.uniformContinuousAt_of_continuousAt f fun _ _ => h_cont.continuousAt) <| symmetrize_mem_uniformity hr) rintro ⟨b₁, b₂⟩ h by_cases h₁ : b₁ ∈ s; · exact (h.1 h₁).1 by_cases h₂ : b₂ ∈ s; · exact (h.2 h₂).2 apply htr exact ⟨x, htsymm.mk_mem_comm.1 (hst h₁), hst h₂⟩ #align continuous.uniform_continuous_of_tendsto_cocompact Continuous.uniformContinuous_of_tendsto_cocompact @[to_additive "If `f` has compact support, then `f` tends to zero at infinity."]
Mathlib/Topology/UniformSpace/Compact.lean
215
224
theorem HasCompactMulSupport.is_one_at_infty {f : α → γ} [TopologicalSpace γ] [One γ] (h : HasCompactMulSupport f) : Tendsto f (cocompact α) (𝓝 1) := by
-- Porting note: move to src/topology/support.lean once the port is over intro N hN rw [mem_map, mem_cocompact'] refine ⟨mulTSupport f, h.isCompact, ?_⟩ rw [compl_subset_comm] intro v hv rw [mem_preimage, image_eq_one_of_nmem_mulTSupport hv] exact mem_of_mem_nhds hN
import Mathlib.MeasureTheory.Function.LpOrder #align_import measure_theory.function.l1_space from "leanprover-community/mathlib"@"ccdbfb6e5614667af5aa3ab2d50885e0ef44a46f" noncomputable section open scoped Classical open Topology ENNReal MeasureTheory NNReal open Set Filter TopologicalSpace ENNReal EMetric MeasureTheory variable {α β γ δ : Type*} {m : MeasurableSpace α} {μ ν : Measure α} [MeasurableSpace δ] variable [NormedAddCommGroup β] variable [NormedAddCommGroup γ] namespace MeasureTheory theorem lintegral_nnnorm_eq_lintegral_edist (f : α → β) : ∫⁻ a, ‖f a‖₊ ∂μ = ∫⁻ a, edist (f a) 0 ∂μ := by simp only [edist_eq_coe_nnnorm] #align measure_theory.lintegral_nnnorm_eq_lintegral_edist MeasureTheory.lintegral_nnnorm_eq_lintegral_edist theorem lintegral_norm_eq_lintegral_edist (f : α → β) : ∫⁻ a, ENNReal.ofReal ‖f a‖ ∂μ = ∫⁻ a, edist (f a) 0 ∂μ := by simp only [ofReal_norm_eq_coe_nnnorm, edist_eq_coe_nnnorm] #align measure_theory.lintegral_norm_eq_lintegral_edist MeasureTheory.lintegral_norm_eq_lintegral_edist theorem lintegral_edist_triangle {f g h : α → β} (hf : AEStronglyMeasurable f μ) (hh : AEStronglyMeasurable h μ) : (∫⁻ a, edist (f a) (g a) ∂μ) ≤ (∫⁻ a, edist (f a) (h a) ∂μ) + ∫⁻ a, edist (g a) (h a) ∂μ := by rw [← lintegral_add_left' (hf.edist hh)] refine lintegral_mono fun a => ?_ apply edist_triangle_right #align measure_theory.lintegral_edist_triangle MeasureTheory.lintegral_edist_triangle theorem lintegral_nnnorm_zero : (∫⁻ _ : α, ‖(0 : β)‖₊ ∂μ) = 0 := by simp #align measure_theory.lintegral_nnnorm_zero MeasureTheory.lintegral_nnnorm_zero theorem lintegral_nnnorm_add_left {f : α → β} (hf : AEStronglyMeasurable f μ) (g : α → γ) : ∫⁻ a, ‖f a‖₊ + ‖g a‖₊ ∂μ = (∫⁻ a, ‖f a‖₊ ∂μ) + ∫⁻ a, ‖g a‖₊ ∂μ := lintegral_add_left' hf.ennnorm _ #align measure_theory.lintegral_nnnorm_add_left MeasureTheory.lintegral_nnnorm_add_left theorem lintegral_nnnorm_add_right (f : α → β) {g : α → γ} (hg : AEStronglyMeasurable g μ) : ∫⁻ a, ‖f a‖₊ + ‖g a‖₊ ∂μ = (∫⁻ a, ‖f a‖₊ ∂μ) + ∫⁻ a, ‖g a‖₊ ∂μ := lintegral_add_right' _ hg.ennnorm #align measure_theory.lintegral_nnnorm_add_right MeasureTheory.lintegral_nnnorm_add_right theorem lintegral_nnnorm_neg {f : α → β} : (∫⁻ a, ‖(-f) a‖₊ ∂μ) = ∫⁻ a, ‖f a‖₊ ∂μ := by simp only [Pi.neg_apply, nnnorm_neg] #align measure_theory.lintegral_nnnorm_neg MeasureTheory.lintegral_nnnorm_neg def HasFiniteIntegral {_ : MeasurableSpace α} (f : α → β) (μ : Measure α := by volume_tac) : Prop := (∫⁻ a, ‖f a‖₊ ∂μ) < ∞ #align measure_theory.has_finite_integral MeasureTheory.HasFiniteIntegral theorem hasFiniteIntegral_def {_ : MeasurableSpace α} (f : α → β) (μ : Measure α) : HasFiniteIntegral f μ ↔ ((∫⁻ a, ‖f a‖₊ ∂μ) < ∞) := Iff.rfl theorem hasFiniteIntegral_iff_norm (f : α → β) : HasFiniteIntegral f μ ↔ (∫⁻ a, ENNReal.ofReal ‖f a‖ ∂μ) < ∞ := by simp only [HasFiniteIntegral, ofReal_norm_eq_coe_nnnorm] #align measure_theory.has_finite_integral_iff_norm MeasureTheory.hasFiniteIntegral_iff_norm theorem hasFiniteIntegral_iff_edist (f : α → β) : HasFiniteIntegral f μ ↔ (∫⁻ a, edist (f a) 0 ∂μ) < ∞ := by simp only [hasFiniteIntegral_iff_norm, edist_dist, dist_zero_right] #align measure_theory.has_finite_integral_iff_edist MeasureTheory.hasFiniteIntegral_iff_edist theorem hasFiniteIntegral_iff_ofReal {f : α → ℝ} (h : 0 ≤ᵐ[μ] f) : HasFiniteIntegral f μ ↔ (∫⁻ a, ENNReal.ofReal (f a) ∂μ) < ∞ := by rw [HasFiniteIntegral, lintegral_nnnorm_eq_of_ae_nonneg h] #align measure_theory.has_finite_integral_iff_of_real MeasureTheory.hasFiniteIntegral_iff_ofReal theorem hasFiniteIntegral_iff_ofNNReal {f : α → ℝ≥0} : HasFiniteIntegral (fun x => (f x : ℝ)) μ ↔ (∫⁻ a, f a ∂μ) < ∞ := by simp [hasFiniteIntegral_iff_norm] #align measure_theory.has_finite_integral_iff_of_nnreal MeasureTheory.hasFiniteIntegral_iff_ofNNReal theorem HasFiniteIntegral.mono {f : α → β} {g : α → γ} (hg : HasFiniteIntegral g μ) (h : ∀ᵐ a ∂μ, ‖f a‖ ≤ ‖g a‖) : HasFiniteIntegral f μ := by simp only [hasFiniteIntegral_iff_norm] at * calc (∫⁻ a, ENNReal.ofReal ‖f a‖ ∂μ) ≤ ∫⁻ a : α, ENNReal.ofReal ‖g a‖ ∂μ := lintegral_mono_ae (h.mono fun a h => ofReal_le_ofReal h) _ < ∞ := hg #align measure_theory.has_finite_integral.mono MeasureTheory.HasFiniteIntegral.mono theorem HasFiniteIntegral.mono' {f : α → β} {g : α → ℝ} (hg : HasFiniteIntegral g μ) (h : ∀ᵐ a ∂μ, ‖f a‖ ≤ g a) : HasFiniteIntegral f μ := hg.mono <| h.mono fun _x hx => le_trans hx (le_abs_self _) #align measure_theory.has_finite_integral.mono' MeasureTheory.HasFiniteIntegral.mono' theorem HasFiniteIntegral.congr' {f : α → β} {g : α → γ} (hf : HasFiniteIntegral f μ) (h : ∀ᵐ a ∂μ, ‖f a‖ = ‖g a‖) : HasFiniteIntegral g μ := hf.mono <| EventuallyEq.le <| EventuallyEq.symm h #align measure_theory.has_finite_integral.congr' MeasureTheory.HasFiniteIntegral.congr' theorem hasFiniteIntegral_congr' {f : α → β} {g : α → γ} (h : ∀ᵐ a ∂μ, ‖f a‖ = ‖g a‖) : HasFiniteIntegral f μ ↔ HasFiniteIntegral g μ := ⟨fun hf => hf.congr' h, fun hg => hg.congr' <| EventuallyEq.symm h⟩ #align measure_theory.has_finite_integral_congr' MeasureTheory.hasFiniteIntegral_congr' theorem HasFiniteIntegral.congr {f g : α → β} (hf : HasFiniteIntegral f μ) (h : f =ᵐ[μ] g) : HasFiniteIntegral g μ := hf.congr' <| h.fun_comp norm #align measure_theory.has_finite_integral.congr MeasureTheory.HasFiniteIntegral.congr theorem hasFiniteIntegral_congr {f g : α → β} (h : f =ᵐ[μ] g) : HasFiniteIntegral f μ ↔ HasFiniteIntegral g μ := hasFiniteIntegral_congr' <| h.fun_comp norm #align measure_theory.has_finite_integral_congr MeasureTheory.hasFiniteIntegral_congr theorem hasFiniteIntegral_const_iff {c : β} : HasFiniteIntegral (fun _ : α => c) μ ↔ c = 0 ∨ μ univ < ∞ := by simp [HasFiniteIntegral, lintegral_const, lt_top_iff_ne_top, ENNReal.mul_eq_top, or_iff_not_imp_left] #align measure_theory.has_finite_integral_const_iff MeasureTheory.hasFiniteIntegral_const_iff theorem hasFiniteIntegral_const [IsFiniteMeasure μ] (c : β) : HasFiniteIntegral (fun _ : α => c) μ := hasFiniteIntegral_const_iff.2 (Or.inr <| measure_lt_top _ _) #align measure_theory.has_finite_integral_const MeasureTheory.hasFiniteIntegral_const theorem hasFiniteIntegral_of_bounded [IsFiniteMeasure μ] {f : α → β} {C : ℝ} (hC : ∀ᵐ a ∂μ, ‖f a‖ ≤ C) : HasFiniteIntegral f μ := (hasFiniteIntegral_const C).mono' hC #align measure_theory.has_finite_integral_of_bounded MeasureTheory.hasFiniteIntegral_of_bounded theorem HasFiniteIntegral.of_finite [Finite α] [IsFiniteMeasure μ] {f : α → β} : HasFiniteIntegral f μ := let ⟨_⟩ := nonempty_fintype α hasFiniteIntegral_of_bounded <| ae_of_all μ <| norm_le_pi_norm f @[deprecated (since := "2024-02-05")] alias hasFiniteIntegral_of_fintype := HasFiniteIntegral.of_finite theorem HasFiniteIntegral.mono_measure {f : α → β} (h : HasFiniteIntegral f ν) (hμ : μ ≤ ν) : HasFiniteIntegral f μ := lt_of_le_of_lt (lintegral_mono' hμ le_rfl) h #align measure_theory.has_finite_integral.mono_measure MeasureTheory.HasFiniteIntegral.mono_measure theorem HasFiniteIntegral.add_measure {f : α → β} (hμ : HasFiniteIntegral f μ) (hν : HasFiniteIntegral f ν) : HasFiniteIntegral f (μ + ν) := by simp only [HasFiniteIntegral, lintegral_add_measure] at * exact add_lt_top.2 ⟨hμ, hν⟩ #align measure_theory.has_finite_integral.add_measure MeasureTheory.HasFiniteIntegral.add_measure theorem HasFiniteIntegral.left_of_add_measure {f : α → β} (h : HasFiniteIntegral f (μ + ν)) : HasFiniteIntegral f μ := h.mono_measure <| Measure.le_add_right <| le_rfl #align measure_theory.has_finite_integral.left_of_add_measure MeasureTheory.HasFiniteIntegral.left_of_add_measure theorem HasFiniteIntegral.right_of_add_measure {f : α → β} (h : HasFiniteIntegral f (μ + ν)) : HasFiniteIntegral f ν := h.mono_measure <| Measure.le_add_left <| le_rfl #align measure_theory.has_finite_integral.right_of_add_measure MeasureTheory.HasFiniteIntegral.right_of_add_measure @[simp] theorem hasFiniteIntegral_add_measure {f : α → β} : HasFiniteIntegral f (μ + ν) ↔ HasFiniteIntegral f μ ∧ HasFiniteIntegral f ν := ⟨fun h => ⟨h.left_of_add_measure, h.right_of_add_measure⟩, fun h => h.1.add_measure h.2⟩ #align measure_theory.has_finite_integral_add_measure MeasureTheory.hasFiniteIntegral_add_measure theorem HasFiniteIntegral.smul_measure {f : α → β} (h : HasFiniteIntegral f μ) {c : ℝ≥0∞} (hc : c ≠ ∞) : HasFiniteIntegral f (c • μ) := by simp only [HasFiniteIntegral, lintegral_smul_measure] at * exact mul_lt_top hc h.ne #align measure_theory.has_finite_integral.smul_measure MeasureTheory.HasFiniteIntegral.smul_measure @[simp] theorem hasFiniteIntegral_zero_measure {m : MeasurableSpace α} (f : α → β) : HasFiniteIntegral f (0 : Measure α) := by simp only [HasFiniteIntegral, lintegral_zero_measure, zero_lt_top] #align measure_theory.has_finite_integral_zero_measure MeasureTheory.hasFiniteIntegral_zero_measure variable (α β μ) @[simp] theorem hasFiniteIntegral_zero : HasFiniteIntegral (fun _ : α => (0 : β)) μ := by simp [HasFiniteIntegral] #align measure_theory.has_finite_integral_zero MeasureTheory.hasFiniteIntegral_zero variable {α β μ} theorem HasFiniteIntegral.neg {f : α → β} (hfi : HasFiniteIntegral f μ) : HasFiniteIntegral (-f) μ := by simpa [HasFiniteIntegral] using hfi #align measure_theory.has_finite_integral.neg MeasureTheory.HasFiniteIntegral.neg @[simp] theorem hasFiniteIntegral_neg_iff {f : α → β} : HasFiniteIntegral (-f) μ ↔ HasFiniteIntegral f μ := ⟨fun h => neg_neg f ▸ h.neg, HasFiniteIntegral.neg⟩ #align measure_theory.has_finite_integral_neg_iff MeasureTheory.hasFiniteIntegral_neg_iff theorem HasFiniteIntegral.norm {f : α → β} (hfi : HasFiniteIntegral f μ) : HasFiniteIntegral (fun a => ‖f a‖) μ := by have eq : (fun a => (nnnorm ‖f a‖ : ℝ≥0∞)) = fun a => (‖f a‖₊ : ℝ≥0∞) := by funext rw [nnnorm_norm] rwa [HasFiniteIntegral, eq] #align measure_theory.has_finite_integral.norm MeasureTheory.HasFiniteIntegral.norm theorem hasFiniteIntegral_norm_iff (f : α → β) : HasFiniteIntegral (fun a => ‖f a‖) μ ↔ HasFiniteIntegral f μ := hasFiniteIntegral_congr' <| eventually_of_forall fun x => norm_norm (f x) #align measure_theory.has_finite_integral_norm_iff MeasureTheory.hasFiniteIntegral_norm_iff theorem hasFiniteIntegral_toReal_of_lintegral_ne_top {f : α → ℝ≥0∞} (hf : (∫⁻ x, f x ∂μ) ≠ ∞) : HasFiniteIntegral (fun x => (f x).toReal) μ := by have : ∀ x, (‖(f x).toReal‖₊ : ℝ≥0∞) = ENNReal.ofNNReal ⟨(f x).toReal, ENNReal.toReal_nonneg⟩ := by intro x rw [Real.nnnorm_of_nonneg] simp_rw [HasFiniteIntegral, this] refine lt_of_le_of_lt (lintegral_mono fun x => ?_) (lt_top_iff_ne_top.2 hf) by_cases hfx : f x = ∞ · simp [hfx] · lift f x to ℝ≥0 using hfx with fx h simp [← h, ← NNReal.coe_le_coe] #align measure_theory.has_finite_integral_to_real_of_lintegral_ne_top MeasureTheory.hasFiniteIntegral_toReal_of_lintegral_ne_top theorem isFiniteMeasure_withDensity_ofReal {f : α → ℝ} (hfi : HasFiniteIntegral f μ) : IsFiniteMeasure (μ.withDensity fun x => ENNReal.ofReal <| f x) := by refine isFiniteMeasure_withDensity ((lintegral_mono fun x => ?_).trans_lt hfi).ne exact Real.ofReal_le_ennnorm (f x) #align measure_theory.is_finite_measure_with_density_of_real MeasureTheory.isFiniteMeasure_withDensity_ofReal -- variable [MeasurableSpace β] [MeasurableSpace γ] [MeasurableSpace δ] def Integrable {α} {_ : MeasurableSpace α} (f : α → β) (μ : Measure α := by volume_tac) : Prop := AEStronglyMeasurable f μ ∧ HasFiniteIntegral f μ #align measure_theory.integrable MeasureTheory.Integrable theorem memℒp_one_iff_integrable {f : α → β} : Memℒp f 1 μ ↔ Integrable f μ := by simp_rw [Integrable, HasFiniteIntegral, Memℒp, snorm_one_eq_lintegral_nnnorm] #align measure_theory.mem_ℒp_one_iff_integrable MeasureTheory.memℒp_one_iff_integrable theorem Integrable.aestronglyMeasurable {f : α → β} (hf : Integrable f μ) : AEStronglyMeasurable f μ := hf.1 #align measure_theory.integrable.ae_strongly_measurable MeasureTheory.Integrable.aestronglyMeasurable theorem Integrable.aemeasurable [MeasurableSpace β] [BorelSpace β] {f : α → β} (hf : Integrable f μ) : AEMeasurable f μ := hf.aestronglyMeasurable.aemeasurable #align measure_theory.integrable.ae_measurable MeasureTheory.Integrable.aemeasurable theorem Integrable.hasFiniteIntegral {f : α → β} (hf : Integrable f μ) : HasFiniteIntegral f μ := hf.2 #align measure_theory.integrable.has_finite_integral MeasureTheory.Integrable.hasFiniteIntegral theorem Integrable.mono {f : α → β} {g : α → γ} (hg : Integrable g μ) (hf : AEStronglyMeasurable f μ) (h : ∀ᵐ a ∂μ, ‖f a‖ ≤ ‖g a‖) : Integrable f μ := ⟨hf, hg.hasFiniteIntegral.mono h⟩ #align measure_theory.integrable.mono MeasureTheory.Integrable.mono theorem Integrable.mono' {f : α → β} {g : α → ℝ} (hg : Integrable g μ) (hf : AEStronglyMeasurable f μ) (h : ∀ᵐ a ∂μ, ‖f a‖ ≤ g a) : Integrable f μ := ⟨hf, hg.hasFiniteIntegral.mono' h⟩ #align measure_theory.integrable.mono' MeasureTheory.Integrable.mono' theorem Integrable.congr' {f : α → β} {g : α → γ} (hf : Integrable f μ) (hg : AEStronglyMeasurable g μ) (h : ∀ᵐ a ∂μ, ‖f a‖ = ‖g a‖) : Integrable g μ := ⟨hg, hf.hasFiniteIntegral.congr' h⟩ #align measure_theory.integrable.congr' MeasureTheory.Integrable.congr' theorem integrable_congr' {f : α → β} {g : α → γ} (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) (h : ∀ᵐ a ∂μ, ‖f a‖ = ‖g a‖) : Integrable f μ ↔ Integrable g μ := ⟨fun h2f => h2f.congr' hg h, fun h2g => h2g.congr' hf <| EventuallyEq.symm h⟩ #align measure_theory.integrable_congr' MeasureTheory.integrable_congr' theorem Integrable.congr {f g : α → β} (hf : Integrable f μ) (h : f =ᵐ[μ] g) : Integrable g μ := ⟨hf.1.congr h, hf.2.congr h⟩ #align measure_theory.integrable.congr MeasureTheory.Integrable.congr theorem integrable_congr {f g : α → β} (h : f =ᵐ[μ] g) : Integrable f μ ↔ Integrable g μ := ⟨fun hf => hf.congr h, fun hg => hg.congr h.symm⟩ #align measure_theory.integrable_congr MeasureTheory.integrable_congr theorem integrable_const_iff {c : β} : Integrable (fun _ : α => c) μ ↔ c = 0 ∨ μ univ < ∞ := by have : AEStronglyMeasurable (fun _ : α => c) μ := aestronglyMeasurable_const rw [Integrable, and_iff_right this, hasFiniteIntegral_const_iff] #align measure_theory.integrable_const_iff MeasureTheory.integrable_const_iff @[simp] theorem integrable_const [IsFiniteMeasure μ] (c : β) : Integrable (fun _ : α => c) μ := integrable_const_iff.2 <| Or.inr <| measure_lt_top _ _ #align measure_theory.integrable_const MeasureTheory.integrable_const @[simp] theorem Integrable.of_finite [Finite α] [MeasurableSpace α] [MeasurableSingletonClass α] (μ : Measure α) [IsFiniteMeasure μ] (f : α → β) : Integrable (fun a ↦ f a) μ := ⟨(StronglyMeasurable.of_finite f).aestronglyMeasurable, .of_finite⟩ @[deprecated (since := "2024-02-05")] alias integrable_of_fintype := Integrable.of_finite
Mathlib/MeasureTheory/Function/L1Space.lean
505
508
theorem Memℒp.integrable_norm_rpow {f : α → β} {p : ℝ≥0∞} (hf : Memℒp f p μ) (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) : Integrable (fun x : α => ‖f x‖ ^ p.toReal) μ := by
rw [← memℒp_one_iff_integrable] exact hf.norm_rpow hp_ne_zero hp_ne_top
import Mathlib.CategoryTheory.Monoidal.Free.Coherence import Mathlib.CategoryTheory.Monoidal.Discrete import Mathlib.CategoryTheory.Monoidal.NaturalTransformation import Mathlib.CategoryTheory.Monoidal.Opposite import Mathlib.Tactic.CategoryTheory.Coherence import Mathlib.CategoryTheory.CommSq #align_import category_theory.monoidal.braided from "leanprover-community/mathlib"@"2efd2423f8d25fa57cf7a179f5d8652ab4d0df44" open CategoryTheory MonoidalCategory universe v v₁ v₂ v₃ u u₁ u₂ u₃ namespace CategoryTheory class BraidedCategory (C : Type u) [Category.{v} C] [MonoidalCategory.{v} C] where braiding : ∀ X Y : C, X ⊗ Y ≅ Y ⊗ X braiding_naturality_right : ∀ (X : C) {Y Z : C} (f : Y ⟶ Z), X ◁ f ≫ (braiding X Z).hom = (braiding X Y).hom ≫ f ▷ X := by aesop_cat braiding_naturality_left : ∀ {X Y : C} (f : X ⟶ Y) (Z : C), f ▷ Z ≫ (braiding Y Z).hom = (braiding X Z).hom ≫ Z ◁ f := by aesop_cat hexagon_forward : ∀ X Y Z : C, (α_ X Y Z).hom ≫ (braiding X (Y ⊗ Z)).hom ≫ (α_ Y Z X).hom = ((braiding X Y).hom ▷ Z) ≫ (α_ Y X Z).hom ≫ (Y ◁ (braiding X Z).hom) := by aesop_cat hexagon_reverse : ∀ X Y Z : C, (α_ X Y Z).inv ≫ (braiding (X ⊗ Y) Z).hom ≫ (α_ Z X Y).inv = (X ◁ (braiding Y Z).hom) ≫ (α_ X Z Y).inv ≫ ((braiding X Z).hom ▷ Y) := by aesop_cat #align category_theory.braided_category CategoryTheory.BraidedCategory attribute [reassoc (attr := simp)] BraidedCategory.braiding_naturality_left BraidedCategory.braiding_naturality_right attribute [reassoc] BraidedCategory.hexagon_forward BraidedCategory.hexagon_reverse open Category open MonoidalCategory open BraidedCategory @[inherit_doc] notation "β_" => BraidedCategory.braiding def braidedCategoryOfFaithful {C D : Type*} [Category C] [Category D] [MonoidalCategory C] [MonoidalCategory D] (F : MonoidalFunctor C D) [F.Faithful] [BraidedCategory D] (β : ∀ X Y : C, X ⊗ Y ≅ Y ⊗ X) (w : ∀ X Y, F.μ _ _ ≫ F.map (β X Y).hom = (β_ _ _).hom ≫ F.μ _ _) : BraidedCategory C where braiding := β braiding_naturality_left := by intros apply F.map_injective refine (cancel_epi (F.μ ?_ ?_)).1 ?_ rw [Functor.map_comp, ← LaxMonoidalFunctor.μ_natural_left_assoc, w, Functor.map_comp, reassoc_of% w, braiding_naturality_left_assoc, LaxMonoidalFunctor.μ_natural_right] braiding_naturality_right := by intros apply F.map_injective refine (cancel_epi (F.μ ?_ ?_)).1 ?_ rw [Functor.map_comp, ← LaxMonoidalFunctor.μ_natural_right_assoc, w, Functor.map_comp, reassoc_of% w, braiding_naturality_right_assoc, LaxMonoidalFunctor.μ_natural_left] hexagon_forward := by intros apply F.map_injective refine (cancel_epi (F.μ _ _)).1 ?_ refine (cancel_epi (F.μ _ _ ▷ _)).1 ?_ rw [Functor.map_comp, Functor.map_comp, Functor.map_comp, Functor.map_comp, ← LaxMonoidalFunctor.μ_natural_left_assoc, ← comp_whiskerRight_assoc, w, comp_whiskerRight_assoc, LaxMonoidalFunctor.associativity_assoc, LaxMonoidalFunctor.associativity_assoc, ← LaxMonoidalFunctor.μ_natural_right, ← MonoidalCategory.whiskerLeft_comp_assoc, w, MonoidalCategory.whiskerLeft_comp_assoc, reassoc_of% w, braiding_naturality_right_assoc, LaxMonoidalFunctor.associativity, hexagon_forward_assoc] hexagon_reverse := by intros apply F.toFunctor.map_injective refine (cancel_epi (F.μ _ _)).1 ?_ refine (cancel_epi (_ ◁ F.μ _ _)).1 ?_ rw [Functor.map_comp, Functor.map_comp, Functor.map_comp, Functor.map_comp, ← LaxMonoidalFunctor.μ_natural_right_assoc, ← MonoidalCategory.whiskerLeft_comp_assoc, w, MonoidalCategory.whiskerLeft_comp_assoc, LaxMonoidalFunctor.associativity_inv_assoc, LaxMonoidalFunctor.associativity_inv_assoc, ← LaxMonoidalFunctor.μ_natural_left, ← comp_whiskerRight_assoc, w, comp_whiskerRight_assoc, reassoc_of% w, braiding_naturality_left_assoc, LaxMonoidalFunctor.associativity_inv, hexagon_reverse_assoc] #align category_theory.braided_category_of_faithful CategoryTheory.braidedCategoryOfFaithful noncomputable def braidedCategoryOfFullyFaithful {C D : Type*} [Category C] [Category D] [MonoidalCategory C] [MonoidalCategory D] (F : MonoidalFunctor C D) [F.Full] [F.Faithful] [BraidedCategory D] : BraidedCategory C := braidedCategoryOfFaithful F (fun X Y => F.toFunctor.preimageIso ((asIso (F.μ _ _)).symm ≪≫ β_ (F.obj X) (F.obj Y) ≪≫ asIso (F.μ _ _))) (by aesop_cat) #align category_theory.braided_category_of_fully_faithful CategoryTheory.braidedCategoryOfFullyFaithful section variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory C] [BraidedCategory C] theorem braiding_leftUnitor_aux₁ (X : C) : (α_ (𝟙_ C) (𝟙_ C) X).hom ≫ (𝟙_ C ◁ (β_ X (𝟙_ C)).inv) ≫ (α_ _ X _).inv ≫ ((λ_ X).hom ▷ _) = ((λ_ _).hom ▷ X) ≫ (β_ X (𝟙_ C)).inv := by coherence #align category_theory.braiding_left_unitor_aux₁ CategoryTheory.braiding_leftUnitor_aux₁ theorem braiding_leftUnitor_aux₂ (X : C) : ((β_ X (𝟙_ C)).hom ▷ 𝟙_ C) ≫ ((λ_ X).hom ▷ 𝟙_ C) = (ρ_ X).hom ▷ 𝟙_ C := calc ((β_ X (𝟙_ C)).hom ▷ 𝟙_ C) ≫ ((λ_ X).hom ▷ 𝟙_ C) = ((β_ X (𝟙_ C)).hom ▷ 𝟙_ C) ≫ (α_ _ _ _).hom ≫ (α_ _ _ _).inv ≫ ((λ_ X).hom ▷ 𝟙_ C) := by coherence _ = ((β_ X (𝟙_ C)).hom ▷ 𝟙_ C) ≫ (α_ _ _ _).hom ≫ (_ ◁ (β_ X _).hom) ≫ (_ ◁ (β_ X _).inv) ≫ (α_ _ _ _).inv ≫ ((λ_ X).hom ▷ 𝟙_ C) := by simp _ = (α_ _ _ _).hom ≫ (β_ _ _).hom ≫ (α_ _ _ _).hom ≫ (_ ◁ (β_ X _).inv) ≫ (α_ _ _ _).inv ≫ ((λ_ X).hom ▷ 𝟙_ C) := by (slice_lhs 1 3 => rw [← hexagon_forward]); simp only [assoc] _ = (α_ _ _ _).hom ≫ (β_ _ _).hom ≫ ((λ_ _).hom ▷ X) ≫ (β_ X _).inv := by rw [braiding_leftUnitor_aux₁] _ = (α_ _ _ _).hom ≫ (_ ◁ (λ_ _).hom) ≫ (β_ _ _).hom ≫ (β_ X _).inv := by (slice_lhs 2 3 => rw [← braiding_naturality_right]); simp only [assoc] _ = (α_ _ _ _).hom ≫ (_ ◁ (λ_ _).hom) := by rw [Iso.hom_inv_id, comp_id] _ = (ρ_ X).hom ▷ 𝟙_ C := by rw [triangle] #align category_theory.braiding_left_unitor_aux₂ CategoryTheory.braiding_leftUnitor_aux₂ @[reassoc]
Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean
295
296
theorem braiding_leftUnitor (X : C) : (β_ X (𝟙_ C)).hom ≫ (λ_ X).hom = (ρ_ X).hom := by
rw [← whiskerRight_iff, comp_whiskerRight, braiding_leftUnitor_aux₂]
import Mathlib.Analysis.Seminorm import Mathlib.Topology.Algebra.Equicontinuity import Mathlib.Topology.MetricSpace.Equicontinuity import Mathlib.Topology.Algebra.FilterBasis import Mathlib.Topology.Algebra.Module.LocallyConvex #align_import analysis.locally_convex.with_seminorms from "leanprover-community/mathlib"@"b31173ee05c911d61ad6a05bd2196835c932e0ec" open NormedField Set Seminorm TopologicalSpace Filter List open NNReal Pointwise Topology Uniformity variable {𝕜 𝕜₂ 𝕝 𝕝₂ E F G ι ι' : Type*} section FilterBasis variable [NormedField 𝕜] [AddCommGroup E] [Module 𝕜 E] variable (𝕜 E ι) abbrev SeminormFamily := ι → Seminorm 𝕜 E #align seminorm_family SeminormFamily variable {𝕜 E ι} namespace SeminormFamily def basisSets (p : SeminormFamily 𝕜 E ι) : Set (Set E) := ⋃ (s : Finset ι) (r) (_ : 0 < r), singleton (ball (s.sup p) (0 : E) r) #align seminorm_family.basis_sets SeminormFamily.basisSets variable (p : SeminormFamily 𝕜 E ι) theorem basisSets_iff {U : Set E} : U ∈ p.basisSets ↔ ∃ (i : Finset ι) (r : ℝ), 0 < r ∧ U = ball (i.sup p) 0 r := by simp only [basisSets, mem_iUnion, exists_prop, mem_singleton_iff] #align seminorm_family.basis_sets_iff SeminormFamily.basisSets_iff theorem basisSets_mem (i : Finset ι) {r : ℝ} (hr : 0 < r) : (i.sup p).ball 0 r ∈ p.basisSets := (basisSets_iff _).mpr ⟨i, _, hr, rfl⟩ #align seminorm_family.basis_sets_mem SeminormFamily.basisSets_mem theorem basisSets_singleton_mem (i : ι) {r : ℝ} (hr : 0 < r) : (p i).ball 0 r ∈ p.basisSets := (basisSets_iff _).mpr ⟨{i}, _, hr, by rw [Finset.sup_singleton]⟩ #align seminorm_family.basis_sets_singleton_mem SeminormFamily.basisSets_singleton_mem theorem basisSets_nonempty [Nonempty ι] : p.basisSets.Nonempty := by let i := Classical.arbitrary ι refine nonempty_def.mpr ⟨(p i).ball 0 1, ?_⟩ exact p.basisSets_singleton_mem i zero_lt_one #align seminorm_family.basis_sets_nonempty SeminormFamily.basisSets_nonempty theorem basisSets_intersect (U V : Set E) (hU : U ∈ p.basisSets) (hV : V ∈ p.basisSets) : ∃ z ∈ p.basisSets, z ⊆ U ∩ V := by classical rcases p.basisSets_iff.mp hU with ⟨s, r₁, hr₁, hU⟩ rcases p.basisSets_iff.mp hV with ⟨t, r₂, hr₂, hV⟩ use ((s ∪ t).sup p).ball 0 (min r₁ r₂) refine ⟨p.basisSets_mem (s ∪ t) (lt_min_iff.mpr ⟨hr₁, hr₂⟩), ?_⟩ rw [hU, hV, ball_finset_sup_eq_iInter _ _ _ (lt_min_iff.mpr ⟨hr₁, hr₂⟩), ball_finset_sup_eq_iInter _ _ _ hr₁, ball_finset_sup_eq_iInter _ _ _ hr₂] exact Set.subset_inter (Set.iInter₂_mono' fun i hi => ⟨i, Finset.subset_union_left hi, ball_mono <| min_le_left _ _⟩) (Set.iInter₂_mono' fun i hi => ⟨i, Finset.subset_union_right hi, ball_mono <| min_le_right _ _⟩) #align seminorm_family.basis_sets_intersect SeminormFamily.basisSets_intersect theorem basisSets_zero (U) (hU : U ∈ p.basisSets) : (0 : E) ∈ U := by rcases p.basisSets_iff.mp hU with ⟨ι', r, hr, hU⟩ rw [hU, mem_ball_zero, map_zero] exact hr #align seminorm_family.basis_sets_zero SeminormFamily.basisSets_zero theorem basisSets_add (U) (hU : U ∈ p.basisSets) : ∃ V ∈ p.basisSets, V + V ⊆ U := by rcases p.basisSets_iff.mp hU with ⟨s, r, hr, hU⟩ use (s.sup p).ball 0 (r / 2) refine ⟨p.basisSets_mem s (div_pos hr zero_lt_two), ?_⟩ refine Set.Subset.trans (ball_add_ball_subset (s.sup p) (r / 2) (r / 2) 0 0) ?_ rw [hU, add_zero, add_halves'] #align seminorm_family.basis_sets_add SeminormFamily.basisSets_add theorem basisSets_neg (U) (hU' : U ∈ p.basisSets) : ∃ V ∈ p.basisSets, V ⊆ (fun x : E => -x) ⁻¹' U := by rcases p.basisSets_iff.mp hU' with ⟨s, r, _, hU⟩ rw [hU, neg_preimage, neg_ball (s.sup p), neg_zero] exact ⟨U, hU', Eq.subset hU⟩ #align seminorm_family.basis_sets_neg SeminormFamily.basisSets_neg protected def addGroupFilterBasis [Nonempty ι] : AddGroupFilterBasis E := addGroupFilterBasisOfComm p.basisSets p.basisSets_nonempty p.basisSets_intersect p.basisSets_zero p.basisSets_add p.basisSets_neg #align seminorm_family.add_group_filter_basis SeminormFamily.addGroupFilterBasis
Mathlib/Analysis/LocallyConvex/WithSeminorms.lean
143
153
theorem basisSets_smul_right (v : E) (U : Set E) (hU : U ∈ p.basisSets) : ∀ᶠ x : 𝕜 in 𝓝 0, x • v ∈ U := by
rcases p.basisSets_iff.mp hU with ⟨s, r, hr, hU⟩ rw [hU, Filter.eventually_iff] simp_rw [(s.sup p).mem_ball_zero, map_smul_eq_mul] by_cases h : 0 < (s.sup p) v · simp_rw [(lt_div_iff h).symm] rw [← _root_.ball_zero_eq] exact Metric.ball_mem_nhds 0 (div_pos hr h) simp_rw [le_antisymm (not_lt.mp h) (apply_nonneg _ v), mul_zero, hr] exact IsOpen.mem_nhds isOpen_univ (mem_univ 0)
import Mathlib.Analysis.NormedSpace.ContinuousAffineMap import Mathlib.Analysis.Calculus.ContDiff.Basic #align_import analysis.calculus.affine_map from "leanprover-community/mathlib"@"839b92fedff9981cf3fe1c1f623e04b0d127f57c" namespace ContinuousAffineMap variable {𝕜 V W : Type*} [NontriviallyNormedField 𝕜] variable [NormedAddCommGroup V] [NormedSpace 𝕜 V] variable [NormedAddCommGroup W] [NormedSpace 𝕜 W]
Mathlib/Analysis/Calculus/AffineMap.lean
30
33
theorem contDiff {n : ℕ∞} (f : V →ᴬ[𝕜] W) : ContDiff 𝕜 n f := by
rw [f.decomp] apply f.contLinear.contDiff.add exact contDiff_const
import Mathlib.Algebra.Polynomial.Degree.TrailingDegree import Mathlib.Algebra.Polynomial.EraseLead import Mathlib.Algebra.Polynomial.Eval #align_import data.polynomial.reverse from "leanprover-community/mathlib"@"44de64f183393284a16016dfb2a48ac97382f2bd" namespace Polynomial open Polynomial Finsupp Finset open Polynomial section Semiring variable {R : Type*} [Semiring R] {f : R[X]} def revAtFun (N i : ℕ) : ℕ := ite (i ≤ N) (N - i) i #align polynomial.rev_at_fun Polynomial.revAtFun theorem revAtFun_invol {N i : ℕ} : revAtFun N (revAtFun N i) = i := by unfold revAtFun split_ifs with h j · exact tsub_tsub_cancel_of_le h · exfalso apply j exact Nat.sub_le N i · rfl #align polynomial.rev_at_fun_invol Polynomial.revAtFun_invol theorem revAtFun_inj {N : ℕ} : Function.Injective (revAtFun N) := by intro a b hab rw [← @revAtFun_invol N a, hab, revAtFun_invol] #align polynomial.rev_at_fun_inj Polynomial.revAtFun_inj def revAt (N : ℕ) : Function.Embedding ℕ ℕ where toFun i := ite (i ≤ N) (N - i) i inj' := revAtFun_inj #align polynomial.rev_at Polynomial.revAt @[simp] theorem revAtFun_eq (N i : ℕ) : revAtFun N i = revAt N i := rfl #align polynomial.rev_at_fun_eq Polynomial.revAtFun_eq @[simp] theorem revAt_invol {N i : ℕ} : (revAt N) (revAt N i) = i := revAtFun_invol #align polynomial.rev_at_invol Polynomial.revAt_invol @[simp] theorem revAt_le {N i : ℕ} (H : i ≤ N) : revAt N i = N - i := if_pos H #align polynomial.rev_at_le Polynomial.revAt_le lemma revAt_eq_self_of_lt {N i : ℕ} (h : N < i) : revAt N i = i := by simp [revAt, Nat.not_le.mpr h] theorem revAt_add {N O n o : ℕ} (hn : n ≤ N) (ho : o ≤ O) : revAt (N + O) (n + o) = revAt N n + revAt O o := by rcases Nat.le.dest hn with ⟨n', rfl⟩ rcases Nat.le.dest ho with ⟨o', rfl⟩ repeat' rw [revAt_le (le_add_right rfl.le)] rw [add_assoc, add_left_comm n' o, ← add_assoc, revAt_le (le_add_right rfl.le)] repeat' rw [add_tsub_cancel_left] #align polynomial.rev_at_add Polynomial.revAt_add -- @[simp] -- Porting note (#10618): simp can prove this theorem revAt_zero (N : ℕ) : revAt N 0 = N := by simp #align polynomial.rev_at_zero Polynomial.revAt_zero noncomputable def reflect (N : ℕ) : R[X] → R[X] | ⟨f⟩ => ⟨Finsupp.embDomain (revAt N) f⟩ #align polynomial.reflect Polynomial.reflect theorem reflect_support (N : ℕ) (f : R[X]) : (reflect N f).support = Finset.image (revAt N) f.support := by rcases f with ⟨⟩ ext1 simp only [reflect, support_ofFinsupp, support_embDomain, Finset.mem_map, Finset.mem_image] #align polynomial.reflect_support Polynomial.reflect_support @[simp] theorem coeff_reflect (N : ℕ) (f : R[X]) (i : ℕ) : coeff (reflect N f) i = f.coeff (revAt N i) := by rcases f with ⟨f⟩ simp only [reflect, coeff] calc Finsupp.embDomain (revAt N) f i = Finsupp.embDomain (revAt N) f (revAt N (revAt N i)) := by rw [revAt_invol] _ = f (revAt N i) := Finsupp.embDomain_apply _ _ _ #align polynomial.coeff_reflect Polynomial.coeff_reflect @[simp] theorem reflect_zero {N : ℕ} : reflect N (0 : R[X]) = 0 := rfl #align polynomial.reflect_zero Polynomial.reflect_zero @[simp] theorem reflect_eq_zero_iff {N : ℕ} {f : R[X]} : reflect N (f : R[X]) = 0 ↔ f = 0 := by rw [ofFinsupp_eq_zero, reflect, embDomain_eq_zero, ofFinsupp_eq_zero] #align polynomial.reflect_eq_zero_iff Polynomial.reflect_eq_zero_iff @[simp] theorem reflect_add (f g : R[X]) (N : ℕ) : reflect N (f + g) = reflect N f + reflect N g := by ext simp only [coeff_add, coeff_reflect] #align polynomial.reflect_add Polynomial.reflect_add @[simp] theorem reflect_C_mul (f : R[X]) (r : R) (N : ℕ) : reflect N (C r * f) = C r * reflect N f := by ext simp only [coeff_reflect, coeff_C_mul] set_option linter.uppercaseLean3 false in #align polynomial.reflect_C_mul Polynomial.reflect_C_mul -- @[simp] -- Porting note (#10618): simp can prove this (once `reflect_monomial` is in simp scope) theorem reflect_C_mul_X_pow (N n : ℕ) {c : R} : reflect N (C c * X ^ n) = C c * X ^ revAt N n := by ext rw [reflect_C_mul, coeff_C_mul, coeff_C_mul, coeff_X_pow, coeff_reflect] split_ifs with h · rw [h, revAt_invol, coeff_X_pow_self] · rw [not_mem_support_iff.mp] intro a rw [← one_mul (X ^ n), ← C_1] at a apply h rw [← mem_support_C_mul_X_pow a, revAt_invol] set_option linter.uppercaseLean3 false in #align polynomial.reflect_C_mul_X_pow Polynomial.reflect_C_mul_X_pow @[simp] theorem reflect_C (r : R) (N : ℕ) : reflect N (C r) = C r * X ^ N := by conv_lhs => rw [← mul_one (C r), ← pow_zero X, reflect_C_mul_X_pow, revAt_zero] set_option linter.uppercaseLean3 false in #align polynomial.reflect_C Polynomial.reflect_C @[simp] theorem reflect_monomial (N n : ℕ) : reflect N ((X : R[X]) ^ n) = X ^ revAt N n := by rw [← one_mul (X ^ n), ← one_mul (X ^ revAt N n), ← C_1, reflect_C_mul_X_pow] #align polynomial.reflect_monomial Polynomial.reflect_monomial @[simp] lemma reflect_one_X : reflect 1 (X : R[X]) = 1 := by simpa using reflect_monomial 1 1 (R := R) theorem reflect_mul_induction (cf cg : ℕ) : ∀ N O : ℕ, ∀ f g : R[X], f.support.card ≤ cf.succ → g.support.card ≤ cg.succ → f.natDegree ≤ N → g.natDegree ≤ O → reflect (N + O) (f * g) = reflect N f * reflect O g := by induction' cf with cf hcf --first induction (left): base case · induction' cg with cg hcg -- second induction (right): base case · intro N O f g Cf Cg Nf Og rw [← C_mul_X_pow_eq_self Cf, ← C_mul_X_pow_eq_self Cg] simp_rw [mul_assoc, X_pow_mul, mul_assoc, ← pow_add (X : R[X]), reflect_C_mul, reflect_monomial, add_comm, revAt_add Nf Og, mul_assoc, X_pow_mul, mul_assoc, ← pow_add (X : R[X]), add_comm] -- second induction (right): induction step · intro N O f g Cf Cg Nf Og by_cases g0 : g = 0 · rw [g0, reflect_zero, mul_zero, mul_zero, reflect_zero] rw [← eraseLead_add_C_mul_X_pow g, mul_add, reflect_add, reflect_add, mul_add, hcg, hcg] <;> try assumption · exact le_add_left card_support_C_mul_X_pow_le_one · exact le_trans (natDegree_C_mul_X_pow_le g.leadingCoeff g.natDegree) Og · exact Nat.lt_succ_iff.mp (gt_of_ge_of_gt Cg (eraseLead_support_card_lt g0)) · exact le_trans eraseLead_natDegree_le_aux Og --first induction (left): induction step · intro N O f g Cf Cg Nf Og by_cases f0 : f = 0 · rw [f0, reflect_zero, zero_mul, zero_mul, reflect_zero] rw [← eraseLead_add_C_mul_X_pow f, add_mul, reflect_add, reflect_add, add_mul, hcf, hcf] <;> try assumption · exact le_add_left card_support_C_mul_X_pow_le_one · exact le_trans (natDegree_C_mul_X_pow_le f.leadingCoeff f.natDegree) Nf · exact Nat.lt_succ_iff.mp (gt_of_ge_of_gt Cf (eraseLead_support_card_lt f0)) · exact le_trans eraseLead_natDegree_le_aux Nf #align polynomial.reflect_mul_induction Polynomial.reflect_mul_induction @[simp] theorem reflect_mul (f g : R[X]) {F G : ℕ} (Ff : f.natDegree ≤ F) (Gg : g.natDegree ≤ G) : reflect (F + G) (f * g) = reflect F f * reflect G g := reflect_mul_induction _ _ F G f g f.support.card.le_succ g.support.card.le_succ Ff Gg #align polynomial.reflect_mul Polynomial.reflect_mul noncomputable def reverse (f : R[X]) : R[X] := reflect f.natDegree f #align polynomial.reverse Polynomial.reverse theorem coeff_reverse (f : R[X]) (n : ℕ) : f.reverse.coeff n = f.coeff (revAt f.natDegree n) := by rw [reverse, coeff_reflect] #align polynomial.coeff_reverse Polynomial.coeff_reverse @[simp] theorem coeff_zero_reverse (f : R[X]) : coeff (reverse f) 0 = leadingCoeff f := by rw [coeff_reverse, revAt_le (zero_le f.natDegree), tsub_zero, leadingCoeff] #align polynomial.coeff_zero_reverse Polynomial.coeff_zero_reverse @[simp] theorem reverse_zero : reverse (0 : R[X]) = 0 := rfl #align polynomial.reverse_zero Polynomial.reverse_zero @[simp] theorem reverse_eq_zero : f.reverse = 0 ↔ f = 0 := by simp [reverse] #align polynomial.reverse_eq_zero Polynomial.reverse_eq_zero theorem reverse_natDegree_le (f : R[X]) : f.reverse.natDegree ≤ f.natDegree := by rw [natDegree_le_iff_degree_le, degree_le_iff_coeff_zero] intro n hn rw [Nat.cast_lt] at hn rw [coeff_reverse, revAt, Function.Embedding.coeFn_mk, if_neg (not_le_of_gt hn), coeff_eq_zero_of_natDegree_lt hn] #align polynomial.reverse_nat_degree_le Polynomial.reverse_natDegree_le theorem natDegree_eq_reverse_natDegree_add_natTrailingDegree (f : R[X]) : f.natDegree = f.reverse.natDegree + f.natTrailingDegree := by by_cases hf : f = 0 · rw [hf, reverse_zero, natDegree_zero, natTrailingDegree_zero] apply le_antisymm · refine tsub_le_iff_right.mp ?_ apply le_natDegree_of_ne_zero rw [reverse, coeff_reflect, ← revAt_le f.natTrailingDegree_le_natDegree, revAt_invol] exact trailingCoeff_nonzero_iff_nonzero.mpr hf · rw [← le_tsub_iff_left f.reverse_natDegree_le] apply natTrailingDegree_le_of_ne_zero have key := mt leadingCoeff_eq_zero.mp (mt reverse_eq_zero.mp hf) rwa [leadingCoeff, coeff_reverse, revAt_le f.reverse_natDegree_le] at key #align polynomial.nat_degree_eq_reverse_nat_degree_add_nat_trailing_degree Polynomial.natDegree_eq_reverse_natDegree_add_natTrailingDegree
Mathlib/Algebra/Polynomial/Reverse.lean
295
296
theorem reverse_natDegree (f : R[X]) : f.reverse.natDegree = f.natDegree - f.natTrailingDegree := by
rw [f.natDegree_eq_reverse_natDegree_add_natTrailingDegree, add_tsub_cancel_right]
import Mathlib.Init.Core import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots import Mathlib.NumberTheory.NumberField.Basic import Mathlib.FieldTheory.Galois #align_import number_theory.cyclotomic.basic from "leanprover-community/mathlib"@"4b05d3f4f0601dca8abf99c4ec99187682ed0bba" open Polynomial Algebra FiniteDimensional Set universe u v w z variable (n : ℕ+) (S T : Set ℕ+) (A : Type u) (B : Type v) (K : Type w) (L : Type z) variable [CommRing A] [CommRing B] [Algebra A B] variable [Field K] [Field L] [Algebra K L] noncomputable section @[mk_iff] class IsCyclotomicExtension : Prop where exists_prim_root {n : ℕ+} (ha : n ∈ S) : ∃ r : B, IsPrimitiveRoot r n adjoin_roots : ∀ x : B, x ∈ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} #align is_cyclotomic_extension IsCyclotomicExtension namespace IsCyclotomicExtension section Basic theorem iff_adjoin_eq_top : IsCyclotomicExtension S A B ↔ (∀ n : ℕ+, n ∈ S → ∃ r : B, IsPrimitiveRoot r n) ∧ adjoin A {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} = ⊤ := ⟨fun h => ⟨fun _ => h.exists_prim_root, Algebra.eq_top_iff.2 h.adjoin_roots⟩, fun h => ⟨h.1 _, Algebra.eq_top_iff.1 h.2⟩⟩ #align is_cyclotomic_extension.iff_adjoin_eq_top IsCyclotomicExtension.iff_adjoin_eq_top theorem iff_singleton : IsCyclotomicExtension {n} A B ↔ (∃ r : B, IsPrimitiveRoot r n) ∧ ∀ x, x ∈ adjoin A {b : B | b ^ (n : ℕ) = 1} := by simp [isCyclotomicExtension_iff] #align is_cyclotomic_extension.iff_singleton IsCyclotomicExtension.iff_singleton theorem empty [h : IsCyclotomicExtension ∅ A B] : (⊥ : Subalgebra A B) = ⊤ := by simpa [Algebra.eq_top_iff, isCyclotomicExtension_iff] using h #align is_cyclotomic_extension.empty IsCyclotomicExtension.empty theorem singleton_one [h : IsCyclotomicExtension {1} A B] : (⊥ : Subalgebra A B) = ⊤ := Algebra.eq_top_iff.2 fun x => by simpa [adjoin_singleton_one] using ((isCyclotomicExtension_iff _ _ _).1 h).2 x #align is_cyclotomic_extension.singleton_one IsCyclotomicExtension.singleton_one variable {A B} theorem singleton_zero_of_bot_eq_top (h : (⊥ : Subalgebra A B) = ⊤) : IsCyclotomicExtension ∅ A B := by -- Porting note: Lean3 is able to infer `A`. refine (iff_adjoin_eq_top _ A _).2 ⟨fun s hs => by simp at hs, _root_.eq_top_iff.2 fun x hx => ?_⟩ rw [← h] at hx simpa using hx #align is_cyclotomic_extension.singleton_zero_of_bot_eq_top IsCyclotomicExtension.singleton_zero_of_bot_eq_top variable (A B) theorem trans (C : Type w) [CommRing C] [Algebra A C] [Algebra B C] [IsScalarTower A B C] [hS : IsCyclotomicExtension S A B] [hT : IsCyclotomicExtension T B C] (h : Function.Injective (algebraMap B C)) : IsCyclotomicExtension (S ∪ T) A C := by refine ⟨fun hn => ?_, fun x => ?_⟩ · cases' hn with hn hn · obtain ⟨b, hb⟩ := ((isCyclotomicExtension_iff _ _ _).1 hS).1 hn refine ⟨algebraMap B C b, ?_⟩ exact hb.map_of_injective h · exact ((isCyclotomicExtension_iff _ _ _).1 hT).1 hn · refine adjoin_induction (((isCyclotomicExtension_iff T B _).1 hT).2 x) (fun c ⟨n, hn⟩ => subset_adjoin ⟨n, Or.inr hn.1, hn.2⟩) (fun b => ?_) (fun x y hx hy => Subalgebra.add_mem _ hx hy) fun x y hx hy => Subalgebra.mul_mem _ hx hy let f := IsScalarTower.toAlgHom A B C have hb : f b ∈ (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}).map f := ⟨b, ((isCyclotomicExtension_iff _ _ _).1 hS).2 b, rfl⟩ rw [IsScalarTower.toAlgHom_apply, ← adjoin_image] at hb refine adjoin_mono (fun y hy => ?_) hb obtain ⟨b₁, ⟨⟨n, hn⟩, h₁⟩⟩ := hy exact ⟨n, ⟨mem_union_left T hn.1, by rw [← h₁, ← AlgHom.map_pow, hn.2, AlgHom.map_one]⟩⟩ #align is_cyclotomic_extension.trans IsCyclotomicExtension.trans @[nontriviality] theorem subsingleton_iff [Subsingleton B] : IsCyclotomicExtension S A B ↔ S = { } ∨ S = {1} := by have : Subsingleton (Subalgebra A B) := inferInstance constructor · rintro ⟨hprim, -⟩ rw [← subset_singleton_iff_eq] intro t ht obtain ⟨ζ, hζ⟩ := hprim ht rw [mem_singleton_iff, ← PNat.coe_eq_one_iff] exact mod_cast hζ.unique (IsPrimitiveRoot.of_subsingleton ζ) · rintro (rfl | rfl) -- Porting note: `R := A` was not needed. · exact ⟨fun h => h.elim, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩ · rw [iff_singleton] exact ⟨⟨0, IsPrimitiveRoot.of_subsingleton 0⟩, fun x => by convert (mem_top (R := A) : x ∈ ⊤)⟩ #align is_cyclotomic_extension.subsingleton_iff IsCyclotomicExtension.subsingleton_iff
Mathlib/NumberTheory/Cyclotomic/Basic.lean
174
188
theorem union_right [h : IsCyclotomicExtension (S ∪ T) A B] : IsCyclotomicExtension T (adjoin A {b : B | ∃ a : ℕ+, a ∈ S ∧ b ^ (a : ℕ) = 1}) B := by
have : {b : B | ∃ n : ℕ+, n ∈ S ∪ T ∧ b ^ (n : ℕ) = 1} = {b : B | ∃ n : ℕ+, n ∈ S ∧ b ^ (n : ℕ) = 1} ∪ {b : B | ∃ n : ℕ+, n ∈ T ∧ b ^ (n : ℕ) = 1} := by refine le_antisymm ?_ ?_ · rintro x ⟨n, hn₁ | hn₂, hnpow⟩ · left; exact ⟨n, hn₁, hnpow⟩ · right; exact ⟨n, hn₂, hnpow⟩ · rintro x (⟨n, hn⟩ | ⟨n, hn⟩) · exact ⟨n, Or.inl hn.1, hn.2⟩ · exact ⟨n, Or.inr hn.1, hn.2⟩ refine ⟨fun hn => ((isCyclotomicExtension_iff _ A _).1 h).1 (mem_union_right S hn), fun b => ?_⟩ replace h := ((isCyclotomicExtension_iff _ _ _).1 h).2 b rwa [this, adjoin_union_eq_adjoin_adjoin, Subalgebra.mem_restrictScalars] at h
import Mathlib.NumberTheory.LegendreSymbol.JacobiSymbol #align_import number_theory.legendre_symbol.norm_num from "leanprover-community/mathlib"@"e2621d935895abe70071ab828a4ee6e26a52afe4" section Lemmas namespace Mathlib.Meta.NormNum def jacobiSymNat (a b : ℕ) : ℤ := jacobiSym a b #align norm_num.jacobi_sym_nat Mathlib.Meta.NormNum.jacobiSymNat theorem jacobiSymNat.zero_right (a : ℕ) : jacobiSymNat a 0 = 1 := by rw [jacobiSymNat, jacobiSym.zero_right] #align norm_num.jacobi_sym_nat.zero_right Mathlib.Meta.NormNum.jacobiSymNat.zero_right theorem jacobiSymNat.one_right (a : ℕ) : jacobiSymNat a 1 = 1 := by rw [jacobiSymNat, jacobiSym.one_right] #align norm_num.jacobi_sym_nat.one_right Mathlib.Meta.NormNum.jacobiSymNat.one_right theorem jacobiSymNat.zero_left (b : ℕ) (hb : Nat.beq (b / 2) 0 = false) : jacobiSymNat 0 b = 0 := by rw [jacobiSymNat, Nat.cast_zero, jacobiSym.zero_left ?_] calc 1 < 2 * 1 := by decide _ ≤ 2 * (b / 2) := Nat.mul_le_mul_left _ (Nat.succ_le.mpr (Nat.pos_of_ne_zero (Nat.ne_of_beq_eq_false hb))) _ ≤ b := Nat.mul_div_le b 2 #align norm_num.jacobi_sym_nat.zero_left_even Mathlib.Meta.NormNum.jacobiSymNat.zero_left #align norm_num.jacobi_sym_nat.zero_left_odd Mathlib.Meta.NormNum.jacobiSymNat.zero_left theorem jacobiSymNat.one_left (b : ℕ) : jacobiSymNat 1 b = 1 := by rw [jacobiSymNat, Nat.cast_one, jacobiSym.one_left] #align norm_num.jacobi_sym_nat.one_left_even Mathlib.Meta.NormNum.jacobiSymNat.one_left #align norm_num.jacobi_sym_nat.one_left_odd Mathlib.Meta.NormNum.jacobiSymNat.one_left theorem LegendreSym.to_jacobiSym (p : ℕ) (pp : Fact p.Prime) (a r : ℤ) (hr : IsInt (jacobiSym a p) r) : IsInt (legendreSym p a) r := by rwa [@jacobiSym.legendreSym.to_jacobiSym p pp a] #align norm_num.legendre_sym.to_jacobi_sym Mathlib.Meta.NormNum.LegendreSym.to_jacobiSym theorem JacobiSym.mod_left (a : ℤ) (b ab' : ℕ) (ab r b' : ℤ) (hb' : (b : ℤ) = b') (hab : a % b' = ab) (h : (ab' : ℤ) = ab) (hr : jacobiSymNat ab' b = r) : jacobiSym a b = r := by rw [← hr, jacobiSymNat, jacobiSym.mod_left, hb', hab, ← h] #align norm_num.jacobi_sym.mod_left Mathlib.Meta.NormNum.JacobiSym.mod_left theorem jacobiSymNat.mod_left (a b ab : ℕ) (r : ℤ) (hab : a % b = ab) (hr : jacobiSymNat ab b = r) : jacobiSymNat a b = r := by rw [← hr, jacobiSymNat, jacobiSymNat, _root_.jacobiSym.mod_left a b, ← hab]; rfl #align norm_num.jacobi_sym_nat.mod_left Mathlib.Meta.NormNum.jacobiSymNat.mod_left theorem jacobiSymNat.even_even (a b : ℕ) (hb₀ : Nat.beq (b / 2) 0 = false) (ha : a % 2 = 0) (hb₁ : b % 2 = 0) : jacobiSymNat a b = 0 := by refine jacobiSym.eq_zero_iff.mpr ⟨ne_of_gt ((Nat.pos_of_ne_zero (Nat.ne_of_beq_eq_false hb₀)).trans_le (Nat.div_le_self b 2)), fun hf => ?_⟩ have h : 2 ∣ a.gcd b := Nat.dvd_gcd (Nat.dvd_of_mod_eq_zero ha) (Nat.dvd_of_mod_eq_zero hb₁) change 2 ∣ (a : ℤ).gcd b at h rw [hf, ← even_iff_two_dvd] at h exact Nat.not_even_one h #align norm_num.jacobi_sym_nat.even_even Mathlib.Meta.NormNum.jacobiSymNat.even_even
Mathlib/Tactic/NormNum/LegendreSymbol.lean
121
131
theorem jacobiSymNat.odd_even (a b c : ℕ) (r : ℤ) (ha : a % 2 = 1) (hb : b % 2 = 0) (hc : b / 2 = c) (hr : jacobiSymNat a c = r) : jacobiSymNat a b = r := by
have ha' : legendreSym 2 a = 1 := by simp only [legendreSym.mod 2 a, Int.ofNat_mod_ofNat, ha] decide rcases eq_or_ne c 0 with (rfl | hc') · rw [← hr, Nat.eq_zero_of_dvd_of_div_eq_zero (Nat.dvd_of_mod_eq_zero hb) hc] · haveI : NeZero c := ⟨hc'⟩ -- for `jacobiSym.mul_right` rwa [← Nat.mod_add_div b 2, hb, hc, Nat.zero_add, jacobiSymNat, jacobiSym.mul_right, ← jacobiSym.legendreSym.to_jacobiSym, ha', one_mul]
import Mathlib.Algebra.Order.Ring.Defs import Mathlib.Data.Set.Finite #align_import order.filter.basic from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494" set_option autoImplicit true open Function Set Order open scoped Classical universe u v w x y structure Filter (α : Type*) where sets : Set (Set α) univ_sets : Set.univ ∈ sets sets_of_superset {x y} : x ∈ sets → x ⊆ y → y ∈ sets inter_sets {x y} : x ∈ sets → y ∈ sets → x ∩ y ∈ sets #align filter Filter instance {α : Type*} : Membership (Set α) (Filter α) := ⟨fun U F => U ∈ F.sets⟩ namespace Filter variable {α : Type u} {f g : Filter α} {s t : Set α} @[simp] protected theorem mem_mk {t : Set (Set α)} {h₁ h₂ h₃} : s ∈ mk t h₁ h₂ h₃ ↔ s ∈ t := Iff.rfl #align filter.mem_mk Filter.mem_mk @[simp] protected theorem mem_sets : s ∈ f.sets ↔ s ∈ f := Iff.rfl #align filter.mem_sets Filter.mem_sets instance inhabitedMem : Inhabited { s : Set α // s ∈ f } := ⟨⟨univ, f.univ_sets⟩⟩ #align filter.inhabited_mem Filter.inhabitedMem theorem filter_eq : ∀ {f g : Filter α}, f.sets = g.sets → f = g | ⟨_, _, _, _⟩, ⟨_, _, _, _⟩, rfl => rfl #align filter.filter_eq Filter.filter_eq theorem filter_eq_iff : f = g ↔ f.sets = g.sets := ⟨congr_arg _, filter_eq⟩ #align filter.filter_eq_iff Filter.filter_eq_iff protected theorem ext_iff : f = g ↔ ∀ s, s ∈ f ↔ s ∈ g := by simp only [filter_eq_iff, ext_iff, Filter.mem_sets] #align filter.ext_iff Filter.ext_iff @[ext] protected theorem ext : (∀ s, s ∈ f ↔ s ∈ g) → f = g := Filter.ext_iff.2 #align filter.ext Filter.ext protected theorem coext (h : ∀ s, sᶜ ∈ f ↔ sᶜ ∈ g) : f = g := Filter.ext <| compl_surjective.forall.2 h #align filter.coext Filter.coext @[simp] theorem univ_mem : univ ∈ f := f.univ_sets #align filter.univ_mem Filter.univ_mem theorem mem_of_superset {x y : Set α} (hx : x ∈ f) (hxy : x ⊆ y) : y ∈ f := f.sets_of_superset hx hxy #align filter.mem_of_superset Filter.mem_of_superset instance : Trans (· ⊇ ·) ((· ∈ ·) : Set α → Filter α → Prop) (· ∈ ·) where trans h₁ h₂ := mem_of_superset h₂ h₁ theorem inter_mem {s t : Set α} (hs : s ∈ f) (ht : t ∈ f) : s ∩ t ∈ f := f.inter_sets hs ht #align filter.inter_mem Filter.inter_mem @[simp] theorem inter_mem_iff {s t : Set α} : s ∩ t ∈ f ↔ s ∈ f ∧ t ∈ f := ⟨fun h => ⟨mem_of_superset h inter_subset_left, mem_of_superset h inter_subset_right⟩, and_imp.2 inter_mem⟩ #align filter.inter_mem_iff Filter.inter_mem_iff theorem diff_mem {s t : Set α} (hs : s ∈ f) (ht : tᶜ ∈ f) : s \ t ∈ f := inter_mem hs ht #align filter.diff_mem Filter.diff_mem theorem univ_mem' (h : ∀ a, a ∈ s) : s ∈ f := mem_of_superset univ_mem fun x _ => h x #align filter.univ_mem' Filter.univ_mem' theorem mp_mem (hs : s ∈ f) (h : { x | x ∈ s → x ∈ t } ∈ f) : t ∈ f := mem_of_superset (inter_mem hs h) fun _ ⟨h₁, h₂⟩ => h₂ h₁ #align filter.mp_mem Filter.mp_mem theorem congr_sets (h : { x | x ∈ s ↔ x ∈ t } ∈ f) : s ∈ f ↔ t ∈ f := ⟨fun hs => mp_mem hs (mem_of_superset h fun _ => Iff.mp), fun hs => mp_mem hs (mem_of_superset h fun _ => Iff.mpr)⟩ #align filter.congr_sets Filter.congr_sets protected def copy (f : Filter α) (S : Set (Set α)) (hmem : ∀ s, s ∈ S ↔ s ∈ f) : Filter α where sets := S univ_sets := (hmem _).2 univ_mem sets_of_superset h hsub := (hmem _).2 <| mem_of_superset ((hmem _).1 h) hsub inter_sets h₁ h₂ := (hmem _).2 <| inter_mem ((hmem _).1 h₁) ((hmem _).1 h₂) lemma copy_eq {S} (hmem : ∀ s, s ∈ S ↔ s ∈ f) : f.copy S hmem = f := Filter.ext hmem @[simp] lemma mem_copy {S hmem} : s ∈ f.copy S hmem ↔ s ∈ S := Iff.rfl @[simp] theorem biInter_mem {β : Type v} {s : β → Set α} {is : Set β} (hf : is.Finite) : (⋂ i ∈ is, s i) ∈ f ↔ ∀ i ∈ is, s i ∈ f := Finite.induction_on hf (by simp) fun _ _ hs => by simp [hs] #align filter.bInter_mem Filter.biInter_mem @[simp] theorem biInter_finset_mem {β : Type v} {s : β → Set α} (is : Finset β) : (⋂ i ∈ is, s i) ∈ f ↔ ∀ i ∈ is, s i ∈ f := biInter_mem is.finite_toSet #align filter.bInter_finset_mem Filter.biInter_finset_mem alias _root_.Finset.iInter_mem_sets := biInter_finset_mem #align finset.Inter_mem_sets Finset.iInter_mem_sets -- attribute [protected] Finset.iInter_mem_sets porting note: doesn't work @[simp] theorem sInter_mem {s : Set (Set α)} (hfin : s.Finite) : ⋂₀ s ∈ f ↔ ∀ U ∈ s, U ∈ f := by rw [sInter_eq_biInter, biInter_mem hfin] #align filter.sInter_mem Filter.sInter_mem @[simp] theorem iInter_mem {β : Sort v} {s : β → Set α} [Finite β] : (⋂ i, s i) ∈ f ↔ ∀ i, s i ∈ f := (sInter_mem (finite_range _)).trans forall_mem_range #align filter.Inter_mem Filter.iInter_mem theorem exists_mem_subset_iff : (∃ t ∈ f, t ⊆ s) ↔ s ∈ f := ⟨fun ⟨_, ht, ts⟩ => mem_of_superset ht ts, fun hs => ⟨s, hs, Subset.rfl⟩⟩ #align filter.exists_mem_subset_iff Filter.exists_mem_subset_iff theorem monotone_mem {f : Filter α} : Monotone fun s => s ∈ f := fun _ _ hst h => mem_of_superset h hst #align filter.monotone_mem Filter.monotone_mem
Mathlib/Order/Filter/Basic.lean
233
240
theorem exists_mem_and_iff {P : Set α → Prop} {Q : Set α → Prop} (hP : Antitone P) (hQ : Antitone Q) : ((∃ u ∈ f, P u) ∧ ∃ u ∈ f, Q u) ↔ ∃ u ∈ f, P u ∧ Q u := by
constructor · rintro ⟨⟨u, huf, hPu⟩, v, hvf, hQv⟩ exact ⟨u ∩ v, inter_mem huf hvf, hP inter_subset_left hPu, hQ inter_subset_right hQv⟩ · rintro ⟨u, huf, hPu, hQu⟩ exact ⟨⟨u, huf, hPu⟩, u, huf, hQu⟩
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order import Mathlib.Topology.Order.LeftRightLim #align_import measure_theory.measure.stieltjes from "leanprover-community/mathlib"@"20d5763051978e9bc6428578ed070445df6a18b3" noncomputable section open scoped Classical open Set Filter Function ENNReal NNReal Topology MeasureTheory open ENNReal (ofReal) structure StieltjesFunction where toFun : ℝ → ℝ mono' : Monotone toFun right_continuous' : ∀ x, ContinuousWithinAt toFun (Ici x) x #align stieltjes_function StieltjesFunction #align stieltjes_function.to_fun StieltjesFunction.toFun #align stieltjes_function.mono' StieltjesFunction.mono' #align stieltjes_function.right_continuous' StieltjesFunction.right_continuous' namespace StieltjesFunction attribute [coe] toFun instance instCoeFun : CoeFun StieltjesFunction fun _ => ℝ → ℝ := ⟨toFun⟩ #align stieltjes_function.has_coe_to_fun StieltjesFunction.instCoeFun initialize_simps_projections StieltjesFunction (toFun → apply) @[ext] lemma ext {f g : StieltjesFunction} (h : ∀ x, f x = g x) : f = g := by exact (StieltjesFunction.mk.injEq ..).mpr (funext (by exact h)) variable (f : StieltjesFunction) theorem mono : Monotone f := f.mono' #align stieltjes_function.mono StieltjesFunction.mono theorem right_continuous (x : ℝ) : ContinuousWithinAt f (Ici x) x := f.right_continuous' x #align stieltjes_function.right_continuous StieltjesFunction.right_continuous theorem rightLim_eq (f : StieltjesFunction) (x : ℝ) : Function.rightLim f x = f x := by rw [← f.mono.continuousWithinAt_Ioi_iff_rightLim_eq, continuousWithinAt_Ioi_iff_Ici] exact f.right_continuous' x #align stieltjes_function.right_lim_eq StieltjesFunction.rightLim_eq
Mathlib/MeasureTheory/Measure/Stieltjes.lean
76
80
theorem iInf_Ioi_eq (f : StieltjesFunction) (x : ℝ) : ⨅ r : Ioi x, f r = f x := by
suffices Function.rightLim f x = ⨅ r : Ioi x, f r by rw [← this, f.rightLim_eq] rw [f.mono.rightLim_eq_sInf, sInf_image'] rw [← neBot_iff] infer_instance
import Mathlib.Analysis.Calculus.Deriv.Inv import Mathlib.Analysis.Calculus.Deriv.Polynomial import Mathlib.Analysis.SpecialFunctions.ExpDeriv import Mathlib.Analysis.SpecialFunctions.PolynomialExp #align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open scoped Classical Topology open Polynomial Real Filter Set Function open scoped Polynomial def expNegInvGlue (x : ℝ) : ℝ := if x ≤ 0 then 0 else exp (-x⁻¹) #align exp_neg_inv_glue expNegInvGlue namespace expNegInvGlue
Mathlib/Analysis/SpecialFunctions/SmoothTransition.lean
46
46
theorem zero_of_nonpos {x : ℝ} (hx : x ≤ 0) : expNegInvGlue x = 0 := by
simp [expNegInvGlue, hx]
import Mathlib.Data.Nat.Choose.Basic import Mathlib.Data.List.Perm import Mathlib.Data.List.Range #align_import data.list.sublists from "leanprover-community/mathlib"@"ccad6d5093bd2f5c6ca621fc74674cce51355af6" universe u v w variable {α : Type u} {β : Type v} {γ : Type w} open Nat namespace List @[simp] theorem sublists'_nil : sublists' (@nil α) = [[]] := rfl #align list.sublists'_nil List.sublists'_nil @[simp] theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] := rfl #align list.sublists'_singleton List.sublists'_singleton #noalign list.map_sublists'_aux #noalign list.sublists'_aux_append #noalign list.sublists'_aux_eq_sublists' -- Porting note: Not the same as `sublists'_aux` from Lean3 def sublists'Aux (a : α) (r₁ r₂ : List (List α)) : List (List α) := r₁.foldl (init := r₂) fun r l => r ++ [a :: l] #align list.sublists'_aux List.sublists'Aux theorem sublists'Aux_eq_array_foldl (a : α) : ∀ (r₁ r₂ : List (List α)), sublists'Aux a r₁ r₂ = ((r₁.toArray).foldl (init := r₂.toArray) (fun r l => r.push (a :: l))).toList := by intro r₁ r₂ rw [sublists'Aux, Array.foldl_eq_foldl_data] have := List.foldl_hom Array.toList (fun r l => r.push (a :: l)) (fun r l => r ++ [a :: l]) r₁ r₂.toArray (by simp) simpa using this theorem sublists'_eq_sublists'Aux (l : List α) : sublists' l = l.foldr (fun a r => sublists'Aux a r r) [[]] := by simp only [sublists', sublists'Aux_eq_array_foldl] rw [← List.foldr_hom Array.toList] · rfl · intros _ _; congr <;> simp theorem sublists'Aux_eq_map (a : α) (r₁ : List (List α)) : ∀ (r₂ : List (List α)), sublists'Aux a r₁ r₂ = r₂ ++ map (cons a) r₁ := List.reverseRecOn r₁ (fun _ => by simp [sublists'Aux]) fun r₁ l ih r₂ => by rw [map_append, map_singleton, ← append_assoc, ← ih, sublists'Aux, foldl_append, foldl] simp [sublists'Aux] -- Porting note: simp can prove `sublists'_singleton` @[simp 900] theorem sublists'_cons (a : α) (l : List α) : sublists' (a :: l) = sublists' l ++ map (cons a) (sublists' l) := by simp [sublists'_eq_sublists'Aux, foldr_cons, sublists'Aux_eq_map] #align list.sublists'_cons List.sublists'_cons @[simp] theorem mem_sublists' {s t : List α} : s ∈ sublists' t ↔ s <+ t := by induction' t with a t IH generalizing s · simp only [sublists'_nil, mem_singleton] exact ⟨fun h => by rw [h], eq_nil_of_sublist_nil⟩ simp only [sublists'_cons, mem_append, IH, mem_map] constructor <;> intro h · rcases h with (h | ⟨s, h, rfl⟩) · exact sublist_cons_of_sublist _ h · exact h.cons_cons _ · cases' h with _ _ _ h s _ _ h · exact Or.inl h · exact Or.inr ⟨s, h, rfl⟩ #align list.mem_sublists' List.mem_sublists' @[simp] theorem length_sublists' : ∀ l : List α, length (sublists' l) = 2 ^ length l | [] => rfl | a :: l => by simp_arith only [sublists'_cons, length_append, length_sublists' l, length_map, length, Nat.pow_succ'] #align list.length_sublists' List.length_sublists' @[simp] theorem sublists_nil : sublists (@nil α) = [[]] := rfl #align list.sublists_nil List.sublists_nil @[simp] theorem sublists_singleton (a : α) : sublists [a] = [[], [a]] := rfl #align list.sublists_singleton List.sublists_singleton -- Porting note: Not the same as `sublists_aux` from Lean3 def sublistsAux (a : α) (r : List (List α)) : List (List α) := r.foldl (init := []) fun r l => r ++ [l, a :: l] #align list.sublists_aux List.sublistsAux theorem sublistsAux_eq_array_foldl : sublistsAux = fun (a : α) (r : List (List α)) => (r.toArray.foldl (init := #[]) fun r l => (r.push l).push (a :: l)).toList := by funext a r simp only [sublistsAux, Array.foldl_eq_foldl_data, Array.mkEmpty] have := foldl_hom Array.toList (fun r l => (r.push l).push (a :: l)) (fun (r : List (List α)) l => r ++ [l, a :: l]) r #[] (by simp) simpa using this theorem sublistsAux_eq_bind : sublistsAux = fun (a : α) (r : List (List α)) => r.bind fun l => [l, a :: l] := funext fun a => funext fun r => List.reverseRecOn r (by simp [sublistsAux]) (fun r l ih => by rw [append_bind, ← ih, bind_singleton, sublistsAux, foldl_append] simp [sublistsAux]) @[csimp] theorem sublists_eq_sublistsFast : @sublists = @sublistsFast := by ext α l : 2 trans l.foldr sublistsAux [[]] · rw [sublistsAux_eq_bind, sublists] · simp only [sublistsFast, sublistsAux_eq_array_foldl, Array.foldr_eq_foldr_data] rw [← foldr_hom Array.toList] · rfl · intros _ _; congr <;> simp #noalign list.sublists_aux₁_eq_sublists_aux #noalign list.sublists_aux_cons_eq_sublists_aux₁ #noalign list.sublists_aux_eq_foldr.aux #noalign list.sublists_aux_eq_foldr #noalign list.sublists_aux_cons_cons #noalign list.sublists_aux₁_append #noalign list.sublists_aux₁_concat #noalign list.sublists_aux₁_bind #noalign list.sublists_aux_cons_append theorem sublists_append (l₁ l₂ : List α) : sublists (l₁ ++ l₂) = (sublists l₂) >>= (fun x => (sublists l₁).map (· ++ x)) := by simp only [sublists, foldr_append] induction l₁ with | nil => simp | cons a l₁ ih => rw [foldr_cons, ih] simp [List.bind, join_join, Function.comp] #align list.sublists_append List.sublists_append -- Porting note (#10756): new theorem theorem sublists_cons (a : α) (l : List α) : sublists (a :: l) = sublists l >>= (fun x => [x, a :: x]) := show sublists ([a] ++ l) = _ by rw [sublists_append] simp only [sublists_singleton, map_cons, bind_eq_bind, nil_append, cons_append, map_nil] @[simp] theorem sublists_concat (l : List α) (a : α) : sublists (l ++ [a]) = sublists l ++ map (fun x => x ++ [a]) (sublists l) := by rw [sublists_append, sublists_singleton, bind_eq_bind, cons_bind, cons_bind, nil_bind, map_id'' append_nil, append_nil] #align list.sublists_concat List.sublists_concat theorem sublists_reverse (l : List α) : sublists (reverse l) = map reverse (sublists' l) := by induction' l with hd tl ih <;> [rfl; simp only [reverse_cons, sublists_append, sublists'_cons, map_append, ih, sublists_singleton, map_eq_map, bind_eq_bind, map_map, cons_bind, append_nil, nil_bind, (· ∘ ·)]] #align list.sublists_reverse List.sublists_reverse theorem sublists_eq_sublists' (l : List α) : sublists l = map reverse (sublists' (reverse l)) := by rw [← sublists_reverse, reverse_reverse] #align list.sublists_eq_sublists' List.sublists_eq_sublists' theorem sublists'_reverse (l : List α) : sublists' (reverse l) = map reverse (sublists l) := by simp only [sublists_eq_sublists', map_map, map_id'' reverse_reverse, Function.comp] #align list.sublists'_reverse List.sublists'_reverse
Mathlib/Data/List/Sublists.lean
197
198
theorem sublists'_eq_sublists (l : List α) : sublists' l = map reverse (sublists (reverse l)) := by
rw [← sublists'_reverse, reverse_reverse]
import Mathlib.Analysis.Calculus.Deriv.Basic import Mathlib.Analysis.Calculus.ContDiff.Defs #align_import analysis.calculus.iterated_deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe" noncomputable section open scoped Classical Topology open Filter Asymptotics Set variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] def iteratedDeriv (n : ℕ) (f : 𝕜 → F) (x : 𝕜) : F := (iteratedFDeriv 𝕜 n f x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv iteratedDeriv def iteratedDerivWithin (n : ℕ) (f : 𝕜 → F) (s : Set 𝕜) (x : 𝕜) : F := (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 #align iterated_deriv_within iteratedDerivWithin variable {n : ℕ} {f : 𝕜 → F} {s : Set 𝕜} {x : 𝕜} theorem iteratedDerivWithin_univ : iteratedDerivWithin n f univ = iteratedDeriv n f := by ext x rw [iteratedDerivWithin, iteratedDeriv, iteratedFDerivWithin_univ] #align iterated_deriv_within_univ iteratedDerivWithin_univ theorem iteratedDerivWithin_eq_iteratedFDerivWithin : iteratedDerivWithin n f s x = (iteratedFDerivWithin 𝕜 n f s x : (Fin n → 𝕜) → F) fun _ : Fin n => 1 := rfl #align iterated_deriv_within_eq_iterated_fderiv_within iteratedDerivWithin_eq_iteratedFDerivWithin theorem iteratedDerivWithin_eq_equiv_comp : iteratedDerivWithin n f s = (ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F).symm ∘ iteratedFDerivWithin 𝕜 n f s := by ext x; rfl #align iterated_deriv_within_eq_equiv_comp iteratedDerivWithin_eq_equiv_comp
Mathlib/Analysis/Calculus/IteratedDeriv/Defs.lean
91
95
theorem iteratedFDerivWithin_eq_equiv_comp : iteratedFDerivWithin 𝕜 n f s = ContinuousMultilinearMap.piFieldEquiv 𝕜 (Fin n) F ∘ iteratedDerivWithin n f s := by
rw [iteratedDerivWithin_eq_equiv_comp, ← Function.comp.assoc, LinearIsometryEquiv.self_comp_symm, Function.id_comp]
import Mathlib.Analysis.Calculus.ContDiff.Basic import Mathlib.Analysis.Calculus.ParametricIntegral import Mathlib.MeasureTheory.Constructions.Prod.Integral import Mathlib.MeasureTheory.Function.LocallyIntegrable import Mathlib.MeasureTheory.Group.Integral import Mathlib.MeasureTheory.Group.Prod import Mathlib.MeasureTheory.Integral.IntervalIntegral #align_import analysis.convolution from "leanprover-community/mathlib"@"8905e5ed90859939681a725b00f6063e65096d95" open Set Function Filter MeasureTheory MeasureTheory.Measure TopologicalSpace open ContinuousLinearMap Metric Bornology open scoped Pointwise Topology NNReal Filter universe u𝕜 uG uE uE' uE'' uF uF' uF'' uP variable {𝕜 : Type u𝕜} {G : Type uG} {E : Type uE} {E' : Type uE'} {E'' : Type uE''} {F : Type uF} {F' : Type uF'} {F'' : Type uF''} {P : Type uP} variable [NormedAddCommGroup E] [NormedAddCommGroup E'] [NormedAddCommGroup E''] [NormedAddCommGroup F] {f f' : G → E} {g g' : G → E'} {x x' : G} {y y' : E} namespace MeasureTheory section NontriviallyNormedField variable [NontriviallyNormedField 𝕜] variable [NormedSpace 𝕜 E] [NormedSpace 𝕜 E'] [NormedSpace 𝕜 E''] [NormedSpace 𝕜 F] variable (L : E →L[𝕜] E' →L[𝕜] F) section Measurability variable [MeasurableSpace G] {μ ν : Measure G} def ConvolutionExistsAt [Sub G] (f : G → E) (g : G → E') (x : G) (L : E →L[𝕜] E' →L[𝕜] F) (μ : Measure G := by volume_tac) : Prop := Integrable (fun t => L (f t) (g (x - t))) μ #align convolution_exists_at MeasureTheory.ConvolutionExistsAt def ConvolutionExists [Sub G] (f : G → E) (g : G → E') (L : E →L[𝕜] E' →L[𝕜] F) (μ : Measure G := by volume_tac) : Prop := ∀ x : G, ConvolutionExistsAt f g x L μ #align convolution_exists MeasureTheory.ConvolutionExists section ConvolutionExists variable {L} in theorem ConvolutionExistsAt.integrable [Sub G] {x : G} (h : ConvolutionExistsAt f g x L μ) : Integrable (fun t => L (f t) (g (x - t))) μ := h #align convolution_exists_at.integrable MeasureTheory.ConvolutionExistsAt.integrable section Group variable [AddGroup G] theorem AEStronglyMeasurable.convolution_integrand' [MeasurableAdd₂ G] [MeasurableNeg G] [SigmaFinite ν] (hf : AEStronglyMeasurable f ν) (hg : AEStronglyMeasurable g <| map (fun p : G × G => p.1 - p.2) (μ.prod ν)) : AEStronglyMeasurable (fun p : G × G => L (f p.2) (g (p.1 - p.2))) (μ.prod ν) := L.aestronglyMeasurable_comp₂ hf.snd <| hg.comp_measurable measurable_sub #align measure_theory.ae_strongly_measurable.convolution_integrand' MeasureTheory.AEStronglyMeasurable.convolution_integrand' section variable [MeasurableAdd G] [MeasurableNeg G] theorem AEStronglyMeasurable.convolution_integrand_snd' (hf : AEStronglyMeasurable f μ) {x : G} (hg : AEStronglyMeasurable g <| map (fun t => x - t) μ) : AEStronglyMeasurable (fun t => L (f t) (g (x - t))) μ := L.aestronglyMeasurable_comp₂ hf <| hg.comp_measurable <| measurable_id.const_sub x #align measure_theory.ae_strongly_measurable.convolution_integrand_snd' MeasureTheory.AEStronglyMeasurable.convolution_integrand_snd' theorem AEStronglyMeasurable.convolution_integrand_swap_snd' {x : G} (hf : AEStronglyMeasurable f <| map (fun t => x - t) μ) (hg : AEStronglyMeasurable g μ) : AEStronglyMeasurable (fun t => L (f (x - t)) (g t)) μ := L.aestronglyMeasurable_comp₂ (hf.comp_measurable <| measurable_id.const_sub x) hg #align measure_theory.ae_strongly_measurable.convolution_integrand_swap_snd' MeasureTheory.AEStronglyMeasurable.convolution_integrand_swap_snd' theorem _root_.BddAbove.convolutionExistsAt' {x₀ : G} {s : Set G} (hbg : BddAbove ((fun i => ‖g i‖) '' ((fun t => -t + x₀) ⁻¹' s))) (hs : MeasurableSet s) (h2s : (support fun t => L (f t) (g (x₀ - t))) ⊆ s) (hf : IntegrableOn f s μ) (hmg : AEStronglyMeasurable g <| map (fun t => x₀ - t) (μ.restrict s)) : ConvolutionExistsAt f g x₀ L μ := by rw [ConvolutionExistsAt] rw [← integrableOn_iff_integrable_of_support_subset h2s] set s' := (fun t => -t + x₀) ⁻¹' s have : ∀ᵐ t : G ∂μ.restrict s, ‖L (f t) (g (x₀ - t))‖ ≤ s.indicator (fun t => ‖L‖ * ‖f t‖ * ⨆ i : s', ‖g i‖) t := by filter_upwards refine le_indicator (fun t ht => ?_) fun t ht => ?_ · apply_rules [L.le_of_opNorm₂_le_of_le, le_rfl] refine (le_ciSup_set hbg <| mem_preimage.mpr ?_) rwa [neg_sub, sub_add_cancel] · have : t ∉ support fun t => L (f t) (g (x₀ - t)) := mt (fun h => h2s h) ht rw [nmem_support.mp this, norm_zero] refine Integrable.mono' ?_ ?_ this · rw [integrable_indicator_iff hs]; exact ((hf.norm.const_mul _).mul_const _).integrableOn · exact hf.aestronglyMeasurable.convolution_integrand_snd' L hmg #align bdd_above.convolution_exists_at' BddAbove.convolutionExistsAt' theorem ConvolutionExistsAt.ofNorm' {x₀ : G} (h : ConvolutionExistsAt (fun x => ‖f x‖) (fun x => ‖g x‖) x₀ (mul ℝ ℝ) μ) (hmf : AEStronglyMeasurable f μ) (hmg : AEStronglyMeasurable g <| map (fun t => x₀ - t) μ) : ConvolutionExistsAt f g x₀ L μ := by refine (h.const_mul ‖L‖).mono' (hmf.convolution_integrand_snd' L hmg) (eventually_of_forall fun x => ?_) rw [mul_apply', ← mul_assoc] apply L.le_opNorm₂ #align convolution_exists_at.of_norm' MeasureTheory.ConvolutionExistsAt.ofNorm' end section CommGroup variable [AddCommGroup G] variable [NormedSpace ℝ F] noncomputable def convolution [Sub G] (f : G → E) (g : G → E') (L : E →L[𝕜] E' →L[𝕜] F) (μ : Measure G := by volume_tac) : G → F := fun x => ∫ t, L (f t) (g (x - t)) ∂μ #align convolution MeasureTheory.convolution scoped[Convolution] notation:67 f " ⋆[" L:67 ", " μ:67 "] " g:66 => convolution f g L μ scoped[Convolution] notation:67 f " ⋆[" L:67 "]" g:66 => convolution f g L MeasureSpace.volume scoped[Convolution] notation:67 f " ⋆ " g:66 => convolution f g (ContinuousLinearMap.lsmul ℝ ℝ) MeasureSpace.volume open scoped Convolution theorem convolution_def [Sub G] : (f ⋆[L, μ] g) x = ∫ t, L (f t) (g (x - t)) ∂μ := rfl #align convolution_def MeasureTheory.convolution_def theorem convolution_lsmul [Sub G] {f : G → 𝕜} {g : G → F} : (f ⋆[lsmul 𝕜 𝕜, μ] g : G → F) x = ∫ t, f t • g (x - t) ∂μ := rfl #align convolution_lsmul MeasureTheory.convolution_lsmul theorem convolution_mul [Sub G] [NormedSpace ℝ 𝕜] {f : G → 𝕜} {g : G → 𝕜} : (f ⋆[mul 𝕜 𝕜, μ] g) x = ∫ t, f t * g (x - t) ∂μ := rfl #align convolution_mul MeasureTheory.convolution_mul section Group variable {L} [AddGroup G] theorem smul_convolution [SMulCommClass ℝ 𝕜 F] {y : 𝕜} : y • f ⋆[L, μ] g = y • (f ⋆[L, μ] g) := by ext; simp only [Pi.smul_apply, convolution_def, ← integral_smul, L.map_smul₂] #align smul_convolution MeasureTheory.smul_convolution theorem convolution_smul [SMulCommClass ℝ 𝕜 F] {y : 𝕜} : f ⋆[L, μ] y • g = y • (f ⋆[L, μ] g) := by ext; simp only [Pi.smul_apply, convolution_def, ← integral_smul, (L _).map_smul] #align convolution_smul MeasureTheory.convolution_smul @[simp] theorem zero_convolution : 0 ⋆[L, μ] g = 0 := by ext simp_rw [convolution_def, Pi.zero_apply, L.map_zero₂, integral_zero] #align zero_convolution MeasureTheory.zero_convolution @[simp] theorem convolution_zero : f ⋆[L, μ] 0 = 0 := by ext simp_rw [convolution_def, Pi.zero_apply, (L _).map_zero, integral_zero] #align convolution_zero MeasureTheory.convolution_zero theorem ConvolutionExistsAt.distrib_add {x : G} (hfg : ConvolutionExistsAt f g x L μ) (hfg' : ConvolutionExistsAt f g' x L μ) : (f ⋆[L, μ] (g + g')) x = (f ⋆[L, μ] g) x + (f ⋆[L, μ] g') x := by simp only [convolution_def, (L _).map_add, Pi.add_apply, integral_add hfg hfg'] #align convolution_exists_at.distrib_add MeasureTheory.ConvolutionExistsAt.distrib_add
Mathlib/Analysis/Convolution.lean
500
503
theorem ConvolutionExists.distrib_add (hfg : ConvolutionExists f g L μ) (hfg' : ConvolutionExists f g' L μ) : f ⋆[L, μ] (g + g') = f ⋆[L, μ] g + f ⋆[L, μ] g' := by
ext x exact (hfg x).distrib_add (hfg' x)
import Mathlib.Logic.Equiv.Fin import Mathlib.Topology.DenseEmbedding import Mathlib.Topology.Support import Mathlib.Topology.Connected.LocallyConnected #align_import topology.homeomorph from "leanprover-community/mathlib"@"4c3e1721c58ef9087bbc2c8c38b540f70eda2e53" open Set Filter open Topology variable {X : Type*} {Y : Type*} {Z : Type*} -- not all spaces are homeomorphic to each other structure Homeomorph (X : Type*) (Y : Type*) [TopologicalSpace X] [TopologicalSpace Y] extends X ≃ Y where continuous_toFun : Continuous toFun := by continuity continuous_invFun : Continuous invFun := by continuity #align homeomorph Homeomorph @[inherit_doc] infixl:25 " ≃ₜ " => Homeomorph namespace Homeomorph variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] {X' Y' : Type*} [TopologicalSpace X'] [TopologicalSpace Y'] theorem toEquiv_injective : Function.Injective (toEquiv : X ≃ₜ Y → X ≃ Y) | ⟨_, _, _⟩, ⟨_, _, _⟩, rfl => rfl #align homeomorph.to_equiv_injective Homeomorph.toEquiv_injective instance : EquivLike (X ≃ₜ Y) X Y where coe := fun h => h.toEquiv inv := fun h => h.toEquiv.symm left_inv := fun h => h.left_inv right_inv := fun h => h.right_inv coe_injective' := fun _ _ H _ => toEquiv_injective <| DFunLike.ext' H instance : CoeFun (X ≃ₜ Y) fun _ ↦ X → Y := ⟨DFunLike.coe⟩ @[simp] theorem homeomorph_mk_coe (a : X ≃ Y) (b c) : (Homeomorph.mk a b c : X → Y) = a := rfl #align homeomorph.homeomorph_mk_coe Homeomorph.homeomorph_mk_coe protected def empty [IsEmpty X] [IsEmpty Y] : X ≃ₜ Y where __ := Equiv.equivOfIsEmpty X Y @[symm] protected def symm (h : X ≃ₜ Y) : Y ≃ₜ X where continuous_toFun := h.continuous_invFun continuous_invFun := h.continuous_toFun toEquiv := h.toEquiv.symm #align homeomorph.symm Homeomorph.symm @[simp] theorem symm_symm (h : X ≃ₜ Y) : h.symm.symm = h := rfl #align homeomorph.symm_symm Homeomorph.symm_symm theorem symm_bijective : Function.Bijective (Homeomorph.symm : (X ≃ₜ Y) → Y ≃ₜ X) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ def Simps.symm_apply (h : X ≃ₜ Y) : Y → X := h.symm #align homeomorph.simps.symm_apply Homeomorph.Simps.symm_apply initialize_simps_projections Homeomorph (toFun → apply, invFun → symm_apply) @[simp] theorem coe_toEquiv (h : X ≃ₜ Y) : ⇑h.toEquiv = h := rfl #align homeomorph.coe_to_equiv Homeomorph.coe_toEquiv @[simp] theorem coe_symm_toEquiv (h : X ≃ₜ Y) : ⇑h.toEquiv.symm = h.symm := rfl #align homeomorph.coe_symm_to_equiv Homeomorph.coe_symm_toEquiv @[ext] theorem ext {h h' : X ≃ₜ Y} (H : ∀ x, h x = h' x) : h = h' := DFunLike.ext _ _ H #align homeomorph.ext Homeomorph.ext @[simps! (config := .asFn) apply] protected def refl (X : Type*) [TopologicalSpace X] : X ≃ₜ X where continuous_toFun := continuous_id continuous_invFun := continuous_id toEquiv := Equiv.refl X #align homeomorph.refl Homeomorph.refl @[trans] protected def trans (h₁ : X ≃ₜ Y) (h₂ : Y ≃ₜ Z) : X ≃ₜ Z where continuous_toFun := h₂.continuous_toFun.comp h₁.continuous_toFun continuous_invFun := h₁.continuous_invFun.comp h₂.continuous_invFun toEquiv := Equiv.trans h₁.toEquiv h₂.toEquiv #align homeomorph.trans Homeomorph.trans @[simp] theorem trans_apply (h₁ : X ≃ₜ Y) (h₂ : Y ≃ₜ Z) (x : X) : h₁.trans h₂ x = h₂ (h₁ x) := rfl #align homeomorph.trans_apply Homeomorph.trans_apply @[simp] theorem symm_trans_apply (f : X ≃ₜ Y) (g : Y ≃ₜ Z) (z : Z) : (f.trans g).symm z = f.symm (g.symm z) := rfl @[simp] theorem homeomorph_mk_coe_symm (a : X ≃ Y) (b c) : ((Homeomorph.mk a b c).symm : Y → X) = a.symm := rfl #align homeomorph.homeomorph_mk_coe_symm Homeomorph.homeomorph_mk_coe_symm @[simp] theorem refl_symm : (Homeomorph.refl X).symm = Homeomorph.refl X := rfl #align homeomorph.refl_symm Homeomorph.refl_symm @[continuity] protected theorem continuous (h : X ≃ₜ Y) : Continuous h := h.continuous_toFun #align homeomorph.continuous Homeomorph.continuous -- otherwise `by continuity` can't prove continuity of `h.to_equiv.symm` @[continuity] protected theorem continuous_symm (h : X ≃ₜ Y) : Continuous h.symm := h.continuous_invFun #align homeomorph.continuous_symm Homeomorph.continuous_symm @[simp] theorem apply_symm_apply (h : X ≃ₜ Y) (y : Y) : h (h.symm y) = y := h.toEquiv.apply_symm_apply y #align homeomorph.apply_symm_apply Homeomorph.apply_symm_apply @[simp] theorem symm_apply_apply (h : X ≃ₜ Y) (x : X) : h.symm (h x) = x := h.toEquiv.symm_apply_apply x #align homeomorph.symm_apply_apply Homeomorph.symm_apply_apply @[simp] theorem self_trans_symm (h : X ≃ₜ Y) : h.trans h.symm = Homeomorph.refl X := by ext apply symm_apply_apply #align homeomorph.self_trans_symm Homeomorph.self_trans_symm @[simp] theorem symm_trans_self (h : X ≃ₜ Y) : h.symm.trans h = Homeomorph.refl Y := by ext apply apply_symm_apply #align homeomorph.symm_trans_self Homeomorph.symm_trans_self protected theorem bijective (h : X ≃ₜ Y) : Function.Bijective h := h.toEquiv.bijective #align homeomorph.bijective Homeomorph.bijective protected theorem injective (h : X ≃ₜ Y) : Function.Injective h := h.toEquiv.injective #align homeomorph.injective Homeomorph.injective protected theorem surjective (h : X ≃ₜ Y) : Function.Surjective h := h.toEquiv.surjective #align homeomorph.surjective Homeomorph.surjective def changeInv (f : X ≃ₜ Y) (g : Y → X) (hg : Function.RightInverse g f) : X ≃ₜ Y := haveI : g = f.symm := (f.left_inv.eq_rightInverse hg).symm { toFun := f invFun := g left_inv := by convert f.left_inv right_inv := by convert f.right_inv using 1 continuous_toFun := f.continuous continuous_invFun := by convert f.symm.continuous } #align homeomorph.change_inv Homeomorph.changeInv @[simp] theorem symm_comp_self (h : X ≃ₜ Y) : h.symm ∘ h = id := funext h.symm_apply_apply #align homeomorph.symm_comp_self Homeomorph.symm_comp_self @[simp] theorem self_comp_symm (h : X ≃ₜ Y) : h ∘ h.symm = id := funext h.apply_symm_apply #align homeomorph.self_comp_symm Homeomorph.self_comp_symm @[simp] theorem range_coe (h : X ≃ₜ Y) : range h = univ := h.surjective.range_eq #align homeomorph.range_coe Homeomorph.range_coe theorem image_symm (h : X ≃ₜ Y) : image h.symm = preimage h := funext h.symm.toEquiv.image_eq_preimage #align homeomorph.image_symm Homeomorph.image_symm theorem preimage_symm (h : X ≃ₜ Y) : preimage h.symm = image h := (funext h.toEquiv.image_eq_preimage).symm #align homeomorph.preimage_symm Homeomorph.preimage_symm @[simp] theorem image_preimage (h : X ≃ₜ Y) (s : Set Y) : h '' (h ⁻¹' s) = s := h.toEquiv.image_preimage s #align homeomorph.image_preimage Homeomorph.image_preimage @[simp] theorem preimage_image (h : X ≃ₜ Y) (s : Set X) : h ⁻¹' (h '' s) = s := h.toEquiv.preimage_image s #align homeomorph.preimage_image Homeomorph.preimage_image lemma image_compl (h : X ≃ₜ Y) (s : Set X) : h '' (sᶜ) = (h '' s)ᶜ := h.toEquiv.image_compl s protected theorem inducing (h : X ≃ₜ Y) : Inducing h := inducing_of_inducing_compose h.continuous h.symm.continuous <| by simp only [symm_comp_self, inducing_id] #align homeomorph.inducing Homeomorph.inducing theorem induced_eq (h : X ≃ₜ Y) : TopologicalSpace.induced h ‹_› = ‹_› := h.inducing.1.symm #align homeomorph.induced_eq Homeomorph.induced_eq protected theorem quotientMap (h : X ≃ₜ Y) : QuotientMap h := QuotientMap.of_quotientMap_compose h.symm.continuous h.continuous <| by simp only [self_comp_symm, QuotientMap.id] #align homeomorph.quotient_map Homeomorph.quotientMap theorem coinduced_eq (h : X ≃ₜ Y) : TopologicalSpace.coinduced h ‹_› = ‹_› := h.quotientMap.2.symm #align homeomorph.coinduced_eq Homeomorph.coinduced_eq protected theorem embedding (h : X ≃ₜ Y) : Embedding h := ⟨h.inducing, h.injective⟩ #align homeomorph.embedding Homeomorph.embedding noncomputable def ofEmbedding (f : X → Y) (hf : Embedding f) : X ≃ₜ Set.range f where continuous_toFun := hf.continuous.subtype_mk _ continuous_invFun := hf.continuous_iff.2 <| by simp [continuous_subtype_val] toEquiv := Equiv.ofInjective f hf.inj #align homeomorph.of_embedding Homeomorph.ofEmbedding protected theorem secondCountableTopology [SecondCountableTopology Y] (h : X ≃ₜ Y) : SecondCountableTopology X := h.inducing.secondCountableTopology #align homeomorph.second_countable_topology Homeomorph.secondCountableTopology @[simp] theorem isCompact_image {s : Set X} (h : X ≃ₜ Y) : IsCompact (h '' s) ↔ IsCompact s := h.embedding.isCompact_iff.symm #align homeomorph.is_compact_image Homeomorph.isCompact_image @[simp] theorem isCompact_preimage {s : Set Y} (h : X ≃ₜ Y) : IsCompact (h ⁻¹' s) ↔ IsCompact s := by rw [← image_symm]; exact h.symm.isCompact_image #align homeomorph.is_compact_preimage Homeomorph.isCompact_preimage @[simp] theorem isSigmaCompact_image {s : Set X} (h : X ≃ₜ Y) : IsSigmaCompact (h '' s) ↔ IsSigmaCompact s := h.embedding.isSigmaCompact_iff.symm @[simp] theorem isSigmaCompact_preimage {s : Set Y} (h : X ≃ₜ Y) : IsSigmaCompact (h ⁻¹' s) ↔ IsSigmaCompact s := by rw [← image_symm]; exact h.symm.isSigmaCompact_image @[simp] theorem isPreconnected_image {s : Set X} (h : X ≃ₜ Y) : IsPreconnected (h '' s) ↔ IsPreconnected s := ⟨fun hs ↦ by simpa only [image_symm, preimage_image] using hs.image _ h.symm.continuous.continuousOn, fun hs ↦ hs.image _ h.continuous.continuousOn⟩ @[simp] theorem isPreconnected_preimage {s : Set Y} (h : X ≃ₜ Y) : IsPreconnected (h ⁻¹' s) ↔ IsPreconnected s := by rw [← image_symm, isPreconnected_image] @[simp] theorem isConnected_image {s : Set X} (h : X ≃ₜ Y) : IsConnected (h '' s) ↔ IsConnected s := image_nonempty.and h.isPreconnected_image @[simp] theorem isConnected_preimage {s : Set Y} (h : X ≃ₜ Y) : IsConnected (h ⁻¹' s) ↔ IsConnected s := by rw [← image_symm, isConnected_image] theorem image_connectedComponentIn {s : Set X} (h : X ≃ₜ Y) {x : X} (hx : x ∈ s) : h '' connectedComponentIn s x = connectedComponentIn (h '' s) (h x) := by refine (h.continuous.image_connectedComponentIn_subset hx).antisymm ?_ have := h.symm.continuous.image_connectedComponentIn_subset (mem_image_of_mem h hx) rwa [image_subset_iff, h.preimage_symm, h.image_symm, h.preimage_image, h.symm_apply_apply] at this @[simp] theorem comap_cocompact (h : X ≃ₜ Y) : comap h (cocompact Y) = cocompact X := (comap_cocompact_le h.continuous).antisymm <| (hasBasis_cocompact.le_basis_iff (hasBasis_cocompact.comap h)).2 fun K hK => ⟨h ⁻¹' K, h.isCompact_preimage.2 hK, Subset.rfl⟩ #align homeomorph.comap_cocompact Homeomorph.comap_cocompact @[simp] theorem map_cocompact (h : X ≃ₜ Y) : map h (cocompact X) = cocompact Y := by rw [← h.comap_cocompact, map_comap_of_surjective h.surjective] #align homeomorph.map_cocompact Homeomorph.map_cocompact protected theorem compactSpace [CompactSpace X] (h : X ≃ₜ Y) : CompactSpace Y where isCompact_univ := h.symm.isCompact_preimage.2 isCompact_univ #align homeomorph.compact_space Homeomorph.compactSpace protected theorem t0Space [T0Space X] (h : X ≃ₜ Y) : T0Space Y := h.symm.embedding.t0Space #align homeomorph.t0_space Homeomorph.t0Space protected theorem t1Space [T1Space X] (h : X ≃ₜ Y) : T1Space Y := h.symm.embedding.t1Space #align homeomorph.t1_space Homeomorph.t1Space protected theorem t2Space [T2Space X] (h : X ≃ₜ Y) : T2Space Y := h.symm.embedding.t2Space #align homeomorph.t2_space Homeomorph.t2Space protected theorem t3Space [T3Space X] (h : X ≃ₜ Y) : T3Space Y := h.symm.embedding.t3Space #align homeomorph.t3_space Homeomorph.t3Space protected theorem denseEmbedding (h : X ≃ₜ Y) : DenseEmbedding h := { h.embedding with dense := h.surjective.denseRange } #align homeomorph.dense_embedding Homeomorph.denseEmbedding @[simp] theorem isOpen_preimage (h : X ≃ₜ Y) {s : Set Y} : IsOpen (h ⁻¹' s) ↔ IsOpen s := h.quotientMap.isOpen_preimage #align homeomorph.is_open_preimage Homeomorph.isOpen_preimage @[simp] theorem isOpen_image (h : X ≃ₜ Y) {s : Set X} : IsOpen (h '' s) ↔ IsOpen s := by rw [← preimage_symm, isOpen_preimage] #align homeomorph.is_open_image Homeomorph.isOpen_image protected theorem isOpenMap (h : X ≃ₜ Y) : IsOpenMap h := fun _ => h.isOpen_image.2 #align homeomorph.is_open_map Homeomorph.isOpenMap @[simp] theorem isClosed_preimage (h : X ≃ₜ Y) {s : Set Y} : IsClosed (h ⁻¹' s) ↔ IsClosed s := by simp only [← isOpen_compl_iff, ← preimage_compl, isOpen_preimage] #align homeomorph.is_closed_preimage Homeomorph.isClosed_preimage @[simp] theorem isClosed_image (h : X ≃ₜ Y) {s : Set X} : IsClosed (h '' s) ↔ IsClosed s := by rw [← preimage_symm, isClosed_preimage] #align homeomorph.is_closed_image Homeomorph.isClosed_image protected theorem isClosedMap (h : X ≃ₜ Y) : IsClosedMap h := fun _ => h.isClosed_image.2 #align homeomorph.is_closed_map Homeomorph.isClosedMap protected theorem openEmbedding (h : X ≃ₜ Y) : OpenEmbedding h := openEmbedding_of_embedding_open h.embedding h.isOpenMap #align homeomorph.open_embedding Homeomorph.openEmbedding protected theorem closedEmbedding (h : X ≃ₜ Y) : ClosedEmbedding h := closedEmbedding_of_embedding_closed h.embedding h.isClosedMap #align homeomorph.closed_embedding Homeomorph.closedEmbedding protected theorem normalSpace [NormalSpace X] (h : X ≃ₜ Y) : NormalSpace Y := h.symm.closedEmbedding.normalSpace protected theorem t4Space [T4Space X] (h : X ≃ₜ Y) : T4Space Y := h.symm.closedEmbedding.t4Space #align homeomorph.normal_space Homeomorph.t4Space theorem preimage_closure (h : X ≃ₜ Y) (s : Set Y) : h ⁻¹' closure s = closure (h ⁻¹' s) := h.isOpenMap.preimage_closure_eq_closure_preimage h.continuous _ #align homeomorph.preimage_closure Homeomorph.preimage_closure theorem image_closure (h : X ≃ₜ Y) (s : Set X) : h '' closure s = closure (h '' s) := by rw [← preimage_symm, preimage_closure] #align homeomorph.image_closure Homeomorph.image_closure theorem preimage_interior (h : X ≃ₜ Y) (s : Set Y) : h ⁻¹' interior s = interior (h ⁻¹' s) := h.isOpenMap.preimage_interior_eq_interior_preimage h.continuous _ #align homeomorph.preimage_interior Homeomorph.preimage_interior theorem image_interior (h : X ≃ₜ Y) (s : Set X) : h '' interior s = interior (h '' s) := by rw [← preimage_symm, preimage_interior] #align homeomorph.image_interior Homeomorph.image_interior theorem preimage_frontier (h : X ≃ₜ Y) (s : Set Y) : h ⁻¹' frontier s = frontier (h ⁻¹' s) := h.isOpenMap.preimage_frontier_eq_frontier_preimage h.continuous _ #align homeomorph.preimage_frontier Homeomorph.preimage_frontier
Mathlib/Topology/Homeomorph.lean
425
426
theorem image_frontier (h : X ≃ₜ Y) (s : Set X) : h '' frontier s = frontier (h '' s) := by
rw [← preimage_symm, preimage_frontier]
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h]
Mathlib/Algebra/Polynomial/RingDivision.lean
124
126
theorem natDegree_mul (hp : p ≠ 0) (hq : q ≠ 0) : (p*q).natDegree = p.natDegree + q.natDegree := by
rw [← Nat.cast_inj (R := WithBot ℕ), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul]
import Mathlib.Algebra.Ring.Prod import Mathlib.GroupTheory.OrderOfElement import Mathlib.Tactic.FinCases #align_import data.zmod.basic from "leanprover-community/mathlib"@"74ad1c88c77e799d2fea62801d1dbbd698cff1b7" assert_not_exists Submodule open Function namespace ZMod instance charZero : CharZero (ZMod 0) := inferInstanceAs (CharZero ℤ) def val : ∀ {n : ℕ}, ZMod n → ℕ | 0 => Int.natAbs | n + 1 => ((↑) : Fin (n + 1) → ℕ) #align zmod.val ZMod.val theorem val_lt {n : ℕ} [NeZero n] (a : ZMod n) : a.val < n := by cases n · cases NeZero.ne 0 rfl exact Fin.is_lt a #align zmod.val_lt ZMod.val_lt theorem val_le {n : ℕ} [NeZero n] (a : ZMod n) : a.val ≤ n := a.val_lt.le #align zmod.val_le ZMod.val_le @[simp] theorem val_zero : ∀ {n}, (0 : ZMod n).val = 0 | 0 => rfl | _ + 1 => rfl #align zmod.val_zero ZMod.val_zero @[simp] theorem val_one' : (1 : ZMod 0).val = 1 := rfl #align zmod.val_one' ZMod.val_one' @[simp] theorem val_neg' {n : ZMod 0} : (-n).val = n.val := Int.natAbs_neg n #align zmod.val_neg' ZMod.val_neg' @[simp] theorem val_mul' {m n : ZMod 0} : (m * n).val = m.val * n.val := Int.natAbs_mul m n #align zmod.val_mul' ZMod.val_mul' @[simp] theorem val_natCast {n : ℕ} (a : ℕ) : (a : ZMod n).val = a % n := by cases n · rw [Nat.mod_zero] exact Int.natAbs_ofNat a · apply Fin.val_natCast #align zmod.val_nat_cast ZMod.val_natCast @[deprecated (since := "2024-04-17")] alias val_nat_cast := val_natCast theorem val_unit' {n : ZMod 0} : IsUnit n ↔ n.val = 1 := by simp only [val] rw [Int.isUnit_iff, Int.natAbs_eq_iff, Nat.cast_one] lemma eq_one_of_isUnit_natCast {n : ℕ} (h : IsUnit (n : ZMod 0)) : n = 1 := by rw [← Nat.mod_zero n, ← val_natCast, val_unit'.mp h] theorem val_natCast_of_lt {n a : ℕ} (h : a < n) : (a : ZMod n).val = a := by rwa [val_natCast, Nat.mod_eq_of_lt] @[deprecated (since := "2024-04-17")] alias val_nat_cast_of_lt := val_natCast_of_lt instance charP (n : ℕ) : CharP (ZMod n) n where cast_eq_zero_iff' := by intro k cases' n with n · simp [zero_dvd_iff, Int.natCast_eq_zero, Nat.zero_eq] · exact Fin.natCast_eq_zero @[simp] theorem addOrderOf_one (n : ℕ) : addOrderOf (1 : ZMod n) = n := CharP.eq _ (CharP.addOrderOf_one _) (ZMod.charP n) #align zmod.add_order_of_one ZMod.addOrderOf_one @[simp] theorem addOrderOf_coe (a : ℕ) {n : ℕ} (n0 : n ≠ 0) : addOrderOf (a : ZMod n) = n / n.gcd a := by cases' a with a · simp only [Nat.zero_eq, Nat.cast_zero, addOrderOf_zero, Nat.gcd_zero_right, Nat.pos_of_ne_zero n0, Nat.div_self] rw [← Nat.smul_one_eq_cast, addOrderOf_nsmul' _ a.succ_ne_zero, ZMod.addOrderOf_one] #align zmod.add_order_of_coe ZMod.addOrderOf_coe @[simp] theorem addOrderOf_coe' {a : ℕ} (n : ℕ) (a0 : a ≠ 0) : addOrderOf (a : ZMod n) = n / n.gcd a := by rw [← Nat.smul_one_eq_cast, addOrderOf_nsmul' _ a0, ZMod.addOrderOf_one] #align zmod.add_order_of_coe' ZMod.addOrderOf_coe' theorem ringChar_zmod_n (n : ℕ) : ringChar (ZMod n) = n := by rw [ringChar.eq_iff] exact ZMod.charP n #align zmod.ring_char_zmod_n ZMod.ringChar_zmod_n -- @[simp] -- Porting note (#10618): simp can prove this theorem natCast_self (n : ℕ) : (n : ZMod n) = 0 := CharP.cast_eq_zero (ZMod n) n #align zmod.nat_cast_self ZMod.natCast_self @[deprecated (since := "2024-04-17")] alias nat_cast_self := natCast_self @[simp] theorem natCast_self' (n : ℕ) : (n + 1 : ZMod (n + 1)) = 0 := by rw [← Nat.cast_add_one, natCast_self (n + 1)] #align zmod.nat_cast_self' ZMod.natCast_self' @[deprecated (since := "2024-04-17")] alias nat_cast_self' := natCast_self' section UniversalProperty variable {n : ℕ} {R : Type*} section variable [AddGroupWithOne R] def cast : ∀ {n : ℕ}, ZMod n → R | 0 => Int.cast | _ + 1 => fun i => i.val #align zmod.cast ZMod.cast @[simp] theorem cast_zero : (cast (0 : ZMod n) : R) = 0 := by delta ZMod.cast cases n · exact Int.cast_zero · simp #align zmod.cast_zero ZMod.cast_zero theorem cast_eq_val [NeZero n] (a : ZMod n) : (cast a : R) = a.val := by cases n · cases NeZero.ne 0 rfl rfl #align zmod.cast_eq_val ZMod.cast_eq_val variable {S : Type*} [AddGroupWithOne S] @[simp] theorem _root_.Prod.fst_zmod_cast (a : ZMod n) : (cast a : R × S).fst = cast a := by cases n · rfl · simp [ZMod.cast] #align prod.fst_zmod_cast Prod.fst_zmod_cast @[simp] theorem _root_.Prod.snd_zmod_cast (a : ZMod n) : (cast a : R × S).snd = cast a := by cases n · rfl · simp [ZMod.cast] #align prod.snd_zmod_cast Prod.snd_zmod_cast end theorem natCast_zmod_val {n : ℕ} [NeZero n] (a : ZMod n) : (a.val : ZMod n) = a := by cases n · cases NeZero.ne 0 rfl · apply Fin.cast_val_eq_self #align zmod.nat_cast_zmod_val ZMod.natCast_zmod_val @[deprecated (since := "2024-04-17")] alias nat_cast_zmod_val := natCast_zmod_val theorem natCast_rightInverse [NeZero n] : Function.RightInverse val ((↑) : ℕ → ZMod n) := natCast_zmod_val #align zmod.nat_cast_right_inverse ZMod.natCast_rightInverse @[deprecated (since := "2024-04-17")] alias nat_cast_rightInverse := natCast_rightInverse theorem natCast_zmod_surjective [NeZero n] : Function.Surjective ((↑) : ℕ → ZMod n) := natCast_rightInverse.surjective #align zmod.nat_cast_zmod_surjective ZMod.natCast_zmod_surjective @[deprecated (since := "2024-04-17")] alias nat_cast_zmod_surjective := natCast_zmod_surjective @[norm_cast] theorem intCast_zmod_cast (a : ZMod n) : ((cast a : ℤ) : ZMod n) = a := by cases n · simp [ZMod.cast, ZMod] · dsimp [ZMod.cast, ZMod] erw [Int.cast_natCast, Fin.cast_val_eq_self] #align zmod.int_cast_zmod_cast ZMod.intCast_zmod_cast @[deprecated (since := "2024-04-17")] alias int_cast_zmod_cast := intCast_zmod_cast theorem intCast_rightInverse : Function.RightInverse (cast : ZMod n → ℤ) ((↑) : ℤ → ZMod n) := intCast_zmod_cast #align zmod.int_cast_right_inverse ZMod.intCast_rightInverse @[deprecated (since := "2024-04-17")] alias int_cast_rightInverse := intCast_rightInverse theorem intCast_surjective : Function.Surjective ((↑) : ℤ → ZMod n) := intCast_rightInverse.surjective #align zmod.int_cast_surjective ZMod.intCast_surjective @[deprecated (since := "2024-04-17")] alias int_cast_surjective := intCast_surjective theorem cast_id : ∀ (n) (i : ZMod n), (ZMod.cast i : ZMod n) = i | 0, _ => Int.cast_id | _ + 1, i => natCast_zmod_val i #align zmod.cast_id ZMod.cast_id @[simp] theorem cast_id' : (ZMod.cast : ZMod n → ZMod n) = id := funext (cast_id n) #align zmod.cast_id' ZMod.cast_id' variable (R) [Ring R] @[simp] theorem natCast_comp_val [NeZero n] : ((↑) : ℕ → R) ∘ (val : ZMod n → ℕ) = cast := by cases n · cases NeZero.ne 0 rfl rfl #align zmod.nat_cast_comp_val ZMod.natCast_comp_val @[deprecated (since := "2024-04-17")] alias nat_cast_comp_val := natCast_comp_val @[simp] theorem intCast_comp_cast : ((↑) : ℤ → R) ∘ (cast : ZMod n → ℤ) = cast := by cases n · exact congr_arg (Int.cast ∘ ·) ZMod.cast_id' · ext simp [ZMod, ZMod.cast] #align zmod.int_cast_comp_cast ZMod.intCast_comp_cast @[deprecated (since := "2024-04-17")] alias int_cast_comp_cast := intCast_comp_cast variable {R} @[simp] theorem natCast_val [NeZero n] (i : ZMod n) : (i.val : R) = cast i := congr_fun (natCast_comp_val R) i #align zmod.nat_cast_val ZMod.natCast_val @[deprecated (since := "2024-04-17")] alias nat_cast_val := natCast_val @[simp] theorem intCast_cast (i : ZMod n) : ((cast i : ℤ) : R) = cast i := congr_fun (intCast_comp_cast R) i #align zmod.int_cast_cast ZMod.intCast_cast @[deprecated (since := "2024-04-17")] alias int_cast_cast := intCast_cast theorem cast_add_eq_ite {n : ℕ} (a b : ZMod n) : (cast (a + b) : ℤ) = if (n : ℤ) ≤ cast a + cast b then (cast a + cast b - n : ℤ) else cast a + cast b := by cases' n with n · simp; rfl change Fin (n + 1) at a b change ((((a + b) : Fin (n + 1)) : ℕ) : ℤ) = if ((n + 1 : ℕ) : ℤ) ≤ (a : ℕ) + b then _ else _ simp only [Fin.val_add_eq_ite, Int.ofNat_succ, Int.ofNat_le] norm_cast split_ifs with h · rw [Nat.cast_sub h] congr · rfl #align zmod.coe_add_eq_ite ZMod.cast_add_eq_ite theorem intCast_eq_intCast_iff (a b : ℤ) (c : ℕ) : (a : ZMod c) = (b : ZMod c) ↔ a ≡ b [ZMOD c] := CharP.intCast_eq_intCast (ZMod c) c #align zmod.int_coe_eq_int_coe_iff ZMod.intCast_eq_intCast_iff @[deprecated (since := "2024-04-17")] alias int_cast_eq_int_cast_iff := intCast_eq_intCast_iff theorem intCast_eq_intCast_iff' (a b : ℤ) (c : ℕ) : (a : ZMod c) = (b : ZMod c) ↔ a % c = b % c := ZMod.intCast_eq_intCast_iff a b c #align zmod.int_coe_eq_int_coe_iff' ZMod.intCast_eq_intCast_iff' @[deprecated (since := "2024-04-17")] alias int_cast_eq_int_cast_iff' := intCast_eq_intCast_iff' theorem natCast_eq_natCast_iff (a b c : ℕ) : (a : ZMod c) = (b : ZMod c) ↔ a ≡ b [MOD c] := by simpa [Int.natCast_modEq_iff] using ZMod.intCast_eq_intCast_iff a b c #align zmod.nat_coe_eq_nat_coe_iff ZMod.natCast_eq_natCast_iff @[deprecated (since := "2024-04-17")] alias nat_cast_eq_nat_cast_iff := natCast_eq_natCast_iff theorem natCast_eq_natCast_iff' (a b c : ℕ) : (a : ZMod c) = (b : ZMod c) ↔ a % c = b % c := ZMod.natCast_eq_natCast_iff a b c #align zmod.nat_coe_eq_nat_coe_iff' ZMod.natCast_eq_natCast_iff' @[deprecated (since := "2024-04-17")] alias nat_cast_eq_nat_cast_iff' := natCast_eq_natCast_iff' theorem intCast_zmod_eq_zero_iff_dvd (a : ℤ) (b : ℕ) : (a : ZMod b) = 0 ↔ (b : ℤ) ∣ a := by rw [← Int.cast_zero, ZMod.intCast_eq_intCast_iff, Int.modEq_zero_iff_dvd] #align zmod.int_coe_zmod_eq_zero_iff_dvd ZMod.intCast_zmod_eq_zero_iff_dvd @[deprecated (since := "2024-04-17")] alias int_cast_zmod_eq_zero_iff_dvd := intCast_zmod_eq_zero_iff_dvd theorem intCast_eq_intCast_iff_dvd_sub (a b : ℤ) (c : ℕ) : (a : ZMod c) = ↑b ↔ ↑c ∣ b - a := by rw [ZMod.intCast_eq_intCast_iff, Int.modEq_iff_dvd] #align zmod.int_coe_eq_int_coe_iff_dvd_sub ZMod.intCast_eq_intCast_iff_dvd_sub @[deprecated (since := "2024-04-17")] alias int_cast_eq_int_cast_iff_dvd_sub := intCast_eq_intCast_iff_dvd_sub theorem natCast_zmod_eq_zero_iff_dvd (a b : ℕ) : (a : ZMod b) = 0 ↔ b ∣ a := by rw [← Nat.cast_zero, ZMod.natCast_eq_natCast_iff, Nat.modEq_zero_iff_dvd] #align zmod.nat_coe_zmod_eq_zero_iff_dvd ZMod.natCast_zmod_eq_zero_iff_dvd @[deprecated (since := "2024-04-17")] alias nat_cast_zmod_eq_zero_iff_dvd := natCast_zmod_eq_zero_iff_dvd theorem val_intCast {n : ℕ} (a : ℤ) [NeZero n] : ↑(a : ZMod n).val = a % n := by have hle : (0 : ℤ) ≤ ↑(a : ZMod n).val := Int.natCast_nonneg _ have hlt : ↑(a : ZMod n).val < (n : ℤ) := Int.ofNat_lt.mpr (ZMod.val_lt a) refine (Int.emod_eq_of_lt hle hlt).symm.trans ?_ rw [← ZMod.intCast_eq_intCast_iff', Int.cast_natCast, ZMod.natCast_val, ZMod.cast_id] #align zmod.val_int_cast ZMod.val_intCast @[deprecated (since := "2024-04-17")] alias val_int_cast := val_intCast theorem coe_intCast {n : ℕ} (a : ℤ) : cast (a : ZMod n) = a % n := by cases n · rw [Int.ofNat_zero, Int.emod_zero, Int.cast_id]; rfl · rw [← val_intCast, val]; rfl #align zmod.coe_int_cast ZMod.coe_intCast @[deprecated (since := "2024-04-17")] alias coe_int_cast := coe_intCast @[simp] theorem val_neg_one (n : ℕ) : (-1 : ZMod n.succ).val = n := by dsimp [val, Fin.coe_neg] cases n · simp [Nat.mod_one] · dsimp [ZMod, ZMod.cast] rw [Fin.coe_neg_one] #align zmod.val_neg_one ZMod.val_neg_one theorem cast_neg_one {R : Type*} [Ring R] (n : ℕ) : cast (-1 : ZMod n) = (n - 1 : R) := by cases' n with n · dsimp [ZMod, ZMod.cast]; simp · rw [← natCast_val, val_neg_one, Nat.cast_succ, add_sub_cancel_right] #align zmod.cast_neg_one ZMod.cast_neg_one theorem cast_sub_one {R : Type*} [Ring R] {n : ℕ} (k : ZMod n) : (cast (k - 1 : ZMod n) : R) = (if k = 0 then (n : R) else cast k) - 1 := by split_ifs with hk · rw [hk, zero_sub, ZMod.cast_neg_one] · cases n · dsimp [ZMod, ZMod.cast] rw [Int.cast_sub, Int.cast_one] · dsimp [ZMod, ZMod.cast, ZMod.val] rw [Fin.coe_sub_one, if_neg] · rw [Nat.cast_sub, Nat.cast_one] rwa [Fin.ext_iff, Fin.val_zero, ← Ne, ← Nat.one_le_iff_ne_zero] at hk · exact hk #align zmod.cast_sub_one ZMod.cast_sub_one theorem natCast_eq_iff (p : ℕ) (n : ℕ) (z : ZMod p) [NeZero p] : ↑n = z ↔ ∃ k, n = z.val + p * k := by constructor · rintro rfl refine ⟨n / p, ?_⟩ rw [val_natCast, Nat.mod_add_div] · rintro ⟨k, rfl⟩ rw [Nat.cast_add, natCast_zmod_val, Nat.cast_mul, natCast_self, zero_mul, add_zero] #align zmod.nat_coe_zmod_eq_iff ZMod.natCast_eq_iff theorem intCast_eq_iff (p : ℕ) (n : ℤ) (z : ZMod p) [NeZero p] : ↑n = z ↔ ∃ k, n = z.val + p * k := by constructor · rintro rfl refine ⟨n / p, ?_⟩ rw [val_intCast, Int.emod_add_ediv] · rintro ⟨k, rfl⟩ rw [Int.cast_add, Int.cast_mul, Int.cast_natCast, Int.cast_natCast, natCast_val, ZMod.natCast_self, zero_mul, add_zero, cast_id] #align zmod.int_coe_zmod_eq_iff ZMod.intCast_eq_iff @[deprecated (since := "2024-05-25")] alias nat_coe_zmod_eq_iff := natCast_eq_iff @[deprecated (since := "2024-05-25")] alias int_coe_zmod_eq_iff := intCast_eq_iff @[push_cast, simp]
Mathlib/Data/ZMod/Basic.lean
676
678
theorem intCast_mod (a : ℤ) (b : ℕ) : ((a % b : ℤ) : ZMod b) = (a : ZMod b) := by
rw [ZMod.intCast_eq_intCast_iff] apply Int.mod_modEq
import Mathlib.Algebra.IsPrimePow import Mathlib.Algebra.Squarefree.Basic import Mathlib.Order.Hom.Bounded import Mathlib.Algebra.GCDMonoid.Basic #align_import ring_theory.chain_of_divisors from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" variable {M : Type*} [CancelCommMonoidWithZero M] theorem Associates.isAtom_iff {p : Associates M} (h₁ : p ≠ 0) : IsAtom p ↔ Irreducible p := ⟨fun hp => ⟨by simpa only [Associates.isUnit_iff_eq_one] using hp.1, fun a b h => (hp.le_iff.mp ⟨_, h⟩).casesOn (fun ha => Or.inl (a.isUnit_iff_eq_one.mpr ha)) fun ha => Or.inr (show IsUnit b by rw [ha] at h apply isUnit_of_associated_mul (show Associated (p * b) p by conv_rhs => rw [h]) h₁)⟩, fun hp => ⟨by simpa only [Associates.isUnit_iff_eq_one, Associates.bot_eq_one] using hp.1, fun b ⟨⟨a, hab⟩, hb⟩ => (hp.isUnit_or_isUnit hab).casesOn (fun hb => show b = ⊥ by rwa [Associates.isUnit_iff_eq_one, ← Associates.bot_eq_one] at hb) fun ha => absurd (show p ∣ b from ⟨(ha.unit⁻¹ : Units _), by rw [hab, mul_assoc, IsUnit.mul_val_inv ha, mul_one]⟩) hb⟩⟩ #align associates.is_atom_iff Associates.isAtom_iff open UniqueFactorizationMonoid multiplicity Irreducible Associates variable {N : Type*} [CancelCommMonoidWithZero N]
Mathlib/RingTheory/ChainOfDivisors.lean
224
231
theorem factor_orderIso_map_one_eq_bot {m : Associates M} {n : Associates N} (d : { l : Associates M // l ≤ m } ≃o { l : Associates N // l ≤ n }) : (d ⟨1, one_dvd m⟩ : Associates N) = 1 := by
letI : OrderBot { l : Associates M // l ≤ m } := Subtype.orderBot bot_le letI : OrderBot { l : Associates N // l ≤ n } := Subtype.orderBot bot_le simp only [← Associates.bot_eq_one, Subtype.mk_bot, bot_le, Subtype.coe_eq_bot_iff] letI : BotHomClass ({ l // l ≤ m } ≃o { l // l ≤ n }) _ _ := OrderIsoClass.toBotHomClass exact map_bot d
import Mathlib.CategoryTheory.Equivalence #align_import algebraic_topology.dold_kan.compatibility from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504" open CategoryTheory CategoryTheory.Category namespace AlgebraicTopology namespace DoldKan namespace Compatibility variable {A A' B B' : Type*} [Category A] [Category A'] [Category B] [Category B'] (eA : A ≌ A') (eB : B ≌ B') (e' : A' ≌ B') {F : A ⥤ B'} (hF : eA.functor ⋙ e'.functor ≅ F) {G : B ⥤ A} (hG : eB.functor ⋙ e'.inverse ≅ G ⋙ eA.functor) @[simps! functor inverse unitIso_hom_app] def equivalence₀ : A ≌ B' := eA.trans e' #align algebraic_topology.dold_kan.compatibility.equivalence₀ AlgebraicTopology.DoldKan.Compatibility.equivalence₀ variable {eA} {e'} @[simps! functor] def equivalence₁ : A ≌ B' := (equivalence₀ eA e').changeFunctor hF #align algebraic_topology.dold_kan.compatibility.equivalence₁ AlgebraicTopology.DoldKan.Compatibility.equivalence₁ theorem equivalence₁_inverse : (equivalence₁ hF).inverse = e'.inverse ⋙ eA.inverse := rfl #align algebraic_topology.dold_kan.compatibility.equivalence₁_inverse AlgebraicTopology.DoldKan.Compatibility.equivalence₁_inverse @[simps!] def equivalence₁CounitIso : (e'.inverse ⋙ eA.inverse) ⋙ F ≅ 𝟭 B' := calc (e'.inverse ⋙ eA.inverse) ⋙ F ≅ (e'.inverse ⋙ eA.inverse) ⋙ eA.functor ⋙ e'.functor := isoWhiskerLeft _ hF.symm _ ≅ e'.inverse ⋙ (eA.inverse ⋙ eA.functor) ⋙ e'.functor := Iso.refl _ _ ≅ e'.inverse ⋙ 𝟭 _ ⋙ e'.functor := isoWhiskerLeft _ (isoWhiskerRight eA.counitIso _) _ ≅ e'.inverse ⋙ e'.functor := Iso.refl _ _ ≅ 𝟭 B' := e'.counitIso #align algebraic_topology.dold_kan.compatibility.equivalence₁_counit_iso AlgebraicTopology.DoldKan.Compatibility.equivalence₁CounitIso theorem equivalence₁CounitIso_eq : (equivalence₁ hF).counitIso = equivalence₁CounitIso hF := by ext Y simp [equivalence₁, equivalence₀] #align algebraic_topology.dold_kan.compatibility.equivalence₁_counit_iso_eq AlgebraicTopology.DoldKan.Compatibility.equivalence₁CounitIso_eq @[simps!] def equivalence₁UnitIso : 𝟭 A ≅ F ⋙ e'.inverse ⋙ eA.inverse := calc 𝟭 A ≅ eA.functor ⋙ eA.inverse := eA.unitIso _ ≅ eA.functor ⋙ 𝟭 A' ⋙ eA.inverse := Iso.refl _ _ ≅ eA.functor ⋙ (e'.functor ⋙ e'.inverse) ⋙ eA.inverse := isoWhiskerLeft _ (isoWhiskerRight e'.unitIso _) _ ≅ (eA.functor ⋙ e'.functor) ⋙ e'.inverse ⋙ eA.inverse := Iso.refl _ _ ≅ F ⋙ e'.inverse ⋙ eA.inverse := isoWhiskerRight hF _ #align algebraic_topology.dold_kan.compatibility.equivalence₁_unit_iso AlgebraicTopology.DoldKan.Compatibility.equivalence₁UnitIso
Mathlib/AlgebraicTopology/DoldKan/Compatibility.lean
103
105
theorem equivalence₁UnitIso_eq : (equivalence₁ hF).unitIso = equivalence₁UnitIso hF := by
ext X simp [equivalence₁]
import Mathlib.Data.PFunctor.Univariate.M #align_import data.qpf.univariate.basic from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7" universe u class QPF (F : Type u → Type u) [Functor F] where P : PFunctor.{u} abs : ∀ {α}, P α → F α repr : ∀ {α}, F α → P α abs_repr : ∀ {α} (x : F α), abs (repr x) = x abs_map : ∀ {α β} (f : α → β) (p : P α), abs (P.map f p) = f <$> abs p #align qpf QPF namespace QPF variable {F : Type u → Type u} [Functor F] [q : QPF F] open Functor (Liftp Liftr) def corecF {α : Type _} (g : α → F α) : α → q.P.M := PFunctor.M.corec fun x => repr (g x) set_option linter.uppercaseLean3 false in #align qpf.corecF QPF.corecF
Mathlib/Data/QPF/Univariate/Basic.lean
377
379
theorem corecF_eq {α : Type _} (g : α → F α) (x : α) : PFunctor.M.dest (corecF g x) = q.P.map (corecF g) (repr (g x)) := by
rw [corecF, PFunctor.M.dest_corec]