state
stringlengths
0
159k
srcUpToTactic
stringlengths
387
167k
nextTactic
stringlengths
3
9k
declUpToTactic
stringlengths
22
11.5k
declId
stringlengths
38
95
decl
stringlengths
16
1.89k
file_tag
stringlengths
17
73
case refine'_1 α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝⁶ : TopologicalSpace α inst✝⁵ : TopologicalSpace β inst✝⁴ : TopologicalSpace γ inst✝³ : TopologicalSpace δ e : PartialHomeomorph α β s : Opens α inst✝² : Nonempty ↥s U V : Opens α inst✝¹ : Nonempty ↥U inst✝ : Nonempty ↥V hUV : U ≤ V i : ↑↑U → ↑↑V := inclusion hUV y : β hy : y ∈ e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' (Opens.localHomeomorphSubtypeCoe U).toPartialEquiv.target hyV : ↑(PartialHomeomorph.symm e) y ∈ (Opens.localHomeomorphSubtypeCoe V).toPartialEquiv.target ⊢ ↑(PartialHomeomorph.symm (Opens.localHomeomorphSubtypeCoe V)) (↑(PartialHomeomorph.symm e) y) ∈ (Opens.localHomeomorphSubtypeCoe V).toPartialEquiv.source
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.is_image.map_nhds_within_eq PartialHomeomorph.IsImage.map_nhdsWithin_eq protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff] #align local_homeomorph.is_image.closure PartialHomeomorph.IsImage.closure protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by simpa only [closure_compl, compl_compl] using h.compl.closure.compl #align local_homeomorph.is_image.interior PartialHomeomorph.IsImage.interior protected theorem frontier (h : e.IsImage s t) : e.IsImage (frontier s) (frontier t) := h.closure.diff h.interior #align local_homeomorph.is_image.frontier PartialHomeomorph.IsImage.frontier theorem isOpen_iff (h : e.IsImage s t) : IsOpen (e.source ∩ s) ↔ IsOpen (e.target ∩ t) := ⟨fun hs => h.symm_preimage_eq' ▸ e.symm.isOpen_inter_preimage hs, fun hs => h.preimage_eq' ▸ e.isOpen_inter_preimage hs⟩ #align local_homeomorph.is_image.is_open_iff PartialHomeomorph.IsImage.isOpen_iff /-- Restrict a `PartialHomeomorph` to a pair of corresponding open sets. -/ @[simps toPartialEquiv] def restr (h : e.IsImage s t) (hs : IsOpen (e.source ∩ s)) : PartialHomeomorph α β where toPartialEquiv := h.toPartialEquiv.restr open_source := hs open_target := h.isOpen_iff.1 hs continuousOn_toFun := e.continuousOn.mono (inter_subset_left _ _) continuousOn_invFun := e.symm.continuousOn.mono (inter_subset_left _ _) #align local_homeomorph.is_image.restr PartialHomeomorph.IsImage.restr end IsImage theorem isImage_source_target : e.IsImage e.source e.target := e.toPartialEquiv.isImage_source_target #align local_homeomorph.is_image_source_target PartialHomeomorph.isImage_source_target theorem isImage_source_target_of_disjoint (e' : PartialHomeomorph α β) (hs : Disjoint e.source e'.source) (ht : Disjoint e.target e'.target) : e.IsImage e'.source e'.target := e.toPartialEquiv.isImage_source_target_of_disjoint e'.toPartialEquiv hs ht #align local_homeomorph.is_image_source_target_of_disjoint PartialHomeomorph.isImage_source_target_of_disjoint /-- Preimage of interior or interior of preimage coincide for partial homeomorphisms, when restricted to the source. -/ theorem preimage_interior (s : Set β) : e.source ∩ e ⁻¹' interior s = e.source ∩ interior (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).interior.preimage_eq #align local_homeomorph.preimage_interior PartialHomeomorph.preimage_interior theorem preimage_closure (s : Set β) : e.source ∩ e ⁻¹' closure s = e.source ∩ closure (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).closure.preimage_eq #align local_homeomorph.preimage_closure PartialHomeomorph.preimage_closure theorem preimage_frontier (s : Set β) : e.source ∩ e ⁻¹' frontier s = e.source ∩ frontier (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).frontier.preimage_eq #align local_homeomorph.preimage_frontier PartialHomeomorph.preimage_frontier theorem isOpen_inter_preimage_symm {s : Set α} (hs : IsOpen s) : IsOpen (e.target ∩ e.symm ⁻¹' s) := e.symm.continuousOn.isOpen_inter_preimage e.open_target hs #align local_homeomorph.preimage_open_of_open_symm PartialHomeomorph.isOpen_inter_preimage_symm /-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by have : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h rw [this] exact e.continuousOn_symm.isOpen_inter_preimage e.open_target hs #align local_homeomorph.image_open_of_open PartialHomeomorph.image_isOpen_of_isOpen /-- The image of the restriction of an open set to the source is open. -/ theorem image_isOpen_of_isOpen' {s : Set α} (hs : IsOpen s) : IsOpen (e '' (e.source ∩ s)) := image_isOpen_of_isOpen _ (IsOpen.inter e.open_source hs) (inter_subset_left _ _) #align local_homeomorph.image_open_of_open' PartialHomeomorph.image_isOpen_of_isOpen' /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpenRestrict (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap (e.source.restrict e)) (hs : IsOpen e.source) : PartialHomeomorph α β where toPartialEquiv := e open_source := hs open_target := by simpa only [range_restrict, e.image_source_eq_target] using ho.isOpen_range continuousOn_toFun := hc continuousOn_invFun := e.image_source_eq_target ▸ ho.continuousOn_image_of_leftInvOn e.leftInvOn #align local_homeomorph.of_continuous_open_restrict PartialHomeomorph.ofContinuousOpenRestrict /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpen (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap e) (hs : IsOpen e.source) : PartialHomeomorph α β := ofContinuousOpenRestrict e hc (ho.restrict hs) hs #align local_homeomorph.of_continuous_open PartialHomeomorph.ofContinuousOpen /-- Restricting a partial homeomorphism `e` to `e.source ∩ s` when `s` is open. This is sometimes hard to use because of the openness assumption, but it has the advantage that when it can be used then its `PartialEquiv` is defeq to `PartialEquiv.restr`. -/ protected def restrOpen (s : Set α) (hs : IsOpen s) : PartialHomeomorph α β := (@IsImage.of_symm_preimage_eq α β _ _ e s (e.symm ⁻¹' s) rfl).restr (IsOpen.inter e.open_source hs) #align local_homeomorph.restr_open PartialHomeomorph.restrOpen @[simp, mfld_simps] theorem restrOpen_toPartialEquiv (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).toPartialEquiv = e.toPartialEquiv.restr s := rfl #align local_homeomorph.restr_open_to_local_equiv PartialHomeomorph.restrOpen_toPartialEquiv -- Already simp via `PartialEquiv` theorem restrOpen_source (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).source = e.source ∩ s := rfl #align local_homeomorph.restr_open_source PartialHomeomorph.restrOpen_source /-- Restricting a partial homeomorphism `e` to `e.source ∩ interior s`. We use the interior to make sure that the restriction is well defined whatever the set s, since partial homeomorphisms are by definition defined on open sets. In applications where `s` is open, this coincides with the restriction of partial equivalences -/ @[simps! (config := mfld_cfg) apply symm_apply, simps! (config := .lemmasOnly) source target] protected def restr (s : Set α) : PartialHomeomorph α β := e.restrOpen (interior s) isOpen_interior #align local_homeomorph.restr PartialHomeomorph.restr @[simp, mfld_simps] theorem restr_toPartialEquiv (s : Set α) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr (interior s) := rfl #align local_homeomorph.restr_to_local_equiv PartialHomeomorph.restr_toPartialEquiv theorem restr_source' (s : Set α) (hs : IsOpen s) : (e.restr s).source = e.source ∩ s := by rw [e.restr_source, hs.interior_eq] #align local_homeomorph.restr_source' PartialHomeomorph.restr_source' theorem restr_toPartialEquiv' (s : Set α) (hs : IsOpen s) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr s := by rw [e.restr_toPartialEquiv, hs.interior_eq] #align local_homeomorph.restr_to_local_equiv' PartialHomeomorph.restr_toPartialEquiv' theorem restr_eq_of_source_subset {e : PartialHomeomorph α β} {s : Set α} (h : e.source ⊆ s) : e.restr s = e := toPartialEquiv_injective <| PartialEquiv.restr_eq_of_source_subset <| interior_maximal h e.open_source #align local_homeomorph.restr_eq_of_source_subset PartialHomeomorph.restr_eq_of_source_subset @[simp, mfld_simps] theorem restr_univ {e : PartialHomeomorph α β} : e.restr univ = e := restr_eq_of_source_subset (subset_univ _) #align local_homeomorph.restr_univ PartialHomeomorph.restr_univ theorem restr_source_inter (s : Set α) : e.restr (e.source ∩ s) = e.restr s := by refine' PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) _ simp [e.open_source.interior_eq, ← inter_assoc] #align local_homeomorph.restr_source_inter PartialHomeomorph.restr_source_inter /-- The identity on the whole space as a partial homeomorphism. -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] protected def refl (α : Type*) [TopologicalSpace α] : PartialHomeomorph α α := (Homeomorph.refl α).toPartialHomeomorph #align local_homeomorph.refl PartialHomeomorph.refl @[simp, mfld_simps] theorem refl_localEquiv : (PartialHomeomorph.refl α).toPartialEquiv = PartialEquiv.refl α := rfl #align local_homeomorph.refl_local_equiv PartialHomeomorph.refl_localEquiv @[simp, mfld_simps] theorem refl_symm : (PartialHomeomorph.refl α).symm = PartialHomeomorph.refl α := rfl #align local_homeomorph.refl_symm PartialHomeomorph.refl_symm section variable {s : Set α} (hs : IsOpen s) /-- The identity partial equivalence on a set `s` -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] def ofSet (s : Set α) (hs : IsOpen s) : PartialHomeomorph α α where toPartialEquiv := PartialEquiv.ofSet s open_source := hs open_target := hs continuousOn_toFun := continuous_id.continuousOn continuousOn_invFun := continuous_id.continuousOn #align local_homeomorph.of_set PartialHomeomorph.ofSet @[simp, mfld_simps] theorem ofSet_toPartialEquiv : (ofSet s hs).toPartialEquiv = PartialEquiv.ofSet s := rfl #align local_homeomorph.of_set_to_local_equiv PartialHomeomorph.ofSet_toPartialEquiv @[simp, mfld_simps] theorem ofSet_symm : (ofSet s hs).symm = ofSet s hs := rfl #align local_homeomorph.of_set_symm PartialHomeomorph.ofSet_symm @[simp, mfld_simps] theorem ofSet_univ_eq_refl : ofSet univ isOpen_univ = PartialHomeomorph.refl α := by ext <;> simp #align local_homeomorph.of_set_univ_eq_refl PartialHomeomorph.ofSet_univ_eq_refl end /-- Composition of two partial homeomorphisms when the target of the first and the source of the second coincide. -/ @[simps! apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] protected def trans' (h : e.target = e'.source) : PartialHomeomorph α γ where toPartialEquiv := PartialEquiv.trans' e.toPartialEquiv e'.toPartialEquiv h open_source := e.open_source open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuousOn <| h ▸ e.mapsTo continuousOn_invFun := e.continuousOn_symm.comp e'.continuousOn_symm <| h.symm ▸ e'.symm_mapsTo #align local_homeomorph.trans' PartialHomeomorph.trans' /-- Composing two partial homeomorphisms, by restricting to the maximal domain where their composition is well defined. -/ protected def trans : PartialHomeomorph α γ := PartialHomeomorph.trans' (e.symm.restrOpen e'.source e'.open_source).symm (e'.restrOpen e.target e.open_target) (by simp [inter_comm]) #align local_homeomorph.trans PartialHomeomorph.trans @[simp, mfld_simps] theorem trans_toPartialEquiv : (e.trans e').toPartialEquiv = e.toPartialEquiv.trans e'.toPartialEquiv := rfl #align local_homeomorph.trans_to_local_equiv PartialHomeomorph.trans_toPartialEquiv @[simp, mfld_simps] theorem coe_trans : (e.trans e' : α → γ) = e' ∘ e := rfl #align local_homeomorph.coe_trans PartialHomeomorph.coe_trans @[simp, mfld_simps] theorem coe_trans_symm : ((e.trans e').symm : γ → α) = e.symm ∘ e'.symm := rfl #align local_homeomorph.coe_trans_symm PartialHomeomorph.coe_trans_symm theorem trans_apply {x : α} : (e.trans e') x = e' (e x) := rfl #align local_homeomorph.trans_apply PartialHomeomorph.trans_apply theorem trans_symm_eq_symm_trans_symm : (e.trans e').symm = e'.symm.trans e.symm := rfl #align local_homeomorph.trans_symm_eq_symm_trans_symm PartialHomeomorph.trans_symm_eq_symm_trans_symm /- This could be considered as a simp lemma, but there are many situations where it makes something simple into something more complicated. -/ theorem trans_source : (e.trans e').source = e.source ∩ e ⁻¹' e'.source := PartialEquiv.trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source PartialHomeomorph.trans_source theorem trans_source' : (e.trans e').source = e.source ∩ e ⁻¹' (e.target ∩ e'.source) := PartialEquiv.trans_source' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source' PartialHomeomorph.trans_source' theorem trans_source'' : (e.trans e').source = e.symm '' (e.target ∩ e'.source) := PartialEquiv.trans_source'' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source'' PartialHomeomorph.trans_source'' theorem image_trans_source : e '' (e.trans e').source = e.target ∩ e'.source := PartialEquiv.image_trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.image_trans_source PartialHomeomorph.image_trans_source theorem trans_target : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' e.target := rfl #align local_homeomorph.trans_target PartialHomeomorph.trans_target theorem trans_target' : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' (e'.source ∩ e.target) := trans_source' e'.symm e.symm #align local_homeomorph.trans_target' PartialHomeomorph.trans_target' theorem trans_target'' : (e.trans e').target = e' '' (e'.source ∩ e.target) := trans_source'' e'.symm e.symm #align local_homeomorph.trans_target'' PartialHomeomorph.trans_target'' theorem inv_image_trans_target : e'.symm '' (e.trans e').target = e'.source ∩ e.target := image_trans_source e'.symm e.symm #align local_homeomorph.inv_image_trans_target PartialHomeomorph.inv_image_trans_target theorem trans_assoc (e'' : PartialHomeomorph γ δ) : (e.trans e').trans e'' = e.trans (e'.trans e'') := toPartialEquiv_injective <| e.1.trans_assoc _ _ #align local_homeomorph.trans_assoc PartialHomeomorph.trans_assoc @[simp, mfld_simps] theorem trans_refl : e.trans (PartialHomeomorph.refl β) = e := toPartialEquiv_injective e.1.trans_refl #align local_homeomorph.trans_refl PartialHomeomorph.trans_refl @[simp, mfld_simps] theorem refl_trans : (PartialHomeomorph.refl α).trans e = e := toPartialEquiv_injective e.1.refl_trans #align local_homeomorph.refl_trans PartialHomeomorph.refl_trans theorem trans_ofSet {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e ⁻¹' s) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) <| by rw [trans_source, restr_source, ofSet_source, ← preimage_interior, hs.interior_eq] #align local_homeomorph.trans_of_set PartialHomeomorph.trans_ofSet theorem trans_of_set' {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e.source ∩ e ⁻¹' s) := by rw [trans_ofSet, restr_source_inter] #align local_homeomorph.trans_of_set' PartialHomeomorph.trans_of_set' theorem ofSet_trans {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr s := PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) <| by simp [hs.interior_eq, inter_comm] #align local_homeomorph.of_set_trans PartialHomeomorph.ofSet_trans theorem ofSet_trans' {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr (e.source ∩ s) := by rw [ofSet_trans, restr_source_inter] #align local_homeomorph.of_set_trans' PartialHomeomorph.ofSet_trans' @[simp, mfld_simps] theorem ofSet_trans_ofSet {s : Set α} (hs : IsOpen s) {s' : Set α} (hs' : IsOpen s') : (ofSet s hs).trans (ofSet s' hs') = ofSet (s ∩ s') (IsOpen.inter hs hs') := by rw [(ofSet s hs).trans_ofSet hs'] ext <;> simp [hs'.interior_eq] #align local_homeomorph.of_set_trans_of_set PartialHomeomorph.ofSet_trans_ofSet theorem restr_trans (s : Set α) : (e.restr s).trans e' = (e.trans e').restr s := toPartialEquiv_injective <| PartialEquiv.restr_trans e.toPartialEquiv e'.toPartialEquiv (interior s) #align local_homeomorph.restr_trans PartialHomeomorph.restr_trans /-- Postcompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def transHomeomorph (e' : β ≃ₜ γ) : PartialHomeomorph α γ where toPartialEquiv := e.toPartialEquiv.transEquiv e'.toEquiv open_source := e.open_source open_target := e.open_target.preimage e'.symm.continuous continuousOn_toFun := e'.continuous.comp_continuousOn e.continuousOn continuousOn_invFun := e.symm.continuousOn.comp e'.symm.continuous.continuousOn fun _ => id #align local_homeomorph.trans_homeomorph PartialHomeomorph.transHomeomorph theorem transHomeomorph_eq_trans (e' : β ≃ₜ γ) : e.transHomeomorph e' = e.trans e'.toPartialHomeomorph := toPartialEquiv_injective <| PartialEquiv.transEquiv_eq_trans _ _ #align local_homeomorph.trans_equiv_eq_trans PartialHomeomorph.transHomeomorph_eq_trans /-- Precompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def _root_.Homeomorph.transPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α γ where toPartialEquiv := e.toEquiv.transPartialEquiv e'.toPartialEquiv open_source := e'.open_source.preimage e.continuous open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuous.continuousOn fun _ => id continuousOn_invFun := e.symm.continuous.comp_continuousOn e'.symm.continuousOn #align homeomorph.trans_local_homeomorph Homeomorph.transPartialHomeomorph theorem _root_.Homeomorph.transPartialHomeomorph_eq_trans (e : α ≃ₜ β) : e.transPartialHomeomorph e' = e.toPartialHomeomorph.trans e' := toPartialEquiv_injective <| Equiv.transPartialEquiv_eq_trans _ _ #align homeomorph.trans_local_homeomorph_eq_trans Homeomorph.transPartialHomeomorph_eq_trans /-- `EqOnSource e e'` means that `e` and `e'` have the same source, and coincide there. They should really be considered the same partial equivalence. -/ def EqOnSource (e e' : PartialHomeomorph α β) : Prop := e.source = e'.source ∧ EqOn e e' e.source #align local_homeomorph.eq_on_source PartialHomeomorph.EqOnSource theorem eqOnSource_iff (e e' : PartialHomeomorph α β) : EqOnSource e e' ↔ PartialEquiv.EqOnSource e.toPartialEquiv e'.toPartialEquiv := Iff.rfl #align local_homeomorph.eq_on_source_iff PartialHomeomorph.eqOnSource_iff /-- `EqOnSource` is an equivalence relation. -/ instance eqOnSourceSetoid : Setoid (PartialHomeomorph α β) := { PartialEquiv.eqOnSourceSetoid.comap toPartialEquiv with r := EqOnSource } theorem eqOnSource_refl : e ≈ e := Setoid.refl _ #align local_homeomorph.eq_on_source_refl PartialHomeomorph.eqOnSource_refl /-- If two partial homeomorphisms are equivalent, so are their inverses. -/ theorem EqOnSource.symm' {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.symm ≈ e'.symm := PartialEquiv.EqOnSource.symm' h #align local_homeomorph.eq_on_source.symm' PartialHomeomorph.EqOnSource.symm' /-- Two equivalent partial homeomorphisms have the same source. -/ theorem EqOnSource.source_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.source = e'.source := h.1 #align local_homeomorph.eq_on_source.source_eq PartialHomeomorph.EqOnSource.source_eq /-- Two equivalent partial homeomorphisms have the same target. -/ theorem EqOnSource.target_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.target = e'.target := h.symm'.1 #align local_homeomorph.eq_on_source.target_eq PartialHomeomorph.EqOnSource.target_eq /-- Two equivalent partial homeomorphisms have coinciding `toFun` on the source -/ theorem EqOnSource.eqOn {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e e' e.source := h.2 #align local_homeomorph.eq_on_source.eq_on PartialHomeomorph.EqOnSource.eqOn /-- Two equivalent partial homeomorphisms have coinciding `invFun` on the target -/ theorem EqOnSource.symm_eqOn_target {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e.symm e'.symm e.target := h.symm'.2 #align local_homeomorph.eq_on_source.symm_eq_on_target PartialHomeomorph.EqOnSource.symm_eqOn_target /-- Composition of partial homeomorphisms respects equivalence. -/ theorem EqOnSource.trans' {e e' : PartialHomeomorph α β} {f f' : PartialHomeomorph β γ} (he : e ≈ e') (hf : f ≈ f') : e.trans f ≈ e'.trans f' := PartialEquiv.EqOnSource.trans' he hf #align local_homeomorph.eq_on_source.trans' PartialHomeomorph.EqOnSource.trans' /-- Restriction of partial homeomorphisms respects equivalence -/ theorem EqOnSource.restr {e e' : PartialHomeomorph α β} (he : e ≈ e') (s : Set α) : e.restr s ≈ e'.restr s := PartialEquiv.EqOnSource.restr he _ #align local_homeomorph.eq_on_source.restr PartialHomeomorph.EqOnSource.restr /- Two equivalent partial homeomorphisms are equal when the source and target are `univ`. -/ theorem Set.EqOn.restr_eqOn_source {e e' : PartialHomeomorph α β} (h : EqOn e e' (e.source ∩ e'.source)) : e.restr e'.source ≈ e'.restr e.source := by constructor · rw [e'.restr_source' _ e.open_source] rw [e.restr_source' _ e'.open_source] exact Set.inter_comm _ _ · rw [e.restr_source' _ e'.open_source] refine' (EqOn.trans _ h).trans _ <;> simp only [mfld_simps, eqOn_refl] #align local_homeomorph.set.eq_on.restr_eq_on_source PartialHomeomorph.Set.EqOn.restr_eqOn_source /-- Composition of a partial homeomorphism and its inverse is equivalent to the restriction of the identity to the source -/ theorem trans_self_symm : e.trans e.symm ≈ PartialHomeomorph.ofSet e.source e.open_source := PartialEquiv.trans_self_symm _ #align local_homeomorph.trans_self_symm PartialHomeomorph.trans_self_symm theorem trans_symm_self : e.symm.trans e ≈ PartialHomeomorph.ofSet e.target e.open_target := e.symm.trans_self_symm #align local_homeomorph.trans_symm_self PartialHomeomorph.trans_symm_self theorem eq_of_eqOnSource_univ {e e' : PartialHomeomorph α β} (h : e ≈ e') (s : e.source = univ) (t : e.target = univ) : e = e' := toPartialEquiv_injective <| PartialEquiv.eq_of_eqOnSource_univ _ _ h s t #align local_homeomorph.eq_of_eq_on_source_univ PartialHomeomorph.eq_of_eqOnSource_univ section Prod /-- The product of two partial homeomorphisms, as a partial homeomorphism on the product space. -/ @[simps! (config := mfld_cfg) toPartialEquiv apply, simps! (config := .lemmasOnly) source target symm_apply] def prod (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : PartialHomeomorph (α × γ) (β × δ) where open_source := e.open_source.prod e'.open_source open_target := e.open_target.prod e'.open_target continuousOn_toFun := e.continuousOn.prod_map e'.continuousOn continuousOn_invFun := e.continuousOn_symm.prod_map e'.continuousOn_symm toPartialEquiv := e.toPartialEquiv.prod e'.toPartialEquiv #align local_homeomorph.prod PartialHomeomorph.prod @[simp, mfld_simps] theorem prod_symm (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : (e.prod e').symm = e.symm.prod e'.symm := rfl #align local_homeomorph.prod_symm PartialHomeomorph.prod_symm @[simp] theorem refl_prod_refl {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] : (PartialHomeomorph.refl α).prod (PartialHomeomorph.refl β) = PartialHomeomorph.refl (α × β) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) univ_prod_univ #align local_homeomorph.refl_prod_refl PartialHomeomorph.refl_prod_refl @[simp, mfld_simps] theorem prod_trans {η : Type*} {ε : Type*} [TopologicalSpace η] [TopologicalSpace ε] (e : PartialHomeomorph α β) (f : PartialHomeomorph β γ) (e' : PartialHomeomorph δ η) (f' : PartialHomeomorph η ε) : (e.prod e').trans (f.prod f') = (e.trans f).prod (e'.trans f') := toPartialEquiv_injective <| e.1.prod_trans .. #align local_homeomorph.prod_trans PartialHomeomorph.prod_trans theorem prod_eq_prod_of_nonempty {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁.prod e₂).source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by obtain ⟨⟨x, y⟩, -⟩ := id h haveI : Nonempty α := ⟨x⟩ haveI : Nonempty β := ⟨e₁ x⟩ haveI : Nonempty γ := ⟨y⟩ haveI : Nonempty δ := ⟨e₂ y⟩ simp_rw [PartialHomeomorph.ext_iff, prod_apply, prod_symm_apply, prod_source, Prod.ext_iff, Set.prod_eq_prod_iff_of_nonempty h, forall_and, Prod.forall, forall_const, and_assoc, and_left_comm] #align local_homeomorph.prod_eq_prod_of_nonempty PartialHomeomorph.prod_eq_prod_of_nonempty theorem prod_eq_prod_of_nonempty' {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁'.prod e₂').source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by rw [eq_comm, prod_eq_prod_of_nonempty h, eq_comm, @eq_comm _ e₂'] #align local_homeomorph.prod_eq_prod_of_nonempty' PartialHomeomorph.prod_eq_prod_of_nonempty' end Prod section Piecewise /-- Combine two `PartialHomeomorph`s using `Set.piecewise`. The source of the new `PartialHomeomorph` is `s.ite e.source e'.source = e.source ∩ s ∪ e'.source \ s`, and similarly for target. The function sends `e.source ∩ s` to `e.target ∩ t` using `e` and `e'.source \ s` to `e'.target \ t` using `e'`, and similarly for the inverse function. To ensure the maps `toFun` and `invFun` are inverse of each other on the new `source` and `target`, the definition assumes that the sets `s` and `t` are related both by `e.is_image` and `e'.is_image`. To ensure that the new maps are continuous on `source`/`target`, it also assumes that `e.source` and `e'.source` meet `frontier s` on the same set and `e x = e' x` on this intersection. -/ @[simps! (config := .asFn) toPartialEquiv apply] def piecewise (e e' : PartialHomeomorph α β) (s : Set α) (t : Set β) [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquiv.piecewise e'.toPartialEquiv s t H H' open_source := e.open_source.ite e'.open_source Hs open_target := e.open_target.ite e'.open_target <| H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq continuousOn_toFun := continuousOn_piecewise_ite e.continuousOn e'.continuousOn Hs Heq continuousOn_invFun := continuousOn_piecewise_ite e.continuousOn_symm e'.continuousOn_symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) #align local_homeomorph.piecewise PartialHomeomorph.piecewise @[simp] theorem symm_piecewise (e e' : PartialHomeomorph α β) {s : Set α} {t : Set β} [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : (e.piecewise e' s t H H' Hs Heq).symm = e.symm.piecewise e'.symm t s H.symm H'.symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) := rfl #align local_homeomorph.symm_piecewise PartialHomeomorph.symm_piecewise /-- Combine two `PartialHomeomorph`s with disjoint sources and disjoint targets. We reuse `PartialHomeomorph.piecewise` then override `toPartialEquiv` to `PartialEquiv.disjointUnion`. This way we have better definitional equalities for `source` and `target`. -/ def disjointUnion (e e' : PartialHomeomorph α β) [∀ x, Decidable (x ∈ e.source)] [∀ y, Decidable (y ∈ e.target)] (Hs : Disjoint e.source e'.source) (Ht : Disjoint e.target e'.target) : PartialHomeomorph α β := (e.piecewise e' e.source e.target e.isImage_source_target (e'.isImage_source_target_of_disjoint e Hs.symm Ht.symm) (by rw [e.open_source.inter_frontier_eq, (Hs.symm.frontier_right e'.open_source).inter_eq]) (by rw [e.open_source.inter_frontier_eq] exact eqOn_empty _ _)).replaceEquiv (e.toPartialEquiv.disjointUnion e'.toPartialEquiv Hs Ht) (PartialEquiv.disjointUnion_eq_piecewise _ _ _ _).symm #align local_homeomorph.disjoint_union PartialHomeomorph.disjointUnion end Piecewise section Pi variable {ι : Type*} [Fintype ι] {Xi Yi : ι → Type*} [∀ i, TopologicalSpace (Xi i)] [∀ i, TopologicalSpace (Yi i)] (ei : ∀ i, PartialHomeomorph (Xi i) (Yi i)) /-- The product of a finite family of `PartialHomeomorph`s. -/ @[simps toPartialEquiv] def pi : PartialHomeomorph (∀ i, Xi i) (∀ i, Yi i) where toPartialEquiv := PartialEquiv.pi fun i => (ei i).toPartialEquiv open_source := isOpen_set_pi finite_univ fun i _ => (ei i).open_source open_target := isOpen_set_pi finite_univ fun i _ => (ei i).open_target continuousOn_toFun := continuousOn_pi.2 fun i => (ei i).continuousOn.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial continuousOn_invFun := continuousOn_pi.2 fun i => (ei i).continuousOn_symm.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial #align local_homeomorph.pi PartialHomeomorph.pi end Pi section Continuity /-- Continuity within a set at a point can be read under right composition with a local homeomorphism, if the point is in its target -/ theorem continuousWithinAt_iff_continuousWithinAt_comp_right {f : β → γ} {s : Set β} {x : β} (h : x ∈ e.target) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (f ∘ e) (e ⁻¹' s) (e.symm x) := by simp_rw [ContinuousWithinAt, ← @tendsto_map'_iff _ _ _ _ e, e.map_nhdsWithin_preimage_eq (e.map_target h), (· ∘ ·), e.right_inv h] #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_right PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_right /-- Continuity at a point can be read under right composition with a partial homeomorphism, if the point is in its target -/ theorem continuousAt_iff_continuousAt_comp_right {f : β → γ} {x : β} (h : x ∈ e.target) : ContinuousAt f x ↔ ContinuousAt (f ∘ e) (e.symm x) := by rw [← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_right h, preimage_univ, continuousWithinAt_univ] #align local_homeomorph.continuous_at_iff_continuous_at_comp_right PartialHomeomorph.continuousAt_iff_continuousAt_comp_right /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the right is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_right {f : β → γ} {s : Set β} (h : s ⊆ e.target) : ContinuousOn f s ↔ ContinuousOn (f ∘ e) (e.source ∩ e ⁻¹' s) := by simp only [← e.symm_image_eq_source_inter_preimage h, ContinuousOn, ball_image_iff] refine' forall₂_congr fun x hx => _ rw [e.continuousWithinAt_iff_continuousWithinAt_comp_right (h hx), e.symm_image_eq_source_inter_preimage h, inter_comm, continuousWithinAt_inter] exact IsOpen.mem_nhds e.open_source (e.map_target (h hx)) #align local_homeomorph.continuous_on_iff_continuous_on_comp_right PartialHomeomorph.continuousOn_iff_continuousOn_comp_right /-- Continuity within a set at a point can be read under left composition with a local homeomorphism if a neighborhood of the initial point is sent to the source of the local homeomorphism-/ theorem continuousWithinAt_iff_continuousWithinAt_comp_left {f : γ → α} {s : Set γ} {x : γ} (hx : f x ∈ e.source) (h : f ⁻¹' e.source ∈ 𝓝[s] x) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (e ∘ f) s x := by refine' ⟨(e.continuousAt hx).comp_continuousWithinAt, fun fe_cont => _⟩ rw [← continuousWithinAt_inter' h] at fe_cont ⊢ have : ContinuousWithinAt (e.symm ∘ e ∘ f) (s ∩ f ⁻¹' e.source) x := haveI : ContinuousWithinAt e.symm univ (e (f x)) := (e.continuousAt_symm (e.map_source hx)).continuousWithinAt ContinuousWithinAt.comp this fe_cont (subset_univ _) exact this.congr (fun y hy => by simp [e.left_inv hy.2]) (by simp [e.left_inv hx]) #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_left PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_left /-- Continuity at a point can be read under left composition with a partial homeomorphism if a neighborhood of the initial point is sent to the source of the partial homeomorphism-/ theorem continuousAt_iff_continuousAt_comp_left {f : γ → α} {x : γ} (h : f ⁻¹' e.source ∈ 𝓝 x) : ContinuousAt f x ↔ ContinuousAt (e ∘ f) x := by have hx : f x ∈ e.source := (mem_of_mem_nhds h : _) have h' : f ⁻¹' e.source ∈ 𝓝[univ] x := by rwa [nhdsWithin_univ] rw [← continuousWithinAt_univ, ← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_left hx h'] #align local_homeomorph.continuous_at_iff_continuous_at_comp_left PartialHomeomorph.continuousAt_iff_continuousAt_comp_left /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the left is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_left {f : γ → α} {s : Set γ} (h : s ⊆ f ⁻¹' e.source) : ContinuousOn f s ↔ ContinuousOn (e ∘ f) s := forall₂_congr fun _x hx => e.continuousWithinAt_iff_continuousWithinAt_comp_left (h hx) (mem_of_superset self_mem_nhdsWithin h) #align local_homeomorph.continuous_on_iff_continuous_on_comp_left PartialHomeomorph.continuousOn_iff_continuousOn_comp_left /-- A function is continuous if and only if its composition with a partial homeomorphism on the left is continuous and its image is contained in the source. -/ theorem continuous_iff_continuous_comp_left {f : γ → α} (h : f ⁻¹' e.source = univ) : Continuous f ↔ Continuous (e ∘ f) := by simp only [continuous_iff_continuousOn_univ] exact e.continuousOn_iff_continuousOn_comp_left (Eq.symm h).subset #align local_homeomorph.continuous_iff_continuous_comp_left PartialHomeomorph.continuous_iff_continuous_comp_left end Continuity /-- The homeomorphism obtained by restricting a `PartialHomeomorph` to a subset of the source. -/ @[simps] def homeomorphOfImageSubsetSource {s : Set α} {t : Set β} (hs : s ⊆ e.source) (ht : e '' s = t) : s ≃ₜ t := have h₁ : MapsTo e s t := mapsTo'.2 ht.subset have h₂ : t ⊆ e.target := ht ▸ e.image_source_eq_target ▸ image_subset e hs have h₃ : MapsTo e.symm t s := ht ▸ ball_image_iff.2 <| fun _x hx => (e.left_inv (hs hx)).symm ▸ hx { toFun := MapsTo.restrict e s t h₁ invFun := MapsTo.restrict e.symm t s h₃ left_inv := fun a => Subtype.ext (e.left_inv (hs a.2)) right_inv := fun b => Subtype.eq <| e.right_inv (h₂ b.2) continuous_toFun := (e.continuousOn.mono hs).restrict_mapsTo h₁ continuous_invFun := (e.continuousOn_symm.mono h₂).restrict_mapsTo h₃ } #align local_homeomorph.homeomorph_of_image_subset_source PartialHomeomorph.homeomorphOfImageSubsetSource /-- A partial homeomorphism defines a homeomorphism between its source and target. -/ @[simps!] -- porting note: new `simps` def toHomeomorphSourceTarget : e.source ≃ₜ e.target := e.homeomorphOfImageSubsetSource subset_rfl e.image_source_eq_target #align local_homeomorph.to_homeomorph_source_target PartialHomeomorph.toHomeomorphSourceTarget theorem secondCountableTopology_source [SecondCountableTopology β] (e : PartialHomeomorph α β) : SecondCountableTopology e.source := e.toHomeomorphSourceTarget.secondCountableTopology #align local_homeomorph.second_countable_topology_source PartialHomeomorph.secondCountableTopology_source theorem nhds_eq_comap_inf_principal {x} (hx : x ∈ e.source) : 𝓝 x = comap e (𝓝 (e x)) ⊓ 𝓟 e.source := by lift x to e.source using hx rw [← e.open_source.nhdsWithin_eq x.2, ← map_nhds_subtype_val, ← map_comap_setCoe_val, e.toHomeomorphSourceTarget.nhds_eq_comap, nhds_subtype_eq_comap] simp only [(· ∘ ·), toHomeomorphSourceTarget_apply_coe, comap_comap] /-- If a partial homeomorphism has source and target equal to univ, then it induces a homeomorphism between the whole spaces, expressed in this definition. -/ @[simps (config := mfld_cfg) apply symm_apply] -- porting note: todo: add a `PartialEquiv` version def toHomeomorphOfSourceEqUnivTargetEqUniv (h : e.source = (univ : Set α)) (h' : e.target = univ) : α ≃ₜ β where toFun := e invFun := e.symm left_inv x := e.left_inv <| by rw [h] exact mem_univ _ right_inv x := e.right_inv <| by rw [h'] exact mem_univ _ continuous_toFun := by simpa only [continuous_iff_continuousOn_univ, h] using e.continuousOn continuous_invFun := by simpa only [continuous_iff_continuousOn_univ, h'] using e.continuousOn_symm #align local_homeomorph.to_homeomorph_of_source_eq_univ_target_eq_univ PartialHomeomorph.toHomeomorphOfSourceEqUnivTargetEqUniv theorem openEmbedding_restrict : OpenEmbedding (e.source.restrict e) := by refine openEmbedding_of_continuous_injective_open (e.continuousOn.comp_continuous continuous_subtype_val Subtype.prop) e.injOn.injective fun V hV ↦ ?_ rw [Set.restrict_eq, Set.image_comp] exact e.image_isOpen_of_isOpen (e.open_source.isOpenMap_subtype_val V hV) fun _ ⟨x, _, h⟩ ↦ h ▸ x.2 /-- A partial homeomorphism whose source is all of `α` defines an open embedding of `α` into `β`. The converse is also true; see `OpenEmbedding.toPartialHomeomorph`. -/ theorem to_openEmbedding (h : e.source = Set.univ) : OpenEmbedding e := e.openEmbedding_restrict.comp ((Homeomorph.setCongr h).trans <| Homeomorph.Set.univ α).symm.openEmbedding #align local_homeomorph.to_open_embedding PartialHomeomorph.to_openEmbedding end PartialHomeomorph namespace Homeomorph variable (e : α ≃ₜ β) (e' : β ≃ₜ γ) /- Register as simp lemmas that the fields of a partial homeomorphism built from a homeomorphism correspond to the fields of the original homeomorphism. -/ @[simp, mfld_simps] theorem refl_toPartialHomeomorph : (Homeomorph.refl α).toPartialHomeomorph = PartialHomeomorph.refl α := rfl #align homeomorph.refl_to_local_homeomorph Homeomorph.refl_toPartialHomeomorph @[simp, mfld_simps] theorem symm_toPartialHomeomorph : e.symm.toPartialHomeomorph = e.toPartialHomeomorph.symm := rfl #align homeomorph.symm_to_local_homeomorph Homeomorph.symm_toPartialHomeomorph @[simp, mfld_simps] theorem trans_toPartialHomeomorph : (e.trans e').toPartialHomeomorph = e.toPartialHomeomorph.trans e'.toPartialHomeomorph := PartialHomeomorph.toPartialEquiv_injective <| Equiv.trans_toPartialEquiv _ _ #align homeomorph.trans_to_local_homeomorph Homeomorph.trans_toPartialHomeomorph end Homeomorph namespace OpenEmbedding variable (f : α → β) (h : OpenEmbedding f) /-- An open embedding of `α` into `β`, with `α` nonempty, defines a partial homeomorphism whose source is all of `α`. The converse is also true; see `PartialHomeomorph.to_openEmbedding`. -/ @[simps! (config := mfld_cfg) apply source target] noncomputable def toPartialHomeomorph [Nonempty α] : PartialHomeomorph α β := PartialHomeomorph.ofContinuousOpen ((h.toEmbedding.inj.injOn univ).toPartialEquiv _ _) h.continuous.continuousOn h.isOpenMap isOpen_univ #align open_embedding.to_local_homeomorph OpenEmbedding.toPartialHomeomorph variable [Nonempty α] lemma toPartialHomeomorph_left_inv {x : α} : (h.toPartialHomeomorph f).symm (f x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.left_inv] exact Set.mem_univ _ lemma toPartialHomeomorph_right_inv {x : β} (hx : x ∈ Set.range f) : f ((h.toPartialHomeomorph f).symm x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.right_inv] rwa [toPartialHomeomorph_target] end OpenEmbedding namespace TopologicalSpace.Opens open TopologicalSpace variable (s : Opens α) [Nonempty s] /-- The inclusion of an open subset `s` of a space `α` into `α` is a partial homeomorphism from the subtype `s` to `α`. -/ noncomputable def localHomeomorphSubtypeCoe : PartialHomeomorph s α := OpenEmbedding.toPartialHomeomorph _ s.2.openEmbedding_subtype_val #align topological_space.opens.local_homeomorph_subtype_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_coe : (s.localHomeomorphSubtypeCoe : s → α) = (↑) := rfl #align topological_space.opens.local_homeomorph_subtype_coe_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe_coe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_source : s.localHomeomorphSubtypeCoe.source = Set.univ := rfl #align topological_space.opens.local_homeomorph_subtype_coe_source TopologicalSpace.Opens.localHomeomorphSubtypeCoe_source @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_target : s.localHomeomorphSubtypeCoe.target = s := by simp only [localHomeomorphSubtypeCoe, Subtype.range_coe_subtype, mfld_simps] rfl #align topological_space.opens.local_homeomorph_subtype_coe_target TopologicalSpace.Opens.localHomeomorphSubtypeCoe_target end TopologicalSpace.Opens namespace PartialHomeomorph open TopologicalSpace variable (e : PartialHomeomorph α β) variable (s : Opens α) [Nonempty s] /-- The restriction of a partial homeomorphism `e` to an open subset `s` of the domain type produces a partial homeomorphism whose domain is the subtype `s`. -/ noncomputable def subtypeRestr : PartialHomeomorph s β := s.localHomeomorphSubtypeCoe.trans e #align local_homeomorph.subtype_restr PartialHomeomorph.subtypeRestr theorem subtypeRestr_def : e.subtypeRestr s = s.localHomeomorphSubtypeCoe.trans e := rfl #align local_homeomorph.subtype_restr_def PartialHomeomorph.subtypeRestr_def @[simp, mfld_simps] theorem subtypeRestr_coe : ((e.subtypeRestr s : PartialHomeomorph s β) : s → β) = Set.restrict ↑s (e : α → β) := rfl #align local_homeomorph.subtype_restr_coe PartialHomeomorph.subtypeRestr_coe @[simp, mfld_simps] theorem subtypeRestr_source : (e.subtypeRestr s).source = (↑) ⁻¹' e.source := by simp only [subtypeRestr_def, mfld_simps] #align local_homeomorph.subtype_restr_source PartialHomeomorph.subtypeRestr_source variable {s} theorem map_subtype_source {x : s} (hxe : (x : α) ∈ e.source): e x ∈ (e.subtypeRestr s).target := by refine' ⟨e.map_source hxe, _⟩ rw [s.localHomeomorphSubtypeCoe_target, mem_preimage, e.leftInvOn hxe] exact x.prop #align local_homeomorph.map_subtype_source PartialHomeomorph.map_subtype_source variable (s) /- This lemma characterizes the transition functions of an open subset in terms of the transition functions of the original space. -/ theorem subtypeRestr_symm_trans_subtypeRestr (f f' : PartialHomeomorph α β) : (f.subtypeRestr s).symm.trans (f'.subtypeRestr s) ≈ (f.symm.trans f').restr (f.target ∩ f.symm ⁻¹' s) := by simp only [subtypeRestr_def, trans_symm_eq_symm_trans_symm] have openness₁ : IsOpen (f.target ∩ f.symm ⁻¹' s) := f.isOpen_inter_preimage_symm s.2 rw [← ofSet_trans _ openness₁, ← trans_assoc, ← trans_assoc] refine' EqOnSource.trans' _ (eqOnSource_refl _) -- f' has been eliminated !!! have sets_identity : f.symm.source ∩ (f.target ∩ f.symm ⁻¹' s) = f.symm.source ∩ f.symm ⁻¹' s := by mfld_set_tac have openness₂ : IsOpen (s : Set α) := s.2 rw [ofSet_trans', sets_identity, ← trans_of_set' _ openness₂, trans_assoc] refine' EqOnSource.trans' (eqOnSource_refl _) _ -- f has been eliminated !!! refine' Setoid.trans (trans_symm_self s.localHomeomorphSubtypeCoe) _ simp only [mfld_simps, Setoid.refl] #align local_homeomorph.subtype_restr_symm_trans_subtype_restr PartialHomeomorph.subtypeRestr_symm_trans_subtypeRestr theorem subtypeRestr_symm_eqOn (U : Opens α) [Nonempty U] : EqOn e.symm (Subtype.val ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by intro y hy rw [eq_comm, eq_symm_apply _ _ hy.1] · change restrict _ e _ = _ rw [← subtypeRestr_coe, (e.subtypeRestr U).right_inv hy] · have := map_target _ hy; rwa [subtypeRestr_source] at this theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ ·
rw [← PartialHomeomorph.symm_target]
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ ·
Mathlib.Topology.PartialHomeomorph.1460_0.xRULiNOId4c9Kju
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target
Mathlib_Topology_PartialHomeomorph
case refine'_1 α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝⁶ : TopologicalSpace α inst✝⁵ : TopologicalSpace β inst✝⁴ : TopologicalSpace γ inst✝³ : TopologicalSpace δ e : PartialHomeomorph α β s : Opens α inst✝² : Nonempty ↥s U V : Opens α inst✝¹ : Nonempty ↥U inst✝ : Nonempty ↥V hUV : U ≤ V i : ↑↑U → ↑↑V := inclusion hUV y : β hy : y ∈ e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' (Opens.localHomeomorphSubtypeCoe U).toPartialEquiv.target hyV : ↑(PartialHomeomorph.symm e) y ∈ (Opens.localHomeomorphSubtypeCoe V).toPartialEquiv.target ⊢ ↑(PartialHomeomorph.symm (Opens.localHomeomorphSubtypeCoe V)) (↑(PartialHomeomorph.symm e) y) ∈ (PartialHomeomorph.symm (Opens.localHomeomorphSubtypeCoe V)).toPartialEquiv.target
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.is_image.map_nhds_within_eq PartialHomeomorph.IsImage.map_nhdsWithin_eq protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff] #align local_homeomorph.is_image.closure PartialHomeomorph.IsImage.closure protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by simpa only [closure_compl, compl_compl] using h.compl.closure.compl #align local_homeomorph.is_image.interior PartialHomeomorph.IsImage.interior protected theorem frontier (h : e.IsImage s t) : e.IsImage (frontier s) (frontier t) := h.closure.diff h.interior #align local_homeomorph.is_image.frontier PartialHomeomorph.IsImage.frontier theorem isOpen_iff (h : e.IsImage s t) : IsOpen (e.source ∩ s) ↔ IsOpen (e.target ∩ t) := ⟨fun hs => h.symm_preimage_eq' ▸ e.symm.isOpen_inter_preimage hs, fun hs => h.preimage_eq' ▸ e.isOpen_inter_preimage hs⟩ #align local_homeomorph.is_image.is_open_iff PartialHomeomorph.IsImage.isOpen_iff /-- Restrict a `PartialHomeomorph` to a pair of corresponding open sets. -/ @[simps toPartialEquiv] def restr (h : e.IsImage s t) (hs : IsOpen (e.source ∩ s)) : PartialHomeomorph α β where toPartialEquiv := h.toPartialEquiv.restr open_source := hs open_target := h.isOpen_iff.1 hs continuousOn_toFun := e.continuousOn.mono (inter_subset_left _ _) continuousOn_invFun := e.symm.continuousOn.mono (inter_subset_left _ _) #align local_homeomorph.is_image.restr PartialHomeomorph.IsImage.restr end IsImage theorem isImage_source_target : e.IsImage e.source e.target := e.toPartialEquiv.isImage_source_target #align local_homeomorph.is_image_source_target PartialHomeomorph.isImage_source_target theorem isImage_source_target_of_disjoint (e' : PartialHomeomorph α β) (hs : Disjoint e.source e'.source) (ht : Disjoint e.target e'.target) : e.IsImage e'.source e'.target := e.toPartialEquiv.isImage_source_target_of_disjoint e'.toPartialEquiv hs ht #align local_homeomorph.is_image_source_target_of_disjoint PartialHomeomorph.isImage_source_target_of_disjoint /-- Preimage of interior or interior of preimage coincide for partial homeomorphisms, when restricted to the source. -/ theorem preimage_interior (s : Set β) : e.source ∩ e ⁻¹' interior s = e.source ∩ interior (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).interior.preimage_eq #align local_homeomorph.preimage_interior PartialHomeomorph.preimage_interior theorem preimage_closure (s : Set β) : e.source ∩ e ⁻¹' closure s = e.source ∩ closure (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).closure.preimage_eq #align local_homeomorph.preimage_closure PartialHomeomorph.preimage_closure theorem preimage_frontier (s : Set β) : e.source ∩ e ⁻¹' frontier s = e.source ∩ frontier (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).frontier.preimage_eq #align local_homeomorph.preimage_frontier PartialHomeomorph.preimage_frontier theorem isOpen_inter_preimage_symm {s : Set α} (hs : IsOpen s) : IsOpen (e.target ∩ e.symm ⁻¹' s) := e.symm.continuousOn.isOpen_inter_preimage e.open_target hs #align local_homeomorph.preimage_open_of_open_symm PartialHomeomorph.isOpen_inter_preimage_symm /-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by have : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h rw [this] exact e.continuousOn_symm.isOpen_inter_preimage e.open_target hs #align local_homeomorph.image_open_of_open PartialHomeomorph.image_isOpen_of_isOpen /-- The image of the restriction of an open set to the source is open. -/ theorem image_isOpen_of_isOpen' {s : Set α} (hs : IsOpen s) : IsOpen (e '' (e.source ∩ s)) := image_isOpen_of_isOpen _ (IsOpen.inter e.open_source hs) (inter_subset_left _ _) #align local_homeomorph.image_open_of_open' PartialHomeomorph.image_isOpen_of_isOpen' /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpenRestrict (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap (e.source.restrict e)) (hs : IsOpen e.source) : PartialHomeomorph α β where toPartialEquiv := e open_source := hs open_target := by simpa only [range_restrict, e.image_source_eq_target] using ho.isOpen_range continuousOn_toFun := hc continuousOn_invFun := e.image_source_eq_target ▸ ho.continuousOn_image_of_leftInvOn e.leftInvOn #align local_homeomorph.of_continuous_open_restrict PartialHomeomorph.ofContinuousOpenRestrict /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpen (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap e) (hs : IsOpen e.source) : PartialHomeomorph α β := ofContinuousOpenRestrict e hc (ho.restrict hs) hs #align local_homeomorph.of_continuous_open PartialHomeomorph.ofContinuousOpen /-- Restricting a partial homeomorphism `e` to `e.source ∩ s` when `s` is open. This is sometimes hard to use because of the openness assumption, but it has the advantage that when it can be used then its `PartialEquiv` is defeq to `PartialEquiv.restr`. -/ protected def restrOpen (s : Set α) (hs : IsOpen s) : PartialHomeomorph α β := (@IsImage.of_symm_preimage_eq α β _ _ e s (e.symm ⁻¹' s) rfl).restr (IsOpen.inter e.open_source hs) #align local_homeomorph.restr_open PartialHomeomorph.restrOpen @[simp, mfld_simps] theorem restrOpen_toPartialEquiv (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).toPartialEquiv = e.toPartialEquiv.restr s := rfl #align local_homeomorph.restr_open_to_local_equiv PartialHomeomorph.restrOpen_toPartialEquiv -- Already simp via `PartialEquiv` theorem restrOpen_source (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).source = e.source ∩ s := rfl #align local_homeomorph.restr_open_source PartialHomeomorph.restrOpen_source /-- Restricting a partial homeomorphism `e` to `e.source ∩ interior s`. We use the interior to make sure that the restriction is well defined whatever the set s, since partial homeomorphisms are by definition defined on open sets. In applications where `s` is open, this coincides with the restriction of partial equivalences -/ @[simps! (config := mfld_cfg) apply symm_apply, simps! (config := .lemmasOnly) source target] protected def restr (s : Set α) : PartialHomeomorph α β := e.restrOpen (interior s) isOpen_interior #align local_homeomorph.restr PartialHomeomorph.restr @[simp, mfld_simps] theorem restr_toPartialEquiv (s : Set α) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr (interior s) := rfl #align local_homeomorph.restr_to_local_equiv PartialHomeomorph.restr_toPartialEquiv theorem restr_source' (s : Set α) (hs : IsOpen s) : (e.restr s).source = e.source ∩ s := by rw [e.restr_source, hs.interior_eq] #align local_homeomorph.restr_source' PartialHomeomorph.restr_source' theorem restr_toPartialEquiv' (s : Set α) (hs : IsOpen s) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr s := by rw [e.restr_toPartialEquiv, hs.interior_eq] #align local_homeomorph.restr_to_local_equiv' PartialHomeomorph.restr_toPartialEquiv' theorem restr_eq_of_source_subset {e : PartialHomeomorph α β} {s : Set α} (h : e.source ⊆ s) : e.restr s = e := toPartialEquiv_injective <| PartialEquiv.restr_eq_of_source_subset <| interior_maximal h e.open_source #align local_homeomorph.restr_eq_of_source_subset PartialHomeomorph.restr_eq_of_source_subset @[simp, mfld_simps] theorem restr_univ {e : PartialHomeomorph α β} : e.restr univ = e := restr_eq_of_source_subset (subset_univ _) #align local_homeomorph.restr_univ PartialHomeomorph.restr_univ theorem restr_source_inter (s : Set α) : e.restr (e.source ∩ s) = e.restr s := by refine' PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) _ simp [e.open_source.interior_eq, ← inter_assoc] #align local_homeomorph.restr_source_inter PartialHomeomorph.restr_source_inter /-- The identity on the whole space as a partial homeomorphism. -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] protected def refl (α : Type*) [TopologicalSpace α] : PartialHomeomorph α α := (Homeomorph.refl α).toPartialHomeomorph #align local_homeomorph.refl PartialHomeomorph.refl @[simp, mfld_simps] theorem refl_localEquiv : (PartialHomeomorph.refl α).toPartialEquiv = PartialEquiv.refl α := rfl #align local_homeomorph.refl_local_equiv PartialHomeomorph.refl_localEquiv @[simp, mfld_simps] theorem refl_symm : (PartialHomeomorph.refl α).symm = PartialHomeomorph.refl α := rfl #align local_homeomorph.refl_symm PartialHomeomorph.refl_symm section variable {s : Set α} (hs : IsOpen s) /-- The identity partial equivalence on a set `s` -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] def ofSet (s : Set α) (hs : IsOpen s) : PartialHomeomorph α α where toPartialEquiv := PartialEquiv.ofSet s open_source := hs open_target := hs continuousOn_toFun := continuous_id.continuousOn continuousOn_invFun := continuous_id.continuousOn #align local_homeomorph.of_set PartialHomeomorph.ofSet @[simp, mfld_simps] theorem ofSet_toPartialEquiv : (ofSet s hs).toPartialEquiv = PartialEquiv.ofSet s := rfl #align local_homeomorph.of_set_to_local_equiv PartialHomeomorph.ofSet_toPartialEquiv @[simp, mfld_simps] theorem ofSet_symm : (ofSet s hs).symm = ofSet s hs := rfl #align local_homeomorph.of_set_symm PartialHomeomorph.ofSet_symm @[simp, mfld_simps] theorem ofSet_univ_eq_refl : ofSet univ isOpen_univ = PartialHomeomorph.refl α := by ext <;> simp #align local_homeomorph.of_set_univ_eq_refl PartialHomeomorph.ofSet_univ_eq_refl end /-- Composition of two partial homeomorphisms when the target of the first and the source of the second coincide. -/ @[simps! apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] protected def trans' (h : e.target = e'.source) : PartialHomeomorph α γ where toPartialEquiv := PartialEquiv.trans' e.toPartialEquiv e'.toPartialEquiv h open_source := e.open_source open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuousOn <| h ▸ e.mapsTo continuousOn_invFun := e.continuousOn_symm.comp e'.continuousOn_symm <| h.symm ▸ e'.symm_mapsTo #align local_homeomorph.trans' PartialHomeomorph.trans' /-- Composing two partial homeomorphisms, by restricting to the maximal domain where their composition is well defined. -/ protected def trans : PartialHomeomorph α γ := PartialHomeomorph.trans' (e.symm.restrOpen e'.source e'.open_source).symm (e'.restrOpen e.target e.open_target) (by simp [inter_comm]) #align local_homeomorph.trans PartialHomeomorph.trans @[simp, mfld_simps] theorem trans_toPartialEquiv : (e.trans e').toPartialEquiv = e.toPartialEquiv.trans e'.toPartialEquiv := rfl #align local_homeomorph.trans_to_local_equiv PartialHomeomorph.trans_toPartialEquiv @[simp, mfld_simps] theorem coe_trans : (e.trans e' : α → γ) = e' ∘ e := rfl #align local_homeomorph.coe_trans PartialHomeomorph.coe_trans @[simp, mfld_simps] theorem coe_trans_symm : ((e.trans e').symm : γ → α) = e.symm ∘ e'.symm := rfl #align local_homeomorph.coe_trans_symm PartialHomeomorph.coe_trans_symm theorem trans_apply {x : α} : (e.trans e') x = e' (e x) := rfl #align local_homeomorph.trans_apply PartialHomeomorph.trans_apply theorem trans_symm_eq_symm_trans_symm : (e.trans e').symm = e'.symm.trans e.symm := rfl #align local_homeomorph.trans_symm_eq_symm_trans_symm PartialHomeomorph.trans_symm_eq_symm_trans_symm /- This could be considered as a simp lemma, but there are many situations where it makes something simple into something more complicated. -/ theorem trans_source : (e.trans e').source = e.source ∩ e ⁻¹' e'.source := PartialEquiv.trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source PartialHomeomorph.trans_source theorem trans_source' : (e.trans e').source = e.source ∩ e ⁻¹' (e.target ∩ e'.source) := PartialEquiv.trans_source' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source' PartialHomeomorph.trans_source' theorem trans_source'' : (e.trans e').source = e.symm '' (e.target ∩ e'.source) := PartialEquiv.trans_source'' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source'' PartialHomeomorph.trans_source'' theorem image_trans_source : e '' (e.trans e').source = e.target ∩ e'.source := PartialEquiv.image_trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.image_trans_source PartialHomeomorph.image_trans_source theorem trans_target : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' e.target := rfl #align local_homeomorph.trans_target PartialHomeomorph.trans_target theorem trans_target' : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' (e'.source ∩ e.target) := trans_source' e'.symm e.symm #align local_homeomorph.trans_target' PartialHomeomorph.trans_target' theorem trans_target'' : (e.trans e').target = e' '' (e'.source ∩ e.target) := trans_source'' e'.symm e.symm #align local_homeomorph.trans_target'' PartialHomeomorph.trans_target'' theorem inv_image_trans_target : e'.symm '' (e.trans e').target = e'.source ∩ e.target := image_trans_source e'.symm e.symm #align local_homeomorph.inv_image_trans_target PartialHomeomorph.inv_image_trans_target theorem trans_assoc (e'' : PartialHomeomorph γ δ) : (e.trans e').trans e'' = e.trans (e'.trans e'') := toPartialEquiv_injective <| e.1.trans_assoc _ _ #align local_homeomorph.trans_assoc PartialHomeomorph.trans_assoc @[simp, mfld_simps] theorem trans_refl : e.trans (PartialHomeomorph.refl β) = e := toPartialEquiv_injective e.1.trans_refl #align local_homeomorph.trans_refl PartialHomeomorph.trans_refl @[simp, mfld_simps] theorem refl_trans : (PartialHomeomorph.refl α).trans e = e := toPartialEquiv_injective e.1.refl_trans #align local_homeomorph.refl_trans PartialHomeomorph.refl_trans theorem trans_ofSet {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e ⁻¹' s) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) <| by rw [trans_source, restr_source, ofSet_source, ← preimage_interior, hs.interior_eq] #align local_homeomorph.trans_of_set PartialHomeomorph.trans_ofSet theorem trans_of_set' {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e.source ∩ e ⁻¹' s) := by rw [trans_ofSet, restr_source_inter] #align local_homeomorph.trans_of_set' PartialHomeomorph.trans_of_set' theorem ofSet_trans {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr s := PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) <| by simp [hs.interior_eq, inter_comm] #align local_homeomorph.of_set_trans PartialHomeomorph.ofSet_trans theorem ofSet_trans' {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr (e.source ∩ s) := by rw [ofSet_trans, restr_source_inter] #align local_homeomorph.of_set_trans' PartialHomeomorph.ofSet_trans' @[simp, mfld_simps] theorem ofSet_trans_ofSet {s : Set α} (hs : IsOpen s) {s' : Set α} (hs' : IsOpen s') : (ofSet s hs).trans (ofSet s' hs') = ofSet (s ∩ s') (IsOpen.inter hs hs') := by rw [(ofSet s hs).trans_ofSet hs'] ext <;> simp [hs'.interior_eq] #align local_homeomorph.of_set_trans_of_set PartialHomeomorph.ofSet_trans_ofSet theorem restr_trans (s : Set α) : (e.restr s).trans e' = (e.trans e').restr s := toPartialEquiv_injective <| PartialEquiv.restr_trans e.toPartialEquiv e'.toPartialEquiv (interior s) #align local_homeomorph.restr_trans PartialHomeomorph.restr_trans /-- Postcompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def transHomeomorph (e' : β ≃ₜ γ) : PartialHomeomorph α γ where toPartialEquiv := e.toPartialEquiv.transEquiv e'.toEquiv open_source := e.open_source open_target := e.open_target.preimage e'.symm.continuous continuousOn_toFun := e'.continuous.comp_continuousOn e.continuousOn continuousOn_invFun := e.symm.continuousOn.comp e'.symm.continuous.continuousOn fun _ => id #align local_homeomorph.trans_homeomorph PartialHomeomorph.transHomeomorph theorem transHomeomorph_eq_trans (e' : β ≃ₜ γ) : e.transHomeomorph e' = e.trans e'.toPartialHomeomorph := toPartialEquiv_injective <| PartialEquiv.transEquiv_eq_trans _ _ #align local_homeomorph.trans_equiv_eq_trans PartialHomeomorph.transHomeomorph_eq_trans /-- Precompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def _root_.Homeomorph.transPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α γ where toPartialEquiv := e.toEquiv.transPartialEquiv e'.toPartialEquiv open_source := e'.open_source.preimage e.continuous open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuous.continuousOn fun _ => id continuousOn_invFun := e.symm.continuous.comp_continuousOn e'.symm.continuousOn #align homeomorph.trans_local_homeomorph Homeomorph.transPartialHomeomorph theorem _root_.Homeomorph.transPartialHomeomorph_eq_trans (e : α ≃ₜ β) : e.transPartialHomeomorph e' = e.toPartialHomeomorph.trans e' := toPartialEquiv_injective <| Equiv.transPartialEquiv_eq_trans _ _ #align homeomorph.trans_local_homeomorph_eq_trans Homeomorph.transPartialHomeomorph_eq_trans /-- `EqOnSource e e'` means that `e` and `e'` have the same source, and coincide there. They should really be considered the same partial equivalence. -/ def EqOnSource (e e' : PartialHomeomorph α β) : Prop := e.source = e'.source ∧ EqOn e e' e.source #align local_homeomorph.eq_on_source PartialHomeomorph.EqOnSource theorem eqOnSource_iff (e e' : PartialHomeomorph α β) : EqOnSource e e' ↔ PartialEquiv.EqOnSource e.toPartialEquiv e'.toPartialEquiv := Iff.rfl #align local_homeomorph.eq_on_source_iff PartialHomeomorph.eqOnSource_iff /-- `EqOnSource` is an equivalence relation. -/ instance eqOnSourceSetoid : Setoid (PartialHomeomorph α β) := { PartialEquiv.eqOnSourceSetoid.comap toPartialEquiv with r := EqOnSource } theorem eqOnSource_refl : e ≈ e := Setoid.refl _ #align local_homeomorph.eq_on_source_refl PartialHomeomorph.eqOnSource_refl /-- If two partial homeomorphisms are equivalent, so are their inverses. -/ theorem EqOnSource.symm' {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.symm ≈ e'.symm := PartialEquiv.EqOnSource.symm' h #align local_homeomorph.eq_on_source.symm' PartialHomeomorph.EqOnSource.symm' /-- Two equivalent partial homeomorphisms have the same source. -/ theorem EqOnSource.source_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.source = e'.source := h.1 #align local_homeomorph.eq_on_source.source_eq PartialHomeomorph.EqOnSource.source_eq /-- Two equivalent partial homeomorphisms have the same target. -/ theorem EqOnSource.target_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.target = e'.target := h.symm'.1 #align local_homeomorph.eq_on_source.target_eq PartialHomeomorph.EqOnSource.target_eq /-- Two equivalent partial homeomorphisms have coinciding `toFun` on the source -/ theorem EqOnSource.eqOn {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e e' e.source := h.2 #align local_homeomorph.eq_on_source.eq_on PartialHomeomorph.EqOnSource.eqOn /-- Two equivalent partial homeomorphisms have coinciding `invFun` on the target -/ theorem EqOnSource.symm_eqOn_target {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e.symm e'.symm e.target := h.symm'.2 #align local_homeomorph.eq_on_source.symm_eq_on_target PartialHomeomorph.EqOnSource.symm_eqOn_target /-- Composition of partial homeomorphisms respects equivalence. -/ theorem EqOnSource.trans' {e e' : PartialHomeomorph α β} {f f' : PartialHomeomorph β γ} (he : e ≈ e') (hf : f ≈ f') : e.trans f ≈ e'.trans f' := PartialEquiv.EqOnSource.trans' he hf #align local_homeomorph.eq_on_source.trans' PartialHomeomorph.EqOnSource.trans' /-- Restriction of partial homeomorphisms respects equivalence -/ theorem EqOnSource.restr {e e' : PartialHomeomorph α β} (he : e ≈ e') (s : Set α) : e.restr s ≈ e'.restr s := PartialEquiv.EqOnSource.restr he _ #align local_homeomorph.eq_on_source.restr PartialHomeomorph.EqOnSource.restr /- Two equivalent partial homeomorphisms are equal when the source and target are `univ`. -/ theorem Set.EqOn.restr_eqOn_source {e e' : PartialHomeomorph α β} (h : EqOn e e' (e.source ∩ e'.source)) : e.restr e'.source ≈ e'.restr e.source := by constructor · rw [e'.restr_source' _ e.open_source] rw [e.restr_source' _ e'.open_source] exact Set.inter_comm _ _ · rw [e.restr_source' _ e'.open_source] refine' (EqOn.trans _ h).trans _ <;> simp only [mfld_simps, eqOn_refl] #align local_homeomorph.set.eq_on.restr_eq_on_source PartialHomeomorph.Set.EqOn.restr_eqOn_source /-- Composition of a partial homeomorphism and its inverse is equivalent to the restriction of the identity to the source -/ theorem trans_self_symm : e.trans e.symm ≈ PartialHomeomorph.ofSet e.source e.open_source := PartialEquiv.trans_self_symm _ #align local_homeomorph.trans_self_symm PartialHomeomorph.trans_self_symm theorem trans_symm_self : e.symm.trans e ≈ PartialHomeomorph.ofSet e.target e.open_target := e.symm.trans_self_symm #align local_homeomorph.trans_symm_self PartialHomeomorph.trans_symm_self theorem eq_of_eqOnSource_univ {e e' : PartialHomeomorph α β} (h : e ≈ e') (s : e.source = univ) (t : e.target = univ) : e = e' := toPartialEquiv_injective <| PartialEquiv.eq_of_eqOnSource_univ _ _ h s t #align local_homeomorph.eq_of_eq_on_source_univ PartialHomeomorph.eq_of_eqOnSource_univ section Prod /-- The product of two partial homeomorphisms, as a partial homeomorphism on the product space. -/ @[simps! (config := mfld_cfg) toPartialEquiv apply, simps! (config := .lemmasOnly) source target symm_apply] def prod (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : PartialHomeomorph (α × γ) (β × δ) where open_source := e.open_source.prod e'.open_source open_target := e.open_target.prod e'.open_target continuousOn_toFun := e.continuousOn.prod_map e'.continuousOn continuousOn_invFun := e.continuousOn_symm.prod_map e'.continuousOn_symm toPartialEquiv := e.toPartialEquiv.prod e'.toPartialEquiv #align local_homeomorph.prod PartialHomeomorph.prod @[simp, mfld_simps] theorem prod_symm (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : (e.prod e').symm = e.symm.prod e'.symm := rfl #align local_homeomorph.prod_symm PartialHomeomorph.prod_symm @[simp] theorem refl_prod_refl {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] : (PartialHomeomorph.refl α).prod (PartialHomeomorph.refl β) = PartialHomeomorph.refl (α × β) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) univ_prod_univ #align local_homeomorph.refl_prod_refl PartialHomeomorph.refl_prod_refl @[simp, mfld_simps] theorem prod_trans {η : Type*} {ε : Type*} [TopologicalSpace η] [TopologicalSpace ε] (e : PartialHomeomorph α β) (f : PartialHomeomorph β γ) (e' : PartialHomeomorph δ η) (f' : PartialHomeomorph η ε) : (e.prod e').trans (f.prod f') = (e.trans f).prod (e'.trans f') := toPartialEquiv_injective <| e.1.prod_trans .. #align local_homeomorph.prod_trans PartialHomeomorph.prod_trans theorem prod_eq_prod_of_nonempty {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁.prod e₂).source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by obtain ⟨⟨x, y⟩, -⟩ := id h haveI : Nonempty α := ⟨x⟩ haveI : Nonempty β := ⟨e₁ x⟩ haveI : Nonempty γ := ⟨y⟩ haveI : Nonempty δ := ⟨e₂ y⟩ simp_rw [PartialHomeomorph.ext_iff, prod_apply, prod_symm_apply, prod_source, Prod.ext_iff, Set.prod_eq_prod_iff_of_nonempty h, forall_and, Prod.forall, forall_const, and_assoc, and_left_comm] #align local_homeomorph.prod_eq_prod_of_nonempty PartialHomeomorph.prod_eq_prod_of_nonempty theorem prod_eq_prod_of_nonempty' {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁'.prod e₂').source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by rw [eq_comm, prod_eq_prod_of_nonempty h, eq_comm, @eq_comm _ e₂'] #align local_homeomorph.prod_eq_prod_of_nonempty' PartialHomeomorph.prod_eq_prod_of_nonempty' end Prod section Piecewise /-- Combine two `PartialHomeomorph`s using `Set.piecewise`. The source of the new `PartialHomeomorph` is `s.ite e.source e'.source = e.source ∩ s ∪ e'.source \ s`, and similarly for target. The function sends `e.source ∩ s` to `e.target ∩ t` using `e` and `e'.source \ s` to `e'.target \ t` using `e'`, and similarly for the inverse function. To ensure the maps `toFun` and `invFun` are inverse of each other on the new `source` and `target`, the definition assumes that the sets `s` and `t` are related both by `e.is_image` and `e'.is_image`. To ensure that the new maps are continuous on `source`/`target`, it also assumes that `e.source` and `e'.source` meet `frontier s` on the same set and `e x = e' x` on this intersection. -/ @[simps! (config := .asFn) toPartialEquiv apply] def piecewise (e e' : PartialHomeomorph α β) (s : Set α) (t : Set β) [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquiv.piecewise e'.toPartialEquiv s t H H' open_source := e.open_source.ite e'.open_source Hs open_target := e.open_target.ite e'.open_target <| H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq continuousOn_toFun := continuousOn_piecewise_ite e.continuousOn e'.continuousOn Hs Heq continuousOn_invFun := continuousOn_piecewise_ite e.continuousOn_symm e'.continuousOn_symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) #align local_homeomorph.piecewise PartialHomeomorph.piecewise @[simp] theorem symm_piecewise (e e' : PartialHomeomorph α β) {s : Set α} {t : Set β} [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : (e.piecewise e' s t H H' Hs Heq).symm = e.symm.piecewise e'.symm t s H.symm H'.symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) := rfl #align local_homeomorph.symm_piecewise PartialHomeomorph.symm_piecewise /-- Combine two `PartialHomeomorph`s with disjoint sources and disjoint targets. We reuse `PartialHomeomorph.piecewise` then override `toPartialEquiv` to `PartialEquiv.disjointUnion`. This way we have better definitional equalities for `source` and `target`. -/ def disjointUnion (e e' : PartialHomeomorph α β) [∀ x, Decidable (x ∈ e.source)] [∀ y, Decidable (y ∈ e.target)] (Hs : Disjoint e.source e'.source) (Ht : Disjoint e.target e'.target) : PartialHomeomorph α β := (e.piecewise e' e.source e.target e.isImage_source_target (e'.isImage_source_target_of_disjoint e Hs.symm Ht.symm) (by rw [e.open_source.inter_frontier_eq, (Hs.symm.frontier_right e'.open_source).inter_eq]) (by rw [e.open_source.inter_frontier_eq] exact eqOn_empty _ _)).replaceEquiv (e.toPartialEquiv.disjointUnion e'.toPartialEquiv Hs Ht) (PartialEquiv.disjointUnion_eq_piecewise _ _ _ _).symm #align local_homeomorph.disjoint_union PartialHomeomorph.disjointUnion end Piecewise section Pi variable {ι : Type*} [Fintype ι] {Xi Yi : ι → Type*} [∀ i, TopologicalSpace (Xi i)] [∀ i, TopologicalSpace (Yi i)] (ei : ∀ i, PartialHomeomorph (Xi i) (Yi i)) /-- The product of a finite family of `PartialHomeomorph`s. -/ @[simps toPartialEquiv] def pi : PartialHomeomorph (∀ i, Xi i) (∀ i, Yi i) where toPartialEquiv := PartialEquiv.pi fun i => (ei i).toPartialEquiv open_source := isOpen_set_pi finite_univ fun i _ => (ei i).open_source open_target := isOpen_set_pi finite_univ fun i _ => (ei i).open_target continuousOn_toFun := continuousOn_pi.2 fun i => (ei i).continuousOn.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial continuousOn_invFun := continuousOn_pi.2 fun i => (ei i).continuousOn_symm.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial #align local_homeomorph.pi PartialHomeomorph.pi end Pi section Continuity /-- Continuity within a set at a point can be read under right composition with a local homeomorphism, if the point is in its target -/ theorem continuousWithinAt_iff_continuousWithinAt_comp_right {f : β → γ} {s : Set β} {x : β} (h : x ∈ e.target) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (f ∘ e) (e ⁻¹' s) (e.symm x) := by simp_rw [ContinuousWithinAt, ← @tendsto_map'_iff _ _ _ _ e, e.map_nhdsWithin_preimage_eq (e.map_target h), (· ∘ ·), e.right_inv h] #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_right PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_right /-- Continuity at a point can be read under right composition with a partial homeomorphism, if the point is in its target -/ theorem continuousAt_iff_continuousAt_comp_right {f : β → γ} {x : β} (h : x ∈ e.target) : ContinuousAt f x ↔ ContinuousAt (f ∘ e) (e.symm x) := by rw [← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_right h, preimage_univ, continuousWithinAt_univ] #align local_homeomorph.continuous_at_iff_continuous_at_comp_right PartialHomeomorph.continuousAt_iff_continuousAt_comp_right /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the right is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_right {f : β → γ} {s : Set β} (h : s ⊆ e.target) : ContinuousOn f s ↔ ContinuousOn (f ∘ e) (e.source ∩ e ⁻¹' s) := by simp only [← e.symm_image_eq_source_inter_preimage h, ContinuousOn, ball_image_iff] refine' forall₂_congr fun x hx => _ rw [e.continuousWithinAt_iff_continuousWithinAt_comp_right (h hx), e.symm_image_eq_source_inter_preimage h, inter_comm, continuousWithinAt_inter] exact IsOpen.mem_nhds e.open_source (e.map_target (h hx)) #align local_homeomorph.continuous_on_iff_continuous_on_comp_right PartialHomeomorph.continuousOn_iff_continuousOn_comp_right /-- Continuity within a set at a point can be read under left composition with a local homeomorphism if a neighborhood of the initial point is sent to the source of the local homeomorphism-/ theorem continuousWithinAt_iff_continuousWithinAt_comp_left {f : γ → α} {s : Set γ} {x : γ} (hx : f x ∈ e.source) (h : f ⁻¹' e.source ∈ 𝓝[s] x) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (e ∘ f) s x := by refine' ⟨(e.continuousAt hx).comp_continuousWithinAt, fun fe_cont => _⟩ rw [← continuousWithinAt_inter' h] at fe_cont ⊢ have : ContinuousWithinAt (e.symm ∘ e ∘ f) (s ∩ f ⁻¹' e.source) x := haveI : ContinuousWithinAt e.symm univ (e (f x)) := (e.continuousAt_symm (e.map_source hx)).continuousWithinAt ContinuousWithinAt.comp this fe_cont (subset_univ _) exact this.congr (fun y hy => by simp [e.left_inv hy.2]) (by simp [e.left_inv hx]) #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_left PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_left /-- Continuity at a point can be read under left composition with a partial homeomorphism if a neighborhood of the initial point is sent to the source of the partial homeomorphism-/ theorem continuousAt_iff_continuousAt_comp_left {f : γ → α} {x : γ} (h : f ⁻¹' e.source ∈ 𝓝 x) : ContinuousAt f x ↔ ContinuousAt (e ∘ f) x := by have hx : f x ∈ e.source := (mem_of_mem_nhds h : _) have h' : f ⁻¹' e.source ∈ 𝓝[univ] x := by rwa [nhdsWithin_univ] rw [← continuousWithinAt_univ, ← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_left hx h'] #align local_homeomorph.continuous_at_iff_continuous_at_comp_left PartialHomeomorph.continuousAt_iff_continuousAt_comp_left /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the left is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_left {f : γ → α} {s : Set γ} (h : s ⊆ f ⁻¹' e.source) : ContinuousOn f s ↔ ContinuousOn (e ∘ f) s := forall₂_congr fun _x hx => e.continuousWithinAt_iff_continuousWithinAt_comp_left (h hx) (mem_of_superset self_mem_nhdsWithin h) #align local_homeomorph.continuous_on_iff_continuous_on_comp_left PartialHomeomorph.continuousOn_iff_continuousOn_comp_left /-- A function is continuous if and only if its composition with a partial homeomorphism on the left is continuous and its image is contained in the source. -/ theorem continuous_iff_continuous_comp_left {f : γ → α} (h : f ⁻¹' e.source = univ) : Continuous f ↔ Continuous (e ∘ f) := by simp only [continuous_iff_continuousOn_univ] exact e.continuousOn_iff_continuousOn_comp_left (Eq.symm h).subset #align local_homeomorph.continuous_iff_continuous_comp_left PartialHomeomorph.continuous_iff_continuous_comp_left end Continuity /-- The homeomorphism obtained by restricting a `PartialHomeomorph` to a subset of the source. -/ @[simps] def homeomorphOfImageSubsetSource {s : Set α} {t : Set β} (hs : s ⊆ e.source) (ht : e '' s = t) : s ≃ₜ t := have h₁ : MapsTo e s t := mapsTo'.2 ht.subset have h₂ : t ⊆ e.target := ht ▸ e.image_source_eq_target ▸ image_subset e hs have h₃ : MapsTo e.symm t s := ht ▸ ball_image_iff.2 <| fun _x hx => (e.left_inv (hs hx)).symm ▸ hx { toFun := MapsTo.restrict e s t h₁ invFun := MapsTo.restrict e.symm t s h₃ left_inv := fun a => Subtype.ext (e.left_inv (hs a.2)) right_inv := fun b => Subtype.eq <| e.right_inv (h₂ b.2) continuous_toFun := (e.continuousOn.mono hs).restrict_mapsTo h₁ continuous_invFun := (e.continuousOn_symm.mono h₂).restrict_mapsTo h₃ } #align local_homeomorph.homeomorph_of_image_subset_source PartialHomeomorph.homeomorphOfImageSubsetSource /-- A partial homeomorphism defines a homeomorphism between its source and target. -/ @[simps!] -- porting note: new `simps` def toHomeomorphSourceTarget : e.source ≃ₜ e.target := e.homeomorphOfImageSubsetSource subset_rfl e.image_source_eq_target #align local_homeomorph.to_homeomorph_source_target PartialHomeomorph.toHomeomorphSourceTarget theorem secondCountableTopology_source [SecondCountableTopology β] (e : PartialHomeomorph α β) : SecondCountableTopology e.source := e.toHomeomorphSourceTarget.secondCountableTopology #align local_homeomorph.second_countable_topology_source PartialHomeomorph.secondCountableTopology_source theorem nhds_eq_comap_inf_principal {x} (hx : x ∈ e.source) : 𝓝 x = comap e (𝓝 (e x)) ⊓ 𝓟 e.source := by lift x to e.source using hx rw [← e.open_source.nhdsWithin_eq x.2, ← map_nhds_subtype_val, ← map_comap_setCoe_val, e.toHomeomorphSourceTarget.nhds_eq_comap, nhds_subtype_eq_comap] simp only [(· ∘ ·), toHomeomorphSourceTarget_apply_coe, comap_comap] /-- If a partial homeomorphism has source and target equal to univ, then it induces a homeomorphism between the whole spaces, expressed in this definition. -/ @[simps (config := mfld_cfg) apply symm_apply] -- porting note: todo: add a `PartialEquiv` version def toHomeomorphOfSourceEqUnivTargetEqUniv (h : e.source = (univ : Set α)) (h' : e.target = univ) : α ≃ₜ β where toFun := e invFun := e.symm left_inv x := e.left_inv <| by rw [h] exact mem_univ _ right_inv x := e.right_inv <| by rw [h'] exact mem_univ _ continuous_toFun := by simpa only [continuous_iff_continuousOn_univ, h] using e.continuousOn continuous_invFun := by simpa only [continuous_iff_continuousOn_univ, h'] using e.continuousOn_symm #align local_homeomorph.to_homeomorph_of_source_eq_univ_target_eq_univ PartialHomeomorph.toHomeomorphOfSourceEqUnivTargetEqUniv theorem openEmbedding_restrict : OpenEmbedding (e.source.restrict e) := by refine openEmbedding_of_continuous_injective_open (e.continuousOn.comp_continuous continuous_subtype_val Subtype.prop) e.injOn.injective fun V hV ↦ ?_ rw [Set.restrict_eq, Set.image_comp] exact e.image_isOpen_of_isOpen (e.open_source.isOpenMap_subtype_val V hV) fun _ ⟨x, _, h⟩ ↦ h ▸ x.2 /-- A partial homeomorphism whose source is all of `α` defines an open embedding of `α` into `β`. The converse is also true; see `OpenEmbedding.toPartialHomeomorph`. -/ theorem to_openEmbedding (h : e.source = Set.univ) : OpenEmbedding e := e.openEmbedding_restrict.comp ((Homeomorph.setCongr h).trans <| Homeomorph.Set.univ α).symm.openEmbedding #align local_homeomorph.to_open_embedding PartialHomeomorph.to_openEmbedding end PartialHomeomorph namespace Homeomorph variable (e : α ≃ₜ β) (e' : β ≃ₜ γ) /- Register as simp lemmas that the fields of a partial homeomorphism built from a homeomorphism correspond to the fields of the original homeomorphism. -/ @[simp, mfld_simps] theorem refl_toPartialHomeomorph : (Homeomorph.refl α).toPartialHomeomorph = PartialHomeomorph.refl α := rfl #align homeomorph.refl_to_local_homeomorph Homeomorph.refl_toPartialHomeomorph @[simp, mfld_simps] theorem symm_toPartialHomeomorph : e.symm.toPartialHomeomorph = e.toPartialHomeomorph.symm := rfl #align homeomorph.symm_to_local_homeomorph Homeomorph.symm_toPartialHomeomorph @[simp, mfld_simps] theorem trans_toPartialHomeomorph : (e.trans e').toPartialHomeomorph = e.toPartialHomeomorph.trans e'.toPartialHomeomorph := PartialHomeomorph.toPartialEquiv_injective <| Equiv.trans_toPartialEquiv _ _ #align homeomorph.trans_to_local_homeomorph Homeomorph.trans_toPartialHomeomorph end Homeomorph namespace OpenEmbedding variable (f : α → β) (h : OpenEmbedding f) /-- An open embedding of `α` into `β`, with `α` nonempty, defines a partial homeomorphism whose source is all of `α`. The converse is also true; see `PartialHomeomorph.to_openEmbedding`. -/ @[simps! (config := mfld_cfg) apply source target] noncomputable def toPartialHomeomorph [Nonempty α] : PartialHomeomorph α β := PartialHomeomorph.ofContinuousOpen ((h.toEmbedding.inj.injOn univ).toPartialEquiv _ _) h.continuous.continuousOn h.isOpenMap isOpen_univ #align open_embedding.to_local_homeomorph OpenEmbedding.toPartialHomeomorph variable [Nonempty α] lemma toPartialHomeomorph_left_inv {x : α} : (h.toPartialHomeomorph f).symm (f x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.left_inv] exact Set.mem_univ _ lemma toPartialHomeomorph_right_inv {x : β} (hx : x ∈ Set.range f) : f ((h.toPartialHomeomorph f).symm x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.right_inv] rwa [toPartialHomeomorph_target] end OpenEmbedding namespace TopologicalSpace.Opens open TopologicalSpace variable (s : Opens α) [Nonempty s] /-- The inclusion of an open subset `s` of a space `α` into `α` is a partial homeomorphism from the subtype `s` to `α`. -/ noncomputable def localHomeomorphSubtypeCoe : PartialHomeomorph s α := OpenEmbedding.toPartialHomeomorph _ s.2.openEmbedding_subtype_val #align topological_space.opens.local_homeomorph_subtype_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_coe : (s.localHomeomorphSubtypeCoe : s → α) = (↑) := rfl #align topological_space.opens.local_homeomorph_subtype_coe_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe_coe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_source : s.localHomeomorphSubtypeCoe.source = Set.univ := rfl #align topological_space.opens.local_homeomorph_subtype_coe_source TopologicalSpace.Opens.localHomeomorphSubtypeCoe_source @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_target : s.localHomeomorphSubtypeCoe.target = s := by simp only [localHomeomorphSubtypeCoe, Subtype.range_coe_subtype, mfld_simps] rfl #align topological_space.opens.local_homeomorph_subtype_coe_target TopologicalSpace.Opens.localHomeomorphSubtypeCoe_target end TopologicalSpace.Opens namespace PartialHomeomorph open TopologicalSpace variable (e : PartialHomeomorph α β) variable (s : Opens α) [Nonempty s] /-- The restriction of a partial homeomorphism `e` to an open subset `s` of the domain type produces a partial homeomorphism whose domain is the subtype `s`. -/ noncomputable def subtypeRestr : PartialHomeomorph s β := s.localHomeomorphSubtypeCoe.trans e #align local_homeomorph.subtype_restr PartialHomeomorph.subtypeRestr theorem subtypeRestr_def : e.subtypeRestr s = s.localHomeomorphSubtypeCoe.trans e := rfl #align local_homeomorph.subtype_restr_def PartialHomeomorph.subtypeRestr_def @[simp, mfld_simps] theorem subtypeRestr_coe : ((e.subtypeRestr s : PartialHomeomorph s β) : s → β) = Set.restrict ↑s (e : α → β) := rfl #align local_homeomorph.subtype_restr_coe PartialHomeomorph.subtypeRestr_coe @[simp, mfld_simps] theorem subtypeRestr_source : (e.subtypeRestr s).source = (↑) ⁻¹' e.source := by simp only [subtypeRestr_def, mfld_simps] #align local_homeomorph.subtype_restr_source PartialHomeomorph.subtypeRestr_source variable {s} theorem map_subtype_source {x : s} (hxe : (x : α) ∈ e.source): e x ∈ (e.subtypeRestr s).target := by refine' ⟨e.map_source hxe, _⟩ rw [s.localHomeomorphSubtypeCoe_target, mem_preimage, e.leftInvOn hxe] exact x.prop #align local_homeomorph.map_subtype_source PartialHomeomorph.map_subtype_source variable (s) /- This lemma characterizes the transition functions of an open subset in terms of the transition functions of the original space. -/ theorem subtypeRestr_symm_trans_subtypeRestr (f f' : PartialHomeomorph α β) : (f.subtypeRestr s).symm.trans (f'.subtypeRestr s) ≈ (f.symm.trans f').restr (f.target ∩ f.symm ⁻¹' s) := by simp only [subtypeRestr_def, trans_symm_eq_symm_trans_symm] have openness₁ : IsOpen (f.target ∩ f.symm ⁻¹' s) := f.isOpen_inter_preimage_symm s.2 rw [← ofSet_trans _ openness₁, ← trans_assoc, ← trans_assoc] refine' EqOnSource.trans' _ (eqOnSource_refl _) -- f' has been eliminated !!! have sets_identity : f.symm.source ∩ (f.target ∩ f.symm ⁻¹' s) = f.symm.source ∩ f.symm ⁻¹' s := by mfld_set_tac have openness₂ : IsOpen (s : Set α) := s.2 rw [ofSet_trans', sets_identity, ← trans_of_set' _ openness₂, trans_assoc] refine' EqOnSource.trans' (eqOnSource_refl _) _ -- f has been eliminated !!! refine' Setoid.trans (trans_symm_self s.localHomeomorphSubtypeCoe) _ simp only [mfld_simps, Setoid.refl] #align local_homeomorph.subtype_restr_symm_trans_subtype_restr PartialHomeomorph.subtypeRestr_symm_trans_subtypeRestr theorem subtypeRestr_symm_eqOn (U : Opens α) [Nonempty U] : EqOn e.symm (Subtype.val ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by intro y hy rw [eq_comm, eq_symm_apply _ _ hy.1] · change restrict _ e _ = _ rw [← subtypeRestr_coe, (e.subtypeRestr U).right_inv hy] · have := map_target _ hy; rwa [subtypeRestr_source] at this theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ · rw [← PartialHomeomorph.symm_target]
apply PartialHomeomorph.map_source
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ · rw [← PartialHomeomorph.symm_target]
Mathlib.Topology.PartialHomeomorph.1460_0.xRULiNOId4c9Kju
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target
Mathlib_Topology_PartialHomeomorph
case refine'_1.h α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝⁶ : TopologicalSpace α inst✝⁵ : TopologicalSpace β inst✝⁴ : TopologicalSpace γ inst✝³ : TopologicalSpace δ e : PartialHomeomorph α β s : Opens α inst✝² : Nonempty ↥s U V : Opens α inst✝¹ : Nonempty ↥U inst✝ : Nonempty ↥V hUV : U ≤ V i : ↑↑U → ↑↑V := inclusion hUV y : β hy : y ∈ e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' (Opens.localHomeomorphSubtypeCoe U).toPartialEquiv.target hyV : ↑(PartialHomeomorph.symm e) y ∈ (Opens.localHomeomorphSubtypeCoe V).toPartialEquiv.target ⊢ ↑(PartialHomeomorph.symm e) y ∈ (PartialHomeomorph.symm (Opens.localHomeomorphSubtypeCoe V)).toPartialEquiv.source
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.is_image.map_nhds_within_eq PartialHomeomorph.IsImage.map_nhdsWithin_eq protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff] #align local_homeomorph.is_image.closure PartialHomeomorph.IsImage.closure protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by simpa only [closure_compl, compl_compl] using h.compl.closure.compl #align local_homeomorph.is_image.interior PartialHomeomorph.IsImage.interior protected theorem frontier (h : e.IsImage s t) : e.IsImage (frontier s) (frontier t) := h.closure.diff h.interior #align local_homeomorph.is_image.frontier PartialHomeomorph.IsImage.frontier theorem isOpen_iff (h : e.IsImage s t) : IsOpen (e.source ∩ s) ↔ IsOpen (e.target ∩ t) := ⟨fun hs => h.symm_preimage_eq' ▸ e.symm.isOpen_inter_preimage hs, fun hs => h.preimage_eq' ▸ e.isOpen_inter_preimage hs⟩ #align local_homeomorph.is_image.is_open_iff PartialHomeomorph.IsImage.isOpen_iff /-- Restrict a `PartialHomeomorph` to a pair of corresponding open sets. -/ @[simps toPartialEquiv] def restr (h : e.IsImage s t) (hs : IsOpen (e.source ∩ s)) : PartialHomeomorph α β where toPartialEquiv := h.toPartialEquiv.restr open_source := hs open_target := h.isOpen_iff.1 hs continuousOn_toFun := e.continuousOn.mono (inter_subset_left _ _) continuousOn_invFun := e.symm.continuousOn.mono (inter_subset_left _ _) #align local_homeomorph.is_image.restr PartialHomeomorph.IsImage.restr end IsImage theorem isImage_source_target : e.IsImage e.source e.target := e.toPartialEquiv.isImage_source_target #align local_homeomorph.is_image_source_target PartialHomeomorph.isImage_source_target theorem isImage_source_target_of_disjoint (e' : PartialHomeomorph α β) (hs : Disjoint e.source e'.source) (ht : Disjoint e.target e'.target) : e.IsImage e'.source e'.target := e.toPartialEquiv.isImage_source_target_of_disjoint e'.toPartialEquiv hs ht #align local_homeomorph.is_image_source_target_of_disjoint PartialHomeomorph.isImage_source_target_of_disjoint /-- Preimage of interior or interior of preimage coincide for partial homeomorphisms, when restricted to the source. -/ theorem preimage_interior (s : Set β) : e.source ∩ e ⁻¹' interior s = e.source ∩ interior (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).interior.preimage_eq #align local_homeomorph.preimage_interior PartialHomeomorph.preimage_interior theorem preimage_closure (s : Set β) : e.source ∩ e ⁻¹' closure s = e.source ∩ closure (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).closure.preimage_eq #align local_homeomorph.preimage_closure PartialHomeomorph.preimage_closure theorem preimage_frontier (s : Set β) : e.source ∩ e ⁻¹' frontier s = e.source ∩ frontier (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).frontier.preimage_eq #align local_homeomorph.preimage_frontier PartialHomeomorph.preimage_frontier theorem isOpen_inter_preimage_symm {s : Set α} (hs : IsOpen s) : IsOpen (e.target ∩ e.symm ⁻¹' s) := e.symm.continuousOn.isOpen_inter_preimage e.open_target hs #align local_homeomorph.preimage_open_of_open_symm PartialHomeomorph.isOpen_inter_preimage_symm /-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by have : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h rw [this] exact e.continuousOn_symm.isOpen_inter_preimage e.open_target hs #align local_homeomorph.image_open_of_open PartialHomeomorph.image_isOpen_of_isOpen /-- The image of the restriction of an open set to the source is open. -/ theorem image_isOpen_of_isOpen' {s : Set α} (hs : IsOpen s) : IsOpen (e '' (e.source ∩ s)) := image_isOpen_of_isOpen _ (IsOpen.inter e.open_source hs) (inter_subset_left _ _) #align local_homeomorph.image_open_of_open' PartialHomeomorph.image_isOpen_of_isOpen' /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpenRestrict (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap (e.source.restrict e)) (hs : IsOpen e.source) : PartialHomeomorph α β where toPartialEquiv := e open_source := hs open_target := by simpa only [range_restrict, e.image_source_eq_target] using ho.isOpen_range continuousOn_toFun := hc continuousOn_invFun := e.image_source_eq_target ▸ ho.continuousOn_image_of_leftInvOn e.leftInvOn #align local_homeomorph.of_continuous_open_restrict PartialHomeomorph.ofContinuousOpenRestrict /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpen (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap e) (hs : IsOpen e.source) : PartialHomeomorph α β := ofContinuousOpenRestrict e hc (ho.restrict hs) hs #align local_homeomorph.of_continuous_open PartialHomeomorph.ofContinuousOpen /-- Restricting a partial homeomorphism `e` to `e.source ∩ s` when `s` is open. This is sometimes hard to use because of the openness assumption, but it has the advantage that when it can be used then its `PartialEquiv` is defeq to `PartialEquiv.restr`. -/ protected def restrOpen (s : Set α) (hs : IsOpen s) : PartialHomeomorph α β := (@IsImage.of_symm_preimage_eq α β _ _ e s (e.symm ⁻¹' s) rfl).restr (IsOpen.inter e.open_source hs) #align local_homeomorph.restr_open PartialHomeomorph.restrOpen @[simp, mfld_simps] theorem restrOpen_toPartialEquiv (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).toPartialEquiv = e.toPartialEquiv.restr s := rfl #align local_homeomorph.restr_open_to_local_equiv PartialHomeomorph.restrOpen_toPartialEquiv -- Already simp via `PartialEquiv` theorem restrOpen_source (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).source = e.source ∩ s := rfl #align local_homeomorph.restr_open_source PartialHomeomorph.restrOpen_source /-- Restricting a partial homeomorphism `e` to `e.source ∩ interior s`. We use the interior to make sure that the restriction is well defined whatever the set s, since partial homeomorphisms are by definition defined on open sets. In applications where `s` is open, this coincides with the restriction of partial equivalences -/ @[simps! (config := mfld_cfg) apply symm_apply, simps! (config := .lemmasOnly) source target] protected def restr (s : Set α) : PartialHomeomorph α β := e.restrOpen (interior s) isOpen_interior #align local_homeomorph.restr PartialHomeomorph.restr @[simp, mfld_simps] theorem restr_toPartialEquiv (s : Set α) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr (interior s) := rfl #align local_homeomorph.restr_to_local_equiv PartialHomeomorph.restr_toPartialEquiv theorem restr_source' (s : Set α) (hs : IsOpen s) : (e.restr s).source = e.source ∩ s := by rw [e.restr_source, hs.interior_eq] #align local_homeomorph.restr_source' PartialHomeomorph.restr_source' theorem restr_toPartialEquiv' (s : Set α) (hs : IsOpen s) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr s := by rw [e.restr_toPartialEquiv, hs.interior_eq] #align local_homeomorph.restr_to_local_equiv' PartialHomeomorph.restr_toPartialEquiv' theorem restr_eq_of_source_subset {e : PartialHomeomorph α β} {s : Set α} (h : e.source ⊆ s) : e.restr s = e := toPartialEquiv_injective <| PartialEquiv.restr_eq_of_source_subset <| interior_maximal h e.open_source #align local_homeomorph.restr_eq_of_source_subset PartialHomeomorph.restr_eq_of_source_subset @[simp, mfld_simps] theorem restr_univ {e : PartialHomeomorph α β} : e.restr univ = e := restr_eq_of_source_subset (subset_univ _) #align local_homeomorph.restr_univ PartialHomeomorph.restr_univ theorem restr_source_inter (s : Set α) : e.restr (e.source ∩ s) = e.restr s := by refine' PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) _ simp [e.open_source.interior_eq, ← inter_assoc] #align local_homeomorph.restr_source_inter PartialHomeomorph.restr_source_inter /-- The identity on the whole space as a partial homeomorphism. -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] protected def refl (α : Type*) [TopologicalSpace α] : PartialHomeomorph α α := (Homeomorph.refl α).toPartialHomeomorph #align local_homeomorph.refl PartialHomeomorph.refl @[simp, mfld_simps] theorem refl_localEquiv : (PartialHomeomorph.refl α).toPartialEquiv = PartialEquiv.refl α := rfl #align local_homeomorph.refl_local_equiv PartialHomeomorph.refl_localEquiv @[simp, mfld_simps] theorem refl_symm : (PartialHomeomorph.refl α).symm = PartialHomeomorph.refl α := rfl #align local_homeomorph.refl_symm PartialHomeomorph.refl_symm section variable {s : Set α} (hs : IsOpen s) /-- The identity partial equivalence on a set `s` -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] def ofSet (s : Set α) (hs : IsOpen s) : PartialHomeomorph α α where toPartialEquiv := PartialEquiv.ofSet s open_source := hs open_target := hs continuousOn_toFun := continuous_id.continuousOn continuousOn_invFun := continuous_id.continuousOn #align local_homeomorph.of_set PartialHomeomorph.ofSet @[simp, mfld_simps] theorem ofSet_toPartialEquiv : (ofSet s hs).toPartialEquiv = PartialEquiv.ofSet s := rfl #align local_homeomorph.of_set_to_local_equiv PartialHomeomorph.ofSet_toPartialEquiv @[simp, mfld_simps] theorem ofSet_symm : (ofSet s hs).symm = ofSet s hs := rfl #align local_homeomorph.of_set_symm PartialHomeomorph.ofSet_symm @[simp, mfld_simps] theorem ofSet_univ_eq_refl : ofSet univ isOpen_univ = PartialHomeomorph.refl α := by ext <;> simp #align local_homeomorph.of_set_univ_eq_refl PartialHomeomorph.ofSet_univ_eq_refl end /-- Composition of two partial homeomorphisms when the target of the first and the source of the second coincide. -/ @[simps! apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] protected def trans' (h : e.target = e'.source) : PartialHomeomorph α γ where toPartialEquiv := PartialEquiv.trans' e.toPartialEquiv e'.toPartialEquiv h open_source := e.open_source open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuousOn <| h ▸ e.mapsTo continuousOn_invFun := e.continuousOn_symm.comp e'.continuousOn_symm <| h.symm ▸ e'.symm_mapsTo #align local_homeomorph.trans' PartialHomeomorph.trans' /-- Composing two partial homeomorphisms, by restricting to the maximal domain where their composition is well defined. -/ protected def trans : PartialHomeomorph α γ := PartialHomeomorph.trans' (e.symm.restrOpen e'.source e'.open_source).symm (e'.restrOpen e.target e.open_target) (by simp [inter_comm]) #align local_homeomorph.trans PartialHomeomorph.trans @[simp, mfld_simps] theorem trans_toPartialEquiv : (e.trans e').toPartialEquiv = e.toPartialEquiv.trans e'.toPartialEquiv := rfl #align local_homeomorph.trans_to_local_equiv PartialHomeomorph.trans_toPartialEquiv @[simp, mfld_simps] theorem coe_trans : (e.trans e' : α → γ) = e' ∘ e := rfl #align local_homeomorph.coe_trans PartialHomeomorph.coe_trans @[simp, mfld_simps] theorem coe_trans_symm : ((e.trans e').symm : γ → α) = e.symm ∘ e'.symm := rfl #align local_homeomorph.coe_trans_symm PartialHomeomorph.coe_trans_symm theorem trans_apply {x : α} : (e.trans e') x = e' (e x) := rfl #align local_homeomorph.trans_apply PartialHomeomorph.trans_apply theorem trans_symm_eq_symm_trans_symm : (e.trans e').symm = e'.symm.trans e.symm := rfl #align local_homeomorph.trans_symm_eq_symm_trans_symm PartialHomeomorph.trans_symm_eq_symm_trans_symm /- This could be considered as a simp lemma, but there are many situations where it makes something simple into something more complicated. -/ theorem trans_source : (e.trans e').source = e.source ∩ e ⁻¹' e'.source := PartialEquiv.trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source PartialHomeomorph.trans_source theorem trans_source' : (e.trans e').source = e.source ∩ e ⁻¹' (e.target ∩ e'.source) := PartialEquiv.trans_source' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source' PartialHomeomorph.trans_source' theorem trans_source'' : (e.trans e').source = e.symm '' (e.target ∩ e'.source) := PartialEquiv.trans_source'' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source'' PartialHomeomorph.trans_source'' theorem image_trans_source : e '' (e.trans e').source = e.target ∩ e'.source := PartialEquiv.image_trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.image_trans_source PartialHomeomorph.image_trans_source theorem trans_target : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' e.target := rfl #align local_homeomorph.trans_target PartialHomeomorph.trans_target theorem trans_target' : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' (e'.source ∩ e.target) := trans_source' e'.symm e.symm #align local_homeomorph.trans_target' PartialHomeomorph.trans_target' theorem trans_target'' : (e.trans e').target = e' '' (e'.source ∩ e.target) := trans_source'' e'.symm e.symm #align local_homeomorph.trans_target'' PartialHomeomorph.trans_target'' theorem inv_image_trans_target : e'.symm '' (e.trans e').target = e'.source ∩ e.target := image_trans_source e'.symm e.symm #align local_homeomorph.inv_image_trans_target PartialHomeomorph.inv_image_trans_target theorem trans_assoc (e'' : PartialHomeomorph γ δ) : (e.trans e').trans e'' = e.trans (e'.trans e'') := toPartialEquiv_injective <| e.1.trans_assoc _ _ #align local_homeomorph.trans_assoc PartialHomeomorph.trans_assoc @[simp, mfld_simps] theorem trans_refl : e.trans (PartialHomeomorph.refl β) = e := toPartialEquiv_injective e.1.trans_refl #align local_homeomorph.trans_refl PartialHomeomorph.trans_refl @[simp, mfld_simps] theorem refl_trans : (PartialHomeomorph.refl α).trans e = e := toPartialEquiv_injective e.1.refl_trans #align local_homeomorph.refl_trans PartialHomeomorph.refl_trans theorem trans_ofSet {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e ⁻¹' s) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) <| by rw [trans_source, restr_source, ofSet_source, ← preimage_interior, hs.interior_eq] #align local_homeomorph.trans_of_set PartialHomeomorph.trans_ofSet theorem trans_of_set' {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e.source ∩ e ⁻¹' s) := by rw [trans_ofSet, restr_source_inter] #align local_homeomorph.trans_of_set' PartialHomeomorph.trans_of_set' theorem ofSet_trans {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr s := PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) <| by simp [hs.interior_eq, inter_comm] #align local_homeomorph.of_set_trans PartialHomeomorph.ofSet_trans theorem ofSet_trans' {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr (e.source ∩ s) := by rw [ofSet_trans, restr_source_inter] #align local_homeomorph.of_set_trans' PartialHomeomorph.ofSet_trans' @[simp, mfld_simps] theorem ofSet_trans_ofSet {s : Set α} (hs : IsOpen s) {s' : Set α} (hs' : IsOpen s') : (ofSet s hs).trans (ofSet s' hs') = ofSet (s ∩ s') (IsOpen.inter hs hs') := by rw [(ofSet s hs).trans_ofSet hs'] ext <;> simp [hs'.interior_eq] #align local_homeomorph.of_set_trans_of_set PartialHomeomorph.ofSet_trans_ofSet theorem restr_trans (s : Set α) : (e.restr s).trans e' = (e.trans e').restr s := toPartialEquiv_injective <| PartialEquiv.restr_trans e.toPartialEquiv e'.toPartialEquiv (interior s) #align local_homeomorph.restr_trans PartialHomeomorph.restr_trans /-- Postcompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def transHomeomorph (e' : β ≃ₜ γ) : PartialHomeomorph α γ where toPartialEquiv := e.toPartialEquiv.transEquiv e'.toEquiv open_source := e.open_source open_target := e.open_target.preimage e'.symm.continuous continuousOn_toFun := e'.continuous.comp_continuousOn e.continuousOn continuousOn_invFun := e.symm.continuousOn.comp e'.symm.continuous.continuousOn fun _ => id #align local_homeomorph.trans_homeomorph PartialHomeomorph.transHomeomorph theorem transHomeomorph_eq_trans (e' : β ≃ₜ γ) : e.transHomeomorph e' = e.trans e'.toPartialHomeomorph := toPartialEquiv_injective <| PartialEquiv.transEquiv_eq_trans _ _ #align local_homeomorph.trans_equiv_eq_trans PartialHomeomorph.transHomeomorph_eq_trans /-- Precompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def _root_.Homeomorph.transPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α γ where toPartialEquiv := e.toEquiv.transPartialEquiv e'.toPartialEquiv open_source := e'.open_source.preimage e.continuous open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuous.continuousOn fun _ => id continuousOn_invFun := e.symm.continuous.comp_continuousOn e'.symm.continuousOn #align homeomorph.trans_local_homeomorph Homeomorph.transPartialHomeomorph theorem _root_.Homeomorph.transPartialHomeomorph_eq_trans (e : α ≃ₜ β) : e.transPartialHomeomorph e' = e.toPartialHomeomorph.trans e' := toPartialEquiv_injective <| Equiv.transPartialEquiv_eq_trans _ _ #align homeomorph.trans_local_homeomorph_eq_trans Homeomorph.transPartialHomeomorph_eq_trans /-- `EqOnSource e e'` means that `e` and `e'` have the same source, and coincide there. They should really be considered the same partial equivalence. -/ def EqOnSource (e e' : PartialHomeomorph α β) : Prop := e.source = e'.source ∧ EqOn e e' e.source #align local_homeomorph.eq_on_source PartialHomeomorph.EqOnSource theorem eqOnSource_iff (e e' : PartialHomeomorph α β) : EqOnSource e e' ↔ PartialEquiv.EqOnSource e.toPartialEquiv e'.toPartialEquiv := Iff.rfl #align local_homeomorph.eq_on_source_iff PartialHomeomorph.eqOnSource_iff /-- `EqOnSource` is an equivalence relation. -/ instance eqOnSourceSetoid : Setoid (PartialHomeomorph α β) := { PartialEquiv.eqOnSourceSetoid.comap toPartialEquiv with r := EqOnSource } theorem eqOnSource_refl : e ≈ e := Setoid.refl _ #align local_homeomorph.eq_on_source_refl PartialHomeomorph.eqOnSource_refl /-- If two partial homeomorphisms are equivalent, so are their inverses. -/ theorem EqOnSource.symm' {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.symm ≈ e'.symm := PartialEquiv.EqOnSource.symm' h #align local_homeomorph.eq_on_source.symm' PartialHomeomorph.EqOnSource.symm' /-- Two equivalent partial homeomorphisms have the same source. -/ theorem EqOnSource.source_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.source = e'.source := h.1 #align local_homeomorph.eq_on_source.source_eq PartialHomeomorph.EqOnSource.source_eq /-- Two equivalent partial homeomorphisms have the same target. -/ theorem EqOnSource.target_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.target = e'.target := h.symm'.1 #align local_homeomorph.eq_on_source.target_eq PartialHomeomorph.EqOnSource.target_eq /-- Two equivalent partial homeomorphisms have coinciding `toFun` on the source -/ theorem EqOnSource.eqOn {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e e' e.source := h.2 #align local_homeomorph.eq_on_source.eq_on PartialHomeomorph.EqOnSource.eqOn /-- Two equivalent partial homeomorphisms have coinciding `invFun` on the target -/ theorem EqOnSource.symm_eqOn_target {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e.symm e'.symm e.target := h.symm'.2 #align local_homeomorph.eq_on_source.symm_eq_on_target PartialHomeomorph.EqOnSource.symm_eqOn_target /-- Composition of partial homeomorphisms respects equivalence. -/ theorem EqOnSource.trans' {e e' : PartialHomeomorph α β} {f f' : PartialHomeomorph β γ} (he : e ≈ e') (hf : f ≈ f') : e.trans f ≈ e'.trans f' := PartialEquiv.EqOnSource.trans' he hf #align local_homeomorph.eq_on_source.trans' PartialHomeomorph.EqOnSource.trans' /-- Restriction of partial homeomorphisms respects equivalence -/ theorem EqOnSource.restr {e e' : PartialHomeomorph α β} (he : e ≈ e') (s : Set α) : e.restr s ≈ e'.restr s := PartialEquiv.EqOnSource.restr he _ #align local_homeomorph.eq_on_source.restr PartialHomeomorph.EqOnSource.restr /- Two equivalent partial homeomorphisms are equal when the source and target are `univ`. -/ theorem Set.EqOn.restr_eqOn_source {e e' : PartialHomeomorph α β} (h : EqOn e e' (e.source ∩ e'.source)) : e.restr e'.source ≈ e'.restr e.source := by constructor · rw [e'.restr_source' _ e.open_source] rw [e.restr_source' _ e'.open_source] exact Set.inter_comm _ _ · rw [e.restr_source' _ e'.open_source] refine' (EqOn.trans _ h).trans _ <;> simp only [mfld_simps, eqOn_refl] #align local_homeomorph.set.eq_on.restr_eq_on_source PartialHomeomorph.Set.EqOn.restr_eqOn_source /-- Composition of a partial homeomorphism and its inverse is equivalent to the restriction of the identity to the source -/ theorem trans_self_symm : e.trans e.symm ≈ PartialHomeomorph.ofSet e.source e.open_source := PartialEquiv.trans_self_symm _ #align local_homeomorph.trans_self_symm PartialHomeomorph.trans_self_symm theorem trans_symm_self : e.symm.trans e ≈ PartialHomeomorph.ofSet e.target e.open_target := e.symm.trans_self_symm #align local_homeomorph.trans_symm_self PartialHomeomorph.trans_symm_self theorem eq_of_eqOnSource_univ {e e' : PartialHomeomorph α β} (h : e ≈ e') (s : e.source = univ) (t : e.target = univ) : e = e' := toPartialEquiv_injective <| PartialEquiv.eq_of_eqOnSource_univ _ _ h s t #align local_homeomorph.eq_of_eq_on_source_univ PartialHomeomorph.eq_of_eqOnSource_univ section Prod /-- The product of two partial homeomorphisms, as a partial homeomorphism on the product space. -/ @[simps! (config := mfld_cfg) toPartialEquiv apply, simps! (config := .lemmasOnly) source target symm_apply] def prod (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : PartialHomeomorph (α × γ) (β × δ) where open_source := e.open_source.prod e'.open_source open_target := e.open_target.prod e'.open_target continuousOn_toFun := e.continuousOn.prod_map e'.continuousOn continuousOn_invFun := e.continuousOn_symm.prod_map e'.continuousOn_symm toPartialEquiv := e.toPartialEquiv.prod e'.toPartialEquiv #align local_homeomorph.prod PartialHomeomorph.prod @[simp, mfld_simps] theorem prod_symm (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : (e.prod e').symm = e.symm.prod e'.symm := rfl #align local_homeomorph.prod_symm PartialHomeomorph.prod_symm @[simp] theorem refl_prod_refl {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] : (PartialHomeomorph.refl α).prod (PartialHomeomorph.refl β) = PartialHomeomorph.refl (α × β) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) univ_prod_univ #align local_homeomorph.refl_prod_refl PartialHomeomorph.refl_prod_refl @[simp, mfld_simps] theorem prod_trans {η : Type*} {ε : Type*} [TopologicalSpace η] [TopologicalSpace ε] (e : PartialHomeomorph α β) (f : PartialHomeomorph β γ) (e' : PartialHomeomorph δ η) (f' : PartialHomeomorph η ε) : (e.prod e').trans (f.prod f') = (e.trans f).prod (e'.trans f') := toPartialEquiv_injective <| e.1.prod_trans .. #align local_homeomorph.prod_trans PartialHomeomorph.prod_trans theorem prod_eq_prod_of_nonempty {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁.prod e₂).source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by obtain ⟨⟨x, y⟩, -⟩ := id h haveI : Nonempty α := ⟨x⟩ haveI : Nonempty β := ⟨e₁ x⟩ haveI : Nonempty γ := ⟨y⟩ haveI : Nonempty δ := ⟨e₂ y⟩ simp_rw [PartialHomeomorph.ext_iff, prod_apply, prod_symm_apply, prod_source, Prod.ext_iff, Set.prod_eq_prod_iff_of_nonempty h, forall_and, Prod.forall, forall_const, and_assoc, and_left_comm] #align local_homeomorph.prod_eq_prod_of_nonempty PartialHomeomorph.prod_eq_prod_of_nonempty theorem prod_eq_prod_of_nonempty' {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁'.prod e₂').source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by rw [eq_comm, prod_eq_prod_of_nonempty h, eq_comm, @eq_comm _ e₂'] #align local_homeomorph.prod_eq_prod_of_nonempty' PartialHomeomorph.prod_eq_prod_of_nonempty' end Prod section Piecewise /-- Combine two `PartialHomeomorph`s using `Set.piecewise`. The source of the new `PartialHomeomorph` is `s.ite e.source e'.source = e.source ∩ s ∪ e'.source \ s`, and similarly for target. The function sends `e.source ∩ s` to `e.target ∩ t` using `e` and `e'.source \ s` to `e'.target \ t` using `e'`, and similarly for the inverse function. To ensure the maps `toFun` and `invFun` are inverse of each other on the new `source` and `target`, the definition assumes that the sets `s` and `t` are related both by `e.is_image` and `e'.is_image`. To ensure that the new maps are continuous on `source`/`target`, it also assumes that `e.source` and `e'.source` meet `frontier s` on the same set and `e x = e' x` on this intersection. -/ @[simps! (config := .asFn) toPartialEquiv apply] def piecewise (e e' : PartialHomeomorph α β) (s : Set α) (t : Set β) [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquiv.piecewise e'.toPartialEquiv s t H H' open_source := e.open_source.ite e'.open_source Hs open_target := e.open_target.ite e'.open_target <| H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq continuousOn_toFun := continuousOn_piecewise_ite e.continuousOn e'.continuousOn Hs Heq continuousOn_invFun := continuousOn_piecewise_ite e.continuousOn_symm e'.continuousOn_symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) #align local_homeomorph.piecewise PartialHomeomorph.piecewise @[simp] theorem symm_piecewise (e e' : PartialHomeomorph α β) {s : Set α} {t : Set β} [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : (e.piecewise e' s t H H' Hs Heq).symm = e.symm.piecewise e'.symm t s H.symm H'.symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) := rfl #align local_homeomorph.symm_piecewise PartialHomeomorph.symm_piecewise /-- Combine two `PartialHomeomorph`s with disjoint sources and disjoint targets. We reuse `PartialHomeomorph.piecewise` then override `toPartialEquiv` to `PartialEquiv.disjointUnion`. This way we have better definitional equalities for `source` and `target`. -/ def disjointUnion (e e' : PartialHomeomorph α β) [∀ x, Decidable (x ∈ e.source)] [∀ y, Decidable (y ∈ e.target)] (Hs : Disjoint e.source e'.source) (Ht : Disjoint e.target e'.target) : PartialHomeomorph α β := (e.piecewise e' e.source e.target e.isImage_source_target (e'.isImage_source_target_of_disjoint e Hs.symm Ht.symm) (by rw [e.open_source.inter_frontier_eq, (Hs.symm.frontier_right e'.open_source).inter_eq]) (by rw [e.open_source.inter_frontier_eq] exact eqOn_empty _ _)).replaceEquiv (e.toPartialEquiv.disjointUnion e'.toPartialEquiv Hs Ht) (PartialEquiv.disjointUnion_eq_piecewise _ _ _ _).symm #align local_homeomorph.disjoint_union PartialHomeomorph.disjointUnion end Piecewise section Pi variable {ι : Type*} [Fintype ι] {Xi Yi : ι → Type*} [∀ i, TopologicalSpace (Xi i)] [∀ i, TopologicalSpace (Yi i)] (ei : ∀ i, PartialHomeomorph (Xi i) (Yi i)) /-- The product of a finite family of `PartialHomeomorph`s. -/ @[simps toPartialEquiv] def pi : PartialHomeomorph (∀ i, Xi i) (∀ i, Yi i) where toPartialEquiv := PartialEquiv.pi fun i => (ei i).toPartialEquiv open_source := isOpen_set_pi finite_univ fun i _ => (ei i).open_source open_target := isOpen_set_pi finite_univ fun i _ => (ei i).open_target continuousOn_toFun := continuousOn_pi.2 fun i => (ei i).continuousOn.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial continuousOn_invFun := continuousOn_pi.2 fun i => (ei i).continuousOn_symm.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial #align local_homeomorph.pi PartialHomeomorph.pi end Pi section Continuity /-- Continuity within a set at a point can be read under right composition with a local homeomorphism, if the point is in its target -/ theorem continuousWithinAt_iff_continuousWithinAt_comp_right {f : β → γ} {s : Set β} {x : β} (h : x ∈ e.target) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (f ∘ e) (e ⁻¹' s) (e.symm x) := by simp_rw [ContinuousWithinAt, ← @tendsto_map'_iff _ _ _ _ e, e.map_nhdsWithin_preimage_eq (e.map_target h), (· ∘ ·), e.right_inv h] #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_right PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_right /-- Continuity at a point can be read under right composition with a partial homeomorphism, if the point is in its target -/ theorem continuousAt_iff_continuousAt_comp_right {f : β → γ} {x : β} (h : x ∈ e.target) : ContinuousAt f x ↔ ContinuousAt (f ∘ e) (e.symm x) := by rw [← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_right h, preimage_univ, continuousWithinAt_univ] #align local_homeomorph.continuous_at_iff_continuous_at_comp_right PartialHomeomorph.continuousAt_iff_continuousAt_comp_right /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the right is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_right {f : β → γ} {s : Set β} (h : s ⊆ e.target) : ContinuousOn f s ↔ ContinuousOn (f ∘ e) (e.source ∩ e ⁻¹' s) := by simp only [← e.symm_image_eq_source_inter_preimage h, ContinuousOn, ball_image_iff] refine' forall₂_congr fun x hx => _ rw [e.continuousWithinAt_iff_continuousWithinAt_comp_right (h hx), e.symm_image_eq_source_inter_preimage h, inter_comm, continuousWithinAt_inter] exact IsOpen.mem_nhds e.open_source (e.map_target (h hx)) #align local_homeomorph.continuous_on_iff_continuous_on_comp_right PartialHomeomorph.continuousOn_iff_continuousOn_comp_right /-- Continuity within a set at a point can be read under left composition with a local homeomorphism if a neighborhood of the initial point is sent to the source of the local homeomorphism-/ theorem continuousWithinAt_iff_continuousWithinAt_comp_left {f : γ → α} {s : Set γ} {x : γ} (hx : f x ∈ e.source) (h : f ⁻¹' e.source ∈ 𝓝[s] x) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (e ∘ f) s x := by refine' ⟨(e.continuousAt hx).comp_continuousWithinAt, fun fe_cont => _⟩ rw [← continuousWithinAt_inter' h] at fe_cont ⊢ have : ContinuousWithinAt (e.symm ∘ e ∘ f) (s ∩ f ⁻¹' e.source) x := haveI : ContinuousWithinAt e.symm univ (e (f x)) := (e.continuousAt_symm (e.map_source hx)).continuousWithinAt ContinuousWithinAt.comp this fe_cont (subset_univ _) exact this.congr (fun y hy => by simp [e.left_inv hy.2]) (by simp [e.left_inv hx]) #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_left PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_left /-- Continuity at a point can be read under left composition with a partial homeomorphism if a neighborhood of the initial point is sent to the source of the partial homeomorphism-/ theorem continuousAt_iff_continuousAt_comp_left {f : γ → α} {x : γ} (h : f ⁻¹' e.source ∈ 𝓝 x) : ContinuousAt f x ↔ ContinuousAt (e ∘ f) x := by have hx : f x ∈ e.source := (mem_of_mem_nhds h : _) have h' : f ⁻¹' e.source ∈ 𝓝[univ] x := by rwa [nhdsWithin_univ] rw [← continuousWithinAt_univ, ← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_left hx h'] #align local_homeomorph.continuous_at_iff_continuous_at_comp_left PartialHomeomorph.continuousAt_iff_continuousAt_comp_left /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the left is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_left {f : γ → α} {s : Set γ} (h : s ⊆ f ⁻¹' e.source) : ContinuousOn f s ↔ ContinuousOn (e ∘ f) s := forall₂_congr fun _x hx => e.continuousWithinAt_iff_continuousWithinAt_comp_left (h hx) (mem_of_superset self_mem_nhdsWithin h) #align local_homeomorph.continuous_on_iff_continuous_on_comp_left PartialHomeomorph.continuousOn_iff_continuousOn_comp_left /-- A function is continuous if and only if its composition with a partial homeomorphism on the left is continuous and its image is contained in the source. -/ theorem continuous_iff_continuous_comp_left {f : γ → α} (h : f ⁻¹' e.source = univ) : Continuous f ↔ Continuous (e ∘ f) := by simp only [continuous_iff_continuousOn_univ] exact e.continuousOn_iff_continuousOn_comp_left (Eq.symm h).subset #align local_homeomorph.continuous_iff_continuous_comp_left PartialHomeomorph.continuous_iff_continuous_comp_left end Continuity /-- The homeomorphism obtained by restricting a `PartialHomeomorph` to a subset of the source. -/ @[simps] def homeomorphOfImageSubsetSource {s : Set α} {t : Set β} (hs : s ⊆ e.source) (ht : e '' s = t) : s ≃ₜ t := have h₁ : MapsTo e s t := mapsTo'.2 ht.subset have h₂ : t ⊆ e.target := ht ▸ e.image_source_eq_target ▸ image_subset e hs have h₃ : MapsTo e.symm t s := ht ▸ ball_image_iff.2 <| fun _x hx => (e.left_inv (hs hx)).symm ▸ hx { toFun := MapsTo.restrict e s t h₁ invFun := MapsTo.restrict e.symm t s h₃ left_inv := fun a => Subtype.ext (e.left_inv (hs a.2)) right_inv := fun b => Subtype.eq <| e.right_inv (h₂ b.2) continuous_toFun := (e.continuousOn.mono hs).restrict_mapsTo h₁ continuous_invFun := (e.continuousOn_symm.mono h₂).restrict_mapsTo h₃ } #align local_homeomorph.homeomorph_of_image_subset_source PartialHomeomorph.homeomorphOfImageSubsetSource /-- A partial homeomorphism defines a homeomorphism between its source and target. -/ @[simps!] -- porting note: new `simps` def toHomeomorphSourceTarget : e.source ≃ₜ e.target := e.homeomorphOfImageSubsetSource subset_rfl e.image_source_eq_target #align local_homeomorph.to_homeomorph_source_target PartialHomeomorph.toHomeomorphSourceTarget theorem secondCountableTopology_source [SecondCountableTopology β] (e : PartialHomeomorph α β) : SecondCountableTopology e.source := e.toHomeomorphSourceTarget.secondCountableTopology #align local_homeomorph.second_countable_topology_source PartialHomeomorph.secondCountableTopology_source theorem nhds_eq_comap_inf_principal {x} (hx : x ∈ e.source) : 𝓝 x = comap e (𝓝 (e x)) ⊓ 𝓟 e.source := by lift x to e.source using hx rw [← e.open_source.nhdsWithin_eq x.2, ← map_nhds_subtype_val, ← map_comap_setCoe_val, e.toHomeomorphSourceTarget.nhds_eq_comap, nhds_subtype_eq_comap] simp only [(· ∘ ·), toHomeomorphSourceTarget_apply_coe, comap_comap] /-- If a partial homeomorphism has source and target equal to univ, then it induces a homeomorphism between the whole spaces, expressed in this definition. -/ @[simps (config := mfld_cfg) apply symm_apply] -- porting note: todo: add a `PartialEquiv` version def toHomeomorphOfSourceEqUnivTargetEqUniv (h : e.source = (univ : Set α)) (h' : e.target = univ) : α ≃ₜ β where toFun := e invFun := e.symm left_inv x := e.left_inv <| by rw [h] exact mem_univ _ right_inv x := e.right_inv <| by rw [h'] exact mem_univ _ continuous_toFun := by simpa only [continuous_iff_continuousOn_univ, h] using e.continuousOn continuous_invFun := by simpa only [continuous_iff_continuousOn_univ, h'] using e.continuousOn_symm #align local_homeomorph.to_homeomorph_of_source_eq_univ_target_eq_univ PartialHomeomorph.toHomeomorphOfSourceEqUnivTargetEqUniv theorem openEmbedding_restrict : OpenEmbedding (e.source.restrict e) := by refine openEmbedding_of_continuous_injective_open (e.continuousOn.comp_continuous continuous_subtype_val Subtype.prop) e.injOn.injective fun V hV ↦ ?_ rw [Set.restrict_eq, Set.image_comp] exact e.image_isOpen_of_isOpen (e.open_source.isOpenMap_subtype_val V hV) fun _ ⟨x, _, h⟩ ↦ h ▸ x.2 /-- A partial homeomorphism whose source is all of `α` defines an open embedding of `α` into `β`. The converse is also true; see `OpenEmbedding.toPartialHomeomorph`. -/ theorem to_openEmbedding (h : e.source = Set.univ) : OpenEmbedding e := e.openEmbedding_restrict.comp ((Homeomorph.setCongr h).trans <| Homeomorph.Set.univ α).symm.openEmbedding #align local_homeomorph.to_open_embedding PartialHomeomorph.to_openEmbedding end PartialHomeomorph namespace Homeomorph variable (e : α ≃ₜ β) (e' : β ≃ₜ γ) /- Register as simp lemmas that the fields of a partial homeomorphism built from a homeomorphism correspond to the fields of the original homeomorphism. -/ @[simp, mfld_simps] theorem refl_toPartialHomeomorph : (Homeomorph.refl α).toPartialHomeomorph = PartialHomeomorph.refl α := rfl #align homeomorph.refl_to_local_homeomorph Homeomorph.refl_toPartialHomeomorph @[simp, mfld_simps] theorem symm_toPartialHomeomorph : e.symm.toPartialHomeomorph = e.toPartialHomeomorph.symm := rfl #align homeomorph.symm_to_local_homeomorph Homeomorph.symm_toPartialHomeomorph @[simp, mfld_simps] theorem trans_toPartialHomeomorph : (e.trans e').toPartialHomeomorph = e.toPartialHomeomorph.trans e'.toPartialHomeomorph := PartialHomeomorph.toPartialEquiv_injective <| Equiv.trans_toPartialEquiv _ _ #align homeomorph.trans_to_local_homeomorph Homeomorph.trans_toPartialHomeomorph end Homeomorph namespace OpenEmbedding variable (f : α → β) (h : OpenEmbedding f) /-- An open embedding of `α` into `β`, with `α` nonempty, defines a partial homeomorphism whose source is all of `α`. The converse is also true; see `PartialHomeomorph.to_openEmbedding`. -/ @[simps! (config := mfld_cfg) apply source target] noncomputable def toPartialHomeomorph [Nonempty α] : PartialHomeomorph α β := PartialHomeomorph.ofContinuousOpen ((h.toEmbedding.inj.injOn univ).toPartialEquiv _ _) h.continuous.continuousOn h.isOpenMap isOpen_univ #align open_embedding.to_local_homeomorph OpenEmbedding.toPartialHomeomorph variable [Nonempty α] lemma toPartialHomeomorph_left_inv {x : α} : (h.toPartialHomeomorph f).symm (f x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.left_inv] exact Set.mem_univ _ lemma toPartialHomeomorph_right_inv {x : β} (hx : x ∈ Set.range f) : f ((h.toPartialHomeomorph f).symm x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.right_inv] rwa [toPartialHomeomorph_target] end OpenEmbedding namespace TopologicalSpace.Opens open TopologicalSpace variable (s : Opens α) [Nonempty s] /-- The inclusion of an open subset `s` of a space `α` into `α` is a partial homeomorphism from the subtype `s` to `α`. -/ noncomputable def localHomeomorphSubtypeCoe : PartialHomeomorph s α := OpenEmbedding.toPartialHomeomorph _ s.2.openEmbedding_subtype_val #align topological_space.opens.local_homeomorph_subtype_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_coe : (s.localHomeomorphSubtypeCoe : s → α) = (↑) := rfl #align topological_space.opens.local_homeomorph_subtype_coe_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe_coe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_source : s.localHomeomorphSubtypeCoe.source = Set.univ := rfl #align topological_space.opens.local_homeomorph_subtype_coe_source TopologicalSpace.Opens.localHomeomorphSubtypeCoe_source @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_target : s.localHomeomorphSubtypeCoe.target = s := by simp only [localHomeomorphSubtypeCoe, Subtype.range_coe_subtype, mfld_simps] rfl #align topological_space.opens.local_homeomorph_subtype_coe_target TopologicalSpace.Opens.localHomeomorphSubtypeCoe_target end TopologicalSpace.Opens namespace PartialHomeomorph open TopologicalSpace variable (e : PartialHomeomorph α β) variable (s : Opens α) [Nonempty s] /-- The restriction of a partial homeomorphism `e` to an open subset `s` of the domain type produces a partial homeomorphism whose domain is the subtype `s`. -/ noncomputable def subtypeRestr : PartialHomeomorph s β := s.localHomeomorphSubtypeCoe.trans e #align local_homeomorph.subtype_restr PartialHomeomorph.subtypeRestr theorem subtypeRestr_def : e.subtypeRestr s = s.localHomeomorphSubtypeCoe.trans e := rfl #align local_homeomorph.subtype_restr_def PartialHomeomorph.subtypeRestr_def @[simp, mfld_simps] theorem subtypeRestr_coe : ((e.subtypeRestr s : PartialHomeomorph s β) : s → β) = Set.restrict ↑s (e : α → β) := rfl #align local_homeomorph.subtype_restr_coe PartialHomeomorph.subtypeRestr_coe @[simp, mfld_simps] theorem subtypeRestr_source : (e.subtypeRestr s).source = (↑) ⁻¹' e.source := by simp only [subtypeRestr_def, mfld_simps] #align local_homeomorph.subtype_restr_source PartialHomeomorph.subtypeRestr_source variable {s} theorem map_subtype_source {x : s} (hxe : (x : α) ∈ e.source): e x ∈ (e.subtypeRestr s).target := by refine' ⟨e.map_source hxe, _⟩ rw [s.localHomeomorphSubtypeCoe_target, mem_preimage, e.leftInvOn hxe] exact x.prop #align local_homeomorph.map_subtype_source PartialHomeomorph.map_subtype_source variable (s) /- This lemma characterizes the transition functions of an open subset in terms of the transition functions of the original space. -/ theorem subtypeRestr_symm_trans_subtypeRestr (f f' : PartialHomeomorph α β) : (f.subtypeRestr s).symm.trans (f'.subtypeRestr s) ≈ (f.symm.trans f').restr (f.target ∩ f.symm ⁻¹' s) := by simp only [subtypeRestr_def, trans_symm_eq_symm_trans_symm] have openness₁ : IsOpen (f.target ∩ f.symm ⁻¹' s) := f.isOpen_inter_preimage_symm s.2 rw [← ofSet_trans _ openness₁, ← trans_assoc, ← trans_assoc] refine' EqOnSource.trans' _ (eqOnSource_refl _) -- f' has been eliminated !!! have sets_identity : f.symm.source ∩ (f.target ∩ f.symm ⁻¹' s) = f.symm.source ∩ f.symm ⁻¹' s := by mfld_set_tac have openness₂ : IsOpen (s : Set α) := s.2 rw [ofSet_trans', sets_identity, ← trans_of_set' _ openness₂, trans_assoc] refine' EqOnSource.trans' (eqOnSource_refl _) _ -- f has been eliminated !!! refine' Setoid.trans (trans_symm_self s.localHomeomorphSubtypeCoe) _ simp only [mfld_simps, Setoid.refl] #align local_homeomorph.subtype_restr_symm_trans_subtype_restr PartialHomeomorph.subtypeRestr_symm_trans_subtypeRestr theorem subtypeRestr_symm_eqOn (U : Opens α) [Nonempty U] : EqOn e.symm (Subtype.val ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by intro y hy rw [eq_comm, eq_symm_apply _ _ hy.1] · change restrict _ e _ = _ rw [← subtypeRestr_coe, (e.subtypeRestr U).right_inv hy] · have := map_target _ hy; rwa [subtypeRestr_source] at this theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ · rw [← PartialHomeomorph.symm_target] apply PartialHomeomorph.map_source
rw [PartialHomeomorph.symm_source]
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ · rw [← PartialHomeomorph.symm_target] apply PartialHomeomorph.map_source
Mathlib.Topology.PartialHomeomorph.1460_0.xRULiNOId4c9Kju
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target
Mathlib_Topology_PartialHomeomorph
case refine'_1.h α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝⁶ : TopologicalSpace α inst✝⁵ : TopologicalSpace β inst✝⁴ : TopologicalSpace γ inst✝³ : TopologicalSpace δ e : PartialHomeomorph α β s : Opens α inst✝² : Nonempty ↥s U V : Opens α inst✝¹ : Nonempty ↥U inst✝ : Nonempty ↥V hUV : U ≤ V i : ↑↑U → ↑↑V := inclusion hUV y : β hy : y ∈ e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' (Opens.localHomeomorphSubtypeCoe U).toPartialEquiv.target hyV : ↑(PartialHomeomorph.symm e) y ∈ (Opens.localHomeomorphSubtypeCoe V).toPartialEquiv.target ⊢ ↑(PartialHomeomorph.symm e) y ∈ (Opens.localHomeomorphSubtypeCoe V).toPartialEquiv.target
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.is_image.map_nhds_within_eq PartialHomeomorph.IsImage.map_nhdsWithin_eq protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff] #align local_homeomorph.is_image.closure PartialHomeomorph.IsImage.closure protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by simpa only [closure_compl, compl_compl] using h.compl.closure.compl #align local_homeomorph.is_image.interior PartialHomeomorph.IsImage.interior protected theorem frontier (h : e.IsImage s t) : e.IsImage (frontier s) (frontier t) := h.closure.diff h.interior #align local_homeomorph.is_image.frontier PartialHomeomorph.IsImage.frontier theorem isOpen_iff (h : e.IsImage s t) : IsOpen (e.source ∩ s) ↔ IsOpen (e.target ∩ t) := ⟨fun hs => h.symm_preimage_eq' ▸ e.symm.isOpen_inter_preimage hs, fun hs => h.preimage_eq' ▸ e.isOpen_inter_preimage hs⟩ #align local_homeomorph.is_image.is_open_iff PartialHomeomorph.IsImage.isOpen_iff /-- Restrict a `PartialHomeomorph` to a pair of corresponding open sets. -/ @[simps toPartialEquiv] def restr (h : e.IsImage s t) (hs : IsOpen (e.source ∩ s)) : PartialHomeomorph α β where toPartialEquiv := h.toPartialEquiv.restr open_source := hs open_target := h.isOpen_iff.1 hs continuousOn_toFun := e.continuousOn.mono (inter_subset_left _ _) continuousOn_invFun := e.symm.continuousOn.mono (inter_subset_left _ _) #align local_homeomorph.is_image.restr PartialHomeomorph.IsImage.restr end IsImage theorem isImage_source_target : e.IsImage e.source e.target := e.toPartialEquiv.isImage_source_target #align local_homeomorph.is_image_source_target PartialHomeomorph.isImage_source_target theorem isImage_source_target_of_disjoint (e' : PartialHomeomorph α β) (hs : Disjoint e.source e'.source) (ht : Disjoint e.target e'.target) : e.IsImage e'.source e'.target := e.toPartialEquiv.isImage_source_target_of_disjoint e'.toPartialEquiv hs ht #align local_homeomorph.is_image_source_target_of_disjoint PartialHomeomorph.isImage_source_target_of_disjoint /-- Preimage of interior or interior of preimage coincide for partial homeomorphisms, when restricted to the source. -/ theorem preimage_interior (s : Set β) : e.source ∩ e ⁻¹' interior s = e.source ∩ interior (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).interior.preimage_eq #align local_homeomorph.preimage_interior PartialHomeomorph.preimage_interior theorem preimage_closure (s : Set β) : e.source ∩ e ⁻¹' closure s = e.source ∩ closure (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).closure.preimage_eq #align local_homeomorph.preimage_closure PartialHomeomorph.preimage_closure theorem preimage_frontier (s : Set β) : e.source ∩ e ⁻¹' frontier s = e.source ∩ frontier (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).frontier.preimage_eq #align local_homeomorph.preimage_frontier PartialHomeomorph.preimage_frontier theorem isOpen_inter_preimage_symm {s : Set α} (hs : IsOpen s) : IsOpen (e.target ∩ e.symm ⁻¹' s) := e.symm.continuousOn.isOpen_inter_preimage e.open_target hs #align local_homeomorph.preimage_open_of_open_symm PartialHomeomorph.isOpen_inter_preimage_symm /-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by have : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h rw [this] exact e.continuousOn_symm.isOpen_inter_preimage e.open_target hs #align local_homeomorph.image_open_of_open PartialHomeomorph.image_isOpen_of_isOpen /-- The image of the restriction of an open set to the source is open. -/ theorem image_isOpen_of_isOpen' {s : Set α} (hs : IsOpen s) : IsOpen (e '' (e.source ∩ s)) := image_isOpen_of_isOpen _ (IsOpen.inter e.open_source hs) (inter_subset_left _ _) #align local_homeomorph.image_open_of_open' PartialHomeomorph.image_isOpen_of_isOpen' /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpenRestrict (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap (e.source.restrict e)) (hs : IsOpen e.source) : PartialHomeomorph α β where toPartialEquiv := e open_source := hs open_target := by simpa only [range_restrict, e.image_source_eq_target] using ho.isOpen_range continuousOn_toFun := hc continuousOn_invFun := e.image_source_eq_target ▸ ho.continuousOn_image_of_leftInvOn e.leftInvOn #align local_homeomorph.of_continuous_open_restrict PartialHomeomorph.ofContinuousOpenRestrict /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpen (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap e) (hs : IsOpen e.source) : PartialHomeomorph α β := ofContinuousOpenRestrict e hc (ho.restrict hs) hs #align local_homeomorph.of_continuous_open PartialHomeomorph.ofContinuousOpen /-- Restricting a partial homeomorphism `e` to `e.source ∩ s` when `s` is open. This is sometimes hard to use because of the openness assumption, but it has the advantage that when it can be used then its `PartialEquiv` is defeq to `PartialEquiv.restr`. -/ protected def restrOpen (s : Set α) (hs : IsOpen s) : PartialHomeomorph α β := (@IsImage.of_symm_preimage_eq α β _ _ e s (e.symm ⁻¹' s) rfl).restr (IsOpen.inter e.open_source hs) #align local_homeomorph.restr_open PartialHomeomorph.restrOpen @[simp, mfld_simps] theorem restrOpen_toPartialEquiv (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).toPartialEquiv = e.toPartialEquiv.restr s := rfl #align local_homeomorph.restr_open_to_local_equiv PartialHomeomorph.restrOpen_toPartialEquiv -- Already simp via `PartialEquiv` theorem restrOpen_source (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).source = e.source ∩ s := rfl #align local_homeomorph.restr_open_source PartialHomeomorph.restrOpen_source /-- Restricting a partial homeomorphism `e` to `e.source ∩ interior s`. We use the interior to make sure that the restriction is well defined whatever the set s, since partial homeomorphisms are by definition defined on open sets. In applications where `s` is open, this coincides with the restriction of partial equivalences -/ @[simps! (config := mfld_cfg) apply symm_apply, simps! (config := .lemmasOnly) source target] protected def restr (s : Set α) : PartialHomeomorph α β := e.restrOpen (interior s) isOpen_interior #align local_homeomorph.restr PartialHomeomorph.restr @[simp, mfld_simps] theorem restr_toPartialEquiv (s : Set α) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr (interior s) := rfl #align local_homeomorph.restr_to_local_equiv PartialHomeomorph.restr_toPartialEquiv theorem restr_source' (s : Set α) (hs : IsOpen s) : (e.restr s).source = e.source ∩ s := by rw [e.restr_source, hs.interior_eq] #align local_homeomorph.restr_source' PartialHomeomorph.restr_source' theorem restr_toPartialEquiv' (s : Set α) (hs : IsOpen s) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr s := by rw [e.restr_toPartialEquiv, hs.interior_eq] #align local_homeomorph.restr_to_local_equiv' PartialHomeomorph.restr_toPartialEquiv' theorem restr_eq_of_source_subset {e : PartialHomeomorph α β} {s : Set α} (h : e.source ⊆ s) : e.restr s = e := toPartialEquiv_injective <| PartialEquiv.restr_eq_of_source_subset <| interior_maximal h e.open_source #align local_homeomorph.restr_eq_of_source_subset PartialHomeomorph.restr_eq_of_source_subset @[simp, mfld_simps] theorem restr_univ {e : PartialHomeomorph α β} : e.restr univ = e := restr_eq_of_source_subset (subset_univ _) #align local_homeomorph.restr_univ PartialHomeomorph.restr_univ theorem restr_source_inter (s : Set α) : e.restr (e.source ∩ s) = e.restr s := by refine' PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) _ simp [e.open_source.interior_eq, ← inter_assoc] #align local_homeomorph.restr_source_inter PartialHomeomorph.restr_source_inter /-- The identity on the whole space as a partial homeomorphism. -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] protected def refl (α : Type*) [TopologicalSpace α] : PartialHomeomorph α α := (Homeomorph.refl α).toPartialHomeomorph #align local_homeomorph.refl PartialHomeomorph.refl @[simp, mfld_simps] theorem refl_localEquiv : (PartialHomeomorph.refl α).toPartialEquiv = PartialEquiv.refl α := rfl #align local_homeomorph.refl_local_equiv PartialHomeomorph.refl_localEquiv @[simp, mfld_simps] theorem refl_symm : (PartialHomeomorph.refl α).symm = PartialHomeomorph.refl α := rfl #align local_homeomorph.refl_symm PartialHomeomorph.refl_symm section variable {s : Set α} (hs : IsOpen s) /-- The identity partial equivalence on a set `s` -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] def ofSet (s : Set α) (hs : IsOpen s) : PartialHomeomorph α α where toPartialEquiv := PartialEquiv.ofSet s open_source := hs open_target := hs continuousOn_toFun := continuous_id.continuousOn continuousOn_invFun := continuous_id.continuousOn #align local_homeomorph.of_set PartialHomeomorph.ofSet @[simp, mfld_simps] theorem ofSet_toPartialEquiv : (ofSet s hs).toPartialEquiv = PartialEquiv.ofSet s := rfl #align local_homeomorph.of_set_to_local_equiv PartialHomeomorph.ofSet_toPartialEquiv @[simp, mfld_simps] theorem ofSet_symm : (ofSet s hs).symm = ofSet s hs := rfl #align local_homeomorph.of_set_symm PartialHomeomorph.ofSet_symm @[simp, mfld_simps] theorem ofSet_univ_eq_refl : ofSet univ isOpen_univ = PartialHomeomorph.refl α := by ext <;> simp #align local_homeomorph.of_set_univ_eq_refl PartialHomeomorph.ofSet_univ_eq_refl end /-- Composition of two partial homeomorphisms when the target of the first and the source of the second coincide. -/ @[simps! apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] protected def trans' (h : e.target = e'.source) : PartialHomeomorph α γ where toPartialEquiv := PartialEquiv.trans' e.toPartialEquiv e'.toPartialEquiv h open_source := e.open_source open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuousOn <| h ▸ e.mapsTo continuousOn_invFun := e.continuousOn_symm.comp e'.continuousOn_symm <| h.symm ▸ e'.symm_mapsTo #align local_homeomorph.trans' PartialHomeomorph.trans' /-- Composing two partial homeomorphisms, by restricting to the maximal domain where their composition is well defined. -/ protected def trans : PartialHomeomorph α γ := PartialHomeomorph.trans' (e.symm.restrOpen e'.source e'.open_source).symm (e'.restrOpen e.target e.open_target) (by simp [inter_comm]) #align local_homeomorph.trans PartialHomeomorph.trans @[simp, mfld_simps] theorem trans_toPartialEquiv : (e.trans e').toPartialEquiv = e.toPartialEquiv.trans e'.toPartialEquiv := rfl #align local_homeomorph.trans_to_local_equiv PartialHomeomorph.trans_toPartialEquiv @[simp, mfld_simps] theorem coe_trans : (e.trans e' : α → γ) = e' ∘ e := rfl #align local_homeomorph.coe_trans PartialHomeomorph.coe_trans @[simp, mfld_simps] theorem coe_trans_symm : ((e.trans e').symm : γ → α) = e.symm ∘ e'.symm := rfl #align local_homeomorph.coe_trans_symm PartialHomeomorph.coe_trans_symm theorem trans_apply {x : α} : (e.trans e') x = e' (e x) := rfl #align local_homeomorph.trans_apply PartialHomeomorph.trans_apply theorem trans_symm_eq_symm_trans_symm : (e.trans e').symm = e'.symm.trans e.symm := rfl #align local_homeomorph.trans_symm_eq_symm_trans_symm PartialHomeomorph.trans_symm_eq_symm_trans_symm /- This could be considered as a simp lemma, but there are many situations where it makes something simple into something more complicated. -/ theorem trans_source : (e.trans e').source = e.source ∩ e ⁻¹' e'.source := PartialEquiv.trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source PartialHomeomorph.trans_source theorem trans_source' : (e.trans e').source = e.source ∩ e ⁻¹' (e.target ∩ e'.source) := PartialEquiv.trans_source' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source' PartialHomeomorph.trans_source' theorem trans_source'' : (e.trans e').source = e.symm '' (e.target ∩ e'.source) := PartialEquiv.trans_source'' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source'' PartialHomeomorph.trans_source'' theorem image_trans_source : e '' (e.trans e').source = e.target ∩ e'.source := PartialEquiv.image_trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.image_trans_source PartialHomeomorph.image_trans_source theorem trans_target : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' e.target := rfl #align local_homeomorph.trans_target PartialHomeomorph.trans_target theorem trans_target' : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' (e'.source ∩ e.target) := trans_source' e'.symm e.symm #align local_homeomorph.trans_target' PartialHomeomorph.trans_target' theorem trans_target'' : (e.trans e').target = e' '' (e'.source ∩ e.target) := trans_source'' e'.symm e.symm #align local_homeomorph.trans_target'' PartialHomeomorph.trans_target'' theorem inv_image_trans_target : e'.symm '' (e.trans e').target = e'.source ∩ e.target := image_trans_source e'.symm e.symm #align local_homeomorph.inv_image_trans_target PartialHomeomorph.inv_image_trans_target theorem trans_assoc (e'' : PartialHomeomorph γ δ) : (e.trans e').trans e'' = e.trans (e'.trans e'') := toPartialEquiv_injective <| e.1.trans_assoc _ _ #align local_homeomorph.trans_assoc PartialHomeomorph.trans_assoc @[simp, mfld_simps] theorem trans_refl : e.trans (PartialHomeomorph.refl β) = e := toPartialEquiv_injective e.1.trans_refl #align local_homeomorph.trans_refl PartialHomeomorph.trans_refl @[simp, mfld_simps] theorem refl_trans : (PartialHomeomorph.refl α).trans e = e := toPartialEquiv_injective e.1.refl_trans #align local_homeomorph.refl_trans PartialHomeomorph.refl_trans theorem trans_ofSet {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e ⁻¹' s) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) <| by rw [trans_source, restr_source, ofSet_source, ← preimage_interior, hs.interior_eq] #align local_homeomorph.trans_of_set PartialHomeomorph.trans_ofSet theorem trans_of_set' {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e.source ∩ e ⁻¹' s) := by rw [trans_ofSet, restr_source_inter] #align local_homeomorph.trans_of_set' PartialHomeomorph.trans_of_set' theorem ofSet_trans {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr s := PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) <| by simp [hs.interior_eq, inter_comm] #align local_homeomorph.of_set_trans PartialHomeomorph.ofSet_trans theorem ofSet_trans' {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr (e.source ∩ s) := by rw [ofSet_trans, restr_source_inter] #align local_homeomorph.of_set_trans' PartialHomeomorph.ofSet_trans' @[simp, mfld_simps] theorem ofSet_trans_ofSet {s : Set α} (hs : IsOpen s) {s' : Set α} (hs' : IsOpen s') : (ofSet s hs).trans (ofSet s' hs') = ofSet (s ∩ s') (IsOpen.inter hs hs') := by rw [(ofSet s hs).trans_ofSet hs'] ext <;> simp [hs'.interior_eq] #align local_homeomorph.of_set_trans_of_set PartialHomeomorph.ofSet_trans_ofSet theorem restr_trans (s : Set α) : (e.restr s).trans e' = (e.trans e').restr s := toPartialEquiv_injective <| PartialEquiv.restr_trans e.toPartialEquiv e'.toPartialEquiv (interior s) #align local_homeomorph.restr_trans PartialHomeomorph.restr_trans /-- Postcompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def transHomeomorph (e' : β ≃ₜ γ) : PartialHomeomorph α γ where toPartialEquiv := e.toPartialEquiv.transEquiv e'.toEquiv open_source := e.open_source open_target := e.open_target.preimage e'.symm.continuous continuousOn_toFun := e'.continuous.comp_continuousOn e.continuousOn continuousOn_invFun := e.symm.continuousOn.comp e'.symm.continuous.continuousOn fun _ => id #align local_homeomorph.trans_homeomorph PartialHomeomorph.transHomeomorph theorem transHomeomorph_eq_trans (e' : β ≃ₜ γ) : e.transHomeomorph e' = e.trans e'.toPartialHomeomorph := toPartialEquiv_injective <| PartialEquiv.transEquiv_eq_trans _ _ #align local_homeomorph.trans_equiv_eq_trans PartialHomeomorph.transHomeomorph_eq_trans /-- Precompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def _root_.Homeomorph.transPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α γ where toPartialEquiv := e.toEquiv.transPartialEquiv e'.toPartialEquiv open_source := e'.open_source.preimage e.continuous open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuous.continuousOn fun _ => id continuousOn_invFun := e.symm.continuous.comp_continuousOn e'.symm.continuousOn #align homeomorph.trans_local_homeomorph Homeomorph.transPartialHomeomorph theorem _root_.Homeomorph.transPartialHomeomorph_eq_trans (e : α ≃ₜ β) : e.transPartialHomeomorph e' = e.toPartialHomeomorph.trans e' := toPartialEquiv_injective <| Equiv.transPartialEquiv_eq_trans _ _ #align homeomorph.trans_local_homeomorph_eq_trans Homeomorph.transPartialHomeomorph_eq_trans /-- `EqOnSource e e'` means that `e` and `e'` have the same source, and coincide there. They should really be considered the same partial equivalence. -/ def EqOnSource (e e' : PartialHomeomorph α β) : Prop := e.source = e'.source ∧ EqOn e e' e.source #align local_homeomorph.eq_on_source PartialHomeomorph.EqOnSource theorem eqOnSource_iff (e e' : PartialHomeomorph α β) : EqOnSource e e' ↔ PartialEquiv.EqOnSource e.toPartialEquiv e'.toPartialEquiv := Iff.rfl #align local_homeomorph.eq_on_source_iff PartialHomeomorph.eqOnSource_iff /-- `EqOnSource` is an equivalence relation. -/ instance eqOnSourceSetoid : Setoid (PartialHomeomorph α β) := { PartialEquiv.eqOnSourceSetoid.comap toPartialEquiv with r := EqOnSource } theorem eqOnSource_refl : e ≈ e := Setoid.refl _ #align local_homeomorph.eq_on_source_refl PartialHomeomorph.eqOnSource_refl /-- If two partial homeomorphisms are equivalent, so are their inverses. -/ theorem EqOnSource.symm' {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.symm ≈ e'.symm := PartialEquiv.EqOnSource.symm' h #align local_homeomorph.eq_on_source.symm' PartialHomeomorph.EqOnSource.symm' /-- Two equivalent partial homeomorphisms have the same source. -/ theorem EqOnSource.source_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.source = e'.source := h.1 #align local_homeomorph.eq_on_source.source_eq PartialHomeomorph.EqOnSource.source_eq /-- Two equivalent partial homeomorphisms have the same target. -/ theorem EqOnSource.target_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.target = e'.target := h.symm'.1 #align local_homeomorph.eq_on_source.target_eq PartialHomeomorph.EqOnSource.target_eq /-- Two equivalent partial homeomorphisms have coinciding `toFun` on the source -/ theorem EqOnSource.eqOn {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e e' e.source := h.2 #align local_homeomorph.eq_on_source.eq_on PartialHomeomorph.EqOnSource.eqOn /-- Two equivalent partial homeomorphisms have coinciding `invFun` on the target -/ theorem EqOnSource.symm_eqOn_target {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e.symm e'.symm e.target := h.symm'.2 #align local_homeomorph.eq_on_source.symm_eq_on_target PartialHomeomorph.EqOnSource.symm_eqOn_target /-- Composition of partial homeomorphisms respects equivalence. -/ theorem EqOnSource.trans' {e e' : PartialHomeomorph α β} {f f' : PartialHomeomorph β γ} (he : e ≈ e') (hf : f ≈ f') : e.trans f ≈ e'.trans f' := PartialEquiv.EqOnSource.trans' he hf #align local_homeomorph.eq_on_source.trans' PartialHomeomorph.EqOnSource.trans' /-- Restriction of partial homeomorphisms respects equivalence -/ theorem EqOnSource.restr {e e' : PartialHomeomorph α β} (he : e ≈ e') (s : Set α) : e.restr s ≈ e'.restr s := PartialEquiv.EqOnSource.restr he _ #align local_homeomorph.eq_on_source.restr PartialHomeomorph.EqOnSource.restr /- Two equivalent partial homeomorphisms are equal when the source and target are `univ`. -/ theorem Set.EqOn.restr_eqOn_source {e e' : PartialHomeomorph α β} (h : EqOn e e' (e.source ∩ e'.source)) : e.restr e'.source ≈ e'.restr e.source := by constructor · rw [e'.restr_source' _ e.open_source] rw [e.restr_source' _ e'.open_source] exact Set.inter_comm _ _ · rw [e.restr_source' _ e'.open_source] refine' (EqOn.trans _ h).trans _ <;> simp only [mfld_simps, eqOn_refl] #align local_homeomorph.set.eq_on.restr_eq_on_source PartialHomeomorph.Set.EqOn.restr_eqOn_source /-- Composition of a partial homeomorphism and its inverse is equivalent to the restriction of the identity to the source -/ theorem trans_self_symm : e.trans e.symm ≈ PartialHomeomorph.ofSet e.source e.open_source := PartialEquiv.trans_self_symm _ #align local_homeomorph.trans_self_symm PartialHomeomorph.trans_self_symm theorem trans_symm_self : e.symm.trans e ≈ PartialHomeomorph.ofSet e.target e.open_target := e.symm.trans_self_symm #align local_homeomorph.trans_symm_self PartialHomeomorph.trans_symm_self theorem eq_of_eqOnSource_univ {e e' : PartialHomeomorph α β} (h : e ≈ e') (s : e.source = univ) (t : e.target = univ) : e = e' := toPartialEquiv_injective <| PartialEquiv.eq_of_eqOnSource_univ _ _ h s t #align local_homeomorph.eq_of_eq_on_source_univ PartialHomeomorph.eq_of_eqOnSource_univ section Prod /-- The product of two partial homeomorphisms, as a partial homeomorphism on the product space. -/ @[simps! (config := mfld_cfg) toPartialEquiv apply, simps! (config := .lemmasOnly) source target symm_apply] def prod (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : PartialHomeomorph (α × γ) (β × δ) where open_source := e.open_source.prod e'.open_source open_target := e.open_target.prod e'.open_target continuousOn_toFun := e.continuousOn.prod_map e'.continuousOn continuousOn_invFun := e.continuousOn_symm.prod_map e'.continuousOn_symm toPartialEquiv := e.toPartialEquiv.prod e'.toPartialEquiv #align local_homeomorph.prod PartialHomeomorph.prod @[simp, mfld_simps] theorem prod_symm (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : (e.prod e').symm = e.symm.prod e'.symm := rfl #align local_homeomorph.prod_symm PartialHomeomorph.prod_symm @[simp] theorem refl_prod_refl {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] : (PartialHomeomorph.refl α).prod (PartialHomeomorph.refl β) = PartialHomeomorph.refl (α × β) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) univ_prod_univ #align local_homeomorph.refl_prod_refl PartialHomeomorph.refl_prod_refl @[simp, mfld_simps] theorem prod_trans {η : Type*} {ε : Type*} [TopologicalSpace η] [TopologicalSpace ε] (e : PartialHomeomorph α β) (f : PartialHomeomorph β γ) (e' : PartialHomeomorph δ η) (f' : PartialHomeomorph η ε) : (e.prod e').trans (f.prod f') = (e.trans f).prod (e'.trans f') := toPartialEquiv_injective <| e.1.prod_trans .. #align local_homeomorph.prod_trans PartialHomeomorph.prod_trans theorem prod_eq_prod_of_nonempty {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁.prod e₂).source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by obtain ⟨⟨x, y⟩, -⟩ := id h haveI : Nonempty α := ⟨x⟩ haveI : Nonempty β := ⟨e₁ x⟩ haveI : Nonempty γ := ⟨y⟩ haveI : Nonempty δ := ⟨e₂ y⟩ simp_rw [PartialHomeomorph.ext_iff, prod_apply, prod_symm_apply, prod_source, Prod.ext_iff, Set.prod_eq_prod_iff_of_nonempty h, forall_and, Prod.forall, forall_const, and_assoc, and_left_comm] #align local_homeomorph.prod_eq_prod_of_nonempty PartialHomeomorph.prod_eq_prod_of_nonempty theorem prod_eq_prod_of_nonempty' {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁'.prod e₂').source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by rw [eq_comm, prod_eq_prod_of_nonempty h, eq_comm, @eq_comm _ e₂'] #align local_homeomorph.prod_eq_prod_of_nonempty' PartialHomeomorph.prod_eq_prod_of_nonempty' end Prod section Piecewise /-- Combine two `PartialHomeomorph`s using `Set.piecewise`. The source of the new `PartialHomeomorph` is `s.ite e.source e'.source = e.source ∩ s ∪ e'.source \ s`, and similarly for target. The function sends `e.source ∩ s` to `e.target ∩ t` using `e` and `e'.source \ s` to `e'.target \ t` using `e'`, and similarly for the inverse function. To ensure the maps `toFun` and `invFun` are inverse of each other on the new `source` and `target`, the definition assumes that the sets `s` and `t` are related both by `e.is_image` and `e'.is_image`. To ensure that the new maps are continuous on `source`/`target`, it also assumes that `e.source` and `e'.source` meet `frontier s` on the same set and `e x = e' x` on this intersection. -/ @[simps! (config := .asFn) toPartialEquiv apply] def piecewise (e e' : PartialHomeomorph α β) (s : Set α) (t : Set β) [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquiv.piecewise e'.toPartialEquiv s t H H' open_source := e.open_source.ite e'.open_source Hs open_target := e.open_target.ite e'.open_target <| H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq continuousOn_toFun := continuousOn_piecewise_ite e.continuousOn e'.continuousOn Hs Heq continuousOn_invFun := continuousOn_piecewise_ite e.continuousOn_symm e'.continuousOn_symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) #align local_homeomorph.piecewise PartialHomeomorph.piecewise @[simp] theorem symm_piecewise (e e' : PartialHomeomorph α β) {s : Set α} {t : Set β} [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : (e.piecewise e' s t H H' Hs Heq).symm = e.symm.piecewise e'.symm t s H.symm H'.symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) := rfl #align local_homeomorph.symm_piecewise PartialHomeomorph.symm_piecewise /-- Combine two `PartialHomeomorph`s with disjoint sources and disjoint targets. We reuse `PartialHomeomorph.piecewise` then override `toPartialEquiv` to `PartialEquiv.disjointUnion`. This way we have better definitional equalities for `source` and `target`. -/ def disjointUnion (e e' : PartialHomeomorph α β) [∀ x, Decidable (x ∈ e.source)] [∀ y, Decidable (y ∈ e.target)] (Hs : Disjoint e.source e'.source) (Ht : Disjoint e.target e'.target) : PartialHomeomorph α β := (e.piecewise e' e.source e.target e.isImage_source_target (e'.isImage_source_target_of_disjoint e Hs.symm Ht.symm) (by rw [e.open_source.inter_frontier_eq, (Hs.symm.frontier_right e'.open_source).inter_eq]) (by rw [e.open_source.inter_frontier_eq] exact eqOn_empty _ _)).replaceEquiv (e.toPartialEquiv.disjointUnion e'.toPartialEquiv Hs Ht) (PartialEquiv.disjointUnion_eq_piecewise _ _ _ _).symm #align local_homeomorph.disjoint_union PartialHomeomorph.disjointUnion end Piecewise section Pi variable {ι : Type*} [Fintype ι] {Xi Yi : ι → Type*} [∀ i, TopologicalSpace (Xi i)] [∀ i, TopologicalSpace (Yi i)] (ei : ∀ i, PartialHomeomorph (Xi i) (Yi i)) /-- The product of a finite family of `PartialHomeomorph`s. -/ @[simps toPartialEquiv] def pi : PartialHomeomorph (∀ i, Xi i) (∀ i, Yi i) where toPartialEquiv := PartialEquiv.pi fun i => (ei i).toPartialEquiv open_source := isOpen_set_pi finite_univ fun i _ => (ei i).open_source open_target := isOpen_set_pi finite_univ fun i _ => (ei i).open_target continuousOn_toFun := continuousOn_pi.2 fun i => (ei i).continuousOn.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial continuousOn_invFun := continuousOn_pi.2 fun i => (ei i).continuousOn_symm.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial #align local_homeomorph.pi PartialHomeomorph.pi end Pi section Continuity /-- Continuity within a set at a point can be read under right composition with a local homeomorphism, if the point is in its target -/ theorem continuousWithinAt_iff_continuousWithinAt_comp_right {f : β → γ} {s : Set β} {x : β} (h : x ∈ e.target) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (f ∘ e) (e ⁻¹' s) (e.symm x) := by simp_rw [ContinuousWithinAt, ← @tendsto_map'_iff _ _ _ _ e, e.map_nhdsWithin_preimage_eq (e.map_target h), (· ∘ ·), e.right_inv h] #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_right PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_right /-- Continuity at a point can be read under right composition with a partial homeomorphism, if the point is in its target -/ theorem continuousAt_iff_continuousAt_comp_right {f : β → γ} {x : β} (h : x ∈ e.target) : ContinuousAt f x ↔ ContinuousAt (f ∘ e) (e.symm x) := by rw [← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_right h, preimage_univ, continuousWithinAt_univ] #align local_homeomorph.continuous_at_iff_continuous_at_comp_right PartialHomeomorph.continuousAt_iff_continuousAt_comp_right /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the right is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_right {f : β → γ} {s : Set β} (h : s ⊆ e.target) : ContinuousOn f s ↔ ContinuousOn (f ∘ e) (e.source ∩ e ⁻¹' s) := by simp only [← e.symm_image_eq_source_inter_preimage h, ContinuousOn, ball_image_iff] refine' forall₂_congr fun x hx => _ rw [e.continuousWithinAt_iff_continuousWithinAt_comp_right (h hx), e.symm_image_eq_source_inter_preimage h, inter_comm, continuousWithinAt_inter] exact IsOpen.mem_nhds e.open_source (e.map_target (h hx)) #align local_homeomorph.continuous_on_iff_continuous_on_comp_right PartialHomeomorph.continuousOn_iff_continuousOn_comp_right /-- Continuity within a set at a point can be read under left composition with a local homeomorphism if a neighborhood of the initial point is sent to the source of the local homeomorphism-/ theorem continuousWithinAt_iff_continuousWithinAt_comp_left {f : γ → α} {s : Set γ} {x : γ} (hx : f x ∈ e.source) (h : f ⁻¹' e.source ∈ 𝓝[s] x) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (e ∘ f) s x := by refine' ⟨(e.continuousAt hx).comp_continuousWithinAt, fun fe_cont => _⟩ rw [← continuousWithinAt_inter' h] at fe_cont ⊢ have : ContinuousWithinAt (e.symm ∘ e ∘ f) (s ∩ f ⁻¹' e.source) x := haveI : ContinuousWithinAt e.symm univ (e (f x)) := (e.continuousAt_symm (e.map_source hx)).continuousWithinAt ContinuousWithinAt.comp this fe_cont (subset_univ _) exact this.congr (fun y hy => by simp [e.left_inv hy.2]) (by simp [e.left_inv hx]) #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_left PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_left /-- Continuity at a point can be read under left composition with a partial homeomorphism if a neighborhood of the initial point is sent to the source of the partial homeomorphism-/ theorem continuousAt_iff_continuousAt_comp_left {f : γ → α} {x : γ} (h : f ⁻¹' e.source ∈ 𝓝 x) : ContinuousAt f x ↔ ContinuousAt (e ∘ f) x := by have hx : f x ∈ e.source := (mem_of_mem_nhds h : _) have h' : f ⁻¹' e.source ∈ 𝓝[univ] x := by rwa [nhdsWithin_univ] rw [← continuousWithinAt_univ, ← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_left hx h'] #align local_homeomorph.continuous_at_iff_continuous_at_comp_left PartialHomeomorph.continuousAt_iff_continuousAt_comp_left /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the left is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_left {f : γ → α} {s : Set γ} (h : s ⊆ f ⁻¹' e.source) : ContinuousOn f s ↔ ContinuousOn (e ∘ f) s := forall₂_congr fun _x hx => e.continuousWithinAt_iff_continuousWithinAt_comp_left (h hx) (mem_of_superset self_mem_nhdsWithin h) #align local_homeomorph.continuous_on_iff_continuous_on_comp_left PartialHomeomorph.continuousOn_iff_continuousOn_comp_left /-- A function is continuous if and only if its composition with a partial homeomorphism on the left is continuous and its image is contained in the source. -/ theorem continuous_iff_continuous_comp_left {f : γ → α} (h : f ⁻¹' e.source = univ) : Continuous f ↔ Continuous (e ∘ f) := by simp only [continuous_iff_continuousOn_univ] exact e.continuousOn_iff_continuousOn_comp_left (Eq.symm h).subset #align local_homeomorph.continuous_iff_continuous_comp_left PartialHomeomorph.continuous_iff_continuous_comp_left end Continuity /-- The homeomorphism obtained by restricting a `PartialHomeomorph` to a subset of the source. -/ @[simps] def homeomorphOfImageSubsetSource {s : Set α} {t : Set β} (hs : s ⊆ e.source) (ht : e '' s = t) : s ≃ₜ t := have h₁ : MapsTo e s t := mapsTo'.2 ht.subset have h₂ : t ⊆ e.target := ht ▸ e.image_source_eq_target ▸ image_subset e hs have h₃ : MapsTo e.symm t s := ht ▸ ball_image_iff.2 <| fun _x hx => (e.left_inv (hs hx)).symm ▸ hx { toFun := MapsTo.restrict e s t h₁ invFun := MapsTo.restrict e.symm t s h₃ left_inv := fun a => Subtype.ext (e.left_inv (hs a.2)) right_inv := fun b => Subtype.eq <| e.right_inv (h₂ b.2) continuous_toFun := (e.continuousOn.mono hs).restrict_mapsTo h₁ continuous_invFun := (e.continuousOn_symm.mono h₂).restrict_mapsTo h₃ } #align local_homeomorph.homeomorph_of_image_subset_source PartialHomeomorph.homeomorphOfImageSubsetSource /-- A partial homeomorphism defines a homeomorphism between its source and target. -/ @[simps!] -- porting note: new `simps` def toHomeomorphSourceTarget : e.source ≃ₜ e.target := e.homeomorphOfImageSubsetSource subset_rfl e.image_source_eq_target #align local_homeomorph.to_homeomorph_source_target PartialHomeomorph.toHomeomorphSourceTarget theorem secondCountableTopology_source [SecondCountableTopology β] (e : PartialHomeomorph α β) : SecondCountableTopology e.source := e.toHomeomorphSourceTarget.secondCountableTopology #align local_homeomorph.second_countable_topology_source PartialHomeomorph.secondCountableTopology_source theorem nhds_eq_comap_inf_principal {x} (hx : x ∈ e.source) : 𝓝 x = comap e (𝓝 (e x)) ⊓ 𝓟 e.source := by lift x to e.source using hx rw [← e.open_source.nhdsWithin_eq x.2, ← map_nhds_subtype_val, ← map_comap_setCoe_val, e.toHomeomorphSourceTarget.nhds_eq_comap, nhds_subtype_eq_comap] simp only [(· ∘ ·), toHomeomorphSourceTarget_apply_coe, comap_comap] /-- If a partial homeomorphism has source and target equal to univ, then it induces a homeomorphism between the whole spaces, expressed in this definition. -/ @[simps (config := mfld_cfg) apply symm_apply] -- porting note: todo: add a `PartialEquiv` version def toHomeomorphOfSourceEqUnivTargetEqUniv (h : e.source = (univ : Set α)) (h' : e.target = univ) : α ≃ₜ β where toFun := e invFun := e.symm left_inv x := e.left_inv <| by rw [h] exact mem_univ _ right_inv x := e.right_inv <| by rw [h'] exact mem_univ _ continuous_toFun := by simpa only [continuous_iff_continuousOn_univ, h] using e.continuousOn continuous_invFun := by simpa only [continuous_iff_continuousOn_univ, h'] using e.continuousOn_symm #align local_homeomorph.to_homeomorph_of_source_eq_univ_target_eq_univ PartialHomeomorph.toHomeomorphOfSourceEqUnivTargetEqUniv theorem openEmbedding_restrict : OpenEmbedding (e.source.restrict e) := by refine openEmbedding_of_continuous_injective_open (e.continuousOn.comp_continuous continuous_subtype_val Subtype.prop) e.injOn.injective fun V hV ↦ ?_ rw [Set.restrict_eq, Set.image_comp] exact e.image_isOpen_of_isOpen (e.open_source.isOpenMap_subtype_val V hV) fun _ ⟨x, _, h⟩ ↦ h ▸ x.2 /-- A partial homeomorphism whose source is all of `α` defines an open embedding of `α` into `β`. The converse is also true; see `OpenEmbedding.toPartialHomeomorph`. -/ theorem to_openEmbedding (h : e.source = Set.univ) : OpenEmbedding e := e.openEmbedding_restrict.comp ((Homeomorph.setCongr h).trans <| Homeomorph.Set.univ α).symm.openEmbedding #align local_homeomorph.to_open_embedding PartialHomeomorph.to_openEmbedding end PartialHomeomorph namespace Homeomorph variable (e : α ≃ₜ β) (e' : β ≃ₜ γ) /- Register as simp lemmas that the fields of a partial homeomorphism built from a homeomorphism correspond to the fields of the original homeomorphism. -/ @[simp, mfld_simps] theorem refl_toPartialHomeomorph : (Homeomorph.refl α).toPartialHomeomorph = PartialHomeomorph.refl α := rfl #align homeomorph.refl_to_local_homeomorph Homeomorph.refl_toPartialHomeomorph @[simp, mfld_simps] theorem symm_toPartialHomeomorph : e.symm.toPartialHomeomorph = e.toPartialHomeomorph.symm := rfl #align homeomorph.symm_to_local_homeomorph Homeomorph.symm_toPartialHomeomorph @[simp, mfld_simps] theorem trans_toPartialHomeomorph : (e.trans e').toPartialHomeomorph = e.toPartialHomeomorph.trans e'.toPartialHomeomorph := PartialHomeomorph.toPartialEquiv_injective <| Equiv.trans_toPartialEquiv _ _ #align homeomorph.trans_to_local_homeomorph Homeomorph.trans_toPartialHomeomorph end Homeomorph namespace OpenEmbedding variable (f : α → β) (h : OpenEmbedding f) /-- An open embedding of `α` into `β`, with `α` nonempty, defines a partial homeomorphism whose source is all of `α`. The converse is also true; see `PartialHomeomorph.to_openEmbedding`. -/ @[simps! (config := mfld_cfg) apply source target] noncomputable def toPartialHomeomorph [Nonempty α] : PartialHomeomorph α β := PartialHomeomorph.ofContinuousOpen ((h.toEmbedding.inj.injOn univ).toPartialEquiv _ _) h.continuous.continuousOn h.isOpenMap isOpen_univ #align open_embedding.to_local_homeomorph OpenEmbedding.toPartialHomeomorph variable [Nonempty α] lemma toPartialHomeomorph_left_inv {x : α} : (h.toPartialHomeomorph f).symm (f x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.left_inv] exact Set.mem_univ _ lemma toPartialHomeomorph_right_inv {x : β} (hx : x ∈ Set.range f) : f ((h.toPartialHomeomorph f).symm x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.right_inv] rwa [toPartialHomeomorph_target] end OpenEmbedding namespace TopologicalSpace.Opens open TopologicalSpace variable (s : Opens α) [Nonempty s] /-- The inclusion of an open subset `s` of a space `α` into `α` is a partial homeomorphism from the subtype `s` to `α`. -/ noncomputable def localHomeomorphSubtypeCoe : PartialHomeomorph s α := OpenEmbedding.toPartialHomeomorph _ s.2.openEmbedding_subtype_val #align topological_space.opens.local_homeomorph_subtype_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_coe : (s.localHomeomorphSubtypeCoe : s → α) = (↑) := rfl #align topological_space.opens.local_homeomorph_subtype_coe_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe_coe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_source : s.localHomeomorphSubtypeCoe.source = Set.univ := rfl #align topological_space.opens.local_homeomorph_subtype_coe_source TopologicalSpace.Opens.localHomeomorphSubtypeCoe_source @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_target : s.localHomeomorphSubtypeCoe.target = s := by simp only [localHomeomorphSubtypeCoe, Subtype.range_coe_subtype, mfld_simps] rfl #align topological_space.opens.local_homeomorph_subtype_coe_target TopologicalSpace.Opens.localHomeomorphSubtypeCoe_target end TopologicalSpace.Opens namespace PartialHomeomorph open TopologicalSpace variable (e : PartialHomeomorph α β) variable (s : Opens α) [Nonempty s] /-- The restriction of a partial homeomorphism `e` to an open subset `s` of the domain type produces a partial homeomorphism whose domain is the subtype `s`. -/ noncomputable def subtypeRestr : PartialHomeomorph s β := s.localHomeomorphSubtypeCoe.trans e #align local_homeomorph.subtype_restr PartialHomeomorph.subtypeRestr theorem subtypeRestr_def : e.subtypeRestr s = s.localHomeomorphSubtypeCoe.trans e := rfl #align local_homeomorph.subtype_restr_def PartialHomeomorph.subtypeRestr_def @[simp, mfld_simps] theorem subtypeRestr_coe : ((e.subtypeRestr s : PartialHomeomorph s β) : s → β) = Set.restrict ↑s (e : α → β) := rfl #align local_homeomorph.subtype_restr_coe PartialHomeomorph.subtypeRestr_coe @[simp, mfld_simps] theorem subtypeRestr_source : (e.subtypeRestr s).source = (↑) ⁻¹' e.source := by simp only [subtypeRestr_def, mfld_simps] #align local_homeomorph.subtype_restr_source PartialHomeomorph.subtypeRestr_source variable {s} theorem map_subtype_source {x : s} (hxe : (x : α) ∈ e.source): e x ∈ (e.subtypeRestr s).target := by refine' ⟨e.map_source hxe, _⟩ rw [s.localHomeomorphSubtypeCoe_target, mem_preimage, e.leftInvOn hxe] exact x.prop #align local_homeomorph.map_subtype_source PartialHomeomorph.map_subtype_source variable (s) /- This lemma characterizes the transition functions of an open subset in terms of the transition functions of the original space. -/ theorem subtypeRestr_symm_trans_subtypeRestr (f f' : PartialHomeomorph α β) : (f.subtypeRestr s).symm.trans (f'.subtypeRestr s) ≈ (f.symm.trans f').restr (f.target ∩ f.symm ⁻¹' s) := by simp only [subtypeRestr_def, trans_symm_eq_symm_trans_symm] have openness₁ : IsOpen (f.target ∩ f.symm ⁻¹' s) := f.isOpen_inter_preimage_symm s.2 rw [← ofSet_trans _ openness₁, ← trans_assoc, ← trans_assoc] refine' EqOnSource.trans' _ (eqOnSource_refl _) -- f' has been eliminated !!! have sets_identity : f.symm.source ∩ (f.target ∩ f.symm ⁻¹' s) = f.symm.source ∩ f.symm ⁻¹' s := by mfld_set_tac have openness₂ : IsOpen (s : Set α) := s.2 rw [ofSet_trans', sets_identity, ← trans_of_set' _ openness₂, trans_assoc] refine' EqOnSource.trans' (eqOnSource_refl _) _ -- f has been eliminated !!! refine' Setoid.trans (trans_symm_self s.localHomeomorphSubtypeCoe) _ simp only [mfld_simps, Setoid.refl] #align local_homeomorph.subtype_restr_symm_trans_subtype_restr PartialHomeomorph.subtypeRestr_symm_trans_subtypeRestr theorem subtypeRestr_symm_eqOn (U : Opens α) [Nonempty U] : EqOn e.symm (Subtype.val ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by intro y hy rw [eq_comm, eq_symm_apply _ _ hy.1] · change restrict _ e _ = _ rw [← subtypeRestr_coe, (e.subtypeRestr U).right_inv hy] · have := map_target _ hy; rwa [subtypeRestr_source] at this theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ · rw [← PartialHomeomorph.symm_target] apply PartialHomeomorph.map_source rw [PartialHomeomorph.symm_source]
exact hyV
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ · rw [← PartialHomeomorph.symm_target] apply PartialHomeomorph.map_source rw [PartialHomeomorph.symm_source]
Mathlib.Topology.PartialHomeomorph.1460_0.xRULiNOId4c9Kju
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target
Mathlib_Topology_PartialHomeomorph
case refine'_2 α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝⁶ : TopologicalSpace α inst✝⁵ : TopologicalSpace β inst✝⁴ : TopologicalSpace γ inst✝³ : TopologicalSpace δ e : PartialHomeomorph α β s : Opens α inst✝² : Nonempty ↥s U V : Opens α inst✝¹ : Nonempty ↥U inst✝ : Nonempty ↥V hUV : U ≤ V i : ↑↑U → ↑↑V := inclusion hUV y : β hy : y ∈ e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' (Opens.localHomeomorphSubtypeCoe U).toPartialEquiv.target hyV : ↑(PartialHomeomorph.symm e) y ∈ (Opens.localHomeomorphSubtypeCoe V).toPartialEquiv.target ⊢ ↑(Opens.localHomeomorphSubtypeCoe V) (↑(PartialHomeomorph.symm (Opens.localHomeomorphSubtypeCoe V)) (↑(PartialHomeomorph.symm e) y)) = ↑(Opens.localHomeomorphSubtypeCoe V) (inclusion hUV (↑(PartialHomeomorph.symm (Opens.localHomeomorphSubtypeCoe U)) (↑(PartialHomeomorph.symm e) y)))
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.is_image.map_nhds_within_eq PartialHomeomorph.IsImage.map_nhdsWithin_eq protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff] #align local_homeomorph.is_image.closure PartialHomeomorph.IsImage.closure protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by simpa only [closure_compl, compl_compl] using h.compl.closure.compl #align local_homeomorph.is_image.interior PartialHomeomorph.IsImage.interior protected theorem frontier (h : e.IsImage s t) : e.IsImage (frontier s) (frontier t) := h.closure.diff h.interior #align local_homeomorph.is_image.frontier PartialHomeomorph.IsImage.frontier theorem isOpen_iff (h : e.IsImage s t) : IsOpen (e.source ∩ s) ↔ IsOpen (e.target ∩ t) := ⟨fun hs => h.symm_preimage_eq' ▸ e.symm.isOpen_inter_preimage hs, fun hs => h.preimage_eq' ▸ e.isOpen_inter_preimage hs⟩ #align local_homeomorph.is_image.is_open_iff PartialHomeomorph.IsImage.isOpen_iff /-- Restrict a `PartialHomeomorph` to a pair of corresponding open sets. -/ @[simps toPartialEquiv] def restr (h : e.IsImage s t) (hs : IsOpen (e.source ∩ s)) : PartialHomeomorph α β where toPartialEquiv := h.toPartialEquiv.restr open_source := hs open_target := h.isOpen_iff.1 hs continuousOn_toFun := e.continuousOn.mono (inter_subset_left _ _) continuousOn_invFun := e.symm.continuousOn.mono (inter_subset_left _ _) #align local_homeomorph.is_image.restr PartialHomeomorph.IsImage.restr end IsImage theorem isImage_source_target : e.IsImage e.source e.target := e.toPartialEquiv.isImage_source_target #align local_homeomorph.is_image_source_target PartialHomeomorph.isImage_source_target theorem isImage_source_target_of_disjoint (e' : PartialHomeomorph α β) (hs : Disjoint e.source e'.source) (ht : Disjoint e.target e'.target) : e.IsImage e'.source e'.target := e.toPartialEquiv.isImage_source_target_of_disjoint e'.toPartialEquiv hs ht #align local_homeomorph.is_image_source_target_of_disjoint PartialHomeomorph.isImage_source_target_of_disjoint /-- Preimage of interior or interior of preimage coincide for partial homeomorphisms, when restricted to the source. -/ theorem preimage_interior (s : Set β) : e.source ∩ e ⁻¹' interior s = e.source ∩ interior (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).interior.preimage_eq #align local_homeomorph.preimage_interior PartialHomeomorph.preimage_interior theorem preimage_closure (s : Set β) : e.source ∩ e ⁻¹' closure s = e.source ∩ closure (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).closure.preimage_eq #align local_homeomorph.preimage_closure PartialHomeomorph.preimage_closure theorem preimage_frontier (s : Set β) : e.source ∩ e ⁻¹' frontier s = e.source ∩ frontier (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).frontier.preimage_eq #align local_homeomorph.preimage_frontier PartialHomeomorph.preimage_frontier theorem isOpen_inter_preimage_symm {s : Set α} (hs : IsOpen s) : IsOpen (e.target ∩ e.symm ⁻¹' s) := e.symm.continuousOn.isOpen_inter_preimage e.open_target hs #align local_homeomorph.preimage_open_of_open_symm PartialHomeomorph.isOpen_inter_preimage_symm /-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by have : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h rw [this] exact e.continuousOn_symm.isOpen_inter_preimage e.open_target hs #align local_homeomorph.image_open_of_open PartialHomeomorph.image_isOpen_of_isOpen /-- The image of the restriction of an open set to the source is open. -/ theorem image_isOpen_of_isOpen' {s : Set α} (hs : IsOpen s) : IsOpen (e '' (e.source ∩ s)) := image_isOpen_of_isOpen _ (IsOpen.inter e.open_source hs) (inter_subset_left _ _) #align local_homeomorph.image_open_of_open' PartialHomeomorph.image_isOpen_of_isOpen' /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpenRestrict (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap (e.source.restrict e)) (hs : IsOpen e.source) : PartialHomeomorph α β where toPartialEquiv := e open_source := hs open_target := by simpa only [range_restrict, e.image_source_eq_target] using ho.isOpen_range continuousOn_toFun := hc continuousOn_invFun := e.image_source_eq_target ▸ ho.continuousOn_image_of_leftInvOn e.leftInvOn #align local_homeomorph.of_continuous_open_restrict PartialHomeomorph.ofContinuousOpenRestrict /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpen (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap e) (hs : IsOpen e.source) : PartialHomeomorph α β := ofContinuousOpenRestrict e hc (ho.restrict hs) hs #align local_homeomorph.of_continuous_open PartialHomeomorph.ofContinuousOpen /-- Restricting a partial homeomorphism `e` to `e.source ∩ s` when `s` is open. This is sometimes hard to use because of the openness assumption, but it has the advantage that when it can be used then its `PartialEquiv` is defeq to `PartialEquiv.restr`. -/ protected def restrOpen (s : Set α) (hs : IsOpen s) : PartialHomeomorph α β := (@IsImage.of_symm_preimage_eq α β _ _ e s (e.symm ⁻¹' s) rfl).restr (IsOpen.inter e.open_source hs) #align local_homeomorph.restr_open PartialHomeomorph.restrOpen @[simp, mfld_simps] theorem restrOpen_toPartialEquiv (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).toPartialEquiv = e.toPartialEquiv.restr s := rfl #align local_homeomorph.restr_open_to_local_equiv PartialHomeomorph.restrOpen_toPartialEquiv -- Already simp via `PartialEquiv` theorem restrOpen_source (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).source = e.source ∩ s := rfl #align local_homeomorph.restr_open_source PartialHomeomorph.restrOpen_source /-- Restricting a partial homeomorphism `e` to `e.source ∩ interior s`. We use the interior to make sure that the restriction is well defined whatever the set s, since partial homeomorphisms are by definition defined on open sets. In applications where `s` is open, this coincides with the restriction of partial equivalences -/ @[simps! (config := mfld_cfg) apply symm_apply, simps! (config := .lemmasOnly) source target] protected def restr (s : Set α) : PartialHomeomorph α β := e.restrOpen (interior s) isOpen_interior #align local_homeomorph.restr PartialHomeomorph.restr @[simp, mfld_simps] theorem restr_toPartialEquiv (s : Set α) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr (interior s) := rfl #align local_homeomorph.restr_to_local_equiv PartialHomeomorph.restr_toPartialEquiv theorem restr_source' (s : Set α) (hs : IsOpen s) : (e.restr s).source = e.source ∩ s := by rw [e.restr_source, hs.interior_eq] #align local_homeomorph.restr_source' PartialHomeomorph.restr_source' theorem restr_toPartialEquiv' (s : Set α) (hs : IsOpen s) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr s := by rw [e.restr_toPartialEquiv, hs.interior_eq] #align local_homeomorph.restr_to_local_equiv' PartialHomeomorph.restr_toPartialEquiv' theorem restr_eq_of_source_subset {e : PartialHomeomorph α β} {s : Set α} (h : e.source ⊆ s) : e.restr s = e := toPartialEquiv_injective <| PartialEquiv.restr_eq_of_source_subset <| interior_maximal h e.open_source #align local_homeomorph.restr_eq_of_source_subset PartialHomeomorph.restr_eq_of_source_subset @[simp, mfld_simps] theorem restr_univ {e : PartialHomeomorph α β} : e.restr univ = e := restr_eq_of_source_subset (subset_univ _) #align local_homeomorph.restr_univ PartialHomeomorph.restr_univ theorem restr_source_inter (s : Set α) : e.restr (e.source ∩ s) = e.restr s := by refine' PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) _ simp [e.open_source.interior_eq, ← inter_assoc] #align local_homeomorph.restr_source_inter PartialHomeomorph.restr_source_inter /-- The identity on the whole space as a partial homeomorphism. -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] protected def refl (α : Type*) [TopologicalSpace α] : PartialHomeomorph α α := (Homeomorph.refl α).toPartialHomeomorph #align local_homeomorph.refl PartialHomeomorph.refl @[simp, mfld_simps] theorem refl_localEquiv : (PartialHomeomorph.refl α).toPartialEquiv = PartialEquiv.refl α := rfl #align local_homeomorph.refl_local_equiv PartialHomeomorph.refl_localEquiv @[simp, mfld_simps] theorem refl_symm : (PartialHomeomorph.refl α).symm = PartialHomeomorph.refl α := rfl #align local_homeomorph.refl_symm PartialHomeomorph.refl_symm section variable {s : Set α} (hs : IsOpen s) /-- The identity partial equivalence on a set `s` -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] def ofSet (s : Set α) (hs : IsOpen s) : PartialHomeomorph α α where toPartialEquiv := PartialEquiv.ofSet s open_source := hs open_target := hs continuousOn_toFun := continuous_id.continuousOn continuousOn_invFun := continuous_id.continuousOn #align local_homeomorph.of_set PartialHomeomorph.ofSet @[simp, mfld_simps] theorem ofSet_toPartialEquiv : (ofSet s hs).toPartialEquiv = PartialEquiv.ofSet s := rfl #align local_homeomorph.of_set_to_local_equiv PartialHomeomorph.ofSet_toPartialEquiv @[simp, mfld_simps] theorem ofSet_symm : (ofSet s hs).symm = ofSet s hs := rfl #align local_homeomorph.of_set_symm PartialHomeomorph.ofSet_symm @[simp, mfld_simps] theorem ofSet_univ_eq_refl : ofSet univ isOpen_univ = PartialHomeomorph.refl α := by ext <;> simp #align local_homeomorph.of_set_univ_eq_refl PartialHomeomorph.ofSet_univ_eq_refl end /-- Composition of two partial homeomorphisms when the target of the first and the source of the second coincide. -/ @[simps! apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] protected def trans' (h : e.target = e'.source) : PartialHomeomorph α γ where toPartialEquiv := PartialEquiv.trans' e.toPartialEquiv e'.toPartialEquiv h open_source := e.open_source open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuousOn <| h ▸ e.mapsTo continuousOn_invFun := e.continuousOn_symm.comp e'.continuousOn_symm <| h.symm ▸ e'.symm_mapsTo #align local_homeomorph.trans' PartialHomeomorph.trans' /-- Composing two partial homeomorphisms, by restricting to the maximal domain where their composition is well defined. -/ protected def trans : PartialHomeomorph α γ := PartialHomeomorph.trans' (e.symm.restrOpen e'.source e'.open_source).symm (e'.restrOpen e.target e.open_target) (by simp [inter_comm]) #align local_homeomorph.trans PartialHomeomorph.trans @[simp, mfld_simps] theorem trans_toPartialEquiv : (e.trans e').toPartialEquiv = e.toPartialEquiv.trans e'.toPartialEquiv := rfl #align local_homeomorph.trans_to_local_equiv PartialHomeomorph.trans_toPartialEquiv @[simp, mfld_simps] theorem coe_trans : (e.trans e' : α → γ) = e' ∘ e := rfl #align local_homeomorph.coe_trans PartialHomeomorph.coe_trans @[simp, mfld_simps] theorem coe_trans_symm : ((e.trans e').symm : γ → α) = e.symm ∘ e'.symm := rfl #align local_homeomorph.coe_trans_symm PartialHomeomorph.coe_trans_symm theorem trans_apply {x : α} : (e.trans e') x = e' (e x) := rfl #align local_homeomorph.trans_apply PartialHomeomorph.trans_apply theorem trans_symm_eq_symm_trans_symm : (e.trans e').symm = e'.symm.trans e.symm := rfl #align local_homeomorph.trans_symm_eq_symm_trans_symm PartialHomeomorph.trans_symm_eq_symm_trans_symm /- This could be considered as a simp lemma, but there are many situations where it makes something simple into something more complicated. -/ theorem trans_source : (e.trans e').source = e.source ∩ e ⁻¹' e'.source := PartialEquiv.trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source PartialHomeomorph.trans_source theorem trans_source' : (e.trans e').source = e.source ∩ e ⁻¹' (e.target ∩ e'.source) := PartialEquiv.trans_source' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source' PartialHomeomorph.trans_source' theorem trans_source'' : (e.trans e').source = e.symm '' (e.target ∩ e'.source) := PartialEquiv.trans_source'' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source'' PartialHomeomorph.trans_source'' theorem image_trans_source : e '' (e.trans e').source = e.target ∩ e'.source := PartialEquiv.image_trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.image_trans_source PartialHomeomorph.image_trans_source theorem trans_target : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' e.target := rfl #align local_homeomorph.trans_target PartialHomeomorph.trans_target theorem trans_target' : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' (e'.source ∩ e.target) := trans_source' e'.symm e.symm #align local_homeomorph.trans_target' PartialHomeomorph.trans_target' theorem trans_target'' : (e.trans e').target = e' '' (e'.source ∩ e.target) := trans_source'' e'.symm e.symm #align local_homeomorph.trans_target'' PartialHomeomorph.trans_target'' theorem inv_image_trans_target : e'.symm '' (e.trans e').target = e'.source ∩ e.target := image_trans_source e'.symm e.symm #align local_homeomorph.inv_image_trans_target PartialHomeomorph.inv_image_trans_target theorem trans_assoc (e'' : PartialHomeomorph γ δ) : (e.trans e').trans e'' = e.trans (e'.trans e'') := toPartialEquiv_injective <| e.1.trans_assoc _ _ #align local_homeomorph.trans_assoc PartialHomeomorph.trans_assoc @[simp, mfld_simps] theorem trans_refl : e.trans (PartialHomeomorph.refl β) = e := toPartialEquiv_injective e.1.trans_refl #align local_homeomorph.trans_refl PartialHomeomorph.trans_refl @[simp, mfld_simps] theorem refl_trans : (PartialHomeomorph.refl α).trans e = e := toPartialEquiv_injective e.1.refl_trans #align local_homeomorph.refl_trans PartialHomeomorph.refl_trans theorem trans_ofSet {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e ⁻¹' s) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) <| by rw [trans_source, restr_source, ofSet_source, ← preimage_interior, hs.interior_eq] #align local_homeomorph.trans_of_set PartialHomeomorph.trans_ofSet theorem trans_of_set' {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e.source ∩ e ⁻¹' s) := by rw [trans_ofSet, restr_source_inter] #align local_homeomorph.trans_of_set' PartialHomeomorph.trans_of_set' theorem ofSet_trans {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr s := PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) <| by simp [hs.interior_eq, inter_comm] #align local_homeomorph.of_set_trans PartialHomeomorph.ofSet_trans theorem ofSet_trans' {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr (e.source ∩ s) := by rw [ofSet_trans, restr_source_inter] #align local_homeomorph.of_set_trans' PartialHomeomorph.ofSet_trans' @[simp, mfld_simps] theorem ofSet_trans_ofSet {s : Set α} (hs : IsOpen s) {s' : Set α} (hs' : IsOpen s') : (ofSet s hs).trans (ofSet s' hs') = ofSet (s ∩ s') (IsOpen.inter hs hs') := by rw [(ofSet s hs).trans_ofSet hs'] ext <;> simp [hs'.interior_eq] #align local_homeomorph.of_set_trans_of_set PartialHomeomorph.ofSet_trans_ofSet theorem restr_trans (s : Set α) : (e.restr s).trans e' = (e.trans e').restr s := toPartialEquiv_injective <| PartialEquiv.restr_trans e.toPartialEquiv e'.toPartialEquiv (interior s) #align local_homeomorph.restr_trans PartialHomeomorph.restr_trans /-- Postcompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def transHomeomorph (e' : β ≃ₜ γ) : PartialHomeomorph α γ where toPartialEquiv := e.toPartialEquiv.transEquiv e'.toEquiv open_source := e.open_source open_target := e.open_target.preimage e'.symm.continuous continuousOn_toFun := e'.continuous.comp_continuousOn e.continuousOn continuousOn_invFun := e.symm.continuousOn.comp e'.symm.continuous.continuousOn fun _ => id #align local_homeomorph.trans_homeomorph PartialHomeomorph.transHomeomorph theorem transHomeomorph_eq_trans (e' : β ≃ₜ γ) : e.transHomeomorph e' = e.trans e'.toPartialHomeomorph := toPartialEquiv_injective <| PartialEquiv.transEquiv_eq_trans _ _ #align local_homeomorph.trans_equiv_eq_trans PartialHomeomorph.transHomeomorph_eq_trans /-- Precompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def _root_.Homeomorph.transPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α γ where toPartialEquiv := e.toEquiv.transPartialEquiv e'.toPartialEquiv open_source := e'.open_source.preimage e.continuous open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuous.continuousOn fun _ => id continuousOn_invFun := e.symm.continuous.comp_continuousOn e'.symm.continuousOn #align homeomorph.trans_local_homeomorph Homeomorph.transPartialHomeomorph theorem _root_.Homeomorph.transPartialHomeomorph_eq_trans (e : α ≃ₜ β) : e.transPartialHomeomorph e' = e.toPartialHomeomorph.trans e' := toPartialEquiv_injective <| Equiv.transPartialEquiv_eq_trans _ _ #align homeomorph.trans_local_homeomorph_eq_trans Homeomorph.transPartialHomeomorph_eq_trans /-- `EqOnSource e e'` means that `e` and `e'` have the same source, and coincide there. They should really be considered the same partial equivalence. -/ def EqOnSource (e e' : PartialHomeomorph α β) : Prop := e.source = e'.source ∧ EqOn e e' e.source #align local_homeomorph.eq_on_source PartialHomeomorph.EqOnSource theorem eqOnSource_iff (e e' : PartialHomeomorph α β) : EqOnSource e e' ↔ PartialEquiv.EqOnSource e.toPartialEquiv e'.toPartialEquiv := Iff.rfl #align local_homeomorph.eq_on_source_iff PartialHomeomorph.eqOnSource_iff /-- `EqOnSource` is an equivalence relation. -/ instance eqOnSourceSetoid : Setoid (PartialHomeomorph α β) := { PartialEquiv.eqOnSourceSetoid.comap toPartialEquiv with r := EqOnSource } theorem eqOnSource_refl : e ≈ e := Setoid.refl _ #align local_homeomorph.eq_on_source_refl PartialHomeomorph.eqOnSource_refl /-- If two partial homeomorphisms are equivalent, so are their inverses. -/ theorem EqOnSource.symm' {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.symm ≈ e'.symm := PartialEquiv.EqOnSource.symm' h #align local_homeomorph.eq_on_source.symm' PartialHomeomorph.EqOnSource.symm' /-- Two equivalent partial homeomorphisms have the same source. -/ theorem EqOnSource.source_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.source = e'.source := h.1 #align local_homeomorph.eq_on_source.source_eq PartialHomeomorph.EqOnSource.source_eq /-- Two equivalent partial homeomorphisms have the same target. -/ theorem EqOnSource.target_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.target = e'.target := h.symm'.1 #align local_homeomorph.eq_on_source.target_eq PartialHomeomorph.EqOnSource.target_eq /-- Two equivalent partial homeomorphisms have coinciding `toFun` on the source -/ theorem EqOnSource.eqOn {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e e' e.source := h.2 #align local_homeomorph.eq_on_source.eq_on PartialHomeomorph.EqOnSource.eqOn /-- Two equivalent partial homeomorphisms have coinciding `invFun` on the target -/ theorem EqOnSource.symm_eqOn_target {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e.symm e'.symm e.target := h.symm'.2 #align local_homeomorph.eq_on_source.symm_eq_on_target PartialHomeomorph.EqOnSource.symm_eqOn_target /-- Composition of partial homeomorphisms respects equivalence. -/ theorem EqOnSource.trans' {e e' : PartialHomeomorph α β} {f f' : PartialHomeomorph β γ} (he : e ≈ e') (hf : f ≈ f') : e.trans f ≈ e'.trans f' := PartialEquiv.EqOnSource.trans' he hf #align local_homeomorph.eq_on_source.trans' PartialHomeomorph.EqOnSource.trans' /-- Restriction of partial homeomorphisms respects equivalence -/ theorem EqOnSource.restr {e e' : PartialHomeomorph α β} (he : e ≈ e') (s : Set α) : e.restr s ≈ e'.restr s := PartialEquiv.EqOnSource.restr he _ #align local_homeomorph.eq_on_source.restr PartialHomeomorph.EqOnSource.restr /- Two equivalent partial homeomorphisms are equal when the source and target are `univ`. -/ theorem Set.EqOn.restr_eqOn_source {e e' : PartialHomeomorph α β} (h : EqOn e e' (e.source ∩ e'.source)) : e.restr e'.source ≈ e'.restr e.source := by constructor · rw [e'.restr_source' _ e.open_source] rw [e.restr_source' _ e'.open_source] exact Set.inter_comm _ _ · rw [e.restr_source' _ e'.open_source] refine' (EqOn.trans _ h).trans _ <;> simp only [mfld_simps, eqOn_refl] #align local_homeomorph.set.eq_on.restr_eq_on_source PartialHomeomorph.Set.EqOn.restr_eqOn_source /-- Composition of a partial homeomorphism and its inverse is equivalent to the restriction of the identity to the source -/ theorem trans_self_symm : e.trans e.symm ≈ PartialHomeomorph.ofSet e.source e.open_source := PartialEquiv.trans_self_symm _ #align local_homeomorph.trans_self_symm PartialHomeomorph.trans_self_symm theorem trans_symm_self : e.symm.trans e ≈ PartialHomeomorph.ofSet e.target e.open_target := e.symm.trans_self_symm #align local_homeomorph.trans_symm_self PartialHomeomorph.trans_symm_self theorem eq_of_eqOnSource_univ {e e' : PartialHomeomorph α β} (h : e ≈ e') (s : e.source = univ) (t : e.target = univ) : e = e' := toPartialEquiv_injective <| PartialEquiv.eq_of_eqOnSource_univ _ _ h s t #align local_homeomorph.eq_of_eq_on_source_univ PartialHomeomorph.eq_of_eqOnSource_univ section Prod /-- The product of two partial homeomorphisms, as a partial homeomorphism on the product space. -/ @[simps! (config := mfld_cfg) toPartialEquiv apply, simps! (config := .lemmasOnly) source target symm_apply] def prod (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : PartialHomeomorph (α × γ) (β × δ) where open_source := e.open_source.prod e'.open_source open_target := e.open_target.prod e'.open_target continuousOn_toFun := e.continuousOn.prod_map e'.continuousOn continuousOn_invFun := e.continuousOn_symm.prod_map e'.continuousOn_symm toPartialEquiv := e.toPartialEquiv.prod e'.toPartialEquiv #align local_homeomorph.prod PartialHomeomorph.prod @[simp, mfld_simps] theorem prod_symm (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : (e.prod e').symm = e.symm.prod e'.symm := rfl #align local_homeomorph.prod_symm PartialHomeomorph.prod_symm @[simp] theorem refl_prod_refl {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] : (PartialHomeomorph.refl α).prod (PartialHomeomorph.refl β) = PartialHomeomorph.refl (α × β) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) univ_prod_univ #align local_homeomorph.refl_prod_refl PartialHomeomorph.refl_prod_refl @[simp, mfld_simps] theorem prod_trans {η : Type*} {ε : Type*} [TopologicalSpace η] [TopologicalSpace ε] (e : PartialHomeomorph α β) (f : PartialHomeomorph β γ) (e' : PartialHomeomorph δ η) (f' : PartialHomeomorph η ε) : (e.prod e').trans (f.prod f') = (e.trans f).prod (e'.trans f') := toPartialEquiv_injective <| e.1.prod_trans .. #align local_homeomorph.prod_trans PartialHomeomorph.prod_trans theorem prod_eq_prod_of_nonempty {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁.prod e₂).source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by obtain ⟨⟨x, y⟩, -⟩ := id h haveI : Nonempty α := ⟨x⟩ haveI : Nonempty β := ⟨e₁ x⟩ haveI : Nonempty γ := ⟨y⟩ haveI : Nonempty δ := ⟨e₂ y⟩ simp_rw [PartialHomeomorph.ext_iff, prod_apply, prod_symm_apply, prod_source, Prod.ext_iff, Set.prod_eq_prod_iff_of_nonempty h, forall_and, Prod.forall, forall_const, and_assoc, and_left_comm] #align local_homeomorph.prod_eq_prod_of_nonempty PartialHomeomorph.prod_eq_prod_of_nonempty theorem prod_eq_prod_of_nonempty' {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁'.prod e₂').source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by rw [eq_comm, prod_eq_prod_of_nonempty h, eq_comm, @eq_comm _ e₂'] #align local_homeomorph.prod_eq_prod_of_nonempty' PartialHomeomorph.prod_eq_prod_of_nonempty' end Prod section Piecewise /-- Combine two `PartialHomeomorph`s using `Set.piecewise`. The source of the new `PartialHomeomorph` is `s.ite e.source e'.source = e.source ∩ s ∪ e'.source \ s`, and similarly for target. The function sends `e.source ∩ s` to `e.target ∩ t` using `e` and `e'.source \ s` to `e'.target \ t` using `e'`, and similarly for the inverse function. To ensure the maps `toFun` and `invFun` are inverse of each other on the new `source` and `target`, the definition assumes that the sets `s` and `t` are related both by `e.is_image` and `e'.is_image`. To ensure that the new maps are continuous on `source`/`target`, it also assumes that `e.source` and `e'.source` meet `frontier s` on the same set and `e x = e' x` on this intersection. -/ @[simps! (config := .asFn) toPartialEquiv apply] def piecewise (e e' : PartialHomeomorph α β) (s : Set α) (t : Set β) [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquiv.piecewise e'.toPartialEquiv s t H H' open_source := e.open_source.ite e'.open_source Hs open_target := e.open_target.ite e'.open_target <| H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq continuousOn_toFun := continuousOn_piecewise_ite e.continuousOn e'.continuousOn Hs Heq continuousOn_invFun := continuousOn_piecewise_ite e.continuousOn_symm e'.continuousOn_symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) #align local_homeomorph.piecewise PartialHomeomorph.piecewise @[simp] theorem symm_piecewise (e e' : PartialHomeomorph α β) {s : Set α} {t : Set β} [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : (e.piecewise e' s t H H' Hs Heq).symm = e.symm.piecewise e'.symm t s H.symm H'.symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) := rfl #align local_homeomorph.symm_piecewise PartialHomeomorph.symm_piecewise /-- Combine two `PartialHomeomorph`s with disjoint sources and disjoint targets. We reuse `PartialHomeomorph.piecewise` then override `toPartialEquiv` to `PartialEquiv.disjointUnion`. This way we have better definitional equalities for `source` and `target`. -/ def disjointUnion (e e' : PartialHomeomorph α β) [∀ x, Decidable (x ∈ e.source)] [∀ y, Decidable (y ∈ e.target)] (Hs : Disjoint e.source e'.source) (Ht : Disjoint e.target e'.target) : PartialHomeomorph α β := (e.piecewise e' e.source e.target e.isImage_source_target (e'.isImage_source_target_of_disjoint e Hs.symm Ht.symm) (by rw [e.open_source.inter_frontier_eq, (Hs.symm.frontier_right e'.open_source).inter_eq]) (by rw [e.open_source.inter_frontier_eq] exact eqOn_empty _ _)).replaceEquiv (e.toPartialEquiv.disjointUnion e'.toPartialEquiv Hs Ht) (PartialEquiv.disjointUnion_eq_piecewise _ _ _ _).symm #align local_homeomorph.disjoint_union PartialHomeomorph.disjointUnion end Piecewise section Pi variable {ι : Type*} [Fintype ι] {Xi Yi : ι → Type*} [∀ i, TopologicalSpace (Xi i)] [∀ i, TopologicalSpace (Yi i)] (ei : ∀ i, PartialHomeomorph (Xi i) (Yi i)) /-- The product of a finite family of `PartialHomeomorph`s. -/ @[simps toPartialEquiv] def pi : PartialHomeomorph (∀ i, Xi i) (∀ i, Yi i) where toPartialEquiv := PartialEquiv.pi fun i => (ei i).toPartialEquiv open_source := isOpen_set_pi finite_univ fun i _ => (ei i).open_source open_target := isOpen_set_pi finite_univ fun i _ => (ei i).open_target continuousOn_toFun := continuousOn_pi.2 fun i => (ei i).continuousOn.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial continuousOn_invFun := continuousOn_pi.2 fun i => (ei i).continuousOn_symm.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial #align local_homeomorph.pi PartialHomeomorph.pi end Pi section Continuity /-- Continuity within a set at a point can be read under right composition with a local homeomorphism, if the point is in its target -/ theorem continuousWithinAt_iff_continuousWithinAt_comp_right {f : β → γ} {s : Set β} {x : β} (h : x ∈ e.target) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (f ∘ e) (e ⁻¹' s) (e.symm x) := by simp_rw [ContinuousWithinAt, ← @tendsto_map'_iff _ _ _ _ e, e.map_nhdsWithin_preimage_eq (e.map_target h), (· ∘ ·), e.right_inv h] #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_right PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_right /-- Continuity at a point can be read under right composition with a partial homeomorphism, if the point is in its target -/ theorem continuousAt_iff_continuousAt_comp_right {f : β → γ} {x : β} (h : x ∈ e.target) : ContinuousAt f x ↔ ContinuousAt (f ∘ e) (e.symm x) := by rw [← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_right h, preimage_univ, continuousWithinAt_univ] #align local_homeomorph.continuous_at_iff_continuous_at_comp_right PartialHomeomorph.continuousAt_iff_continuousAt_comp_right /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the right is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_right {f : β → γ} {s : Set β} (h : s ⊆ e.target) : ContinuousOn f s ↔ ContinuousOn (f ∘ e) (e.source ∩ e ⁻¹' s) := by simp only [← e.symm_image_eq_source_inter_preimage h, ContinuousOn, ball_image_iff] refine' forall₂_congr fun x hx => _ rw [e.continuousWithinAt_iff_continuousWithinAt_comp_right (h hx), e.symm_image_eq_source_inter_preimage h, inter_comm, continuousWithinAt_inter] exact IsOpen.mem_nhds e.open_source (e.map_target (h hx)) #align local_homeomorph.continuous_on_iff_continuous_on_comp_right PartialHomeomorph.continuousOn_iff_continuousOn_comp_right /-- Continuity within a set at a point can be read under left composition with a local homeomorphism if a neighborhood of the initial point is sent to the source of the local homeomorphism-/ theorem continuousWithinAt_iff_continuousWithinAt_comp_left {f : γ → α} {s : Set γ} {x : γ} (hx : f x ∈ e.source) (h : f ⁻¹' e.source ∈ 𝓝[s] x) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (e ∘ f) s x := by refine' ⟨(e.continuousAt hx).comp_continuousWithinAt, fun fe_cont => _⟩ rw [← continuousWithinAt_inter' h] at fe_cont ⊢ have : ContinuousWithinAt (e.symm ∘ e ∘ f) (s ∩ f ⁻¹' e.source) x := haveI : ContinuousWithinAt e.symm univ (e (f x)) := (e.continuousAt_symm (e.map_source hx)).continuousWithinAt ContinuousWithinAt.comp this fe_cont (subset_univ _) exact this.congr (fun y hy => by simp [e.left_inv hy.2]) (by simp [e.left_inv hx]) #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_left PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_left /-- Continuity at a point can be read under left composition with a partial homeomorphism if a neighborhood of the initial point is sent to the source of the partial homeomorphism-/ theorem continuousAt_iff_continuousAt_comp_left {f : γ → α} {x : γ} (h : f ⁻¹' e.source ∈ 𝓝 x) : ContinuousAt f x ↔ ContinuousAt (e ∘ f) x := by have hx : f x ∈ e.source := (mem_of_mem_nhds h : _) have h' : f ⁻¹' e.source ∈ 𝓝[univ] x := by rwa [nhdsWithin_univ] rw [← continuousWithinAt_univ, ← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_left hx h'] #align local_homeomorph.continuous_at_iff_continuous_at_comp_left PartialHomeomorph.continuousAt_iff_continuousAt_comp_left /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the left is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_left {f : γ → α} {s : Set γ} (h : s ⊆ f ⁻¹' e.source) : ContinuousOn f s ↔ ContinuousOn (e ∘ f) s := forall₂_congr fun _x hx => e.continuousWithinAt_iff_continuousWithinAt_comp_left (h hx) (mem_of_superset self_mem_nhdsWithin h) #align local_homeomorph.continuous_on_iff_continuous_on_comp_left PartialHomeomorph.continuousOn_iff_continuousOn_comp_left /-- A function is continuous if and only if its composition with a partial homeomorphism on the left is continuous and its image is contained in the source. -/ theorem continuous_iff_continuous_comp_left {f : γ → α} (h : f ⁻¹' e.source = univ) : Continuous f ↔ Continuous (e ∘ f) := by simp only [continuous_iff_continuousOn_univ] exact e.continuousOn_iff_continuousOn_comp_left (Eq.symm h).subset #align local_homeomorph.continuous_iff_continuous_comp_left PartialHomeomorph.continuous_iff_continuous_comp_left end Continuity /-- The homeomorphism obtained by restricting a `PartialHomeomorph` to a subset of the source. -/ @[simps] def homeomorphOfImageSubsetSource {s : Set α} {t : Set β} (hs : s ⊆ e.source) (ht : e '' s = t) : s ≃ₜ t := have h₁ : MapsTo e s t := mapsTo'.2 ht.subset have h₂ : t ⊆ e.target := ht ▸ e.image_source_eq_target ▸ image_subset e hs have h₃ : MapsTo e.symm t s := ht ▸ ball_image_iff.2 <| fun _x hx => (e.left_inv (hs hx)).symm ▸ hx { toFun := MapsTo.restrict e s t h₁ invFun := MapsTo.restrict e.symm t s h₃ left_inv := fun a => Subtype.ext (e.left_inv (hs a.2)) right_inv := fun b => Subtype.eq <| e.right_inv (h₂ b.2) continuous_toFun := (e.continuousOn.mono hs).restrict_mapsTo h₁ continuous_invFun := (e.continuousOn_symm.mono h₂).restrict_mapsTo h₃ } #align local_homeomorph.homeomorph_of_image_subset_source PartialHomeomorph.homeomorphOfImageSubsetSource /-- A partial homeomorphism defines a homeomorphism between its source and target. -/ @[simps!] -- porting note: new `simps` def toHomeomorphSourceTarget : e.source ≃ₜ e.target := e.homeomorphOfImageSubsetSource subset_rfl e.image_source_eq_target #align local_homeomorph.to_homeomorph_source_target PartialHomeomorph.toHomeomorphSourceTarget theorem secondCountableTopology_source [SecondCountableTopology β] (e : PartialHomeomorph α β) : SecondCountableTopology e.source := e.toHomeomorphSourceTarget.secondCountableTopology #align local_homeomorph.second_countable_topology_source PartialHomeomorph.secondCountableTopology_source theorem nhds_eq_comap_inf_principal {x} (hx : x ∈ e.source) : 𝓝 x = comap e (𝓝 (e x)) ⊓ 𝓟 e.source := by lift x to e.source using hx rw [← e.open_source.nhdsWithin_eq x.2, ← map_nhds_subtype_val, ← map_comap_setCoe_val, e.toHomeomorphSourceTarget.nhds_eq_comap, nhds_subtype_eq_comap] simp only [(· ∘ ·), toHomeomorphSourceTarget_apply_coe, comap_comap] /-- If a partial homeomorphism has source and target equal to univ, then it induces a homeomorphism between the whole spaces, expressed in this definition. -/ @[simps (config := mfld_cfg) apply symm_apply] -- porting note: todo: add a `PartialEquiv` version def toHomeomorphOfSourceEqUnivTargetEqUniv (h : e.source = (univ : Set α)) (h' : e.target = univ) : α ≃ₜ β where toFun := e invFun := e.symm left_inv x := e.left_inv <| by rw [h] exact mem_univ _ right_inv x := e.right_inv <| by rw [h'] exact mem_univ _ continuous_toFun := by simpa only [continuous_iff_continuousOn_univ, h] using e.continuousOn continuous_invFun := by simpa only [continuous_iff_continuousOn_univ, h'] using e.continuousOn_symm #align local_homeomorph.to_homeomorph_of_source_eq_univ_target_eq_univ PartialHomeomorph.toHomeomorphOfSourceEqUnivTargetEqUniv theorem openEmbedding_restrict : OpenEmbedding (e.source.restrict e) := by refine openEmbedding_of_continuous_injective_open (e.continuousOn.comp_continuous continuous_subtype_val Subtype.prop) e.injOn.injective fun V hV ↦ ?_ rw [Set.restrict_eq, Set.image_comp] exact e.image_isOpen_of_isOpen (e.open_source.isOpenMap_subtype_val V hV) fun _ ⟨x, _, h⟩ ↦ h ▸ x.2 /-- A partial homeomorphism whose source is all of `α` defines an open embedding of `α` into `β`. The converse is also true; see `OpenEmbedding.toPartialHomeomorph`. -/ theorem to_openEmbedding (h : e.source = Set.univ) : OpenEmbedding e := e.openEmbedding_restrict.comp ((Homeomorph.setCongr h).trans <| Homeomorph.Set.univ α).symm.openEmbedding #align local_homeomorph.to_open_embedding PartialHomeomorph.to_openEmbedding end PartialHomeomorph namespace Homeomorph variable (e : α ≃ₜ β) (e' : β ≃ₜ γ) /- Register as simp lemmas that the fields of a partial homeomorphism built from a homeomorphism correspond to the fields of the original homeomorphism. -/ @[simp, mfld_simps] theorem refl_toPartialHomeomorph : (Homeomorph.refl α).toPartialHomeomorph = PartialHomeomorph.refl α := rfl #align homeomorph.refl_to_local_homeomorph Homeomorph.refl_toPartialHomeomorph @[simp, mfld_simps] theorem symm_toPartialHomeomorph : e.symm.toPartialHomeomorph = e.toPartialHomeomorph.symm := rfl #align homeomorph.symm_to_local_homeomorph Homeomorph.symm_toPartialHomeomorph @[simp, mfld_simps] theorem trans_toPartialHomeomorph : (e.trans e').toPartialHomeomorph = e.toPartialHomeomorph.trans e'.toPartialHomeomorph := PartialHomeomorph.toPartialEquiv_injective <| Equiv.trans_toPartialEquiv _ _ #align homeomorph.trans_to_local_homeomorph Homeomorph.trans_toPartialHomeomorph end Homeomorph namespace OpenEmbedding variable (f : α → β) (h : OpenEmbedding f) /-- An open embedding of `α` into `β`, with `α` nonempty, defines a partial homeomorphism whose source is all of `α`. The converse is also true; see `PartialHomeomorph.to_openEmbedding`. -/ @[simps! (config := mfld_cfg) apply source target] noncomputable def toPartialHomeomorph [Nonempty α] : PartialHomeomorph α β := PartialHomeomorph.ofContinuousOpen ((h.toEmbedding.inj.injOn univ).toPartialEquiv _ _) h.continuous.continuousOn h.isOpenMap isOpen_univ #align open_embedding.to_local_homeomorph OpenEmbedding.toPartialHomeomorph variable [Nonempty α] lemma toPartialHomeomorph_left_inv {x : α} : (h.toPartialHomeomorph f).symm (f x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.left_inv] exact Set.mem_univ _ lemma toPartialHomeomorph_right_inv {x : β} (hx : x ∈ Set.range f) : f ((h.toPartialHomeomorph f).symm x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.right_inv] rwa [toPartialHomeomorph_target] end OpenEmbedding namespace TopologicalSpace.Opens open TopologicalSpace variable (s : Opens α) [Nonempty s] /-- The inclusion of an open subset `s` of a space `α` into `α` is a partial homeomorphism from the subtype `s` to `α`. -/ noncomputable def localHomeomorphSubtypeCoe : PartialHomeomorph s α := OpenEmbedding.toPartialHomeomorph _ s.2.openEmbedding_subtype_val #align topological_space.opens.local_homeomorph_subtype_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_coe : (s.localHomeomorphSubtypeCoe : s → α) = (↑) := rfl #align topological_space.opens.local_homeomorph_subtype_coe_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe_coe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_source : s.localHomeomorphSubtypeCoe.source = Set.univ := rfl #align topological_space.opens.local_homeomorph_subtype_coe_source TopologicalSpace.Opens.localHomeomorphSubtypeCoe_source @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_target : s.localHomeomorphSubtypeCoe.target = s := by simp only [localHomeomorphSubtypeCoe, Subtype.range_coe_subtype, mfld_simps] rfl #align topological_space.opens.local_homeomorph_subtype_coe_target TopologicalSpace.Opens.localHomeomorphSubtypeCoe_target end TopologicalSpace.Opens namespace PartialHomeomorph open TopologicalSpace variable (e : PartialHomeomorph α β) variable (s : Opens α) [Nonempty s] /-- The restriction of a partial homeomorphism `e` to an open subset `s` of the domain type produces a partial homeomorphism whose domain is the subtype `s`. -/ noncomputable def subtypeRestr : PartialHomeomorph s β := s.localHomeomorphSubtypeCoe.trans e #align local_homeomorph.subtype_restr PartialHomeomorph.subtypeRestr theorem subtypeRestr_def : e.subtypeRestr s = s.localHomeomorphSubtypeCoe.trans e := rfl #align local_homeomorph.subtype_restr_def PartialHomeomorph.subtypeRestr_def @[simp, mfld_simps] theorem subtypeRestr_coe : ((e.subtypeRestr s : PartialHomeomorph s β) : s → β) = Set.restrict ↑s (e : α → β) := rfl #align local_homeomorph.subtype_restr_coe PartialHomeomorph.subtypeRestr_coe @[simp, mfld_simps] theorem subtypeRestr_source : (e.subtypeRestr s).source = (↑) ⁻¹' e.source := by simp only [subtypeRestr_def, mfld_simps] #align local_homeomorph.subtype_restr_source PartialHomeomorph.subtypeRestr_source variable {s} theorem map_subtype_source {x : s} (hxe : (x : α) ∈ e.source): e x ∈ (e.subtypeRestr s).target := by refine' ⟨e.map_source hxe, _⟩ rw [s.localHomeomorphSubtypeCoe_target, mem_preimage, e.leftInvOn hxe] exact x.prop #align local_homeomorph.map_subtype_source PartialHomeomorph.map_subtype_source variable (s) /- This lemma characterizes the transition functions of an open subset in terms of the transition functions of the original space. -/ theorem subtypeRestr_symm_trans_subtypeRestr (f f' : PartialHomeomorph α β) : (f.subtypeRestr s).symm.trans (f'.subtypeRestr s) ≈ (f.symm.trans f').restr (f.target ∩ f.symm ⁻¹' s) := by simp only [subtypeRestr_def, trans_symm_eq_symm_trans_symm] have openness₁ : IsOpen (f.target ∩ f.symm ⁻¹' s) := f.isOpen_inter_preimage_symm s.2 rw [← ofSet_trans _ openness₁, ← trans_assoc, ← trans_assoc] refine' EqOnSource.trans' _ (eqOnSource_refl _) -- f' has been eliminated !!! have sets_identity : f.symm.source ∩ (f.target ∩ f.symm ⁻¹' s) = f.symm.source ∩ f.symm ⁻¹' s := by mfld_set_tac have openness₂ : IsOpen (s : Set α) := s.2 rw [ofSet_trans', sets_identity, ← trans_of_set' _ openness₂, trans_assoc] refine' EqOnSource.trans' (eqOnSource_refl _) _ -- f has been eliminated !!! refine' Setoid.trans (trans_symm_self s.localHomeomorphSubtypeCoe) _ simp only [mfld_simps, Setoid.refl] #align local_homeomorph.subtype_restr_symm_trans_subtype_restr PartialHomeomorph.subtypeRestr_symm_trans_subtypeRestr theorem subtypeRestr_symm_eqOn (U : Opens α) [Nonempty U] : EqOn e.symm (Subtype.val ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by intro y hy rw [eq_comm, eq_symm_apply _ _ hy.1] · change restrict _ e _ = _ rw [← subtypeRestr_coe, (e.subtypeRestr U).right_inv hy] · have := map_target _ hy; rwa [subtypeRestr_source] at this theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ · rw [← PartialHomeomorph.symm_target] apply PartialHomeomorph.map_source rw [PartialHomeomorph.symm_source] exact hyV ·
rw [V.localHomeomorphSubtypeCoe.right_inv hyV]
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ · rw [← PartialHomeomorph.symm_target] apply PartialHomeomorph.map_source rw [PartialHomeomorph.symm_source] exact hyV ·
Mathlib.Topology.PartialHomeomorph.1460_0.xRULiNOId4c9Kju
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target
Mathlib_Topology_PartialHomeomorph
case refine'_2 α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝⁶ : TopologicalSpace α inst✝⁵ : TopologicalSpace β inst✝⁴ : TopologicalSpace γ inst✝³ : TopologicalSpace δ e : PartialHomeomorph α β s : Opens α inst✝² : Nonempty ↥s U V : Opens α inst✝¹ : Nonempty ↥U inst✝ : Nonempty ↥V hUV : U ≤ V i : ↑↑U → ↑↑V := inclusion hUV y : β hy : y ∈ e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' (Opens.localHomeomorphSubtypeCoe U).toPartialEquiv.target hyV : ↑(PartialHomeomorph.symm e) y ∈ (Opens.localHomeomorphSubtypeCoe V).toPartialEquiv.target ⊢ ↑(PartialHomeomorph.symm e) y = ↑(Opens.localHomeomorphSubtypeCoe V) (inclusion hUV (↑(PartialHomeomorph.symm (Opens.localHomeomorphSubtypeCoe U)) (↑(PartialHomeomorph.symm e) y)))
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.is_image.map_nhds_within_eq PartialHomeomorph.IsImage.map_nhdsWithin_eq protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff] #align local_homeomorph.is_image.closure PartialHomeomorph.IsImage.closure protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by simpa only [closure_compl, compl_compl] using h.compl.closure.compl #align local_homeomorph.is_image.interior PartialHomeomorph.IsImage.interior protected theorem frontier (h : e.IsImage s t) : e.IsImage (frontier s) (frontier t) := h.closure.diff h.interior #align local_homeomorph.is_image.frontier PartialHomeomorph.IsImage.frontier theorem isOpen_iff (h : e.IsImage s t) : IsOpen (e.source ∩ s) ↔ IsOpen (e.target ∩ t) := ⟨fun hs => h.symm_preimage_eq' ▸ e.symm.isOpen_inter_preimage hs, fun hs => h.preimage_eq' ▸ e.isOpen_inter_preimage hs⟩ #align local_homeomorph.is_image.is_open_iff PartialHomeomorph.IsImage.isOpen_iff /-- Restrict a `PartialHomeomorph` to a pair of corresponding open sets. -/ @[simps toPartialEquiv] def restr (h : e.IsImage s t) (hs : IsOpen (e.source ∩ s)) : PartialHomeomorph α β where toPartialEquiv := h.toPartialEquiv.restr open_source := hs open_target := h.isOpen_iff.1 hs continuousOn_toFun := e.continuousOn.mono (inter_subset_left _ _) continuousOn_invFun := e.symm.continuousOn.mono (inter_subset_left _ _) #align local_homeomorph.is_image.restr PartialHomeomorph.IsImage.restr end IsImage theorem isImage_source_target : e.IsImage e.source e.target := e.toPartialEquiv.isImage_source_target #align local_homeomorph.is_image_source_target PartialHomeomorph.isImage_source_target theorem isImage_source_target_of_disjoint (e' : PartialHomeomorph α β) (hs : Disjoint e.source e'.source) (ht : Disjoint e.target e'.target) : e.IsImage e'.source e'.target := e.toPartialEquiv.isImage_source_target_of_disjoint e'.toPartialEquiv hs ht #align local_homeomorph.is_image_source_target_of_disjoint PartialHomeomorph.isImage_source_target_of_disjoint /-- Preimage of interior or interior of preimage coincide for partial homeomorphisms, when restricted to the source. -/ theorem preimage_interior (s : Set β) : e.source ∩ e ⁻¹' interior s = e.source ∩ interior (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).interior.preimage_eq #align local_homeomorph.preimage_interior PartialHomeomorph.preimage_interior theorem preimage_closure (s : Set β) : e.source ∩ e ⁻¹' closure s = e.source ∩ closure (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).closure.preimage_eq #align local_homeomorph.preimage_closure PartialHomeomorph.preimage_closure theorem preimage_frontier (s : Set β) : e.source ∩ e ⁻¹' frontier s = e.source ∩ frontier (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).frontier.preimage_eq #align local_homeomorph.preimage_frontier PartialHomeomorph.preimage_frontier theorem isOpen_inter_preimage_symm {s : Set α} (hs : IsOpen s) : IsOpen (e.target ∩ e.symm ⁻¹' s) := e.symm.continuousOn.isOpen_inter_preimage e.open_target hs #align local_homeomorph.preimage_open_of_open_symm PartialHomeomorph.isOpen_inter_preimage_symm /-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by have : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h rw [this] exact e.continuousOn_symm.isOpen_inter_preimage e.open_target hs #align local_homeomorph.image_open_of_open PartialHomeomorph.image_isOpen_of_isOpen /-- The image of the restriction of an open set to the source is open. -/ theorem image_isOpen_of_isOpen' {s : Set α} (hs : IsOpen s) : IsOpen (e '' (e.source ∩ s)) := image_isOpen_of_isOpen _ (IsOpen.inter e.open_source hs) (inter_subset_left _ _) #align local_homeomorph.image_open_of_open' PartialHomeomorph.image_isOpen_of_isOpen' /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpenRestrict (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap (e.source.restrict e)) (hs : IsOpen e.source) : PartialHomeomorph α β where toPartialEquiv := e open_source := hs open_target := by simpa only [range_restrict, e.image_source_eq_target] using ho.isOpen_range continuousOn_toFun := hc continuousOn_invFun := e.image_source_eq_target ▸ ho.continuousOn_image_of_leftInvOn e.leftInvOn #align local_homeomorph.of_continuous_open_restrict PartialHomeomorph.ofContinuousOpenRestrict /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpen (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap e) (hs : IsOpen e.source) : PartialHomeomorph α β := ofContinuousOpenRestrict e hc (ho.restrict hs) hs #align local_homeomorph.of_continuous_open PartialHomeomorph.ofContinuousOpen /-- Restricting a partial homeomorphism `e` to `e.source ∩ s` when `s` is open. This is sometimes hard to use because of the openness assumption, but it has the advantage that when it can be used then its `PartialEquiv` is defeq to `PartialEquiv.restr`. -/ protected def restrOpen (s : Set α) (hs : IsOpen s) : PartialHomeomorph α β := (@IsImage.of_symm_preimage_eq α β _ _ e s (e.symm ⁻¹' s) rfl).restr (IsOpen.inter e.open_source hs) #align local_homeomorph.restr_open PartialHomeomorph.restrOpen @[simp, mfld_simps] theorem restrOpen_toPartialEquiv (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).toPartialEquiv = e.toPartialEquiv.restr s := rfl #align local_homeomorph.restr_open_to_local_equiv PartialHomeomorph.restrOpen_toPartialEquiv -- Already simp via `PartialEquiv` theorem restrOpen_source (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).source = e.source ∩ s := rfl #align local_homeomorph.restr_open_source PartialHomeomorph.restrOpen_source /-- Restricting a partial homeomorphism `e` to `e.source ∩ interior s`. We use the interior to make sure that the restriction is well defined whatever the set s, since partial homeomorphisms are by definition defined on open sets. In applications where `s` is open, this coincides with the restriction of partial equivalences -/ @[simps! (config := mfld_cfg) apply symm_apply, simps! (config := .lemmasOnly) source target] protected def restr (s : Set α) : PartialHomeomorph α β := e.restrOpen (interior s) isOpen_interior #align local_homeomorph.restr PartialHomeomorph.restr @[simp, mfld_simps] theorem restr_toPartialEquiv (s : Set α) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr (interior s) := rfl #align local_homeomorph.restr_to_local_equiv PartialHomeomorph.restr_toPartialEquiv theorem restr_source' (s : Set α) (hs : IsOpen s) : (e.restr s).source = e.source ∩ s := by rw [e.restr_source, hs.interior_eq] #align local_homeomorph.restr_source' PartialHomeomorph.restr_source' theorem restr_toPartialEquiv' (s : Set α) (hs : IsOpen s) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr s := by rw [e.restr_toPartialEquiv, hs.interior_eq] #align local_homeomorph.restr_to_local_equiv' PartialHomeomorph.restr_toPartialEquiv' theorem restr_eq_of_source_subset {e : PartialHomeomorph α β} {s : Set α} (h : e.source ⊆ s) : e.restr s = e := toPartialEquiv_injective <| PartialEquiv.restr_eq_of_source_subset <| interior_maximal h e.open_source #align local_homeomorph.restr_eq_of_source_subset PartialHomeomorph.restr_eq_of_source_subset @[simp, mfld_simps] theorem restr_univ {e : PartialHomeomorph α β} : e.restr univ = e := restr_eq_of_source_subset (subset_univ _) #align local_homeomorph.restr_univ PartialHomeomorph.restr_univ theorem restr_source_inter (s : Set α) : e.restr (e.source ∩ s) = e.restr s := by refine' PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) _ simp [e.open_source.interior_eq, ← inter_assoc] #align local_homeomorph.restr_source_inter PartialHomeomorph.restr_source_inter /-- The identity on the whole space as a partial homeomorphism. -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] protected def refl (α : Type*) [TopologicalSpace α] : PartialHomeomorph α α := (Homeomorph.refl α).toPartialHomeomorph #align local_homeomorph.refl PartialHomeomorph.refl @[simp, mfld_simps] theorem refl_localEquiv : (PartialHomeomorph.refl α).toPartialEquiv = PartialEquiv.refl α := rfl #align local_homeomorph.refl_local_equiv PartialHomeomorph.refl_localEquiv @[simp, mfld_simps] theorem refl_symm : (PartialHomeomorph.refl α).symm = PartialHomeomorph.refl α := rfl #align local_homeomorph.refl_symm PartialHomeomorph.refl_symm section variable {s : Set α} (hs : IsOpen s) /-- The identity partial equivalence on a set `s` -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] def ofSet (s : Set α) (hs : IsOpen s) : PartialHomeomorph α α where toPartialEquiv := PartialEquiv.ofSet s open_source := hs open_target := hs continuousOn_toFun := continuous_id.continuousOn continuousOn_invFun := continuous_id.continuousOn #align local_homeomorph.of_set PartialHomeomorph.ofSet @[simp, mfld_simps] theorem ofSet_toPartialEquiv : (ofSet s hs).toPartialEquiv = PartialEquiv.ofSet s := rfl #align local_homeomorph.of_set_to_local_equiv PartialHomeomorph.ofSet_toPartialEquiv @[simp, mfld_simps] theorem ofSet_symm : (ofSet s hs).symm = ofSet s hs := rfl #align local_homeomorph.of_set_symm PartialHomeomorph.ofSet_symm @[simp, mfld_simps] theorem ofSet_univ_eq_refl : ofSet univ isOpen_univ = PartialHomeomorph.refl α := by ext <;> simp #align local_homeomorph.of_set_univ_eq_refl PartialHomeomorph.ofSet_univ_eq_refl end /-- Composition of two partial homeomorphisms when the target of the first and the source of the second coincide. -/ @[simps! apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] protected def trans' (h : e.target = e'.source) : PartialHomeomorph α γ where toPartialEquiv := PartialEquiv.trans' e.toPartialEquiv e'.toPartialEquiv h open_source := e.open_source open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuousOn <| h ▸ e.mapsTo continuousOn_invFun := e.continuousOn_symm.comp e'.continuousOn_symm <| h.symm ▸ e'.symm_mapsTo #align local_homeomorph.trans' PartialHomeomorph.trans' /-- Composing two partial homeomorphisms, by restricting to the maximal domain where their composition is well defined. -/ protected def trans : PartialHomeomorph α γ := PartialHomeomorph.trans' (e.symm.restrOpen e'.source e'.open_source).symm (e'.restrOpen e.target e.open_target) (by simp [inter_comm]) #align local_homeomorph.trans PartialHomeomorph.trans @[simp, mfld_simps] theorem trans_toPartialEquiv : (e.trans e').toPartialEquiv = e.toPartialEquiv.trans e'.toPartialEquiv := rfl #align local_homeomorph.trans_to_local_equiv PartialHomeomorph.trans_toPartialEquiv @[simp, mfld_simps] theorem coe_trans : (e.trans e' : α → γ) = e' ∘ e := rfl #align local_homeomorph.coe_trans PartialHomeomorph.coe_trans @[simp, mfld_simps] theorem coe_trans_symm : ((e.trans e').symm : γ → α) = e.symm ∘ e'.symm := rfl #align local_homeomorph.coe_trans_symm PartialHomeomorph.coe_trans_symm theorem trans_apply {x : α} : (e.trans e') x = e' (e x) := rfl #align local_homeomorph.trans_apply PartialHomeomorph.trans_apply theorem trans_symm_eq_symm_trans_symm : (e.trans e').symm = e'.symm.trans e.symm := rfl #align local_homeomorph.trans_symm_eq_symm_trans_symm PartialHomeomorph.trans_symm_eq_symm_trans_symm /- This could be considered as a simp lemma, but there are many situations where it makes something simple into something more complicated. -/ theorem trans_source : (e.trans e').source = e.source ∩ e ⁻¹' e'.source := PartialEquiv.trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source PartialHomeomorph.trans_source theorem trans_source' : (e.trans e').source = e.source ∩ e ⁻¹' (e.target ∩ e'.source) := PartialEquiv.trans_source' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source' PartialHomeomorph.trans_source' theorem trans_source'' : (e.trans e').source = e.symm '' (e.target ∩ e'.source) := PartialEquiv.trans_source'' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source'' PartialHomeomorph.trans_source'' theorem image_trans_source : e '' (e.trans e').source = e.target ∩ e'.source := PartialEquiv.image_trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.image_trans_source PartialHomeomorph.image_trans_source theorem trans_target : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' e.target := rfl #align local_homeomorph.trans_target PartialHomeomorph.trans_target theorem trans_target' : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' (e'.source ∩ e.target) := trans_source' e'.symm e.symm #align local_homeomorph.trans_target' PartialHomeomorph.trans_target' theorem trans_target'' : (e.trans e').target = e' '' (e'.source ∩ e.target) := trans_source'' e'.symm e.symm #align local_homeomorph.trans_target'' PartialHomeomorph.trans_target'' theorem inv_image_trans_target : e'.symm '' (e.trans e').target = e'.source ∩ e.target := image_trans_source e'.symm e.symm #align local_homeomorph.inv_image_trans_target PartialHomeomorph.inv_image_trans_target theorem trans_assoc (e'' : PartialHomeomorph γ δ) : (e.trans e').trans e'' = e.trans (e'.trans e'') := toPartialEquiv_injective <| e.1.trans_assoc _ _ #align local_homeomorph.trans_assoc PartialHomeomorph.trans_assoc @[simp, mfld_simps] theorem trans_refl : e.trans (PartialHomeomorph.refl β) = e := toPartialEquiv_injective e.1.trans_refl #align local_homeomorph.trans_refl PartialHomeomorph.trans_refl @[simp, mfld_simps] theorem refl_trans : (PartialHomeomorph.refl α).trans e = e := toPartialEquiv_injective e.1.refl_trans #align local_homeomorph.refl_trans PartialHomeomorph.refl_trans theorem trans_ofSet {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e ⁻¹' s) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) <| by rw [trans_source, restr_source, ofSet_source, ← preimage_interior, hs.interior_eq] #align local_homeomorph.trans_of_set PartialHomeomorph.trans_ofSet theorem trans_of_set' {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e.source ∩ e ⁻¹' s) := by rw [trans_ofSet, restr_source_inter] #align local_homeomorph.trans_of_set' PartialHomeomorph.trans_of_set' theorem ofSet_trans {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr s := PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) <| by simp [hs.interior_eq, inter_comm] #align local_homeomorph.of_set_trans PartialHomeomorph.ofSet_trans theorem ofSet_trans' {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr (e.source ∩ s) := by rw [ofSet_trans, restr_source_inter] #align local_homeomorph.of_set_trans' PartialHomeomorph.ofSet_trans' @[simp, mfld_simps] theorem ofSet_trans_ofSet {s : Set α} (hs : IsOpen s) {s' : Set α} (hs' : IsOpen s') : (ofSet s hs).trans (ofSet s' hs') = ofSet (s ∩ s') (IsOpen.inter hs hs') := by rw [(ofSet s hs).trans_ofSet hs'] ext <;> simp [hs'.interior_eq] #align local_homeomorph.of_set_trans_of_set PartialHomeomorph.ofSet_trans_ofSet theorem restr_trans (s : Set α) : (e.restr s).trans e' = (e.trans e').restr s := toPartialEquiv_injective <| PartialEquiv.restr_trans e.toPartialEquiv e'.toPartialEquiv (interior s) #align local_homeomorph.restr_trans PartialHomeomorph.restr_trans /-- Postcompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def transHomeomorph (e' : β ≃ₜ γ) : PartialHomeomorph α γ where toPartialEquiv := e.toPartialEquiv.transEquiv e'.toEquiv open_source := e.open_source open_target := e.open_target.preimage e'.symm.continuous continuousOn_toFun := e'.continuous.comp_continuousOn e.continuousOn continuousOn_invFun := e.symm.continuousOn.comp e'.symm.continuous.continuousOn fun _ => id #align local_homeomorph.trans_homeomorph PartialHomeomorph.transHomeomorph theorem transHomeomorph_eq_trans (e' : β ≃ₜ γ) : e.transHomeomorph e' = e.trans e'.toPartialHomeomorph := toPartialEquiv_injective <| PartialEquiv.transEquiv_eq_trans _ _ #align local_homeomorph.trans_equiv_eq_trans PartialHomeomorph.transHomeomorph_eq_trans /-- Precompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def _root_.Homeomorph.transPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α γ where toPartialEquiv := e.toEquiv.transPartialEquiv e'.toPartialEquiv open_source := e'.open_source.preimage e.continuous open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuous.continuousOn fun _ => id continuousOn_invFun := e.symm.continuous.comp_continuousOn e'.symm.continuousOn #align homeomorph.trans_local_homeomorph Homeomorph.transPartialHomeomorph theorem _root_.Homeomorph.transPartialHomeomorph_eq_trans (e : α ≃ₜ β) : e.transPartialHomeomorph e' = e.toPartialHomeomorph.trans e' := toPartialEquiv_injective <| Equiv.transPartialEquiv_eq_trans _ _ #align homeomorph.trans_local_homeomorph_eq_trans Homeomorph.transPartialHomeomorph_eq_trans /-- `EqOnSource e e'` means that `e` and `e'` have the same source, and coincide there. They should really be considered the same partial equivalence. -/ def EqOnSource (e e' : PartialHomeomorph α β) : Prop := e.source = e'.source ∧ EqOn e e' e.source #align local_homeomorph.eq_on_source PartialHomeomorph.EqOnSource theorem eqOnSource_iff (e e' : PartialHomeomorph α β) : EqOnSource e e' ↔ PartialEquiv.EqOnSource e.toPartialEquiv e'.toPartialEquiv := Iff.rfl #align local_homeomorph.eq_on_source_iff PartialHomeomorph.eqOnSource_iff /-- `EqOnSource` is an equivalence relation. -/ instance eqOnSourceSetoid : Setoid (PartialHomeomorph α β) := { PartialEquiv.eqOnSourceSetoid.comap toPartialEquiv with r := EqOnSource } theorem eqOnSource_refl : e ≈ e := Setoid.refl _ #align local_homeomorph.eq_on_source_refl PartialHomeomorph.eqOnSource_refl /-- If two partial homeomorphisms are equivalent, so are their inverses. -/ theorem EqOnSource.symm' {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.symm ≈ e'.symm := PartialEquiv.EqOnSource.symm' h #align local_homeomorph.eq_on_source.symm' PartialHomeomorph.EqOnSource.symm' /-- Two equivalent partial homeomorphisms have the same source. -/ theorem EqOnSource.source_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.source = e'.source := h.1 #align local_homeomorph.eq_on_source.source_eq PartialHomeomorph.EqOnSource.source_eq /-- Two equivalent partial homeomorphisms have the same target. -/ theorem EqOnSource.target_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.target = e'.target := h.symm'.1 #align local_homeomorph.eq_on_source.target_eq PartialHomeomorph.EqOnSource.target_eq /-- Two equivalent partial homeomorphisms have coinciding `toFun` on the source -/ theorem EqOnSource.eqOn {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e e' e.source := h.2 #align local_homeomorph.eq_on_source.eq_on PartialHomeomorph.EqOnSource.eqOn /-- Two equivalent partial homeomorphisms have coinciding `invFun` on the target -/ theorem EqOnSource.symm_eqOn_target {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e.symm e'.symm e.target := h.symm'.2 #align local_homeomorph.eq_on_source.symm_eq_on_target PartialHomeomorph.EqOnSource.symm_eqOn_target /-- Composition of partial homeomorphisms respects equivalence. -/ theorem EqOnSource.trans' {e e' : PartialHomeomorph α β} {f f' : PartialHomeomorph β γ} (he : e ≈ e') (hf : f ≈ f') : e.trans f ≈ e'.trans f' := PartialEquiv.EqOnSource.trans' he hf #align local_homeomorph.eq_on_source.trans' PartialHomeomorph.EqOnSource.trans' /-- Restriction of partial homeomorphisms respects equivalence -/ theorem EqOnSource.restr {e e' : PartialHomeomorph α β} (he : e ≈ e') (s : Set α) : e.restr s ≈ e'.restr s := PartialEquiv.EqOnSource.restr he _ #align local_homeomorph.eq_on_source.restr PartialHomeomorph.EqOnSource.restr /- Two equivalent partial homeomorphisms are equal when the source and target are `univ`. -/ theorem Set.EqOn.restr_eqOn_source {e e' : PartialHomeomorph α β} (h : EqOn e e' (e.source ∩ e'.source)) : e.restr e'.source ≈ e'.restr e.source := by constructor · rw [e'.restr_source' _ e.open_source] rw [e.restr_source' _ e'.open_source] exact Set.inter_comm _ _ · rw [e.restr_source' _ e'.open_source] refine' (EqOn.trans _ h).trans _ <;> simp only [mfld_simps, eqOn_refl] #align local_homeomorph.set.eq_on.restr_eq_on_source PartialHomeomorph.Set.EqOn.restr_eqOn_source /-- Composition of a partial homeomorphism and its inverse is equivalent to the restriction of the identity to the source -/ theorem trans_self_symm : e.trans e.symm ≈ PartialHomeomorph.ofSet e.source e.open_source := PartialEquiv.trans_self_symm _ #align local_homeomorph.trans_self_symm PartialHomeomorph.trans_self_symm theorem trans_symm_self : e.symm.trans e ≈ PartialHomeomorph.ofSet e.target e.open_target := e.symm.trans_self_symm #align local_homeomorph.trans_symm_self PartialHomeomorph.trans_symm_self theorem eq_of_eqOnSource_univ {e e' : PartialHomeomorph α β} (h : e ≈ e') (s : e.source = univ) (t : e.target = univ) : e = e' := toPartialEquiv_injective <| PartialEquiv.eq_of_eqOnSource_univ _ _ h s t #align local_homeomorph.eq_of_eq_on_source_univ PartialHomeomorph.eq_of_eqOnSource_univ section Prod /-- The product of two partial homeomorphisms, as a partial homeomorphism on the product space. -/ @[simps! (config := mfld_cfg) toPartialEquiv apply, simps! (config := .lemmasOnly) source target symm_apply] def prod (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : PartialHomeomorph (α × γ) (β × δ) where open_source := e.open_source.prod e'.open_source open_target := e.open_target.prod e'.open_target continuousOn_toFun := e.continuousOn.prod_map e'.continuousOn continuousOn_invFun := e.continuousOn_symm.prod_map e'.continuousOn_symm toPartialEquiv := e.toPartialEquiv.prod e'.toPartialEquiv #align local_homeomorph.prod PartialHomeomorph.prod @[simp, mfld_simps] theorem prod_symm (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : (e.prod e').symm = e.symm.prod e'.symm := rfl #align local_homeomorph.prod_symm PartialHomeomorph.prod_symm @[simp] theorem refl_prod_refl {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] : (PartialHomeomorph.refl α).prod (PartialHomeomorph.refl β) = PartialHomeomorph.refl (α × β) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) univ_prod_univ #align local_homeomorph.refl_prod_refl PartialHomeomorph.refl_prod_refl @[simp, mfld_simps] theorem prod_trans {η : Type*} {ε : Type*} [TopologicalSpace η] [TopologicalSpace ε] (e : PartialHomeomorph α β) (f : PartialHomeomorph β γ) (e' : PartialHomeomorph δ η) (f' : PartialHomeomorph η ε) : (e.prod e').trans (f.prod f') = (e.trans f).prod (e'.trans f') := toPartialEquiv_injective <| e.1.prod_trans .. #align local_homeomorph.prod_trans PartialHomeomorph.prod_trans theorem prod_eq_prod_of_nonempty {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁.prod e₂).source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by obtain ⟨⟨x, y⟩, -⟩ := id h haveI : Nonempty α := ⟨x⟩ haveI : Nonempty β := ⟨e₁ x⟩ haveI : Nonempty γ := ⟨y⟩ haveI : Nonempty δ := ⟨e₂ y⟩ simp_rw [PartialHomeomorph.ext_iff, prod_apply, prod_symm_apply, prod_source, Prod.ext_iff, Set.prod_eq_prod_iff_of_nonempty h, forall_and, Prod.forall, forall_const, and_assoc, and_left_comm] #align local_homeomorph.prod_eq_prod_of_nonempty PartialHomeomorph.prod_eq_prod_of_nonempty theorem prod_eq_prod_of_nonempty' {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁'.prod e₂').source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by rw [eq_comm, prod_eq_prod_of_nonempty h, eq_comm, @eq_comm _ e₂'] #align local_homeomorph.prod_eq_prod_of_nonempty' PartialHomeomorph.prod_eq_prod_of_nonempty' end Prod section Piecewise /-- Combine two `PartialHomeomorph`s using `Set.piecewise`. The source of the new `PartialHomeomorph` is `s.ite e.source e'.source = e.source ∩ s ∪ e'.source \ s`, and similarly for target. The function sends `e.source ∩ s` to `e.target ∩ t` using `e` and `e'.source \ s` to `e'.target \ t` using `e'`, and similarly for the inverse function. To ensure the maps `toFun` and `invFun` are inverse of each other on the new `source` and `target`, the definition assumes that the sets `s` and `t` are related both by `e.is_image` and `e'.is_image`. To ensure that the new maps are continuous on `source`/`target`, it also assumes that `e.source` and `e'.source` meet `frontier s` on the same set and `e x = e' x` on this intersection. -/ @[simps! (config := .asFn) toPartialEquiv apply] def piecewise (e e' : PartialHomeomorph α β) (s : Set α) (t : Set β) [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquiv.piecewise e'.toPartialEquiv s t H H' open_source := e.open_source.ite e'.open_source Hs open_target := e.open_target.ite e'.open_target <| H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq continuousOn_toFun := continuousOn_piecewise_ite e.continuousOn e'.continuousOn Hs Heq continuousOn_invFun := continuousOn_piecewise_ite e.continuousOn_symm e'.continuousOn_symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) #align local_homeomorph.piecewise PartialHomeomorph.piecewise @[simp] theorem symm_piecewise (e e' : PartialHomeomorph α β) {s : Set α} {t : Set β} [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : (e.piecewise e' s t H H' Hs Heq).symm = e.symm.piecewise e'.symm t s H.symm H'.symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) := rfl #align local_homeomorph.symm_piecewise PartialHomeomorph.symm_piecewise /-- Combine two `PartialHomeomorph`s with disjoint sources and disjoint targets. We reuse `PartialHomeomorph.piecewise` then override `toPartialEquiv` to `PartialEquiv.disjointUnion`. This way we have better definitional equalities for `source` and `target`. -/ def disjointUnion (e e' : PartialHomeomorph α β) [∀ x, Decidable (x ∈ e.source)] [∀ y, Decidable (y ∈ e.target)] (Hs : Disjoint e.source e'.source) (Ht : Disjoint e.target e'.target) : PartialHomeomorph α β := (e.piecewise e' e.source e.target e.isImage_source_target (e'.isImage_source_target_of_disjoint e Hs.symm Ht.symm) (by rw [e.open_source.inter_frontier_eq, (Hs.symm.frontier_right e'.open_source).inter_eq]) (by rw [e.open_source.inter_frontier_eq] exact eqOn_empty _ _)).replaceEquiv (e.toPartialEquiv.disjointUnion e'.toPartialEquiv Hs Ht) (PartialEquiv.disjointUnion_eq_piecewise _ _ _ _).symm #align local_homeomorph.disjoint_union PartialHomeomorph.disjointUnion end Piecewise section Pi variable {ι : Type*} [Fintype ι] {Xi Yi : ι → Type*} [∀ i, TopologicalSpace (Xi i)] [∀ i, TopologicalSpace (Yi i)] (ei : ∀ i, PartialHomeomorph (Xi i) (Yi i)) /-- The product of a finite family of `PartialHomeomorph`s. -/ @[simps toPartialEquiv] def pi : PartialHomeomorph (∀ i, Xi i) (∀ i, Yi i) where toPartialEquiv := PartialEquiv.pi fun i => (ei i).toPartialEquiv open_source := isOpen_set_pi finite_univ fun i _ => (ei i).open_source open_target := isOpen_set_pi finite_univ fun i _ => (ei i).open_target continuousOn_toFun := continuousOn_pi.2 fun i => (ei i).continuousOn.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial continuousOn_invFun := continuousOn_pi.2 fun i => (ei i).continuousOn_symm.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial #align local_homeomorph.pi PartialHomeomorph.pi end Pi section Continuity /-- Continuity within a set at a point can be read under right composition with a local homeomorphism, if the point is in its target -/ theorem continuousWithinAt_iff_continuousWithinAt_comp_right {f : β → γ} {s : Set β} {x : β} (h : x ∈ e.target) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (f ∘ e) (e ⁻¹' s) (e.symm x) := by simp_rw [ContinuousWithinAt, ← @tendsto_map'_iff _ _ _ _ e, e.map_nhdsWithin_preimage_eq (e.map_target h), (· ∘ ·), e.right_inv h] #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_right PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_right /-- Continuity at a point can be read under right composition with a partial homeomorphism, if the point is in its target -/ theorem continuousAt_iff_continuousAt_comp_right {f : β → γ} {x : β} (h : x ∈ e.target) : ContinuousAt f x ↔ ContinuousAt (f ∘ e) (e.symm x) := by rw [← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_right h, preimage_univ, continuousWithinAt_univ] #align local_homeomorph.continuous_at_iff_continuous_at_comp_right PartialHomeomorph.continuousAt_iff_continuousAt_comp_right /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the right is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_right {f : β → γ} {s : Set β} (h : s ⊆ e.target) : ContinuousOn f s ↔ ContinuousOn (f ∘ e) (e.source ∩ e ⁻¹' s) := by simp only [← e.symm_image_eq_source_inter_preimage h, ContinuousOn, ball_image_iff] refine' forall₂_congr fun x hx => _ rw [e.continuousWithinAt_iff_continuousWithinAt_comp_right (h hx), e.symm_image_eq_source_inter_preimage h, inter_comm, continuousWithinAt_inter] exact IsOpen.mem_nhds e.open_source (e.map_target (h hx)) #align local_homeomorph.continuous_on_iff_continuous_on_comp_right PartialHomeomorph.continuousOn_iff_continuousOn_comp_right /-- Continuity within a set at a point can be read under left composition with a local homeomorphism if a neighborhood of the initial point is sent to the source of the local homeomorphism-/ theorem continuousWithinAt_iff_continuousWithinAt_comp_left {f : γ → α} {s : Set γ} {x : γ} (hx : f x ∈ e.source) (h : f ⁻¹' e.source ∈ 𝓝[s] x) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (e ∘ f) s x := by refine' ⟨(e.continuousAt hx).comp_continuousWithinAt, fun fe_cont => _⟩ rw [← continuousWithinAt_inter' h] at fe_cont ⊢ have : ContinuousWithinAt (e.symm ∘ e ∘ f) (s ∩ f ⁻¹' e.source) x := haveI : ContinuousWithinAt e.symm univ (e (f x)) := (e.continuousAt_symm (e.map_source hx)).continuousWithinAt ContinuousWithinAt.comp this fe_cont (subset_univ _) exact this.congr (fun y hy => by simp [e.left_inv hy.2]) (by simp [e.left_inv hx]) #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_left PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_left /-- Continuity at a point can be read under left composition with a partial homeomorphism if a neighborhood of the initial point is sent to the source of the partial homeomorphism-/ theorem continuousAt_iff_continuousAt_comp_left {f : γ → α} {x : γ} (h : f ⁻¹' e.source ∈ 𝓝 x) : ContinuousAt f x ↔ ContinuousAt (e ∘ f) x := by have hx : f x ∈ e.source := (mem_of_mem_nhds h : _) have h' : f ⁻¹' e.source ∈ 𝓝[univ] x := by rwa [nhdsWithin_univ] rw [← continuousWithinAt_univ, ← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_left hx h'] #align local_homeomorph.continuous_at_iff_continuous_at_comp_left PartialHomeomorph.continuousAt_iff_continuousAt_comp_left /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the left is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_left {f : γ → α} {s : Set γ} (h : s ⊆ f ⁻¹' e.source) : ContinuousOn f s ↔ ContinuousOn (e ∘ f) s := forall₂_congr fun _x hx => e.continuousWithinAt_iff_continuousWithinAt_comp_left (h hx) (mem_of_superset self_mem_nhdsWithin h) #align local_homeomorph.continuous_on_iff_continuous_on_comp_left PartialHomeomorph.continuousOn_iff_continuousOn_comp_left /-- A function is continuous if and only if its composition with a partial homeomorphism on the left is continuous and its image is contained in the source. -/ theorem continuous_iff_continuous_comp_left {f : γ → α} (h : f ⁻¹' e.source = univ) : Continuous f ↔ Continuous (e ∘ f) := by simp only [continuous_iff_continuousOn_univ] exact e.continuousOn_iff_continuousOn_comp_left (Eq.symm h).subset #align local_homeomorph.continuous_iff_continuous_comp_left PartialHomeomorph.continuous_iff_continuous_comp_left end Continuity /-- The homeomorphism obtained by restricting a `PartialHomeomorph` to a subset of the source. -/ @[simps] def homeomorphOfImageSubsetSource {s : Set α} {t : Set β} (hs : s ⊆ e.source) (ht : e '' s = t) : s ≃ₜ t := have h₁ : MapsTo e s t := mapsTo'.2 ht.subset have h₂ : t ⊆ e.target := ht ▸ e.image_source_eq_target ▸ image_subset e hs have h₃ : MapsTo e.symm t s := ht ▸ ball_image_iff.2 <| fun _x hx => (e.left_inv (hs hx)).symm ▸ hx { toFun := MapsTo.restrict e s t h₁ invFun := MapsTo.restrict e.symm t s h₃ left_inv := fun a => Subtype.ext (e.left_inv (hs a.2)) right_inv := fun b => Subtype.eq <| e.right_inv (h₂ b.2) continuous_toFun := (e.continuousOn.mono hs).restrict_mapsTo h₁ continuous_invFun := (e.continuousOn_symm.mono h₂).restrict_mapsTo h₃ } #align local_homeomorph.homeomorph_of_image_subset_source PartialHomeomorph.homeomorphOfImageSubsetSource /-- A partial homeomorphism defines a homeomorphism between its source and target. -/ @[simps!] -- porting note: new `simps` def toHomeomorphSourceTarget : e.source ≃ₜ e.target := e.homeomorphOfImageSubsetSource subset_rfl e.image_source_eq_target #align local_homeomorph.to_homeomorph_source_target PartialHomeomorph.toHomeomorphSourceTarget theorem secondCountableTopology_source [SecondCountableTopology β] (e : PartialHomeomorph α β) : SecondCountableTopology e.source := e.toHomeomorphSourceTarget.secondCountableTopology #align local_homeomorph.second_countable_topology_source PartialHomeomorph.secondCountableTopology_source theorem nhds_eq_comap_inf_principal {x} (hx : x ∈ e.source) : 𝓝 x = comap e (𝓝 (e x)) ⊓ 𝓟 e.source := by lift x to e.source using hx rw [← e.open_source.nhdsWithin_eq x.2, ← map_nhds_subtype_val, ← map_comap_setCoe_val, e.toHomeomorphSourceTarget.nhds_eq_comap, nhds_subtype_eq_comap] simp only [(· ∘ ·), toHomeomorphSourceTarget_apply_coe, comap_comap] /-- If a partial homeomorphism has source and target equal to univ, then it induces a homeomorphism between the whole spaces, expressed in this definition. -/ @[simps (config := mfld_cfg) apply symm_apply] -- porting note: todo: add a `PartialEquiv` version def toHomeomorphOfSourceEqUnivTargetEqUniv (h : e.source = (univ : Set α)) (h' : e.target = univ) : α ≃ₜ β where toFun := e invFun := e.symm left_inv x := e.left_inv <| by rw [h] exact mem_univ _ right_inv x := e.right_inv <| by rw [h'] exact mem_univ _ continuous_toFun := by simpa only [continuous_iff_continuousOn_univ, h] using e.continuousOn continuous_invFun := by simpa only [continuous_iff_continuousOn_univ, h'] using e.continuousOn_symm #align local_homeomorph.to_homeomorph_of_source_eq_univ_target_eq_univ PartialHomeomorph.toHomeomorphOfSourceEqUnivTargetEqUniv theorem openEmbedding_restrict : OpenEmbedding (e.source.restrict e) := by refine openEmbedding_of_continuous_injective_open (e.continuousOn.comp_continuous continuous_subtype_val Subtype.prop) e.injOn.injective fun V hV ↦ ?_ rw [Set.restrict_eq, Set.image_comp] exact e.image_isOpen_of_isOpen (e.open_source.isOpenMap_subtype_val V hV) fun _ ⟨x, _, h⟩ ↦ h ▸ x.2 /-- A partial homeomorphism whose source is all of `α` defines an open embedding of `α` into `β`. The converse is also true; see `OpenEmbedding.toPartialHomeomorph`. -/ theorem to_openEmbedding (h : e.source = Set.univ) : OpenEmbedding e := e.openEmbedding_restrict.comp ((Homeomorph.setCongr h).trans <| Homeomorph.Set.univ α).symm.openEmbedding #align local_homeomorph.to_open_embedding PartialHomeomorph.to_openEmbedding end PartialHomeomorph namespace Homeomorph variable (e : α ≃ₜ β) (e' : β ≃ₜ γ) /- Register as simp lemmas that the fields of a partial homeomorphism built from a homeomorphism correspond to the fields of the original homeomorphism. -/ @[simp, mfld_simps] theorem refl_toPartialHomeomorph : (Homeomorph.refl α).toPartialHomeomorph = PartialHomeomorph.refl α := rfl #align homeomorph.refl_to_local_homeomorph Homeomorph.refl_toPartialHomeomorph @[simp, mfld_simps] theorem symm_toPartialHomeomorph : e.symm.toPartialHomeomorph = e.toPartialHomeomorph.symm := rfl #align homeomorph.symm_to_local_homeomorph Homeomorph.symm_toPartialHomeomorph @[simp, mfld_simps] theorem trans_toPartialHomeomorph : (e.trans e').toPartialHomeomorph = e.toPartialHomeomorph.trans e'.toPartialHomeomorph := PartialHomeomorph.toPartialEquiv_injective <| Equiv.trans_toPartialEquiv _ _ #align homeomorph.trans_to_local_homeomorph Homeomorph.trans_toPartialHomeomorph end Homeomorph namespace OpenEmbedding variable (f : α → β) (h : OpenEmbedding f) /-- An open embedding of `α` into `β`, with `α` nonempty, defines a partial homeomorphism whose source is all of `α`. The converse is also true; see `PartialHomeomorph.to_openEmbedding`. -/ @[simps! (config := mfld_cfg) apply source target] noncomputable def toPartialHomeomorph [Nonempty α] : PartialHomeomorph α β := PartialHomeomorph.ofContinuousOpen ((h.toEmbedding.inj.injOn univ).toPartialEquiv _ _) h.continuous.continuousOn h.isOpenMap isOpen_univ #align open_embedding.to_local_homeomorph OpenEmbedding.toPartialHomeomorph variable [Nonempty α] lemma toPartialHomeomorph_left_inv {x : α} : (h.toPartialHomeomorph f).symm (f x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.left_inv] exact Set.mem_univ _ lemma toPartialHomeomorph_right_inv {x : β} (hx : x ∈ Set.range f) : f ((h.toPartialHomeomorph f).symm x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.right_inv] rwa [toPartialHomeomorph_target] end OpenEmbedding namespace TopologicalSpace.Opens open TopologicalSpace variable (s : Opens α) [Nonempty s] /-- The inclusion of an open subset `s` of a space `α` into `α` is a partial homeomorphism from the subtype `s` to `α`. -/ noncomputable def localHomeomorphSubtypeCoe : PartialHomeomorph s α := OpenEmbedding.toPartialHomeomorph _ s.2.openEmbedding_subtype_val #align topological_space.opens.local_homeomorph_subtype_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_coe : (s.localHomeomorphSubtypeCoe : s → α) = (↑) := rfl #align topological_space.opens.local_homeomorph_subtype_coe_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe_coe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_source : s.localHomeomorphSubtypeCoe.source = Set.univ := rfl #align topological_space.opens.local_homeomorph_subtype_coe_source TopologicalSpace.Opens.localHomeomorphSubtypeCoe_source @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_target : s.localHomeomorphSubtypeCoe.target = s := by simp only [localHomeomorphSubtypeCoe, Subtype.range_coe_subtype, mfld_simps] rfl #align topological_space.opens.local_homeomorph_subtype_coe_target TopologicalSpace.Opens.localHomeomorphSubtypeCoe_target end TopologicalSpace.Opens namespace PartialHomeomorph open TopologicalSpace variable (e : PartialHomeomorph α β) variable (s : Opens α) [Nonempty s] /-- The restriction of a partial homeomorphism `e` to an open subset `s` of the domain type produces a partial homeomorphism whose domain is the subtype `s`. -/ noncomputable def subtypeRestr : PartialHomeomorph s β := s.localHomeomorphSubtypeCoe.trans e #align local_homeomorph.subtype_restr PartialHomeomorph.subtypeRestr theorem subtypeRestr_def : e.subtypeRestr s = s.localHomeomorphSubtypeCoe.trans e := rfl #align local_homeomorph.subtype_restr_def PartialHomeomorph.subtypeRestr_def @[simp, mfld_simps] theorem subtypeRestr_coe : ((e.subtypeRestr s : PartialHomeomorph s β) : s → β) = Set.restrict ↑s (e : α → β) := rfl #align local_homeomorph.subtype_restr_coe PartialHomeomorph.subtypeRestr_coe @[simp, mfld_simps] theorem subtypeRestr_source : (e.subtypeRestr s).source = (↑) ⁻¹' e.source := by simp only [subtypeRestr_def, mfld_simps] #align local_homeomorph.subtype_restr_source PartialHomeomorph.subtypeRestr_source variable {s} theorem map_subtype_source {x : s} (hxe : (x : α) ∈ e.source): e x ∈ (e.subtypeRestr s).target := by refine' ⟨e.map_source hxe, _⟩ rw [s.localHomeomorphSubtypeCoe_target, mem_preimage, e.leftInvOn hxe] exact x.prop #align local_homeomorph.map_subtype_source PartialHomeomorph.map_subtype_source variable (s) /- This lemma characterizes the transition functions of an open subset in terms of the transition functions of the original space. -/ theorem subtypeRestr_symm_trans_subtypeRestr (f f' : PartialHomeomorph α β) : (f.subtypeRestr s).symm.trans (f'.subtypeRestr s) ≈ (f.symm.trans f').restr (f.target ∩ f.symm ⁻¹' s) := by simp only [subtypeRestr_def, trans_symm_eq_symm_trans_symm] have openness₁ : IsOpen (f.target ∩ f.symm ⁻¹' s) := f.isOpen_inter_preimage_symm s.2 rw [← ofSet_trans _ openness₁, ← trans_assoc, ← trans_assoc] refine' EqOnSource.trans' _ (eqOnSource_refl _) -- f' has been eliminated !!! have sets_identity : f.symm.source ∩ (f.target ∩ f.symm ⁻¹' s) = f.symm.source ∩ f.symm ⁻¹' s := by mfld_set_tac have openness₂ : IsOpen (s : Set α) := s.2 rw [ofSet_trans', sets_identity, ← trans_of_set' _ openness₂, trans_assoc] refine' EqOnSource.trans' (eqOnSource_refl _) _ -- f has been eliminated !!! refine' Setoid.trans (trans_symm_self s.localHomeomorphSubtypeCoe) _ simp only [mfld_simps, Setoid.refl] #align local_homeomorph.subtype_restr_symm_trans_subtype_restr PartialHomeomorph.subtypeRestr_symm_trans_subtypeRestr theorem subtypeRestr_symm_eqOn (U : Opens α) [Nonempty U] : EqOn e.symm (Subtype.val ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by intro y hy rw [eq_comm, eq_symm_apply _ _ hy.1] · change restrict _ e _ = _ rw [← subtypeRestr_coe, (e.subtypeRestr U).right_inv hy] · have := map_target _ hy; rwa [subtypeRestr_source] at this theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ · rw [← PartialHomeomorph.symm_target] apply PartialHomeomorph.map_source rw [PartialHomeomorph.symm_source] exact hyV · rw [V.localHomeomorphSubtypeCoe.right_inv hyV]
show _ = U.localHomeomorphSubtypeCoe _
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ · rw [← PartialHomeomorph.symm_target] apply PartialHomeomorph.map_source rw [PartialHomeomorph.symm_source] exact hyV · rw [V.localHomeomorphSubtypeCoe.right_inv hyV]
Mathlib.Topology.PartialHomeomorph.1460_0.xRULiNOId4c9Kju
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target
Mathlib_Topology_PartialHomeomorph
case refine'_2 α : Type u_1 β : Type u_2 γ : Type u_3 δ : Type u_4 inst✝⁶ : TopologicalSpace α inst✝⁵ : TopologicalSpace β inst✝⁴ : TopologicalSpace γ inst✝³ : TopologicalSpace δ e : PartialHomeomorph α β s : Opens α inst✝² : Nonempty ↥s U V : Opens α inst✝¹ : Nonempty ↥U inst✝ : Nonempty ↥V hUV : U ≤ V i : ↑↑U → ↑↑V := inclusion hUV y : β hy : y ∈ e.target ∩ ↑(PartialHomeomorph.symm e) ⁻¹' (Opens.localHomeomorphSubtypeCoe U).toPartialEquiv.target hyV : ↑(PartialHomeomorph.symm e) y ∈ (Opens.localHomeomorphSubtypeCoe V).toPartialEquiv.target ⊢ ↑(PartialHomeomorph.symm e) y = ↑(Opens.localHomeomorphSubtypeCoe U) (↑(PartialHomeomorph.symm (Opens.localHomeomorphSubtypeCoe U)) (↑(PartialHomeomorph.symm e) y))
/- Copyright (c) 2019 Sébastien Gouëzel. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sébastien Gouëzel -/ import Mathlib.Logic.Equiv.PartialEquiv import Mathlib.Topology.Sets.Opens #align_import topology.local_homeomorph from "leanprover-community/mathlib"@"431589bce478b2229eba14b14a283250428217db" /-! # Partial homeomorphisms # Partial homeomorphisms This file defines homeomorphisms between open subsets of topological spaces. An element `e` of `PartialHomeomorph α β` is an extension of `PartialEquiv α β`, i.e., it is a pair of functions `e.toFun` and `e.invFun`, inverse of each other on the sets `e.source` and `e.target`. Additionally, we require that these sets are open, and that the functions are continuous on them. Equivalently, they are homeomorphisms there. As in equivs, we register a coercion to functions, and we use `e x` and `e.symm x` throughout instead of `e.toFun x` and `e.invFun x`. ## Main definitions * `Homeomorph.toPartialHomeomorph`: associating a partial homeomorphism to a homeomorphism, with `source = target = Set.univ`; * `PartialHomeomorph.symm`: the inverse of a partial homeomorphism * `PartialHomeomorph.trans`: the composition of two partial homeomorphisms * `PartialHomeomorph.refl`: the identity partial homeomorphism * `PartialHomeomorph.ofSet`: the identity on a set `s` * `PartialHomeomorph.EqOnSource`: equivalence relation describing the "right" notion of equality for partial homeomorphisms ## Implementation notes Most statements are copied from their `PartialEquiv` versions, although some care is required especially when restricting to subsets, as these should be open subsets. For design notes, see `PartialEquiv.lean`. ### Local coding conventions If a lemma deals with the intersection of a set with either source or target of a `PartialEquiv`, then it should use `e.source ∩ s` or `e.target ∩ t`, not `s ∩ e.source` or `t ∩ e.target`. -/ open Function Set Filter Topology variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} [TopologicalSpace α] [TopologicalSpace β] [TopologicalSpace γ] [TopologicalSpace δ] /-- Partial homeomorphisms, defined on open subsets of the space -/ -- porting note: commented @[nolint has_nonempty_instance] structure PartialHomeomorph (α : Type*) (β : Type*) [TopologicalSpace α] [TopologicalSpace β] extends PartialEquiv α β where open_source : IsOpen source open_target : IsOpen target continuousOn_toFun : ContinuousOn toFun source continuousOn_invFun : ContinuousOn invFun target #align local_homeomorph PartialHomeomorph namespace PartialHomeomorph variable (e : PartialHomeomorph α β) (e' : PartialHomeomorph β γ) /-- Coercion of a partial homeomorphisms to a function. We don't use `e.toFun` because it is actually `e.toPartialEquiv.toFun`, so `simp` will apply lemmas about `toPartialEquiv`. While we may want to switch to this behavior later, doing it mid-port will break a lot of proofs. -/ @[coe] def toFun' : α → β := e.toFun /-- Coercion of a `PartialHomeomorph` to function. Note that a `PartialHomeomorph` is not `FunLike`. -/ instance : CoeFun (PartialHomeomorph α β) fun _ => α → β := ⟨fun e => e.toFun'⟩ /-- The inverse of a partial homeomorphism -/ protected def symm : PartialHomeomorph β α where toPartialEquiv := e.toPartialEquiv.symm open_source := e.open_target open_target := e.open_source continuousOn_toFun := e.continuousOn_invFun continuousOn_invFun := e.continuousOn_toFun #align local_homeomorph.symm PartialHomeomorph.symm /-- See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections. -/ def Simps.apply (e : PartialHomeomorph α β) : α → β := e #align local_homeomorph.simps.apply PartialHomeomorph.Simps.apply /-- See Note [custom simps projection] -/ def Simps.symm_apply (e : PartialHomeomorph α β) : β → α := e.symm #align local_homeomorph.simps.symm_apply PartialHomeomorph.Simps.symm_apply initialize_simps_projections PartialHomeomorph (toFun → apply, invFun → symm_apply) protected theorem continuousOn : ContinuousOn e e.source := e.continuousOn_toFun #align local_homeomorph.continuous_on PartialHomeomorph.continuousOn theorem continuousOn_symm : ContinuousOn e.symm e.target := e.continuousOn_invFun #align local_homeomorph.continuous_on_symm PartialHomeomorph.continuousOn_symm @[simp, mfld_simps] theorem mk_coe (e : PartialEquiv α β) (a b c d) : (PartialHomeomorph.mk e a b c d : α → β) = e := rfl #align local_homeomorph.mk_coe PartialHomeomorph.mk_coe @[simp, mfld_simps] theorem mk_coe_symm (e : PartialEquiv α β) (a b c d) : ((PartialHomeomorph.mk e a b c d).symm : β → α) = e.symm := rfl #align local_homeomorph.mk_coe_symm PartialHomeomorph.mk_coe_symm theorem toPartialEquiv_injective : Injective (toPartialEquiv : PartialHomeomorph α β → PartialEquiv α β) | ⟨_, _, _, _, _⟩, ⟨_, _, _, _, _⟩, rfl => rfl #align local_homeomorph.to_local_equiv_injective PartialHomeomorph.toPartialEquiv_injective /- Register a few simp lemmas to make sure that `simp` puts the application of a local homeomorphism in its normal form, i.e., in terms of its coercion to a function. -/ @[simp, mfld_simps] theorem toFun_eq_coe (e : PartialHomeomorph α β) : e.toFun = e := rfl #align local_homeomorph.to_fun_eq_coe PartialHomeomorph.toFun_eq_coe @[simp, mfld_simps] theorem invFun_eq_coe (e : PartialHomeomorph α β) : e.invFun = e.symm := rfl #align local_homeomorph.inv_fun_eq_coe PartialHomeomorph.invFun_eq_coe @[simp, mfld_simps] theorem coe_coe : (e.toPartialEquiv : α → β) = e := rfl #align local_homeomorph.coe_coe PartialHomeomorph.coe_coe @[simp, mfld_simps] theorem coe_coe_symm : (e.toPartialEquiv.symm : β → α) = e.symm := rfl #align local_homeomorph.coe_coe_symm PartialHomeomorph.coe_coe_symm @[simp, mfld_simps] theorem map_source {x : α} (h : x ∈ e.source) : e x ∈ e.target := e.map_source' h #align local_homeomorph.map_source PartialHomeomorph.map_source /-- Variant of `map_source`, stated for images of subsets of `source`. -/ lemma map_source'' : e '' e.source ⊆ e.target := fun _ ⟨_, hx, hex⟩ ↦ mem_of_eq_of_mem (id hex.symm) (e.map_source' hx) @[simp, mfld_simps] theorem map_target {x : β} (h : x ∈ e.target) : e.symm x ∈ e.source := e.map_target' h #align local_homeomorph.map_target PartialHomeomorph.map_target @[simp, mfld_simps] theorem left_inv {x : α} (h : x ∈ e.source) : e.symm (e x) = x := e.left_inv' h #align local_homeomorph.left_inv PartialHomeomorph.left_inv @[simp, mfld_simps] theorem right_inv {x : β} (h : x ∈ e.target) : e (e.symm x) = x := e.right_inv' h #align local_homeomorph.right_inv PartialHomeomorph.right_inv theorem eq_symm_apply {x : α} {y : β} (hx : x ∈ e.source) (hy : y ∈ e.target) : x = e.symm y ↔ e x = y := e.toPartialEquiv.eq_symm_apply hx hy #align local_homeomorph.eq_symm_apply PartialHomeomorph.eq_symm_apply protected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source #align local_homeomorph.maps_to PartialHomeomorph.mapsTo protected theorem symm_mapsTo : MapsTo e.symm e.target e.source := e.symm.mapsTo #align local_homeomorph.symm_maps_to PartialHomeomorph.symm_mapsTo protected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv #align local_homeomorph.left_inv_on PartialHomeomorph.leftInvOn protected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv #align local_homeomorph.right_inv_on PartialHomeomorph.rightInvOn protected theorem invOn : InvOn e.symm e e.source e.target := ⟨e.leftInvOn, e.rightInvOn⟩ #align local_homeomorph.inv_on PartialHomeomorph.invOn protected theorem injOn : InjOn e e.source := e.leftInvOn.injOn #align local_homeomorph.inj_on PartialHomeomorph.injOn protected theorem bijOn : BijOn e e.source e.target := e.invOn.bijOn e.mapsTo e.symm_mapsTo #align local_homeomorph.bij_on PartialHomeomorph.bijOn protected theorem surjOn : SurjOn e e.source e.target := e.bijOn.surjOn #align local_homeomorph.surj_on PartialHomeomorph.surjOn /-- Interpret a `Homeomorph` as a `PartialHomeomorph` by restricting it to an open set `s` in the domain and to `t` in the codomain. -/ @[simps! (config := .asFn) apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] def _root_.Homeomorph.toPartialHomeomorphOfImageEq (e : α ≃ₜ β) (s : Set α) (hs : IsOpen s) (t : Set β) (h : e '' s = t) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquivOfImageEq s t h open_source := hs open_target := by simpa [← h] continuousOn_toFun := e.continuous.continuousOn continuousOn_invFun := e.symm.continuous.continuousOn /-- A homeomorphism induces a partial homeomorphism on the whole space -/ @[simps! (config := mfld_cfg)] def _root_.Homeomorph.toPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α β := e.toPartialHomeomorphOfImageEq univ isOpen_univ univ <| by rw [image_univ, e.surjective.range_eq] #align homeomorph.to_local_homeomorph Homeomorph.toPartialHomeomorph /-- Replace `toPartialEquiv` field to provide better definitional equalities. -/ def replaceEquiv (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : PartialHomeomorph α β where toPartialEquiv := e' open_source := h ▸ e.open_source open_target := h ▸ e.open_target continuousOn_toFun := h ▸ e.continuousOn_toFun continuousOn_invFun := h ▸ e.continuousOn_invFun #align local_homeomorph.replace_equiv PartialHomeomorph.replaceEquiv theorem replaceEquiv_eq_self (e : PartialHomeomorph α β) (e' : PartialEquiv α β) (h : e.toPartialEquiv = e') : e.replaceEquiv e' h = e := by cases e subst e' rfl #align local_homeomorph.replace_equiv_eq_self PartialHomeomorph.replaceEquiv_eq_self theorem source_preimage_target : e.source ⊆ e ⁻¹' e.target := e.mapsTo #align local_homeomorph.source_preimage_target PartialHomeomorph.source_preimage_target @[deprecated toPartialEquiv_injective] theorem eq_of_localEquiv_eq {e e' : PartialHomeomorph α β} (h : e.toPartialEquiv = e'.toPartialEquiv) : e = e' := toPartialEquiv_injective h #align local_homeomorph.eq_of_local_equiv_eq PartialHomeomorph.eq_of_localEquiv_eq theorem eventually_left_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 x, e.symm (e y) = y := (e.open_source.eventually_mem hx).mono e.left_inv' #align local_homeomorph.eventually_left_inverse PartialHomeomorph.eventually_left_inverse theorem eventually_left_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 (e.symm x), e.symm (e y) = y := e.eventually_left_inverse (e.map_target hx) #align local_homeomorph.eventually_left_inverse' PartialHomeomorph.eventually_left_inverse' theorem eventually_right_inverse (e : PartialHomeomorph α β) {x} (hx : x ∈ e.target) : ∀ᶠ y in 𝓝 x, e (e.symm y) = y := (e.open_target.eventually_mem hx).mono e.right_inv' #align local_homeomorph.eventually_right_inverse PartialHomeomorph.eventually_right_inverse theorem eventually_right_inverse' (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ y in 𝓝 (e x), e (e.symm y) = y := e.eventually_right_inverse (e.map_source hx) #align local_homeomorph.eventually_right_inverse' PartialHomeomorph.eventually_right_inverse' theorem eventually_ne_nhdsWithin (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) : ∀ᶠ x' in 𝓝[≠] x, e x' ≠ e x := eventually_nhdsWithin_iff.2 <| (e.eventually_left_inverse hx).mono fun x' hx' => mt fun h => by rw [mem_singleton_iff, ← e.left_inv hx, ← h, hx'] #align local_homeomorph.eventually_ne_nhds_within PartialHomeomorph.eventually_ne_nhdsWithin theorem nhdsWithin_source_inter {x} (hx : x ∈ e.source) (s : Set α) : 𝓝[e.source ∩ s] x = 𝓝[s] x := nhdsWithin_inter_of_mem (mem_nhdsWithin_of_mem_nhds <| IsOpen.mem_nhds e.open_source hx) #align local_homeomorph.nhds_within_source_inter PartialHomeomorph.nhdsWithin_source_inter theorem nhdsWithin_target_inter {x} (hx : x ∈ e.target) (s : Set β) : 𝓝[e.target ∩ s] x = 𝓝[s] x := e.symm.nhdsWithin_source_inter hx s #align local_homeomorph.nhds_within_target_inter PartialHomeomorph.nhdsWithin_target_inter theorem image_eq_target_inter_inv_preimage {s : Set α} (h : s ⊆ e.source) : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h #align local_homeomorph.image_eq_target_inter_inv_preimage PartialHomeomorph.image_eq_target_inter_inv_preimage theorem image_source_inter_eq' (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_source_inter_eq' s #align local_homeomorph.image_source_inter_eq' PartialHomeomorph.image_source_inter_eq' theorem image_source_inter_eq (s : Set α) : e '' (e.source ∩ s) = e.target ∩ e.symm ⁻¹' (e.source ∩ s) := e.toPartialEquiv.image_source_inter_eq s #align local_homeomorph.image_source_inter_eq PartialHomeomorph.image_source_inter_eq theorem symm_image_eq_source_inter_preimage {s : Set β} (h : s ⊆ e.target) : e.symm '' s = e.source ∩ e ⁻¹' s := e.symm.image_eq_target_inter_inv_preimage h #align local_homeomorph.symm_image_eq_source_inter_preimage PartialHomeomorph.symm_image_eq_source_inter_preimage theorem symm_image_target_inter_eq (s : Set β) : e.symm '' (e.target ∩ s) = e.source ∩ e ⁻¹' (e.target ∩ s) := e.symm.image_source_inter_eq _ #align local_homeomorph.symm_image_target_inter_eq PartialHomeomorph.symm_image_target_inter_eq theorem source_inter_preimage_inv_preimage (s : Set α) : e.source ∩ e ⁻¹' (e.symm ⁻¹' s) = e.source ∩ s := e.toPartialEquiv.source_inter_preimage_inv_preimage s #align local_homeomorph.source_inter_preimage_inv_preimage PartialHomeomorph.source_inter_preimage_inv_preimage theorem target_inter_inv_preimage_preimage (s : Set β) : e.target ∩ e.symm ⁻¹' (e ⁻¹' s) = e.target ∩ s := e.symm.source_inter_preimage_inv_preimage _ #align local_homeomorph.target_inter_inv_preimage_preimage PartialHomeomorph.target_inter_inv_preimage_preimage theorem source_inter_preimage_target_inter (s : Set β) : e.source ∩ e ⁻¹' (e.target ∩ s) = e.source ∩ e ⁻¹' s := e.toPartialEquiv.source_inter_preimage_target_inter s #align local_homeomorph.source_inter_preimage_target_inter PartialHomeomorph.source_inter_preimage_target_inter theorem image_source_eq_target (e : PartialHomeomorph α β) : e '' e.source = e.target := e.toPartialEquiv.image_source_eq_target #align local_homeomorph.image_source_eq_target PartialHomeomorph.image_source_eq_target theorem symm_image_target_eq_source (e : PartialHomeomorph α β) : e.symm '' e.target = e.source := e.symm.image_source_eq_target #align local_homeomorph.symm_image_target_eq_source PartialHomeomorph.symm_image_target_eq_source /-- Two partial homeomorphisms are equal when they have equal `toFun`, `invFun` and `source`. It is not sufficient to have equal `toFun` and `source`, as this only determines `invFun` on the target. This would only be true for a weaker notion of equality, arguably the right one, called `EqOnSource`. -/ @[ext] protected theorem ext (e' : PartialHomeomorph α β) (h : ∀ x, e x = e' x) (hinv : ∀ x, e.symm x = e'.symm x) (hs : e.source = e'.source) : e = e' := toPartialEquiv_injective (PartialEquiv.ext h hinv hs) #align local_homeomorph.ext PartialHomeomorph.ext protected theorem ext_iff {e e' : PartialHomeomorph α β} : e = e' ↔ (∀ x, e x = e' x) ∧ (∀ x, e.symm x = e'.symm x) ∧ e.source = e'.source := ⟨by rintro rfl exact ⟨fun x => rfl, fun x => rfl, rfl⟩, fun h => e.ext e' h.1 h.2.1 h.2.2⟩ #align local_homeomorph.ext_iff PartialHomeomorph.ext_iff @[simp, mfld_simps] theorem symm_toPartialEquiv : e.symm.toPartialEquiv = e.toPartialEquiv.symm := rfl #align local_homeomorph.symm_to_local_equiv PartialHomeomorph.symm_toPartialEquiv -- The following lemmas are already simp via `PartialEquiv` theorem symm_source : e.symm.source = e.target := rfl #align local_homeomorph.symm_source PartialHomeomorph.symm_source theorem symm_target : e.symm.target = e.source := rfl #align local_homeomorph.symm_target PartialHomeomorph.symm_target @[simp, mfld_simps] theorem symm_symm : e.symm.symm = e := rfl #align local_homeomorph.symm_symm PartialHomeomorph.symm_symm theorem symm_bijective : Function.Bijective (PartialHomeomorph.symm : PartialHomeomorph α β → PartialHomeomorph β α) := Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩ /-- A partial homeomorphism is continuous at any point of its source -/ protected theorem continuousAt {x : α} (h : x ∈ e.source) : ContinuousAt e x := (e.continuousOn x h).continuousAt (e.open_source.mem_nhds h) #align local_homeomorph.continuous_at PartialHomeomorph.continuousAt /-- A partial homeomorphism inverse is continuous at any point of its target -/ theorem continuousAt_symm {x : β} (h : x ∈ e.target) : ContinuousAt e.symm x := e.symm.continuousAt h #align local_homeomorph.continuous_at_symm PartialHomeomorph.continuousAt_symm theorem tendsto_symm {x} (hx : x ∈ e.source) : Tendsto e.symm (𝓝 (e x)) (𝓝 x) := by simpa only [ContinuousAt, e.left_inv hx] using e.continuousAt_symm (e.map_source hx) #align local_homeomorph.tendsto_symm PartialHomeomorph.tendsto_symm theorem map_nhds_eq {x} (hx : x ∈ e.source) : map e (𝓝 x) = 𝓝 (e x) := le_antisymm (e.continuousAt hx) <| le_map_of_right_inverse (e.eventually_right_inverse' hx) (e.tendsto_symm hx) #align local_homeomorph.map_nhds_eq PartialHomeomorph.map_nhds_eq theorem symm_map_nhds_eq {x} (hx : x ∈ e.source) : map e.symm (𝓝 (e x)) = 𝓝 x := (e.symm.map_nhds_eq <| e.map_source hx).trans <| by rw [e.left_inv hx] #align local_homeomorph.symm_map_nhds_eq PartialHomeomorph.symm_map_nhds_eq theorem image_mem_nhds {x} (hx : x ∈ e.source) {s : Set α} (hs : s ∈ 𝓝 x) : e '' s ∈ 𝓝 (e x) := e.map_nhds_eq hx ▸ Filter.image_mem_map hs #align local_homeomorph.image_mem_nhds PartialHomeomorph.image_mem_nhds theorem map_nhdsWithin_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set α) : map e (𝓝[s] x) = 𝓝[e '' (e.source ∩ s)] e x := calc map e (𝓝[s] x) = map e (𝓝[e.source ∩ s] x) := congr_arg (map e) (e.nhdsWithin_source_inter hx _).symm _ = 𝓝[e '' (e.source ∩ s)] e x := (e.leftInvOn.mono <| inter_subset_left _ _).map_nhdsWithin_eq (e.left_inv hx) (e.continuousAt_symm (e.map_source hx)).continuousWithinAt (e.continuousAt hx).continuousWithinAt #align local_homeomorph.map_nhds_within_eq PartialHomeomorph.map_nhdsWithin_eq theorem map_nhdsWithin_preimage_eq (e : PartialHomeomorph α β) {x} (hx : x ∈ e.source) (s : Set β) : map e (𝓝[e ⁻¹' s] x) = 𝓝[s] e x := by rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.target_inter_inv_preimage_preimage, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.map_nhds_within_preimage_eq PartialHomeomorph.map_nhdsWithin_preimage_eq theorem eventually_nhds (e : PartialHomeomorph α β) {x : α} (p : β → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p y) ↔ ∀ᶠ x in 𝓝 x, p (e x) := Iff.trans (by rw [e.map_nhds_eq hx]) eventually_map #align local_homeomorph.eventually_nhds PartialHomeomorph.eventually_nhds theorem eventually_nhds' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) (hx : x ∈ e.source) : (∀ᶠ y in 𝓝 (e x), p (e.symm y)) ↔ ∀ᶠ x in 𝓝 x, p x := by rw [e.eventually_nhds _ hx] refine' eventually_congr ((e.eventually_left_inverse hx).mono fun y hy => _) rw [hy] #align local_homeomorph.eventually_nhds' PartialHomeomorph.eventually_nhds' theorem eventually_nhdsWithin (e : PartialHomeomorph α β) {x : α} (p : β → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p y) ↔ ∀ᶠ x in 𝓝[s] x, p (e x) := by refine' Iff.trans _ eventually_map rw [e.map_nhdsWithin_eq hx, e.image_source_inter_eq', e.nhdsWithin_target_inter (e.mapsTo hx)] #align local_homeomorph.eventually_nhds_within PartialHomeomorph.eventually_nhdsWithin theorem eventually_nhdsWithin' (e : PartialHomeomorph α β) {x : α} (p : α → Prop) {s : Set α} (hx : x ∈ e.source) : (∀ᶠ y in 𝓝[e.symm ⁻¹' s] e x, p (e.symm y)) ↔ ∀ᶠ x in 𝓝[s] x, p x := by rw [e.eventually_nhdsWithin _ hx] refine eventually_congr <| (eventually_nhdsWithin_of_eventually_nhds <| e.eventually_left_inverse hx).mono fun y hy => ?_ rw [hy] #align local_homeomorph.eventually_nhds_within' PartialHomeomorph.eventually_nhdsWithin' /-- This lemma is useful in the manifold library in the case that `e` is a chart. It states that locally around `e x` the set `e.symm ⁻¹' s` is the same as the set intersected with the target of `e` and some other neighborhood of `f x` (which will be the source of a chart on `γ`). -/ theorem preimage_eventuallyEq_target_inter_preimage_inter {e : PartialHomeomorph α β} {s : Set α} {t : Set γ} {x : α} {f : α → γ} (hf : ContinuousWithinAt f s x) (hxe : x ∈ e.source) (ht : t ∈ 𝓝 (f x)) : e.symm ⁻¹' s =ᶠ[𝓝 (e x)] (e.target ∩ e.symm ⁻¹' (s ∩ f ⁻¹' t) : Set β) := by rw [eventuallyEq_set, e.eventually_nhds _ hxe] filter_upwards [e.open_source.mem_nhds hxe, mem_nhdsWithin_iff_eventually.mp (hf.preimage_mem_nhdsWithin ht)] intro y hy hyu simp_rw [mem_inter_iff, mem_preimage, mem_inter_iff, e.mapsTo hy, true_and_iff, iff_self_and, e.left_inv hy, iff_true_intro hyu] #align local_homeomorph.preimage_eventually_eq_target_inter_preimage_inter PartialHomeomorph.preimage_eventuallyEq_target_inter_preimage_inter theorem isOpen_inter_preimage {s : Set β} (hs : IsOpen s) : IsOpen (e.source ∩ e ⁻¹' s) := e.continuousOn.isOpen_inter_preimage e.open_source hs #align local_homeomorph.preimage_open_of_open PartialHomeomorph.isOpen_inter_preimage /-- A partial homeomorphism is an open map on its source. -/ lemma isOpen_image_of_subset_source {s : Set α} (hs : IsOpen s) (hse : s ⊆ e.source) : IsOpen (e '' s) := by rw [(image_eq_target_inter_inv_preimage (e := e) hse)] exact e.continuousOn_invFun.isOpen_inter_preimage e.open_target hs /-- The inverse of a partial homeomorphism `e` is an open map on `e.target`. -/ lemma isOpen_image_symm_of_subset_target {t : Set β} (ht : IsOpen t) (hte : t ⊆ e.target) : IsOpen (e.symm '' t) := isOpen_image_of_subset_source e.symm ht (e.symm_source ▸ hte) /-! ### `PartialHomeomorph.IsImage` relation We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). This definition is a restatement of `PartialEquiv.IsImage` for partial homeomorphisms. In this section we transfer API about `PartialEquiv.IsImage` to partial homeomorphisms and add a few `PartialHomeomorph`-specific lemmas like `PartialHomeomorph.IsImage.closure`. -/ /-- We say that `t : Set β` is an image of `s : Set α` under a partial homeomorphism `e` if any of the following equivalent conditions hold: * `e '' (e.source ∩ s) = e.target ∩ t`; * `e.source ∩ e ⁻¹ t = e.source ∩ s`; * `∀ x ∈ e.source, e x ∈ t ↔ x ∈ s` (this one is used in the definition). -/ def IsImage (s : Set α) (t : Set β) : Prop := ∀ ⦃x⦄, x ∈ e.source → (e x ∈ t ↔ x ∈ s) #align local_homeomorph.is_image PartialHomeomorph.IsImage namespace IsImage variable {e} {s : Set α} {t : Set β} {x : α} {y : β} theorem toPartialEquiv (h : e.IsImage s t) : e.toPartialEquiv.IsImage s t := h #align local_homeomorph.is_image.to_local_equiv PartialHomeomorph.IsImage.toPartialEquiv theorem apply_mem_iff (h : e.IsImage s t) (hx : x ∈ e.source) : e x ∈ t ↔ x ∈ s := h hx #align local_homeomorph.is_image.apply_mem_iff PartialHomeomorph.IsImage.apply_mem_iff protected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s := h.toPartialEquiv.symm #align local_homeomorph.is_image.symm PartialHomeomorph.IsImage.symm theorem symm_apply_mem_iff (h : e.IsImage s t) (hy : y ∈ e.target) : e.symm y ∈ s ↔ y ∈ t := h.symm hy #align local_homeomorph.is_image.symm_apply_mem_iff PartialHomeomorph.IsImage.symm_apply_mem_iff @[simp] theorem symm_iff : e.symm.IsImage t s ↔ e.IsImage s t := ⟨fun h => h.symm, fun h => h.symm⟩ #align local_homeomorph.is_image.symm_iff PartialHomeomorph.IsImage.symm_iff protected theorem mapsTo (h : e.IsImage s t) : MapsTo e (e.source ∩ s) (e.target ∩ t) := h.toPartialEquiv.mapsTo #align local_homeomorph.is_image.maps_to PartialHomeomorph.IsImage.mapsTo theorem symm_mapsTo (h : e.IsImage s t) : MapsTo e.symm (e.target ∩ t) (e.source ∩ s) := h.symm.mapsTo #align local_homeomorph.is_image.symm_maps_to PartialHomeomorph.IsImage.symm_mapsTo theorem image_eq (h : e.IsImage s t) : e '' (e.source ∩ s) = e.target ∩ t := h.toPartialEquiv.image_eq #align local_homeomorph.is_image.image_eq PartialHomeomorph.IsImage.image_eq theorem symm_image_eq (h : e.IsImage s t) : e.symm '' (e.target ∩ t) = e.source ∩ s := h.symm.image_eq #align local_homeomorph.is_image.symm_image_eq PartialHomeomorph.IsImage.symm_image_eq theorem iff_preimage_eq : e.IsImage s t ↔ e.source ∩ e ⁻¹' t = e.source ∩ s := PartialEquiv.IsImage.iff_preimage_eq #align local_homeomorph.is_image.iff_preimage_eq PartialHomeomorph.IsImage.iff_preimage_eq alias ⟨preimage_eq, of_preimage_eq⟩ := iff_preimage_eq #align local_homeomorph.is_image.preimage_eq PartialHomeomorph.IsImage.preimage_eq #align local_homeomorph.is_image.of_preimage_eq PartialHomeomorph.IsImage.of_preimage_eq theorem iff_symm_preimage_eq : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' s = e.target ∩ t := symm_iff.symm.trans iff_preimage_eq #align local_homeomorph.is_image.iff_symm_preimage_eq PartialHomeomorph.IsImage.iff_symm_preimage_eq alias ⟨symm_preimage_eq, of_symm_preimage_eq⟩ := iff_symm_preimage_eq #align local_homeomorph.is_image.symm_preimage_eq PartialHomeomorph.IsImage.symm_preimage_eq #align local_homeomorph.is_image.of_symm_preimage_eq PartialHomeomorph.IsImage.of_symm_preimage_eq theorem iff_symm_preimage_eq' : e.IsImage s t ↔ e.target ∩ e.symm ⁻¹' (e.source ∩ s) = e.target ∩ t := by rw [iff_symm_preimage_eq, ← image_source_inter_eq, ← image_source_inter_eq'] #align local_homeomorph.is_image.iff_symm_preimage_eq' PartialHomeomorph.IsImage.iff_symm_preimage_eq' alias ⟨symm_preimage_eq', of_symm_preimage_eq'⟩ := iff_symm_preimage_eq' #align local_homeomorph.is_image.symm_preimage_eq' PartialHomeomorph.IsImage.symm_preimage_eq' #align local_homeomorph.is_image.of_symm_preimage_eq' PartialHomeomorph.IsImage.of_symm_preimage_eq' theorem iff_preimage_eq' : e.IsImage s t ↔ e.source ∩ e ⁻¹' (e.target ∩ t) = e.source ∩ s := symm_iff.symm.trans iff_symm_preimage_eq' #align local_homeomorph.is_image.iff_preimage_eq' PartialHomeomorph.IsImage.iff_preimage_eq' alias ⟨preimage_eq', of_preimage_eq'⟩ := iff_preimage_eq' #align local_homeomorph.is_image.preimage_eq' PartialHomeomorph.IsImage.preimage_eq' #align local_homeomorph.is_image.of_preimage_eq' PartialHomeomorph.IsImage.of_preimage_eq' theorem of_image_eq (h : e '' (e.source ∩ s) = e.target ∩ t) : e.IsImage s t := PartialEquiv.IsImage.of_image_eq h #align local_homeomorph.is_image.of_image_eq PartialHomeomorph.IsImage.of_image_eq theorem of_symm_image_eq (h : e.symm '' (e.target ∩ t) = e.source ∩ s) : e.IsImage s t := PartialEquiv.IsImage.of_symm_image_eq h #align local_homeomorph.is_image.of_symm_image_eq PartialHomeomorph.IsImage.of_symm_image_eq protected theorem compl (h : e.IsImage s t) : e.IsImage sᶜ tᶜ := fun _ hx => (h hx).not #align local_homeomorph.is_image.compl PartialHomeomorph.IsImage.compl protected theorem inter {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∩ s') (t ∩ t') := fun _ hx => (h hx).and (h' hx) #align local_homeomorph.is_image.inter PartialHomeomorph.IsImage.inter protected theorem union {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s ∪ s') (t ∪ t') := fun _ hx => (h hx).or (h' hx) #align local_homeomorph.is_image.union PartialHomeomorph.IsImage.union protected theorem diff {s' t'} (h : e.IsImage s t) (h' : e.IsImage s' t') : e.IsImage (s \ s') (t \ t') := h.inter h'.compl #align local_homeomorph.is_image.diff PartialHomeomorph.IsImage.diff theorem leftInvOn_piecewise {e' : PartialHomeomorph α β} [∀ i, Decidable (i ∈ s)] [∀ i, Decidable (i ∈ t)] (h : e.IsImage s t) (h' : e'.IsImage s t) : LeftInvOn (t.piecewise e.symm e'.symm) (s.piecewise e e') (s.ite e.source e'.source) := h.toPartialEquiv.leftInvOn_piecewise h' #align local_homeomorph.is_image.left_inv_on_piecewise PartialHomeomorph.IsImage.leftInvOn_piecewise theorem inter_eq_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (h' : e'.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : e.target ∩ t = e'.target ∩ t := h.toPartialEquiv.inter_eq_of_inter_eq_of_eqOn h' hs Heq #align local_homeomorph.is_image.inter_eq_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.inter_eq_of_inter_eq_of_eqOn theorem symm_eqOn_of_inter_eq_of_eqOn {e' : PartialHomeomorph α β} (h : e.IsImage s t) (hs : e.source ∩ s = e'.source ∩ s) (Heq : EqOn e e' (e.source ∩ s)) : EqOn e.symm e'.symm (e.target ∩ t) := h.toPartialEquiv.symm_eq_on_of_inter_eq_of_eqOn hs Heq #align local_homeomorph.is_image.symm_eq_on_of_inter_eq_of_eq_on PartialHomeomorph.IsImage.symm_eqOn_of_inter_eq_of_eqOn theorem map_nhdsWithin_eq (h : e.IsImage s t) (hx : x ∈ e.source) : map e (𝓝[s] x) = 𝓝[t] e x := by rw [e.map_nhdsWithin_eq hx, h.image_eq, e.nhdsWithin_target_inter (e.map_source hx)] #align local_homeomorph.is_image.map_nhds_within_eq PartialHomeomorph.IsImage.map_nhdsWithin_eq protected theorem closure (h : e.IsImage s t) : e.IsImage (closure s) (closure t) := fun x hx => by simp only [mem_closure_iff_nhdsWithin_neBot, ← h.map_nhdsWithin_eq hx, map_neBot_iff] #align local_homeomorph.is_image.closure PartialHomeomorph.IsImage.closure protected theorem interior (h : e.IsImage s t) : e.IsImage (interior s) (interior t) := by simpa only [closure_compl, compl_compl] using h.compl.closure.compl #align local_homeomorph.is_image.interior PartialHomeomorph.IsImage.interior protected theorem frontier (h : e.IsImage s t) : e.IsImage (frontier s) (frontier t) := h.closure.diff h.interior #align local_homeomorph.is_image.frontier PartialHomeomorph.IsImage.frontier theorem isOpen_iff (h : e.IsImage s t) : IsOpen (e.source ∩ s) ↔ IsOpen (e.target ∩ t) := ⟨fun hs => h.symm_preimage_eq' ▸ e.symm.isOpen_inter_preimage hs, fun hs => h.preimage_eq' ▸ e.isOpen_inter_preimage hs⟩ #align local_homeomorph.is_image.is_open_iff PartialHomeomorph.IsImage.isOpen_iff /-- Restrict a `PartialHomeomorph` to a pair of corresponding open sets. -/ @[simps toPartialEquiv] def restr (h : e.IsImage s t) (hs : IsOpen (e.source ∩ s)) : PartialHomeomorph α β where toPartialEquiv := h.toPartialEquiv.restr open_source := hs open_target := h.isOpen_iff.1 hs continuousOn_toFun := e.continuousOn.mono (inter_subset_left _ _) continuousOn_invFun := e.symm.continuousOn.mono (inter_subset_left _ _) #align local_homeomorph.is_image.restr PartialHomeomorph.IsImage.restr end IsImage theorem isImage_source_target : e.IsImage e.source e.target := e.toPartialEquiv.isImage_source_target #align local_homeomorph.is_image_source_target PartialHomeomorph.isImage_source_target theorem isImage_source_target_of_disjoint (e' : PartialHomeomorph α β) (hs : Disjoint e.source e'.source) (ht : Disjoint e.target e'.target) : e.IsImage e'.source e'.target := e.toPartialEquiv.isImage_source_target_of_disjoint e'.toPartialEquiv hs ht #align local_homeomorph.is_image_source_target_of_disjoint PartialHomeomorph.isImage_source_target_of_disjoint /-- Preimage of interior or interior of preimage coincide for partial homeomorphisms, when restricted to the source. -/ theorem preimage_interior (s : Set β) : e.source ∩ e ⁻¹' interior s = e.source ∩ interior (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).interior.preimage_eq #align local_homeomorph.preimage_interior PartialHomeomorph.preimage_interior theorem preimage_closure (s : Set β) : e.source ∩ e ⁻¹' closure s = e.source ∩ closure (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).closure.preimage_eq #align local_homeomorph.preimage_closure PartialHomeomorph.preimage_closure theorem preimage_frontier (s : Set β) : e.source ∩ e ⁻¹' frontier s = e.source ∩ frontier (e ⁻¹' s) := (IsImage.of_preimage_eq rfl).frontier.preimage_eq #align local_homeomorph.preimage_frontier PartialHomeomorph.preimage_frontier theorem isOpen_inter_preimage_symm {s : Set α} (hs : IsOpen s) : IsOpen (e.target ∩ e.symm ⁻¹' s) := e.symm.continuousOn.isOpen_inter_preimage e.open_target hs #align local_homeomorph.preimage_open_of_open_symm PartialHomeomorph.isOpen_inter_preimage_symm /-- The image of an open set in the source is open. -/ theorem image_isOpen_of_isOpen {s : Set α} (hs : IsOpen s) (h : s ⊆ e.source) : IsOpen (e '' s) := by have : e '' s = e.target ∩ e.symm ⁻¹' s := e.toPartialEquiv.image_eq_target_inter_inv_preimage h rw [this] exact e.continuousOn_symm.isOpen_inter_preimage e.open_target hs #align local_homeomorph.image_open_of_open PartialHomeomorph.image_isOpen_of_isOpen /-- The image of the restriction of an open set to the source is open. -/ theorem image_isOpen_of_isOpen' {s : Set α} (hs : IsOpen s) : IsOpen (e '' (e.source ∩ s)) := image_isOpen_of_isOpen _ (IsOpen.inter e.open_source hs) (inter_subset_left _ _) #align local_homeomorph.image_open_of_open' PartialHomeomorph.image_isOpen_of_isOpen' /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpenRestrict (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap (e.source.restrict e)) (hs : IsOpen e.source) : PartialHomeomorph α β where toPartialEquiv := e open_source := hs open_target := by simpa only [range_restrict, e.image_source_eq_target] using ho.isOpen_range continuousOn_toFun := hc continuousOn_invFun := e.image_source_eq_target ▸ ho.continuousOn_image_of_leftInvOn e.leftInvOn #align local_homeomorph.of_continuous_open_restrict PartialHomeomorph.ofContinuousOpenRestrict /-- A `PartialEquiv` with continuous open forward map and open source is a `PartialHomeomorph`. -/ def ofContinuousOpen (e : PartialEquiv α β) (hc : ContinuousOn e e.source) (ho : IsOpenMap e) (hs : IsOpen e.source) : PartialHomeomorph α β := ofContinuousOpenRestrict e hc (ho.restrict hs) hs #align local_homeomorph.of_continuous_open PartialHomeomorph.ofContinuousOpen /-- Restricting a partial homeomorphism `e` to `e.source ∩ s` when `s` is open. This is sometimes hard to use because of the openness assumption, but it has the advantage that when it can be used then its `PartialEquiv` is defeq to `PartialEquiv.restr`. -/ protected def restrOpen (s : Set α) (hs : IsOpen s) : PartialHomeomorph α β := (@IsImage.of_symm_preimage_eq α β _ _ e s (e.symm ⁻¹' s) rfl).restr (IsOpen.inter e.open_source hs) #align local_homeomorph.restr_open PartialHomeomorph.restrOpen @[simp, mfld_simps] theorem restrOpen_toPartialEquiv (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).toPartialEquiv = e.toPartialEquiv.restr s := rfl #align local_homeomorph.restr_open_to_local_equiv PartialHomeomorph.restrOpen_toPartialEquiv -- Already simp via `PartialEquiv` theorem restrOpen_source (s : Set α) (hs : IsOpen s) : (e.restrOpen s hs).source = e.source ∩ s := rfl #align local_homeomorph.restr_open_source PartialHomeomorph.restrOpen_source /-- Restricting a partial homeomorphism `e` to `e.source ∩ interior s`. We use the interior to make sure that the restriction is well defined whatever the set s, since partial homeomorphisms are by definition defined on open sets. In applications where `s` is open, this coincides with the restriction of partial equivalences -/ @[simps! (config := mfld_cfg) apply symm_apply, simps! (config := .lemmasOnly) source target] protected def restr (s : Set α) : PartialHomeomorph α β := e.restrOpen (interior s) isOpen_interior #align local_homeomorph.restr PartialHomeomorph.restr @[simp, mfld_simps] theorem restr_toPartialEquiv (s : Set α) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr (interior s) := rfl #align local_homeomorph.restr_to_local_equiv PartialHomeomorph.restr_toPartialEquiv theorem restr_source' (s : Set α) (hs : IsOpen s) : (e.restr s).source = e.source ∩ s := by rw [e.restr_source, hs.interior_eq] #align local_homeomorph.restr_source' PartialHomeomorph.restr_source' theorem restr_toPartialEquiv' (s : Set α) (hs : IsOpen s) : (e.restr s).toPartialEquiv = e.toPartialEquiv.restr s := by rw [e.restr_toPartialEquiv, hs.interior_eq] #align local_homeomorph.restr_to_local_equiv' PartialHomeomorph.restr_toPartialEquiv' theorem restr_eq_of_source_subset {e : PartialHomeomorph α β} {s : Set α} (h : e.source ⊆ s) : e.restr s = e := toPartialEquiv_injective <| PartialEquiv.restr_eq_of_source_subset <| interior_maximal h e.open_source #align local_homeomorph.restr_eq_of_source_subset PartialHomeomorph.restr_eq_of_source_subset @[simp, mfld_simps] theorem restr_univ {e : PartialHomeomorph α β} : e.restr univ = e := restr_eq_of_source_subset (subset_univ _) #align local_homeomorph.restr_univ PartialHomeomorph.restr_univ theorem restr_source_inter (s : Set α) : e.restr (e.source ∩ s) = e.restr s := by refine' PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) _ simp [e.open_source.interior_eq, ← inter_assoc] #align local_homeomorph.restr_source_inter PartialHomeomorph.restr_source_inter /-- The identity on the whole space as a partial homeomorphism. -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] protected def refl (α : Type*) [TopologicalSpace α] : PartialHomeomorph α α := (Homeomorph.refl α).toPartialHomeomorph #align local_homeomorph.refl PartialHomeomorph.refl @[simp, mfld_simps] theorem refl_localEquiv : (PartialHomeomorph.refl α).toPartialEquiv = PartialEquiv.refl α := rfl #align local_homeomorph.refl_local_equiv PartialHomeomorph.refl_localEquiv @[simp, mfld_simps] theorem refl_symm : (PartialHomeomorph.refl α).symm = PartialHomeomorph.refl α := rfl #align local_homeomorph.refl_symm PartialHomeomorph.refl_symm section variable {s : Set α} (hs : IsOpen s) /-- The identity partial equivalence on a set `s` -/ @[simps! (config := mfld_cfg) apply, simps! (config := .lemmasOnly) source target] def ofSet (s : Set α) (hs : IsOpen s) : PartialHomeomorph α α where toPartialEquiv := PartialEquiv.ofSet s open_source := hs open_target := hs continuousOn_toFun := continuous_id.continuousOn continuousOn_invFun := continuous_id.continuousOn #align local_homeomorph.of_set PartialHomeomorph.ofSet @[simp, mfld_simps] theorem ofSet_toPartialEquiv : (ofSet s hs).toPartialEquiv = PartialEquiv.ofSet s := rfl #align local_homeomorph.of_set_to_local_equiv PartialHomeomorph.ofSet_toPartialEquiv @[simp, mfld_simps] theorem ofSet_symm : (ofSet s hs).symm = ofSet s hs := rfl #align local_homeomorph.of_set_symm PartialHomeomorph.ofSet_symm @[simp, mfld_simps] theorem ofSet_univ_eq_refl : ofSet univ isOpen_univ = PartialHomeomorph.refl α := by ext <;> simp #align local_homeomorph.of_set_univ_eq_refl PartialHomeomorph.ofSet_univ_eq_refl end /-- Composition of two partial homeomorphisms when the target of the first and the source of the second coincide. -/ @[simps! apply symm_apply toPartialEquiv, simps! (config := .lemmasOnly) source target] protected def trans' (h : e.target = e'.source) : PartialHomeomorph α γ where toPartialEquiv := PartialEquiv.trans' e.toPartialEquiv e'.toPartialEquiv h open_source := e.open_source open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuousOn <| h ▸ e.mapsTo continuousOn_invFun := e.continuousOn_symm.comp e'.continuousOn_symm <| h.symm ▸ e'.symm_mapsTo #align local_homeomorph.trans' PartialHomeomorph.trans' /-- Composing two partial homeomorphisms, by restricting to the maximal domain where their composition is well defined. -/ protected def trans : PartialHomeomorph α γ := PartialHomeomorph.trans' (e.symm.restrOpen e'.source e'.open_source).symm (e'.restrOpen e.target e.open_target) (by simp [inter_comm]) #align local_homeomorph.trans PartialHomeomorph.trans @[simp, mfld_simps] theorem trans_toPartialEquiv : (e.trans e').toPartialEquiv = e.toPartialEquiv.trans e'.toPartialEquiv := rfl #align local_homeomorph.trans_to_local_equiv PartialHomeomorph.trans_toPartialEquiv @[simp, mfld_simps] theorem coe_trans : (e.trans e' : α → γ) = e' ∘ e := rfl #align local_homeomorph.coe_trans PartialHomeomorph.coe_trans @[simp, mfld_simps] theorem coe_trans_symm : ((e.trans e').symm : γ → α) = e.symm ∘ e'.symm := rfl #align local_homeomorph.coe_trans_symm PartialHomeomorph.coe_trans_symm theorem trans_apply {x : α} : (e.trans e') x = e' (e x) := rfl #align local_homeomorph.trans_apply PartialHomeomorph.trans_apply theorem trans_symm_eq_symm_trans_symm : (e.trans e').symm = e'.symm.trans e.symm := rfl #align local_homeomorph.trans_symm_eq_symm_trans_symm PartialHomeomorph.trans_symm_eq_symm_trans_symm /- This could be considered as a simp lemma, but there are many situations where it makes something simple into something more complicated. -/ theorem trans_source : (e.trans e').source = e.source ∩ e ⁻¹' e'.source := PartialEquiv.trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source PartialHomeomorph.trans_source theorem trans_source' : (e.trans e').source = e.source ∩ e ⁻¹' (e.target ∩ e'.source) := PartialEquiv.trans_source' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source' PartialHomeomorph.trans_source' theorem trans_source'' : (e.trans e').source = e.symm '' (e.target ∩ e'.source) := PartialEquiv.trans_source'' e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.trans_source'' PartialHomeomorph.trans_source'' theorem image_trans_source : e '' (e.trans e').source = e.target ∩ e'.source := PartialEquiv.image_trans_source e.toPartialEquiv e'.toPartialEquiv #align local_homeomorph.image_trans_source PartialHomeomorph.image_trans_source theorem trans_target : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' e.target := rfl #align local_homeomorph.trans_target PartialHomeomorph.trans_target theorem trans_target' : (e.trans e').target = e'.target ∩ e'.symm ⁻¹' (e'.source ∩ e.target) := trans_source' e'.symm e.symm #align local_homeomorph.trans_target' PartialHomeomorph.trans_target' theorem trans_target'' : (e.trans e').target = e' '' (e'.source ∩ e.target) := trans_source'' e'.symm e.symm #align local_homeomorph.trans_target'' PartialHomeomorph.trans_target'' theorem inv_image_trans_target : e'.symm '' (e.trans e').target = e'.source ∩ e.target := image_trans_source e'.symm e.symm #align local_homeomorph.inv_image_trans_target PartialHomeomorph.inv_image_trans_target theorem trans_assoc (e'' : PartialHomeomorph γ δ) : (e.trans e').trans e'' = e.trans (e'.trans e'') := toPartialEquiv_injective <| e.1.trans_assoc _ _ #align local_homeomorph.trans_assoc PartialHomeomorph.trans_assoc @[simp, mfld_simps] theorem trans_refl : e.trans (PartialHomeomorph.refl β) = e := toPartialEquiv_injective e.1.trans_refl #align local_homeomorph.trans_refl PartialHomeomorph.trans_refl @[simp, mfld_simps] theorem refl_trans : (PartialHomeomorph.refl α).trans e = e := toPartialEquiv_injective e.1.refl_trans #align local_homeomorph.refl_trans PartialHomeomorph.refl_trans theorem trans_ofSet {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e ⁻¹' s) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) <| by rw [trans_source, restr_source, ofSet_source, ← preimage_interior, hs.interior_eq] #align local_homeomorph.trans_of_set PartialHomeomorph.trans_ofSet theorem trans_of_set' {s : Set β} (hs : IsOpen s) : e.trans (ofSet s hs) = e.restr (e.source ∩ e ⁻¹' s) := by rw [trans_ofSet, restr_source_inter] #align local_homeomorph.trans_of_set' PartialHomeomorph.trans_of_set' theorem ofSet_trans {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr s := PartialHomeomorph.ext _ _ (fun x => rfl) (fun x => rfl) <| by simp [hs.interior_eq, inter_comm] #align local_homeomorph.of_set_trans PartialHomeomorph.ofSet_trans theorem ofSet_trans' {s : Set α} (hs : IsOpen s) : (ofSet s hs).trans e = e.restr (e.source ∩ s) := by rw [ofSet_trans, restr_source_inter] #align local_homeomorph.of_set_trans' PartialHomeomorph.ofSet_trans' @[simp, mfld_simps] theorem ofSet_trans_ofSet {s : Set α} (hs : IsOpen s) {s' : Set α} (hs' : IsOpen s') : (ofSet s hs).trans (ofSet s' hs') = ofSet (s ∩ s') (IsOpen.inter hs hs') := by rw [(ofSet s hs).trans_ofSet hs'] ext <;> simp [hs'.interior_eq] #align local_homeomorph.of_set_trans_of_set PartialHomeomorph.ofSet_trans_ofSet theorem restr_trans (s : Set α) : (e.restr s).trans e' = (e.trans e').restr s := toPartialEquiv_injective <| PartialEquiv.restr_trans e.toPartialEquiv e'.toPartialEquiv (interior s) #align local_homeomorph.restr_trans PartialHomeomorph.restr_trans /-- Postcompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def transHomeomorph (e' : β ≃ₜ γ) : PartialHomeomorph α γ where toPartialEquiv := e.toPartialEquiv.transEquiv e'.toEquiv open_source := e.open_source open_target := e.open_target.preimage e'.symm.continuous continuousOn_toFun := e'.continuous.comp_continuousOn e.continuousOn continuousOn_invFun := e.symm.continuousOn.comp e'.symm.continuous.continuousOn fun _ => id #align local_homeomorph.trans_homeomorph PartialHomeomorph.transHomeomorph theorem transHomeomorph_eq_trans (e' : β ≃ₜ γ) : e.transHomeomorph e' = e.trans e'.toPartialHomeomorph := toPartialEquiv_injective <| PartialEquiv.transEquiv_eq_trans _ _ #align local_homeomorph.trans_equiv_eq_trans PartialHomeomorph.transHomeomorph_eq_trans /-- Precompose a partial homeomorphism with a homeomorphism. We modify the source and target to have better definitional behavior. -/ @[simps! (config := .asFn)] def _root_.Homeomorph.transPartialHomeomorph (e : α ≃ₜ β) : PartialHomeomorph α γ where toPartialEquiv := e.toEquiv.transPartialEquiv e'.toPartialEquiv open_source := e'.open_source.preimage e.continuous open_target := e'.open_target continuousOn_toFun := e'.continuousOn.comp e.continuous.continuousOn fun _ => id continuousOn_invFun := e.symm.continuous.comp_continuousOn e'.symm.continuousOn #align homeomorph.trans_local_homeomorph Homeomorph.transPartialHomeomorph theorem _root_.Homeomorph.transPartialHomeomorph_eq_trans (e : α ≃ₜ β) : e.transPartialHomeomorph e' = e.toPartialHomeomorph.trans e' := toPartialEquiv_injective <| Equiv.transPartialEquiv_eq_trans _ _ #align homeomorph.trans_local_homeomorph_eq_trans Homeomorph.transPartialHomeomorph_eq_trans /-- `EqOnSource e e'` means that `e` and `e'` have the same source, and coincide there. They should really be considered the same partial equivalence. -/ def EqOnSource (e e' : PartialHomeomorph α β) : Prop := e.source = e'.source ∧ EqOn e e' e.source #align local_homeomorph.eq_on_source PartialHomeomorph.EqOnSource theorem eqOnSource_iff (e e' : PartialHomeomorph α β) : EqOnSource e e' ↔ PartialEquiv.EqOnSource e.toPartialEquiv e'.toPartialEquiv := Iff.rfl #align local_homeomorph.eq_on_source_iff PartialHomeomorph.eqOnSource_iff /-- `EqOnSource` is an equivalence relation. -/ instance eqOnSourceSetoid : Setoid (PartialHomeomorph α β) := { PartialEquiv.eqOnSourceSetoid.comap toPartialEquiv with r := EqOnSource } theorem eqOnSource_refl : e ≈ e := Setoid.refl _ #align local_homeomorph.eq_on_source_refl PartialHomeomorph.eqOnSource_refl /-- If two partial homeomorphisms are equivalent, so are their inverses. -/ theorem EqOnSource.symm' {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.symm ≈ e'.symm := PartialEquiv.EqOnSource.symm' h #align local_homeomorph.eq_on_source.symm' PartialHomeomorph.EqOnSource.symm' /-- Two equivalent partial homeomorphisms have the same source. -/ theorem EqOnSource.source_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.source = e'.source := h.1 #align local_homeomorph.eq_on_source.source_eq PartialHomeomorph.EqOnSource.source_eq /-- Two equivalent partial homeomorphisms have the same target. -/ theorem EqOnSource.target_eq {e e' : PartialHomeomorph α β} (h : e ≈ e') : e.target = e'.target := h.symm'.1 #align local_homeomorph.eq_on_source.target_eq PartialHomeomorph.EqOnSource.target_eq /-- Two equivalent partial homeomorphisms have coinciding `toFun` on the source -/ theorem EqOnSource.eqOn {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e e' e.source := h.2 #align local_homeomorph.eq_on_source.eq_on PartialHomeomorph.EqOnSource.eqOn /-- Two equivalent partial homeomorphisms have coinciding `invFun` on the target -/ theorem EqOnSource.symm_eqOn_target {e e' : PartialHomeomorph α β} (h : e ≈ e') : EqOn e.symm e'.symm e.target := h.symm'.2 #align local_homeomorph.eq_on_source.symm_eq_on_target PartialHomeomorph.EqOnSource.symm_eqOn_target /-- Composition of partial homeomorphisms respects equivalence. -/ theorem EqOnSource.trans' {e e' : PartialHomeomorph α β} {f f' : PartialHomeomorph β γ} (he : e ≈ e') (hf : f ≈ f') : e.trans f ≈ e'.trans f' := PartialEquiv.EqOnSource.trans' he hf #align local_homeomorph.eq_on_source.trans' PartialHomeomorph.EqOnSource.trans' /-- Restriction of partial homeomorphisms respects equivalence -/ theorem EqOnSource.restr {e e' : PartialHomeomorph α β} (he : e ≈ e') (s : Set α) : e.restr s ≈ e'.restr s := PartialEquiv.EqOnSource.restr he _ #align local_homeomorph.eq_on_source.restr PartialHomeomorph.EqOnSource.restr /- Two equivalent partial homeomorphisms are equal when the source and target are `univ`. -/ theorem Set.EqOn.restr_eqOn_source {e e' : PartialHomeomorph α β} (h : EqOn e e' (e.source ∩ e'.source)) : e.restr e'.source ≈ e'.restr e.source := by constructor · rw [e'.restr_source' _ e.open_source] rw [e.restr_source' _ e'.open_source] exact Set.inter_comm _ _ · rw [e.restr_source' _ e'.open_source] refine' (EqOn.trans _ h).trans _ <;> simp only [mfld_simps, eqOn_refl] #align local_homeomorph.set.eq_on.restr_eq_on_source PartialHomeomorph.Set.EqOn.restr_eqOn_source /-- Composition of a partial homeomorphism and its inverse is equivalent to the restriction of the identity to the source -/ theorem trans_self_symm : e.trans e.symm ≈ PartialHomeomorph.ofSet e.source e.open_source := PartialEquiv.trans_self_symm _ #align local_homeomorph.trans_self_symm PartialHomeomorph.trans_self_symm theorem trans_symm_self : e.symm.trans e ≈ PartialHomeomorph.ofSet e.target e.open_target := e.symm.trans_self_symm #align local_homeomorph.trans_symm_self PartialHomeomorph.trans_symm_self theorem eq_of_eqOnSource_univ {e e' : PartialHomeomorph α β} (h : e ≈ e') (s : e.source = univ) (t : e.target = univ) : e = e' := toPartialEquiv_injective <| PartialEquiv.eq_of_eqOnSource_univ _ _ h s t #align local_homeomorph.eq_of_eq_on_source_univ PartialHomeomorph.eq_of_eqOnSource_univ section Prod /-- The product of two partial homeomorphisms, as a partial homeomorphism on the product space. -/ @[simps! (config := mfld_cfg) toPartialEquiv apply, simps! (config := .lemmasOnly) source target symm_apply] def prod (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : PartialHomeomorph (α × γ) (β × δ) where open_source := e.open_source.prod e'.open_source open_target := e.open_target.prod e'.open_target continuousOn_toFun := e.continuousOn.prod_map e'.continuousOn continuousOn_invFun := e.continuousOn_symm.prod_map e'.continuousOn_symm toPartialEquiv := e.toPartialEquiv.prod e'.toPartialEquiv #align local_homeomorph.prod PartialHomeomorph.prod @[simp, mfld_simps] theorem prod_symm (e : PartialHomeomorph α β) (e' : PartialHomeomorph γ δ) : (e.prod e').symm = e.symm.prod e'.symm := rfl #align local_homeomorph.prod_symm PartialHomeomorph.prod_symm @[simp] theorem refl_prod_refl {α β : Type*} [TopologicalSpace α] [TopologicalSpace β] : (PartialHomeomorph.refl α).prod (PartialHomeomorph.refl β) = PartialHomeomorph.refl (α × β) := PartialHomeomorph.ext _ _ (fun _ => rfl) (fun _ => rfl) univ_prod_univ #align local_homeomorph.refl_prod_refl PartialHomeomorph.refl_prod_refl @[simp, mfld_simps] theorem prod_trans {η : Type*} {ε : Type*} [TopologicalSpace η] [TopologicalSpace ε] (e : PartialHomeomorph α β) (f : PartialHomeomorph β γ) (e' : PartialHomeomorph δ η) (f' : PartialHomeomorph η ε) : (e.prod e').trans (f.prod f') = (e.trans f).prod (e'.trans f') := toPartialEquiv_injective <| e.1.prod_trans .. #align local_homeomorph.prod_trans PartialHomeomorph.prod_trans theorem prod_eq_prod_of_nonempty {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁.prod e₂).source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by obtain ⟨⟨x, y⟩, -⟩ := id h haveI : Nonempty α := ⟨x⟩ haveI : Nonempty β := ⟨e₁ x⟩ haveI : Nonempty γ := ⟨y⟩ haveI : Nonempty δ := ⟨e₂ y⟩ simp_rw [PartialHomeomorph.ext_iff, prod_apply, prod_symm_apply, prod_source, Prod.ext_iff, Set.prod_eq_prod_iff_of_nonempty h, forall_and, Prod.forall, forall_const, and_assoc, and_left_comm] #align local_homeomorph.prod_eq_prod_of_nonempty PartialHomeomorph.prod_eq_prod_of_nonempty theorem prod_eq_prod_of_nonempty' {e₁ e₁' : PartialHomeomorph α β} {e₂ e₂' : PartialHomeomorph γ δ} (h : (e₁'.prod e₂').source.Nonempty) : e₁.prod e₂ = e₁'.prod e₂' ↔ e₁ = e₁' ∧ e₂ = e₂' := by rw [eq_comm, prod_eq_prod_of_nonempty h, eq_comm, @eq_comm _ e₂'] #align local_homeomorph.prod_eq_prod_of_nonempty' PartialHomeomorph.prod_eq_prod_of_nonempty' end Prod section Piecewise /-- Combine two `PartialHomeomorph`s using `Set.piecewise`. The source of the new `PartialHomeomorph` is `s.ite e.source e'.source = e.source ∩ s ∪ e'.source \ s`, and similarly for target. The function sends `e.source ∩ s` to `e.target ∩ t` using `e` and `e'.source \ s` to `e'.target \ t` using `e'`, and similarly for the inverse function. To ensure the maps `toFun` and `invFun` are inverse of each other on the new `source` and `target`, the definition assumes that the sets `s` and `t` are related both by `e.is_image` and `e'.is_image`. To ensure that the new maps are continuous on `source`/`target`, it also assumes that `e.source` and `e'.source` meet `frontier s` on the same set and `e x = e' x` on this intersection. -/ @[simps! (config := .asFn) toPartialEquiv apply] def piecewise (e e' : PartialHomeomorph α β) (s : Set α) (t : Set β) [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : PartialHomeomorph α β where toPartialEquiv := e.toPartialEquiv.piecewise e'.toPartialEquiv s t H H' open_source := e.open_source.ite e'.open_source Hs open_target := e.open_target.ite e'.open_target <| H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq continuousOn_toFun := continuousOn_piecewise_ite e.continuousOn e'.continuousOn Hs Heq continuousOn_invFun := continuousOn_piecewise_ite e.continuousOn_symm e'.continuousOn_symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) #align local_homeomorph.piecewise PartialHomeomorph.piecewise @[simp] theorem symm_piecewise (e e' : PartialHomeomorph α β) {s : Set α} {t : Set β} [∀ x, Decidable (x ∈ s)] [∀ y, Decidable (y ∈ t)] (H : e.IsImage s t) (H' : e'.IsImage s t) (Hs : e.source ∩ frontier s = e'.source ∩ frontier s) (Heq : EqOn e e' (e.source ∩ frontier s)) : (e.piecewise e' s t H H' Hs Heq).symm = e.symm.piecewise e'.symm t s H.symm H'.symm (H.frontier.inter_eq_of_inter_eq_of_eqOn H'.frontier Hs Heq) (H.frontier.symm_eqOn_of_inter_eq_of_eqOn Hs Heq) := rfl #align local_homeomorph.symm_piecewise PartialHomeomorph.symm_piecewise /-- Combine two `PartialHomeomorph`s with disjoint sources and disjoint targets. We reuse `PartialHomeomorph.piecewise` then override `toPartialEquiv` to `PartialEquiv.disjointUnion`. This way we have better definitional equalities for `source` and `target`. -/ def disjointUnion (e e' : PartialHomeomorph α β) [∀ x, Decidable (x ∈ e.source)] [∀ y, Decidable (y ∈ e.target)] (Hs : Disjoint e.source e'.source) (Ht : Disjoint e.target e'.target) : PartialHomeomorph α β := (e.piecewise e' e.source e.target e.isImage_source_target (e'.isImage_source_target_of_disjoint e Hs.symm Ht.symm) (by rw [e.open_source.inter_frontier_eq, (Hs.symm.frontier_right e'.open_source).inter_eq]) (by rw [e.open_source.inter_frontier_eq] exact eqOn_empty _ _)).replaceEquiv (e.toPartialEquiv.disjointUnion e'.toPartialEquiv Hs Ht) (PartialEquiv.disjointUnion_eq_piecewise _ _ _ _).symm #align local_homeomorph.disjoint_union PartialHomeomorph.disjointUnion end Piecewise section Pi variable {ι : Type*} [Fintype ι] {Xi Yi : ι → Type*} [∀ i, TopologicalSpace (Xi i)] [∀ i, TopologicalSpace (Yi i)] (ei : ∀ i, PartialHomeomorph (Xi i) (Yi i)) /-- The product of a finite family of `PartialHomeomorph`s. -/ @[simps toPartialEquiv] def pi : PartialHomeomorph (∀ i, Xi i) (∀ i, Yi i) where toPartialEquiv := PartialEquiv.pi fun i => (ei i).toPartialEquiv open_source := isOpen_set_pi finite_univ fun i _ => (ei i).open_source open_target := isOpen_set_pi finite_univ fun i _ => (ei i).open_target continuousOn_toFun := continuousOn_pi.2 fun i => (ei i).continuousOn.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial continuousOn_invFun := continuousOn_pi.2 fun i => (ei i).continuousOn_symm.comp (continuous_apply _).continuousOn fun _f hf => hf i trivial #align local_homeomorph.pi PartialHomeomorph.pi end Pi section Continuity /-- Continuity within a set at a point can be read under right composition with a local homeomorphism, if the point is in its target -/ theorem continuousWithinAt_iff_continuousWithinAt_comp_right {f : β → γ} {s : Set β} {x : β} (h : x ∈ e.target) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (f ∘ e) (e ⁻¹' s) (e.symm x) := by simp_rw [ContinuousWithinAt, ← @tendsto_map'_iff _ _ _ _ e, e.map_nhdsWithin_preimage_eq (e.map_target h), (· ∘ ·), e.right_inv h] #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_right PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_right /-- Continuity at a point can be read under right composition with a partial homeomorphism, if the point is in its target -/ theorem continuousAt_iff_continuousAt_comp_right {f : β → γ} {x : β} (h : x ∈ e.target) : ContinuousAt f x ↔ ContinuousAt (f ∘ e) (e.symm x) := by rw [← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_right h, preimage_univ, continuousWithinAt_univ] #align local_homeomorph.continuous_at_iff_continuous_at_comp_right PartialHomeomorph.continuousAt_iff_continuousAt_comp_right /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the right is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_right {f : β → γ} {s : Set β} (h : s ⊆ e.target) : ContinuousOn f s ↔ ContinuousOn (f ∘ e) (e.source ∩ e ⁻¹' s) := by simp only [← e.symm_image_eq_source_inter_preimage h, ContinuousOn, ball_image_iff] refine' forall₂_congr fun x hx => _ rw [e.continuousWithinAt_iff_continuousWithinAt_comp_right (h hx), e.symm_image_eq_source_inter_preimage h, inter_comm, continuousWithinAt_inter] exact IsOpen.mem_nhds e.open_source (e.map_target (h hx)) #align local_homeomorph.continuous_on_iff_continuous_on_comp_right PartialHomeomorph.continuousOn_iff_continuousOn_comp_right /-- Continuity within a set at a point can be read under left composition with a local homeomorphism if a neighborhood of the initial point is sent to the source of the local homeomorphism-/ theorem continuousWithinAt_iff_continuousWithinAt_comp_left {f : γ → α} {s : Set γ} {x : γ} (hx : f x ∈ e.source) (h : f ⁻¹' e.source ∈ 𝓝[s] x) : ContinuousWithinAt f s x ↔ ContinuousWithinAt (e ∘ f) s x := by refine' ⟨(e.continuousAt hx).comp_continuousWithinAt, fun fe_cont => _⟩ rw [← continuousWithinAt_inter' h] at fe_cont ⊢ have : ContinuousWithinAt (e.symm ∘ e ∘ f) (s ∩ f ⁻¹' e.source) x := haveI : ContinuousWithinAt e.symm univ (e (f x)) := (e.continuousAt_symm (e.map_source hx)).continuousWithinAt ContinuousWithinAt.comp this fe_cont (subset_univ _) exact this.congr (fun y hy => by simp [e.left_inv hy.2]) (by simp [e.left_inv hx]) #align local_homeomorph.continuous_within_at_iff_continuous_within_at_comp_left PartialHomeomorph.continuousWithinAt_iff_continuousWithinAt_comp_left /-- Continuity at a point can be read under left composition with a partial homeomorphism if a neighborhood of the initial point is sent to the source of the partial homeomorphism-/ theorem continuousAt_iff_continuousAt_comp_left {f : γ → α} {x : γ} (h : f ⁻¹' e.source ∈ 𝓝 x) : ContinuousAt f x ↔ ContinuousAt (e ∘ f) x := by have hx : f x ∈ e.source := (mem_of_mem_nhds h : _) have h' : f ⁻¹' e.source ∈ 𝓝[univ] x := by rwa [nhdsWithin_univ] rw [← continuousWithinAt_univ, ← continuousWithinAt_univ, e.continuousWithinAt_iff_continuousWithinAt_comp_left hx h'] #align local_homeomorph.continuous_at_iff_continuous_at_comp_left PartialHomeomorph.continuousAt_iff_continuousAt_comp_left /-- A function is continuous on a set if and only if its composition with a partial homeomorphism on the left is continuous on the corresponding set. -/ theorem continuousOn_iff_continuousOn_comp_left {f : γ → α} {s : Set γ} (h : s ⊆ f ⁻¹' e.source) : ContinuousOn f s ↔ ContinuousOn (e ∘ f) s := forall₂_congr fun _x hx => e.continuousWithinAt_iff_continuousWithinAt_comp_left (h hx) (mem_of_superset self_mem_nhdsWithin h) #align local_homeomorph.continuous_on_iff_continuous_on_comp_left PartialHomeomorph.continuousOn_iff_continuousOn_comp_left /-- A function is continuous if and only if its composition with a partial homeomorphism on the left is continuous and its image is contained in the source. -/ theorem continuous_iff_continuous_comp_left {f : γ → α} (h : f ⁻¹' e.source = univ) : Continuous f ↔ Continuous (e ∘ f) := by simp only [continuous_iff_continuousOn_univ] exact e.continuousOn_iff_continuousOn_comp_left (Eq.symm h).subset #align local_homeomorph.continuous_iff_continuous_comp_left PartialHomeomorph.continuous_iff_continuous_comp_left end Continuity /-- The homeomorphism obtained by restricting a `PartialHomeomorph` to a subset of the source. -/ @[simps] def homeomorphOfImageSubsetSource {s : Set α} {t : Set β} (hs : s ⊆ e.source) (ht : e '' s = t) : s ≃ₜ t := have h₁ : MapsTo e s t := mapsTo'.2 ht.subset have h₂ : t ⊆ e.target := ht ▸ e.image_source_eq_target ▸ image_subset e hs have h₃ : MapsTo e.symm t s := ht ▸ ball_image_iff.2 <| fun _x hx => (e.left_inv (hs hx)).symm ▸ hx { toFun := MapsTo.restrict e s t h₁ invFun := MapsTo.restrict e.symm t s h₃ left_inv := fun a => Subtype.ext (e.left_inv (hs a.2)) right_inv := fun b => Subtype.eq <| e.right_inv (h₂ b.2) continuous_toFun := (e.continuousOn.mono hs).restrict_mapsTo h₁ continuous_invFun := (e.continuousOn_symm.mono h₂).restrict_mapsTo h₃ } #align local_homeomorph.homeomorph_of_image_subset_source PartialHomeomorph.homeomorphOfImageSubsetSource /-- A partial homeomorphism defines a homeomorphism between its source and target. -/ @[simps!] -- porting note: new `simps` def toHomeomorphSourceTarget : e.source ≃ₜ e.target := e.homeomorphOfImageSubsetSource subset_rfl e.image_source_eq_target #align local_homeomorph.to_homeomorph_source_target PartialHomeomorph.toHomeomorphSourceTarget theorem secondCountableTopology_source [SecondCountableTopology β] (e : PartialHomeomorph α β) : SecondCountableTopology e.source := e.toHomeomorphSourceTarget.secondCountableTopology #align local_homeomorph.second_countable_topology_source PartialHomeomorph.secondCountableTopology_source theorem nhds_eq_comap_inf_principal {x} (hx : x ∈ e.source) : 𝓝 x = comap e (𝓝 (e x)) ⊓ 𝓟 e.source := by lift x to e.source using hx rw [← e.open_source.nhdsWithin_eq x.2, ← map_nhds_subtype_val, ← map_comap_setCoe_val, e.toHomeomorphSourceTarget.nhds_eq_comap, nhds_subtype_eq_comap] simp only [(· ∘ ·), toHomeomorphSourceTarget_apply_coe, comap_comap] /-- If a partial homeomorphism has source and target equal to univ, then it induces a homeomorphism between the whole spaces, expressed in this definition. -/ @[simps (config := mfld_cfg) apply symm_apply] -- porting note: todo: add a `PartialEquiv` version def toHomeomorphOfSourceEqUnivTargetEqUniv (h : e.source = (univ : Set α)) (h' : e.target = univ) : α ≃ₜ β where toFun := e invFun := e.symm left_inv x := e.left_inv <| by rw [h] exact mem_univ _ right_inv x := e.right_inv <| by rw [h'] exact mem_univ _ continuous_toFun := by simpa only [continuous_iff_continuousOn_univ, h] using e.continuousOn continuous_invFun := by simpa only [continuous_iff_continuousOn_univ, h'] using e.continuousOn_symm #align local_homeomorph.to_homeomorph_of_source_eq_univ_target_eq_univ PartialHomeomorph.toHomeomorphOfSourceEqUnivTargetEqUniv theorem openEmbedding_restrict : OpenEmbedding (e.source.restrict e) := by refine openEmbedding_of_continuous_injective_open (e.continuousOn.comp_continuous continuous_subtype_val Subtype.prop) e.injOn.injective fun V hV ↦ ?_ rw [Set.restrict_eq, Set.image_comp] exact e.image_isOpen_of_isOpen (e.open_source.isOpenMap_subtype_val V hV) fun _ ⟨x, _, h⟩ ↦ h ▸ x.2 /-- A partial homeomorphism whose source is all of `α` defines an open embedding of `α` into `β`. The converse is also true; see `OpenEmbedding.toPartialHomeomorph`. -/ theorem to_openEmbedding (h : e.source = Set.univ) : OpenEmbedding e := e.openEmbedding_restrict.comp ((Homeomorph.setCongr h).trans <| Homeomorph.Set.univ α).symm.openEmbedding #align local_homeomorph.to_open_embedding PartialHomeomorph.to_openEmbedding end PartialHomeomorph namespace Homeomorph variable (e : α ≃ₜ β) (e' : β ≃ₜ γ) /- Register as simp lemmas that the fields of a partial homeomorphism built from a homeomorphism correspond to the fields of the original homeomorphism. -/ @[simp, mfld_simps] theorem refl_toPartialHomeomorph : (Homeomorph.refl α).toPartialHomeomorph = PartialHomeomorph.refl α := rfl #align homeomorph.refl_to_local_homeomorph Homeomorph.refl_toPartialHomeomorph @[simp, mfld_simps] theorem symm_toPartialHomeomorph : e.symm.toPartialHomeomorph = e.toPartialHomeomorph.symm := rfl #align homeomorph.symm_to_local_homeomorph Homeomorph.symm_toPartialHomeomorph @[simp, mfld_simps] theorem trans_toPartialHomeomorph : (e.trans e').toPartialHomeomorph = e.toPartialHomeomorph.trans e'.toPartialHomeomorph := PartialHomeomorph.toPartialEquiv_injective <| Equiv.trans_toPartialEquiv _ _ #align homeomorph.trans_to_local_homeomorph Homeomorph.trans_toPartialHomeomorph end Homeomorph namespace OpenEmbedding variable (f : α → β) (h : OpenEmbedding f) /-- An open embedding of `α` into `β`, with `α` nonempty, defines a partial homeomorphism whose source is all of `α`. The converse is also true; see `PartialHomeomorph.to_openEmbedding`. -/ @[simps! (config := mfld_cfg) apply source target] noncomputable def toPartialHomeomorph [Nonempty α] : PartialHomeomorph α β := PartialHomeomorph.ofContinuousOpen ((h.toEmbedding.inj.injOn univ).toPartialEquiv _ _) h.continuous.continuousOn h.isOpenMap isOpen_univ #align open_embedding.to_local_homeomorph OpenEmbedding.toPartialHomeomorph variable [Nonempty α] lemma toPartialHomeomorph_left_inv {x : α} : (h.toPartialHomeomorph f).symm (f x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.left_inv] exact Set.mem_univ _ lemma toPartialHomeomorph_right_inv {x : β} (hx : x ∈ Set.range f) : f ((h.toPartialHomeomorph f).symm x) = x := by rw [← congr_fun (h.toPartialHomeomorph_apply f), PartialHomeomorph.right_inv] rwa [toPartialHomeomorph_target] end OpenEmbedding namespace TopologicalSpace.Opens open TopologicalSpace variable (s : Opens α) [Nonempty s] /-- The inclusion of an open subset `s` of a space `α` into `α` is a partial homeomorphism from the subtype `s` to `α`. -/ noncomputable def localHomeomorphSubtypeCoe : PartialHomeomorph s α := OpenEmbedding.toPartialHomeomorph _ s.2.openEmbedding_subtype_val #align topological_space.opens.local_homeomorph_subtype_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_coe : (s.localHomeomorphSubtypeCoe : s → α) = (↑) := rfl #align topological_space.opens.local_homeomorph_subtype_coe_coe TopologicalSpace.Opens.localHomeomorphSubtypeCoe_coe @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_source : s.localHomeomorphSubtypeCoe.source = Set.univ := rfl #align topological_space.opens.local_homeomorph_subtype_coe_source TopologicalSpace.Opens.localHomeomorphSubtypeCoe_source @[simp, mfld_simps] theorem localHomeomorphSubtypeCoe_target : s.localHomeomorphSubtypeCoe.target = s := by simp only [localHomeomorphSubtypeCoe, Subtype.range_coe_subtype, mfld_simps] rfl #align topological_space.opens.local_homeomorph_subtype_coe_target TopologicalSpace.Opens.localHomeomorphSubtypeCoe_target end TopologicalSpace.Opens namespace PartialHomeomorph open TopologicalSpace variable (e : PartialHomeomorph α β) variable (s : Opens α) [Nonempty s] /-- The restriction of a partial homeomorphism `e` to an open subset `s` of the domain type produces a partial homeomorphism whose domain is the subtype `s`. -/ noncomputable def subtypeRestr : PartialHomeomorph s β := s.localHomeomorphSubtypeCoe.trans e #align local_homeomorph.subtype_restr PartialHomeomorph.subtypeRestr theorem subtypeRestr_def : e.subtypeRestr s = s.localHomeomorphSubtypeCoe.trans e := rfl #align local_homeomorph.subtype_restr_def PartialHomeomorph.subtypeRestr_def @[simp, mfld_simps] theorem subtypeRestr_coe : ((e.subtypeRestr s : PartialHomeomorph s β) : s → β) = Set.restrict ↑s (e : α → β) := rfl #align local_homeomorph.subtype_restr_coe PartialHomeomorph.subtypeRestr_coe @[simp, mfld_simps] theorem subtypeRestr_source : (e.subtypeRestr s).source = (↑) ⁻¹' e.source := by simp only [subtypeRestr_def, mfld_simps] #align local_homeomorph.subtype_restr_source PartialHomeomorph.subtypeRestr_source variable {s} theorem map_subtype_source {x : s} (hxe : (x : α) ∈ e.source): e x ∈ (e.subtypeRestr s).target := by refine' ⟨e.map_source hxe, _⟩ rw [s.localHomeomorphSubtypeCoe_target, mem_preimage, e.leftInvOn hxe] exact x.prop #align local_homeomorph.map_subtype_source PartialHomeomorph.map_subtype_source variable (s) /- This lemma characterizes the transition functions of an open subset in terms of the transition functions of the original space. -/ theorem subtypeRestr_symm_trans_subtypeRestr (f f' : PartialHomeomorph α β) : (f.subtypeRestr s).symm.trans (f'.subtypeRestr s) ≈ (f.symm.trans f').restr (f.target ∩ f.symm ⁻¹' s) := by simp only [subtypeRestr_def, trans_symm_eq_symm_trans_symm] have openness₁ : IsOpen (f.target ∩ f.symm ⁻¹' s) := f.isOpen_inter_preimage_symm s.2 rw [← ofSet_trans _ openness₁, ← trans_assoc, ← trans_assoc] refine' EqOnSource.trans' _ (eqOnSource_refl _) -- f' has been eliminated !!! have sets_identity : f.symm.source ∩ (f.target ∩ f.symm ⁻¹' s) = f.symm.source ∩ f.symm ⁻¹' s := by mfld_set_tac have openness₂ : IsOpen (s : Set α) := s.2 rw [ofSet_trans', sets_identity, ← trans_of_set' _ openness₂, trans_assoc] refine' EqOnSource.trans' (eqOnSource_refl _) _ -- f has been eliminated !!! refine' Setoid.trans (trans_symm_self s.localHomeomorphSubtypeCoe) _ simp only [mfld_simps, Setoid.refl] #align local_homeomorph.subtype_restr_symm_trans_subtype_restr PartialHomeomorph.subtypeRestr_symm_trans_subtypeRestr theorem subtypeRestr_symm_eqOn (U : Opens α) [Nonempty U] : EqOn e.symm (Subtype.val ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by intro y hy rw [eq_comm, eq_symm_apply _ _ hy.1] · change restrict _ e _ = _ rw [← subtypeRestr_coe, (e.subtypeRestr U).right_inv hy] · have := map_target _ hy; rwa [subtypeRestr_source] at this theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ · rw [← PartialHomeomorph.symm_target] apply PartialHomeomorph.map_source rw [PartialHomeomorph.symm_source] exact hyV · rw [V.localHomeomorphSubtypeCoe.right_inv hyV] show _ = U.localHomeomorphSubtypeCoe _
rw [U.localHomeomorphSubtypeCoe.right_inv hy.2]
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target := by set i := Set.inclusion hUV intro y hy dsimp [PartialHomeomorph.subtypeRestr_def] at hy ⊢ have hyV : e.symm y ∈ V.localHomeomorphSubtypeCoe.target := by rw [Opens.localHomeomorphSubtypeCoe_target] at hy ⊢ exact hUV hy.2 refine' V.localHomeomorphSubtypeCoe.injOn _ trivial _ · rw [← PartialHomeomorph.symm_target] apply PartialHomeomorph.map_source rw [PartialHomeomorph.symm_source] exact hyV · rw [V.localHomeomorphSubtypeCoe.right_inv hyV] show _ = U.localHomeomorphSubtypeCoe _
Mathlib.Topology.PartialHomeomorph.1460_0.xRULiNOId4c9Kju
theorem subtypeRestr_symm_eqOn_of_le {U V : Opens α} [Nonempty U] [Nonempty V] (hUV : U ≤ V) : EqOn (e.subtypeRestr V).symm (Set.inclusion hUV ∘ (e.subtypeRestr U).symm) (e.subtypeRestr U).target
Mathlib_Topology_PartialHomeomorph
R : Type u_1 inst✝ : CommSemiring R s : Multiset R ⊢ prod (map (fun r => X + C r) s) = ∑ j in Finset.range (card s + 1), C (esymm s j) * X ^ (card s - j)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by
classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub]
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by
Mathlib.RingTheory.Polynomial.Vieta.38_0.Pzl2ZiAMCjMzQGp
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R s : Multiset R ⊢ prod (map (fun r => X + C r) s) = ∑ j in Finset.range (card s + 1), C (esymm s j) * X ^ (card s - j)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical
rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)]
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical
Mathlib.RingTheory.Polynomial.Vieta.38_0.Pzl2ZiAMCjMzQGp
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R s : Multiset R ⊢ ∀ x ∈ range (card s + 1), sum (map ((fun p => prod (map (fun r => X) p.1) * prod (map (fun r => C r) p.2)) ∘ fun t => (s - t, t)) (powersetCard x s)) = C (esymm s x) * X ^ (card s - x)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)]
intro _ _
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)]
Mathlib.RingTheory.Polynomial.Vieta.38_0.Pzl2ZiAMCjMzQGp
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R s : Multiset R x✝ : ℕ a✝ : x✝ ∈ range (card s + 1) ⊢ sum (map ((fun p => prod (map (fun r => X) p.1) * prod (map (fun r => C r) p.2)) ∘ fun t => (s - t, t)) (powersetCard x✝ s)) = C (esymm s x✝) * X ^ (card s - x✝)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _
rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)]
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _
Mathlib.RingTheory.Polynomial.Vieta.38_0.Pzl2ZiAMCjMzQGp
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R s : Multiset R x✝ : ℕ a✝ : x✝ ∈ range (card s + 1) ⊢ ∀ x ∈ powersetCard x✝ s, ((fun p => prod (map (fun r => X) p.1) * prod (map (fun r => C r) p.2)) ∘ fun t => (s - t, t)) x = C (prod x) * X ^ (card s - x✝)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)]
intro s ht
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)]
Mathlib.RingTheory.Polynomial.Vieta.38_0.Pzl2ZiAMCjMzQGp
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R s✝ : Multiset R x✝ : ℕ a✝ : x✝ ∈ range (card s✝ + 1) s : Multiset R ht : s ∈ powersetCard x✝ s✝ ⊢ ((fun p => prod (map (fun r => X) p.1) * prod (map (fun r => C r) p.2)) ∘ fun t => (s✝ - t, t)) s = C (prod s) * X ^ (card s✝ - x✝)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht
rw [mem_powersetCard] at ht
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht
Mathlib.RingTheory.Polynomial.Vieta.38_0.Pzl2ZiAMCjMzQGp
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R s✝ : Multiset R x✝ : ℕ a✝ : x✝ ∈ range (card s✝ + 1) s : Multiset R ht : s ≤ s✝ ∧ card s = x✝ ⊢ ((fun p => prod (map (fun r => X) p.1) * prod (map (fun r => C r) p.2)) ∘ fun t => (s✝ - t, t)) s = C (prod s) * X ^ (card s✝ - x✝)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht
dsimp
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht
Mathlib.RingTheory.Polynomial.Vieta.38_0.Pzl2ZiAMCjMzQGp
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R s✝ : Multiset R x✝ : ℕ a✝ : x✝ ∈ range (card s✝ + 1) s : Multiset R ht : s ≤ s✝ ∧ card s = x✝ ⊢ prod (map (fun r => X) (s✝ - s)) * prod (map (fun r => C r) s) = C (prod s) * X ^ (card s✝ - x✝)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp
rw [prod_hom' s (Polynomial.C : R →+* R[X])]
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp
Mathlib.RingTheory.Polynomial.Vieta.38_0.Pzl2ZiAMCjMzQGp
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R s✝ : Multiset R x✝ : ℕ a✝ : x✝ ∈ range (card s✝ + 1) s : Multiset R ht : s ≤ s✝ ∧ card s = x✝ ⊢ prod (map (fun r => X) (s✝ - s)) * C (prod (map (fun r => r) s)) = C (prod s) * X ^ (card s✝ - x✝)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])]
simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub]
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])]
Mathlib.RingTheory.Polynomial.Vieta.38_0.Pzl2ZiAMCjMzQGp
/-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R s : Multiset R k : ℕ h : k ≤ card s ⊢ coeff (prod (map (fun r => X + C r) s)) k = esymm s (card s - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by
convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by
Mathlib.RingTheory.Polynomial.Vieta.57_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_3 R : Type u_1 inst✝ : CommSemiring R s : Multiset R k : ℕ h : k ≤ card s ⊢ esymm s (card s - k) = coeff (∑ j in Finset.range (card s + 1), C (esymm s j) * X ^ (card s - j)) k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1
simp_rw [finset_sum_coeff, coeff_C_mul_X_pow]
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1
Mathlib.RingTheory.Polynomial.Vieta.57_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_3 R : Type u_1 inst✝ : CommSemiring R s : Multiset R k : ℕ h : k ≤ card s ⊢ esymm s (card s - k) = ∑ x in Finset.range (card s + 1), if k = card s - x then esymm s x else 0
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow]
rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _]
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow]
Mathlib.RingTheory.Polynomial.Vieta.57_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_3 R : Type u_1 inst✝ : CommSemiring R s : Multiset R k : ℕ h : k ≤ card s ⊢ esymm s (card s - k) = if k = card s - (card s - k) then esymm s (card s - k) else 0
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] ·
rw [if_pos (Nat.sub_sub_self h).symm]
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] ·
Mathlib.RingTheory.Polynomial.Vieta.57_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_3 R : Type u_1 inst✝ : CommSemiring R s : Multiset R k : ℕ h : k ≤ card s ⊢ ∀ b ∈ Finset.range (card s + 1), b ≠ card s - k → (if k = card s - b then esymm s b else 0) = 0
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] ·
intro j hj1 hj2
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] ·
Mathlib.RingTheory.Polynomial.Vieta.57_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_3 R : Type u_1 inst✝ : CommSemiring R s : Multiset R k : ℕ h : k ≤ card s j : ℕ hj1 : j ∈ Finset.range (card s + 1) hj2 : j ≠ card s - k ⊢ (if k = card s - j then esymm s j else 0) = 0
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2
suffices k ≠ card s - j by rw [if_neg this]
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2
Mathlib.RingTheory.Polynomial.Vieta.57_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R s : Multiset R k : ℕ h : k ≤ card s j : ℕ hj1 : j ∈ Finset.range (card s + 1) hj2 : j ≠ card s - k this : k ≠ card s - j ⊢ (if k = card s - j then esymm s j else 0) = 0
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by
rw [if_neg this]
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by
Mathlib.RingTheory.Polynomial.Vieta.57_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_3 R : Type u_1 inst✝ : CommSemiring R s : Multiset R k : ℕ h : k ≤ card s j : ℕ hj1 : j ∈ Finset.range (card s + 1) hj2 : j ≠ card s - k ⊢ k ≠ card s - j
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] ·
intro hn
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] ·
Mathlib.RingTheory.Polynomial.Vieta.57_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_3 R : Type u_1 inst✝ : CommSemiring R s : Multiset R k : ℕ h : k ≤ card s j : ℕ hj1 : j ∈ Finset.range (card s + 1) hj2 : j ≠ card s - k hn : k = card s - j ⊢ False
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn
rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn
Mathlib.RingTheory.Polynomial.Vieta.57_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_3 R : Type u_1 inst✝ : CommSemiring R s : Multiset R k : ℕ h : k ≤ card s j : ℕ hj1 : j ∈ Finset.range (card s + 1) hj2 : j ≠ j hn : k = card s - j ⊢ False
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2
exact Ne.irrefl hj2
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2
Mathlib.RingTheory.Polynomial.Vieta.57_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R s : Multiset R k : ℕ h : k ≤ card s ⊢ card s - k ∈ Finset.range (card s + 1)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 ·
rw [Finset.mem_range]
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 ·
Mathlib.RingTheory.Polynomial.Vieta.57_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R s : Multiset R k : ℕ h : k ≤ card s ⊢ card s - k < card s + 1
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range]
exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k)
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range]
Mathlib.RingTheory.Polynomial.Vieta.57_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R σ : Type u_2 s : Multiset σ r : σ → R k : ℕ h : k ≤ card s ⊢ coeff (prod (map (fun i => X + C (r i)) s)) k = esymm (map r s) (card s - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by
erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff]
theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by
Mathlib.RingTheory.Polynomial.Vieta.75_0.Pzl2ZiAMCjMzQGp
theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R σ : Type u_2 s : Multiset σ r : σ → R k : ℕ h : k ≤ card s ⊢ esymm (map r s) (card (map r s) - k) = esymm (map r s) (card s - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;>
rw [s.card_map r]
theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;>
Mathlib.RingTheory.Polynomial.Vieta.75_0.Pzl2ZiAMCjMzQGp
theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case h R : Type u_1 inst✝ : CommSemiring R σ : Type u_2 s : Multiset σ r : σ → R k : ℕ h : k ≤ card s ⊢ k ≤ card (map r s)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;>
rw [s.card_map r]
theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;>
Mathlib.RingTheory.Polynomial.Vieta.75_0.Pzl2ZiAMCjMzQGp
theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case h R : Type u_1 inst✝ : CommSemiring R σ : Type u_2 s : Multiset σ r : σ → R k : ℕ h : k ≤ card s ⊢ k ≤ card s
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r];
assumption
theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r];
Mathlib.RingTheory.Polynomial.Vieta.75_0.Pzl2ZiAMCjMzQGp
theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R σ : Type u_2 s : Finset σ r : σ → R k : ℕ h : k ≤ Finset.card s ⊢ coeff (∏ i in s, (X + C (r i))) k = ∑ t in Finset.powersetCard (Finset.card s - k) s, ∏ i in t, r i
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by
rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val]
theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by
Mathlib.RingTheory.Polynomial.Vieta.81_0.Pzl2ZiAMCjMzQGp
theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommSemiring R σ : Type u_2 s : Finset σ r : σ → R k : ℕ h : k ≤ Finset.card s ⊢ ∑ t in Finset.powersetCard (card s.val - k) s, Finset.prod t r = ∑ t in Finset.powersetCard (Finset.card s - k) s, ∏ i in t, r i
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val]
rfl
theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val]
Mathlib.RingTheory.Polynomial.Vieta.81_0.Pzl2ZiAMCjMzQGp
theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ ⊢ esymm (map Neg.neg s) k = (-1) ^ k * esymm s k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by
rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)]
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by
Mathlib.RingTheory.Polynomial.Vieta.94_0.Pzl2ZiAMCjMzQGp
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ ⊢ ∀ x ∈ powersetCard k s, (prod ∘ map Neg.neg) x = (-1) ^ k * prod x
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)]
intro x hx
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)]
Mathlib.RingTheory.Polynomial.Vieta.94_0.Pzl2ZiAMCjMzQGp
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ x : Multiset R hx : x ∈ powersetCard k s ⊢ (prod ∘ map Neg.neg) x = (-1) ^ k * prod x
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx
rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const]
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx
Mathlib.RingTheory.Polynomial.Vieta.94_0.Pzl2ZiAMCjMzQGp
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ x : Multiset R hx : x ∈ powersetCard k s ⊢ (prod ∘ map Neg.neg) x = prod (map (Function.const R (-1)) x) * prod x
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const]
nth_rw 3 [← map_id' x]
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const]
Mathlib.RingTheory.Polynomial.Vieta.94_0.Pzl2ZiAMCjMzQGp
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ x : Multiset R hx : x ∈ powersetCard k s ⊢ (prod ∘ map Neg.neg) x = prod (map (Function.const R (-1)) x) * prod (map (fun x => x) x)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x]
rw [← prod_map_mul, map_congr (Eq.refl _)]
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x]
Mathlib.RingTheory.Polynomial.Vieta.94_0.Pzl2ZiAMCjMzQGp
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ x : Multiset R hx : x ∈ powersetCard k s ⊢ (prod ∘ map Neg.neg) x = prod (map ?m.868853 x) R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ x : Multiset R hx : x ∈ powersetCard k s ⊢ ∀ x_1 ∈ x, Function.const R (-1) x_1 * x_1 = ?m.868853 x_1 R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ x : Multiset R hx : x ∈ powersetCard k s ⊢ R → R
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];
rfl
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];
Mathlib.RingTheory.Polynomial.Vieta.94_0.Pzl2ZiAMCjMzQGp
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ x : Multiset R hx : x ∈ powersetCard k s ⊢ ∀ x_1 ∈ x, Function.const R (-1) x_1 * x_1 = -x_1
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl
exact fun z _ => neg_one_mul z
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl
Mathlib.RingTheory.Polynomial.Vieta.94_0.Pzl2ZiAMCjMzQGp
theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R ⊢ prod (map (fun t => X - C t) s) = ∑ j in Finset.range (card s + 1), (-1) ^ j * (C (esymm s j) * X ^ (card s - j))
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by
conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x]
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by
Mathlib.RingTheory.Polynomial.Vieta.104_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R | prod (map (fun t => X - C t) s)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs =>
congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x]
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs =>
Mathlib.RingTheory.Polynomial.Vieta.104_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R | prod (map (fun t => X - C t) s)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs =>
congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x]
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs =>
Mathlib.RingTheory.Polynomial.Vieta.104_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R | prod (map (fun t => X - C t) s)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs =>
congr
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs =>
Mathlib.RingTheory.Polynomial.Vieta.104_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
case a R : Type u_1 inst✝ : CommRing R s : Multiset R | map (fun t => X - C t) s
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr
congr
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr
Mathlib.RingTheory.Polynomial.Vieta.104_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
case a.f R : Type u_1 inst✝ : CommRing R s : Multiset R | fun t => X - C t case a.s R : Type u_1 inst✝ : CommRing R s : Multiset R | s
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr
ext x
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr
Mathlib.RingTheory.Polynomial.Vieta.104_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
case a.f.h R : Type u_1 inst✝ : CommRing R s : Multiset R x : R | X - C x case a.s R : Type u_1 inst✝ : CommRing R s : Multiset R | s
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x
rw [sub_eq_add_neg]
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x
Mathlib.RingTheory.Polynomial.Vieta.104_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
case a.f.h R : Type u_1 inst✝ : CommRing R s : Multiset R x : R | X + -C x case a.s R : Type u_1 inst✝ : CommRing R s : Multiset R | s
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg]
rw [← map_neg C x]
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg]
Mathlib.RingTheory.Polynomial.Vieta.104_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R ⊢ prod (map (fun x => X + C (-x)) s) = ∑ j in Finset.range (card s + 1), (-1) ^ j * (C (esymm s j) * X ^ (card s - j))
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x]
convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x]
Mathlib.RingTheory.Polynomial.Vieta.104_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_2 R : Type u_1 inst✝ : CommRing R s : Multiset R ⊢ prod (map (fun x => X + C (-x)) s) = prod (map (fun r => X + C r) (map (fun t => -t) s))
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 ·
rw [map_map]
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 ·
Mathlib.RingTheory.Polynomial.Vieta.104_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_2 R : Type u_1 inst✝ : CommRing R s : Multiset R ⊢ prod (map (fun x => X + C (-x)) s) = prod (map ((fun r => X + C r) ∘ fun t => -t) s)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map];
rfl
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map];
Mathlib.RingTheory.Polynomial.Vieta.104_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_3 R : Type u_1 inst✝ : CommRing R s : Multiset R ⊢ ∑ j in Finset.range (card s + 1), (-1) ^ j * (C (esymm s j) * X ^ (card s - j)) = ∑ j in Finset.range (card (map (fun t => -t) s) + 1), C (esymm (map (fun t => -t) s) j) * X ^ (card (map (fun t => -t) s) - j)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl ·
simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one]
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl ·
Mathlib.RingTheory.Polynomial.Vieta.104_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j))
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s ⊢ coeff (prod (map (fun t => X - C t) s)) k = (-1) ^ (card s - k) * esymm s (card s - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by
conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x]
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | coeff (prod (map (fun t => X - C t) s)) k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs =>
congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x]
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs =>
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | coeff (prod (map (fun t => X - C t) s)) k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs =>
congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x]
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs =>
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | coeff (prod (map (fun t => X - C t) s)) k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs =>
congr
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs =>
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case a R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | prod (map (fun t => X - C t) s) case a R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr
congr
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case a.a R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | map (fun t => X - C t) s case a R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr
congr
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case a.a.f R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | fun t => X - C t case a.a.s R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | s case a R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr
ext x
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case a.a.f.h R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s x : R | X - C x case a.a.s R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | s case a R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x
rw [sub_eq_add_neg]
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case a.a.f.h R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s x : R | X + -C x case a.a.s R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | s case a R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s | k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg]
rw [← map_neg C x]
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg]
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s ⊢ coeff (prod (map (fun x => X + C (-x)) s)) k = (-1) ^ (card s - k) * esymm s (card s - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x]
convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x]
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_2 R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s ⊢ coeff (prod (map (fun x => X + C (-x)) s)) k = coeff (prod (map (fun r => X + C r) (map (fun t => -t) s))) ?convert_1
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 ·
rw [map_map]
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 ·
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_2 R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s ⊢ coeff (prod (map (fun x => X + C (-x)) s)) k = coeff (prod (map ((fun r => X + C r) ∘ fun t => -t) s)) ?convert_1 case convert_1 R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s ⊢ ℕ
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map];
rfl
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map];
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_3 R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s ⊢ (-1) ^ (card s - k) * esymm s (card s - k) = esymm (map (fun t => -t) s) (card (map (fun t => -t) s) - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl ·
rw [esymm_neg, card_map]
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl ·
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
case convert_2 R : Type u_1 inst✝ : CommRing R s : Multiset R k : ℕ h : k ≤ card s ⊢ k ≤ card (map (fun t => -t) s)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] ·
rwa [card_map]
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] ·
Mathlib.RingTheory.Polynomial.Vieta.120_0.Pzl2ZiAMCjMzQGp
theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝¹ : CommRing R inst✝ : IsDomain R p : R[X] hroots : card (roots p) = natDegree p k : ℕ h : k ≤ natDegree p ⊢ coeff p k = leadingCoeff p * (-1) ^ (natDegree p - k) * esymm (roots p) (natDegree p - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by
conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots]
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by
Mathlib.RingTheory.Polynomial.Vieta.137_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝¹ : CommRing R inst✝ : IsDomain R p : R[X] hroots : card (roots p) = natDegree p k : ℕ h : k ≤ natDegree p | coeff p k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs =>
rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots]
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs =>
Mathlib.RingTheory.Polynomial.Vieta.137_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝¹ : CommRing R inst✝ : IsDomain R p : R[X] hroots : card (roots p) = natDegree p k : ℕ h : k ≤ natDegree p | coeff p k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs =>
rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots]
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs =>
Mathlib.RingTheory.Polynomial.Vieta.137_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝¹ : CommRing R inst✝ : IsDomain R p : R[X] hroots : card (roots p) = natDegree p k : ℕ h : k ≤ natDegree p | coeff p k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs =>
rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots]
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs =>
Mathlib.RingTheory.Polynomial.Vieta.137_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝¹ : CommRing R inst✝ : IsDomain R p : R[X] hroots : card (roots p) = natDegree p k : ℕ h : k ≤ natDegree p ⊢ coeff (C (leadingCoeff p) * prod (map (fun a => X - C a) (roots p))) k = leadingCoeff p * (-1) ^ (natDegree p - k) * esymm (roots p) (natDegree p - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots]
rw [coeff_C_mul, mul_assoc]
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots]
Mathlib.RingTheory.Polynomial.Vieta.137_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝¹ : CommRing R inst✝ : IsDomain R p : R[X] hroots : card (roots p) = natDegree p k : ℕ h : k ≤ natDegree p ⊢ leadingCoeff p * coeff (prod (map (fun a => X - C a) (roots p))) k = leadingCoeff p * ((-1) ^ (natDegree p - k) * esymm (roots p) (natDegree p - k))
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc];
congr
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc];
Mathlib.RingTheory.Polynomial.Vieta.137_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k)
Mathlib_RingTheory_Polynomial_Vieta
case e_a R : Type u_1 inst✝¹ : CommRing R inst✝ : IsDomain R p : R[X] hroots : card (roots p) = natDegree p k : ℕ h : k ≤ natDegree p ⊢ coeff (prod (map (fun a => X - C a) (roots p))) k = (-1) ^ (natDegree p - k) * esymm (roots p) (natDegree p - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr
have : k ≤ card (roots p) := by rw [hroots]; exact h
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr
Mathlib.RingTheory.Polynomial.Vieta.137_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝¹ : CommRing R inst✝ : IsDomain R p : R[X] hroots : card (roots p) = natDegree p k : ℕ h : k ≤ natDegree p ⊢ k ≤ card (roots p)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by
rw [hroots]
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by
Mathlib.RingTheory.Polynomial.Vieta.137_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 inst✝¹ : CommRing R inst✝ : IsDomain R p : R[X] hroots : card (roots p) = natDegree p k : ℕ h : k ≤ natDegree p ⊢ k ≤ natDegree p
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots];
exact h
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots];
Mathlib.RingTheory.Polynomial.Vieta.137_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k)
Mathlib_RingTheory_Polynomial_Vieta
case e_a R : Type u_1 inst✝¹ : CommRing R inst✝ : IsDomain R p : R[X] hroots : card (roots p) = natDegree p k : ℕ h : k ≤ natDegree p this : k ≤ card (roots p) ⊢ coeff (prod (map (fun a => X - C a) (roots p))) k = (-1) ^ (natDegree p - k) * esymm (roots p) (natDegree p - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h
convert p.roots.prod_X_sub_C_coeff this using 3
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h
Mathlib.RingTheory.Polynomial.Vieta.137_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_3.h.e'_5.h.e'_6 R : Type u_1 inst✝¹ : CommRing R inst✝ : IsDomain R p : R[X] hroots : card (roots p) = natDegree p k : ℕ h : k ≤ natDegree p this : k ≤ card (roots p) ⊢ natDegree p - k = card (roots p) - k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;>
rw [hroots]
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;>
Mathlib.RingTheory.Polynomial.Vieta.137_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_3.h.e'_6.h.e'_4 R : Type u_1 inst✝¹ : CommRing R inst✝ : IsDomain R p : R[X] hroots : card (roots p) = natDegree p k : ℕ h : k ≤ natDegree p this : k ≤ card (roots p) ⊢ natDegree p - k = card (roots p) - k
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;>
rw [hroots]
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;>
Mathlib.RingTheory.Polynomial.Vieta.137_0.Pzl2ZiAMCjMzQGp
/-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ ⊢ ∏ i : σ, (Polynomial.X + Polynomial.C (X i)) = ∑ j in range (Fintype.card σ + 1), Polynomial.C (esymm σ R j) * Polynomial.X ^ (Fintype.card σ - j)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by
let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R)
/-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by
Mathlib.RingTheory.Polynomial.Vieta.165_0.Pzl2ZiAMCjMzQGp
/-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val ⊢ ∏ i : σ, (Polynomial.X + Polynomial.C (X i)) = ∑ j in range (Fintype.card σ + 1), Polynomial.C (esymm σ R j) * Polynomial.X ^ (Fintype.card σ - j)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R)
have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def]
/-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R)
Mathlib.RingTheory.Polynomial.Vieta.165_0.Pzl2ZiAMCjMzQGp
/-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val ⊢ Fintype.card σ = Multiset.card s
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by
rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def]
/-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by
Mathlib.RingTheory.Polynomial.Vieta.165_0.Pzl2ZiAMCjMzQGp
/-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val this : Fintype.card σ = Multiset.card s ⊢ ∏ i : σ, (Polynomial.X + Polynomial.C (X i)) = ∑ j in range (Fintype.card σ + 1), Polynomial.C (esymm σ R j) * Polynomial.X ^ (Fintype.card σ - j)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def]
simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod]
/-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def]
Mathlib.RingTheory.Polynomial.Vieta.165_0.Pzl2ZiAMCjMzQGp
/-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val this : Fintype.card σ = Multiset.card s ⊢ Multiset.prod (Multiset.map (fun i => Polynomial.X + Polynomial.C (X i)) univ.val) = ∑ x in range (Multiset.card (Multiset.map (fun i => X i) univ.val) + 1), Polynomial.C (Multiset.esymm (Multiset.map X univ.val) x) * Polynomial.X ^ (Multiset.card (Multiset.map (fun i => X i) univ.val) - x)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod]
convert Multiset.prod_X_add_C_eq_sum_esymm s
/-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod]
Mathlib.RingTheory.Polynomial.Vieta.165_0.Pzl2ZiAMCjMzQGp
/-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_2.h.e'_3 R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val this : Fintype.card σ = Multiset.card s ⊢ Multiset.map (fun i => Polynomial.X + Polynomial.C (X i)) univ.val = Multiset.map (fun r => Polynomial.X + Polynomial.C r) s
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_eq_sum_esymm s
simp_rw [Multiset.map_map, Function.comp_apply]
/-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_eq_sum_esymm s
Mathlib.RingTheory.Polynomial.Vieta.165_0.Pzl2ZiAMCjMzQGp
/-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ k : ℕ h : k ≤ Fintype.card σ ⊢ Polynomial.coeff (∏ i : σ, (Polynomial.X + Polynomial.C (X i))) k = esymm σ R (Fintype.card σ - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_eq_sum_esymm s simp_rw [Multiset.map_map, Function.comp_apply] set_option linter.uppercaseLean3 false in #align mv_polynomial.prod_C_add_X_eq_sum_esymm MvPolynomial.prod_C_add_X_eq_sum_esymm theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by
let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R)
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by
Mathlib.RingTheory.Polynomial.Vieta.181_0.Pzl2ZiAMCjMzQGp
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ k : ℕ h : k ≤ Fintype.card σ s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val ⊢ Polynomial.coeff (∏ i : σ, (Polynomial.X + Polynomial.C (X i))) k = esymm σ R (Fintype.card σ - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_eq_sum_esymm s simp_rw [Multiset.map_map, Function.comp_apply] set_option linter.uppercaseLean3 false in #align mv_polynomial.prod_C_add_X_eq_sum_esymm MvPolynomial.prod_C_add_X_eq_sum_esymm theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R)
have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def]
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R)
Mathlib.RingTheory.Polynomial.Vieta.181_0.Pzl2ZiAMCjMzQGp
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ k : ℕ h : k ≤ Fintype.card σ s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val ⊢ Fintype.card σ = Multiset.card s
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_eq_sum_esymm s simp_rw [Multiset.map_map, Function.comp_apply] set_option linter.uppercaseLean3 false in #align mv_polynomial.prod_C_add_X_eq_sum_esymm MvPolynomial.prod_C_add_X_eq_sum_esymm theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by
rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def]
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by
Mathlib.RingTheory.Polynomial.Vieta.181_0.Pzl2ZiAMCjMzQGp
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ k : ℕ h : k ≤ Fintype.card σ s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val this : Fintype.card σ = Multiset.card s ⊢ Polynomial.coeff (∏ i : σ, (Polynomial.X + Polynomial.C (X i))) k = esymm σ R (Fintype.card σ - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_eq_sum_esymm s simp_rw [Multiset.map_map, Function.comp_apply] set_option linter.uppercaseLean3 false in #align mv_polynomial.prod_C_add_X_eq_sum_esymm MvPolynomial.prod_C_add_X_eq_sum_esymm theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def]
rw [this] at h ⊢
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def]
Mathlib.RingTheory.Polynomial.Vieta.181_0.Pzl2ZiAMCjMzQGp
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ k : ℕ s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val h : k ≤ Multiset.card s this : Fintype.card σ = Multiset.card s ⊢ Polynomial.coeff (∏ i : σ, (Polynomial.X + Polynomial.C (X i))) k = esymm σ R (Multiset.card s - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_eq_sum_esymm s simp_rw [Multiset.map_map, Function.comp_apply] set_option linter.uppercaseLean3 false in #align mv_polynomial.prod_C_add_X_eq_sum_esymm MvPolynomial.prod_C_add_X_eq_sum_esymm theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] rw [this] at h ⊢
rw [MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod]
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] rw [this] at h ⊢
Mathlib.RingTheory.Polynomial.Vieta.181_0.Pzl2ZiAMCjMzQGp
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k)
Mathlib_RingTheory_Polynomial_Vieta
R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ k : ℕ s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val h : k ≤ Multiset.card s this : Fintype.card σ = Multiset.card s ⊢ Polynomial.coeff (Multiset.prod (Multiset.map (fun i => Polynomial.X + Polynomial.C (X i)) univ.val)) k = Multiset.esymm (Multiset.map X univ.val) (Multiset.card s - k)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_eq_sum_esymm s simp_rw [Multiset.map_map, Function.comp_apply] set_option linter.uppercaseLean3 false in #align mv_polynomial.prod_C_add_X_eq_sum_esymm MvPolynomial.prod_C_add_X_eq_sum_esymm theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] rw [this] at h ⊢ rw [MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod]
convert Multiset.prod_X_add_C_coeff s h
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] rw [this] at h ⊢ rw [MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod]
Mathlib.RingTheory.Polynomial.Vieta.181_0.Pzl2ZiAMCjMzQGp
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_2.h.e'_3.h.e'_3 R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ k : ℕ s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val h : k ≤ Multiset.card s this : Fintype.card σ = Multiset.card s ⊢ Multiset.map (fun i => Polynomial.X + Polynomial.C (X i)) univ.val = Multiset.map (fun r => Polynomial.X + Polynomial.C r) s
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_eq_sum_esymm s simp_rw [Multiset.map_map, Function.comp_apply] set_option linter.uppercaseLean3 false in #align mv_polynomial.prod_C_add_X_eq_sum_esymm MvPolynomial.prod_C_add_X_eq_sum_esymm theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] rw [this] at h ⊢ rw [MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_coeff s h
dsimp
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] rw [this] at h ⊢ rw [MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_coeff s h
Mathlib.RingTheory.Polynomial.Vieta.181_0.Pzl2ZiAMCjMzQGp
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k)
Mathlib_RingTheory_Polynomial_Vieta
case h.e'_2.h.e'_3.h.e'_3 R : Type u_1 σ : Type u_2 inst✝¹ : CommSemiring R inst✝ : Fintype σ k : ℕ s : Multiset (MvPolynomial σ R) := Multiset.map (fun i => X i) univ.val h : k ≤ Multiset.card s this : Fintype.card σ = Multiset.card s ⊢ Multiset.map (fun i => Polynomial.X + Polynomial.C (X i)) univ.val = Multiset.map (fun r => Polynomial.X + Polynomial.C r) (Multiset.map (fun i => X i) univ.val)
/- Copyright (c) 2020 Hanting Zhang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hanting Zhang -/ import Mathlib.Data.Polynomial.Splits import Mathlib.RingTheory.MvPolynomial.Symmetric #align_import ring_theory.polynomial.vieta from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" /-! # Vieta's Formula The main result is `Multiset.prod_X_add_C_eq_sum_esymm`, which shows that the product of linear terms `X + λ` with `λ` in a `Multiset s` is equal to a linear combination of the symmetric functions `esymm s`. From this, we deduce `MvPolynomial.prod_X_add_C_eq_sum_esymm` which is the equivalent formula for the product of linear terms `X + X i` with `i` in a `Fintype σ` as a linear combination of the symmetric polynomials `esymm σ R j`. For `R` be an integral domain (so that `p.roots` is defined for any `p : R[X]` as a multiset), we derive `Polynomial.coeff_eq_esymm_roots_of_card`, the relationship between the coefficients and the roots of `p` for a polynomial `p` that splits (i.e. having as many roots as its degree). -/ open BigOperators Polynomial namespace Multiset open Polynomial section Semiring variable {R : Type*} [CommSemiring R] /-- A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .-/ theorem prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j in Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub] set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_eq_sum_esymm Multiset.prod_X_add_C_eq_sum_esymm /-- Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`. -/ theorem prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] · rw [if_pos (Nat.sub_sub_self h).symm] · intro j hj1 hj2 suffices k ≠ card s - j by rw [if_neg this] · intro hn rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2 exact Ne.irrefl hj2 · rw [Finset.mem_range] exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k) set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff Multiset.prod_X_add_C_coeff theorem prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by erw [← map_map (fun r => X + C r) r, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption set_option linter.uppercaseLean3 false in #align multiset.prod_X_add_C_coeff' Multiset.prod_X_add_C_coeff' theorem _root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ s.card) : (∏ i in s, (X + C (r i))).coeff k = ∑ t in s.powersetCard (s.card - k), ∏ i in t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl set_option linter.uppercaseLean3 false in #align finset.prod_X_add_C_coeff Finset.prod_X_add_C_coeff end Semiring section Ring variable {R : Type*} [CommRing R] theorem esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr (Eq.refl _)] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr (Eq.refl _)];rfl exact fun z _ => neg_one_mul z #align multiset.esymm_neg Multiset.esymm_neg theorem prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j in Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_eq_sum_esymm Multiset.prod_X_sub_X_eq_sum_esymm theorem prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map] set_option linter.uppercaseLean3 false in #align multiset.prod_X_sub_C_coeff Multiset.prod_X_sub_C_coeff /-- Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots] #align polynomial.coeff_eq_esymm_roots_of_card Polynomial.coeff_eq_esymm_roots_of_card /-- Vieta's formula for split polynomials over a field. -/ theorem _root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h #align polynomial.coeff_eq_esymm_roots_of_splits Polynomial.coeff_eq_esymm_roots_of_splits end Ring end Multiset section MvPolynomial open Finset Polynomial Fintype variable (R σ : Type*) [CommSemiring R] [Fintype σ] /-- A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`. -/ theorem MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j in range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_eq_sum_esymm s simp_rw [Multiset.map_map, Function.comp_apply] set_option linter.uppercaseLean3 false in #align mv_polynomial.prod_C_add_X_eq_sum_esymm MvPolynomial.prod_C_add_X_eq_sum_esymm theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] rw [this] at h ⊢ rw [MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_coeff s h dsimp
simp_rw [Multiset.map_map, Function.comp_apply]
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] rw [this] at h ⊢ rw [MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_coeff s h dsimp
Mathlib.RingTheory.Polynomial.Vieta.181_0.Pzl2ZiAMCjMzQGp
theorem MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k)
Mathlib_RingTheory_Polynomial_Vieta
ι : Sort u_1 V : Type u W : Type v G : SimpleGraph V v w : V hvw : Adj G v w v✝ w✝ : V h : (fun a b => ⟦(v, w)⟧ = ⟦(a, b)⟧) v✝ w✝ ⊢ Adj G v✝ w✝
/- Copyright (c) 2021 Hunter Monroe. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hunter Monroe, Kyle Miller, Alena Gusakov -/ import Mathlib.Combinatorics.SimpleGraph.Basic #align_import combinatorics.simple_graph.subgraph from "leanprover-community/mathlib"@"c6ef6387ede9983aee397d442974e61f89dfd87b" /-! # Subgraphs of a simple graph A subgraph of a simple graph consists of subsets of the graph's vertices and edges such that the endpoints of each edge are present in the vertex subset. The edge subset is formalized as a sub-relation of the adjacency relation of the simple graph. ## Main definitions * `Subgraph G` is the type of subgraphs of a `G : SimpleGraph V`. * `Subgraph.neighborSet`, `Subgraph.incidenceSet`, and `Subgraph.degree` are like their `SimpleGraph` counterparts, but they refer to vertices from `G` to avoid subtype coercions. * `Subgraph.coe` is the coercion from a `G' : Subgraph G` to a `SimpleGraph G'.verts`. (In Lean 3 this could not be a `Coe` instance since the destination type depends on `G'`.) * `Subgraph.IsSpanning` for whether a subgraph is a spanning subgraph and `Subgraph.IsInduced` for whether a subgraph is an induced subgraph. * Instances for `Lattice (Subgraph G)` and `BoundedOrder (Subgraph G)`. * `SimpleGraph.toSubgraph`: If a `SimpleGraph` is a subgraph of another, then you can turn it into a member of the larger graph's `SimpleGraph.Subgraph` type. * Graph homomorphisms from a subgraph to a graph (`Subgraph.map_top`) and between subgraphs (`Subgraph.map`). ## Implementation notes * Recall that subgraphs are not determined by their vertex sets, so `SetLike` does not apply to this kind of subobject. ## Todo * Images of graph homomorphisms as subgraphs. -/ universe u v namespace SimpleGraph /-- A subgraph of a `SimpleGraph` is a subset of vertices along with a restriction of the adjacency relation that is symmetric and is supported by the vertex subset. They also form a bounded lattice. Thinking of `V → V → Prop` as `Set (V × V)`, a set of darts (i.e., half-edges), then `Subgraph.adj_sub` is that the darts of a subgraph are a subset of the darts of `G`. -/ @[ext] structure Subgraph {V : Type u} (G : SimpleGraph V) where verts : Set V Adj : V → V → Prop adj_sub : ∀ {v w : V}, Adj v w → G.Adj v w edge_vert : ∀ {v w : V}, Adj v w → v ∈ verts symm : Symmetric Adj := by aesop_graph -- Porting note: Originally `by obviously` #align simple_graph.subgraph SimpleGraph.Subgraph initialize_simps_projections SimpleGraph.Subgraph (Adj → adj) variable {ι : Sort*} {V : Type u} {W : Type v} /-- The one-vertex subgraph. -/ @[simps] protected def singletonSubgraph (G : SimpleGraph V) (v : V) : G.Subgraph where verts := {v} Adj := ⊥ adj_sub := False.elim edge_vert := False.elim symm _ _ := False.elim #align simple_graph.singleton_subgraph SimpleGraph.singletonSubgraph /-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts := {v, w} Adj a b := ⟦(v, w)⟧ = ⟦(a, b)⟧ adj_sub h := by
rw [← G.mem_edgeSet, ← h]
/-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts := {v, w} Adj a b := ⟦(v, w)⟧ = ⟦(a, b)⟧ adj_sub h := by
Mathlib.Combinatorics.SimpleGraph.Subgraph.82_0.BlhiAiIDADcXv8t
/-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts
Mathlib_Combinatorics_SimpleGraph_Subgraph
ι : Sort u_1 V : Type u W : Type v G : SimpleGraph V v w : V hvw : Adj G v w v✝ w✝ : V h : (fun a b => ⟦(v, w)⟧ = ⟦(a, b)⟧) v✝ w✝ ⊢ ⟦(v, w)⟧ ∈ edgeSet G
/- Copyright (c) 2021 Hunter Monroe. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hunter Monroe, Kyle Miller, Alena Gusakov -/ import Mathlib.Combinatorics.SimpleGraph.Basic #align_import combinatorics.simple_graph.subgraph from "leanprover-community/mathlib"@"c6ef6387ede9983aee397d442974e61f89dfd87b" /-! # Subgraphs of a simple graph A subgraph of a simple graph consists of subsets of the graph's vertices and edges such that the endpoints of each edge are present in the vertex subset. The edge subset is formalized as a sub-relation of the adjacency relation of the simple graph. ## Main definitions * `Subgraph G` is the type of subgraphs of a `G : SimpleGraph V`. * `Subgraph.neighborSet`, `Subgraph.incidenceSet`, and `Subgraph.degree` are like their `SimpleGraph` counterparts, but they refer to vertices from `G` to avoid subtype coercions. * `Subgraph.coe` is the coercion from a `G' : Subgraph G` to a `SimpleGraph G'.verts`. (In Lean 3 this could not be a `Coe` instance since the destination type depends on `G'`.) * `Subgraph.IsSpanning` for whether a subgraph is a spanning subgraph and `Subgraph.IsInduced` for whether a subgraph is an induced subgraph. * Instances for `Lattice (Subgraph G)` and `BoundedOrder (Subgraph G)`. * `SimpleGraph.toSubgraph`: If a `SimpleGraph` is a subgraph of another, then you can turn it into a member of the larger graph's `SimpleGraph.Subgraph` type. * Graph homomorphisms from a subgraph to a graph (`Subgraph.map_top`) and between subgraphs (`Subgraph.map`). ## Implementation notes * Recall that subgraphs are not determined by their vertex sets, so `SetLike` does not apply to this kind of subobject. ## Todo * Images of graph homomorphisms as subgraphs. -/ universe u v namespace SimpleGraph /-- A subgraph of a `SimpleGraph` is a subset of vertices along with a restriction of the adjacency relation that is symmetric and is supported by the vertex subset. They also form a bounded lattice. Thinking of `V → V → Prop` as `Set (V × V)`, a set of darts (i.e., half-edges), then `Subgraph.adj_sub` is that the darts of a subgraph are a subset of the darts of `G`. -/ @[ext] structure Subgraph {V : Type u} (G : SimpleGraph V) where verts : Set V Adj : V → V → Prop adj_sub : ∀ {v w : V}, Adj v w → G.Adj v w edge_vert : ∀ {v w : V}, Adj v w → v ∈ verts symm : Symmetric Adj := by aesop_graph -- Porting note: Originally `by obviously` #align simple_graph.subgraph SimpleGraph.Subgraph initialize_simps_projections SimpleGraph.Subgraph (Adj → adj) variable {ι : Sort*} {V : Type u} {W : Type v} /-- The one-vertex subgraph. -/ @[simps] protected def singletonSubgraph (G : SimpleGraph V) (v : V) : G.Subgraph where verts := {v} Adj := ⊥ adj_sub := False.elim edge_vert := False.elim symm _ _ := False.elim #align simple_graph.singleton_subgraph SimpleGraph.singletonSubgraph /-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts := {v, w} Adj a b := ⟦(v, w)⟧ = ⟦(a, b)⟧ adj_sub h := by rw [← G.mem_edgeSet, ← h]
exact hvw
/-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts := {v, w} Adj a b := ⟦(v, w)⟧ = ⟦(a, b)⟧ adj_sub h := by rw [← G.mem_edgeSet, ← h]
Mathlib.Combinatorics.SimpleGraph.Subgraph.82_0.BlhiAiIDADcXv8t
/-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts
Mathlib_Combinatorics_SimpleGraph_Subgraph
ι : Sort u_1 V : Type u W : Type v G : SimpleGraph V v w : V hvw : Adj G v w a b : V h : (fun a b => ⟦(v, w)⟧ = ⟦(a, b)⟧) a b ⊢ a ∈ {v, w}
/- Copyright (c) 2021 Hunter Monroe. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hunter Monroe, Kyle Miller, Alena Gusakov -/ import Mathlib.Combinatorics.SimpleGraph.Basic #align_import combinatorics.simple_graph.subgraph from "leanprover-community/mathlib"@"c6ef6387ede9983aee397d442974e61f89dfd87b" /-! # Subgraphs of a simple graph A subgraph of a simple graph consists of subsets of the graph's vertices and edges such that the endpoints of each edge are present in the vertex subset. The edge subset is formalized as a sub-relation of the adjacency relation of the simple graph. ## Main definitions * `Subgraph G` is the type of subgraphs of a `G : SimpleGraph V`. * `Subgraph.neighborSet`, `Subgraph.incidenceSet`, and `Subgraph.degree` are like their `SimpleGraph` counterparts, but they refer to vertices from `G` to avoid subtype coercions. * `Subgraph.coe` is the coercion from a `G' : Subgraph G` to a `SimpleGraph G'.verts`. (In Lean 3 this could not be a `Coe` instance since the destination type depends on `G'`.) * `Subgraph.IsSpanning` for whether a subgraph is a spanning subgraph and `Subgraph.IsInduced` for whether a subgraph is an induced subgraph. * Instances for `Lattice (Subgraph G)` and `BoundedOrder (Subgraph G)`. * `SimpleGraph.toSubgraph`: If a `SimpleGraph` is a subgraph of another, then you can turn it into a member of the larger graph's `SimpleGraph.Subgraph` type. * Graph homomorphisms from a subgraph to a graph (`Subgraph.map_top`) and between subgraphs (`Subgraph.map`). ## Implementation notes * Recall that subgraphs are not determined by their vertex sets, so `SetLike` does not apply to this kind of subobject. ## Todo * Images of graph homomorphisms as subgraphs. -/ universe u v namespace SimpleGraph /-- A subgraph of a `SimpleGraph` is a subset of vertices along with a restriction of the adjacency relation that is symmetric and is supported by the vertex subset. They also form a bounded lattice. Thinking of `V → V → Prop` as `Set (V × V)`, a set of darts (i.e., half-edges), then `Subgraph.adj_sub` is that the darts of a subgraph are a subset of the darts of `G`. -/ @[ext] structure Subgraph {V : Type u} (G : SimpleGraph V) where verts : Set V Adj : V → V → Prop adj_sub : ∀ {v w : V}, Adj v w → G.Adj v w edge_vert : ∀ {v w : V}, Adj v w → v ∈ verts symm : Symmetric Adj := by aesop_graph -- Porting note: Originally `by obviously` #align simple_graph.subgraph SimpleGraph.Subgraph initialize_simps_projections SimpleGraph.Subgraph (Adj → adj) variable {ι : Sort*} {V : Type u} {W : Type v} /-- The one-vertex subgraph. -/ @[simps] protected def singletonSubgraph (G : SimpleGraph V) (v : V) : G.Subgraph where verts := {v} Adj := ⊥ adj_sub := False.elim edge_vert := False.elim symm _ _ := False.elim #align simple_graph.singleton_subgraph SimpleGraph.singletonSubgraph /-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts := {v, w} Adj a b := ⟦(v, w)⟧ = ⟦(a, b)⟧ adj_sub h := by rw [← G.mem_edgeSet, ← h] exact hvw edge_vert {a b} h := by
apply_fun fun e ↦ a ∈ e at h
/-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts := {v, w} Adj a b := ⟦(v, w)⟧ = ⟦(a, b)⟧ adj_sub h := by rw [← G.mem_edgeSet, ← h] exact hvw edge_vert {a b} h := by
Mathlib.Combinatorics.SimpleGraph.Subgraph.82_0.BlhiAiIDADcXv8t
/-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts
Mathlib_Combinatorics_SimpleGraph_Subgraph
ι : Sort u_1 V : Type u W : Type v G : SimpleGraph V v w : V hvw : Adj G v w a b : V h : (a ∈ ⟦(v, w)⟧) = (a ∈ ⟦(a, b)⟧) ⊢ a ∈ {v, w}
/- Copyright (c) 2021 Hunter Monroe. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hunter Monroe, Kyle Miller, Alena Gusakov -/ import Mathlib.Combinatorics.SimpleGraph.Basic #align_import combinatorics.simple_graph.subgraph from "leanprover-community/mathlib"@"c6ef6387ede9983aee397d442974e61f89dfd87b" /-! # Subgraphs of a simple graph A subgraph of a simple graph consists of subsets of the graph's vertices and edges such that the endpoints of each edge are present in the vertex subset. The edge subset is formalized as a sub-relation of the adjacency relation of the simple graph. ## Main definitions * `Subgraph G` is the type of subgraphs of a `G : SimpleGraph V`. * `Subgraph.neighborSet`, `Subgraph.incidenceSet`, and `Subgraph.degree` are like their `SimpleGraph` counterparts, but they refer to vertices from `G` to avoid subtype coercions. * `Subgraph.coe` is the coercion from a `G' : Subgraph G` to a `SimpleGraph G'.verts`. (In Lean 3 this could not be a `Coe` instance since the destination type depends on `G'`.) * `Subgraph.IsSpanning` for whether a subgraph is a spanning subgraph and `Subgraph.IsInduced` for whether a subgraph is an induced subgraph. * Instances for `Lattice (Subgraph G)` and `BoundedOrder (Subgraph G)`. * `SimpleGraph.toSubgraph`: If a `SimpleGraph` is a subgraph of another, then you can turn it into a member of the larger graph's `SimpleGraph.Subgraph` type. * Graph homomorphisms from a subgraph to a graph (`Subgraph.map_top`) and between subgraphs (`Subgraph.map`). ## Implementation notes * Recall that subgraphs are not determined by their vertex sets, so `SetLike` does not apply to this kind of subobject. ## Todo * Images of graph homomorphisms as subgraphs. -/ universe u v namespace SimpleGraph /-- A subgraph of a `SimpleGraph` is a subset of vertices along with a restriction of the adjacency relation that is symmetric and is supported by the vertex subset. They also form a bounded lattice. Thinking of `V → V → Prop` as `Set (V × V)`, a set of darts (i.e., half-edges), then `Subgraph.adj_sub` is that the darts of a subgraph are a subset of the darts of `G`. -/ @[ext] structure Subgraph {V : Type u} (G : SimpleGraph V) where verts : Set V Adj : V → V → Prop adj_sub : ∀ {v w : V}, Adj v w → G.Adj v w edge_vert : ∀ {v w : V}, Adj v w → v ∈ verts symm : Symmetric Adj := by aesop_graph -- Porting note: Originally `by obviously` #align simple_graph.subgraph SimpleGraph.Subgraph initialize_simps_projections SimpleGraph.Subgraph (Adj → adj) variable {ι : Sort*} {V : Type u} {W : Type v} /-- The one-vertex subgraph. -/ @[simps] protected def singletonSubgraph (G : SimpleGraph V) (v : V) : G.Subgraph where verts := {v} Adj := ⊥ adj_sub := False.elim edge_vert := False.elim symm _ _ := False.elim #align simple_graph.singleton_subgraph SimpleGraph.singletonSubgraph /-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts := {v, w} Adj a b := ⟦(v, w)⟧ = ⟦(a, b)⟧ adj_sub h := by rw [← G.mem_edgeSet, ← h] exact hvw edge_vert {a b} h := by apply_fun fun e ↦ a ∈ e at h
simp only [Sym2.mem_iff, true_or, eq_iff_iff, iff_true] at h
/-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts := {v, w} Adj a b := ⟦(v, w)⟧ = ⟦(a, b)⟧ adj_sub h := by rw [← G.mem_edgeSet, ← h] exact hvw edge_vert {a b} h := by apply_fun fun e ↦ a ∈ e at h
Mathlib.Combinatorics.SimpleGraph.Subgraph.82_0.BlhiAiIDADcXv8t
/-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts
Mathlib_Combinatorics_SimpleGraph_Subgraph
ι : Sort u_1 V : Type u W : Type v G : SimpleGraph V v w : V hvw : Adj G v w a b : V h : a = v ∨ a = w ⊢ a ∈ {v, w}
/- Copyright (c) 2021 Hunter Monroe. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hunter Monroe, Kyle Miller, Alena Gusakov -/ import Mathlib.Combinatorics.SimpleGraph.Basic #align_import combinatorics.simple_graph.subgraph from "leanprover-community/mathlib"@"c6ef6387ede9983aee397d442974e61f89dfd87b" /-! # Subgraphs of a simple graph A subgraph of a simple graph consists of subsets of the graph's vertices and edges such that the endpoints of each edge are present in the vertex subset. The edge subset is formalized as a sub-relation of the adjacency relation of the simple graph. ## Main definitions * `Subgraph G` is the type of subgraphs of a `G : SimpleGraph V`. * `Subgraph.neighborSet`, `Subgraph.incidenceSet`, and `Subgraph.degree` are like their `SimpleGraph` counterparts, but they refer to vertices from `G` to avoid subtype coercions. * `Subgraph.coe` is the coercion from a `G' : Subgraph G` to a `SimpleGraph G'.verts`. (In Lean 3 this could not be a `Coe` instance since the destination type depends on `G'`.) * `Subgraph.IsSpanning` for whether a subgraph is a spanning subgraph and `Subgraph.IsInduced` for whether a subgraph is an induced subgraph. * Instances for `Lattice (Subgraph G)` and `BoundedOrder (Subgraph G)`. * `SimpleGraph.toSubgraph`: If a `SimpleGraph` is a subgraph of another, then you can turn it into a member of the larger graph's `SimpleGraph.Subgraph` type. * Graph homomorphisms from a subgraph to a graph (`Subgraph.map_top`) and between subgraphs (`Subgraph.map`). ## Implementation notes * Recall that subgraphs are not determined by their vertex sets, so `SetLike` does not apply to this kind of subobject. ## Todo * Images of graph homomorphisms as subgraphs. -/ universe u v namespace SimpleGraph /-- A subgraph of a `SimpleGraph` is a subset of vertices along with a restriction of the adjacency relation that is symmetric and is supported by the vertex subset. They also form a bounded lattice. Thinking of `V → V → Prop` as `Set (V × V)`, a set of darts (i.e., half-edges), then `Subgraph.adj_sub` is that the darts of a subgraph are a subset of the darts of `G`. -/ @[ext] structure Subgraph {V : Type u} (G : SimpleGraph V) where verts : Set V Adj : V → V → Prop adj_sub : ∀ {v w : V}, Adj v w → G.Adj v w edge_vert : ∀ {v w : V}, Adj v w → v ∈ verts symm : Symmetric Adj := by aesop_graph -- Porting note: Originally `by obviously` #align simple_graph.subgraph SimpleGraph.Subgraph initialize_simps_projections SimpleGraph.Subgraph (Adj → adj) variable {ι : Sort*} {V : Type u} {W : Type v} /-- The one-vertex subgraph. -/ @[simps] protected def singletonSubgraph (G : SimpleGraph V) (v : V) : G.Subgraph where verts := {v} Adj := ⊥ adj_sub := False.elim edge_vert := False.elim symm _ _ := False.elim #align simple_graph.singleton_subgraph SimpleGraph.singletonSubgraph /-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts := {v, w} Adj a b := ⟦(v, w)⟧ = ⟦(a, b)⟧ adj_sub h := by rw [← G.mem_edgeSet, ← h] exact hvw edge_vert {a b} h := by apply_fun fun e ↦ a ∈ e at h simp only [Sym2.mem_iff, true_or, eq_iff_iff, iff_true] at h
exact h
/-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts := {v, w} Adj a b := ⟦(v, w)⟧ = ⟦(a, b)⟧ adj_sub h := by rw [← G.mem_edgeSet, ← h] exact hvw edge_vert {a b} h := by apply_fun fun e ↦ a ∈ e at h simp only [Sym2.mem_iff, true_or, eq_iff_iff, iff_true] at h
Mathlib.Combinatorics.SimpleGraph.Subgraph.82_0.BlhiAiIDADcXv8t
/-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts
Mathlib_Combinatorics_SimpleGraph_Subgraph
ι : Sort u_1 V : Type u W : Type v G : SimpleGraph V G₁ G₂ : Subgraph G a b : V ⊢ Subgraph.spanningCoe G₁ = Subgraph.spanningCoe G₂ ↔ G₁.Adj = G₂.Adj
/- Copyright (c) 2021 Hunter Monroe. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hunter Monroe, Kyle Miller, Alena Gusakov -/ import Mathlib.Combinatorics.SimpleGraph.Basic #align_import combinatorics.simple_graph.subgraph from "leanprover-community/mathlib"@"c6ef6387ede9983aee397d442974e61f89dfd87b" /-! # Subgraphs of a simple graph A subgraph of a simple graph consists of subsets of the graph's vertices and edges such that the endpoints of each edge are present in the vertex subset. The edge subset is formalized as a sub-relation of the adjacency relation of the simple graph. ## Main definitions * `Subgraph G` is the type of subgraphs of a `G : SimpleGraph V`. * `Subgraph.neighborSet`, `Subgraph.incidenceSet`, and `Subgraph.degree` are like their `SimpleGraph` counterparts, but they refer to vertices from `G` to avoid subtype coercions. * `Subgraph.coe` is the coercion from a `G' : Subgraph G` to a `SimpleGraph G'.verts`. (In Lean 3 this could not be a `Coe` instance since the destination type depends on `G'`.) * `Subgraph.IsSpanning` for whether a subgraph is a spanning subgraph and `Subgraph.IsInduced` for whether a subgraph is an induced subgraph. * Instances for `Lattice (Subgraph G)` and `BoundedOrder (Subgraph G)`. * `SimpleGraph.toSubgraph`: If a `SimpleGraph` is a subgraph of another, then you can turn it into a member of the larger graph's `SimpleGraph.Subgraph` type. * Graph homomorphisms from a subgraph to a graph (`Subgraph.map_top`) and between subgraphs (`Subgraph.map`). ## Implementation notes * Recall that subgraphs are not determined by their vertex sets, so `SetLike` does not apply to this kind of subobject. ## Todo * Images of graph homomorphisms as subgraphs. -/ universe u v namespace SimpleGraph /-- A subgraph of a `SimpleGraph` is a subset of vertices along with a restriction of the adjacency relation that is symmetric and is supported by the vertex subset. They also form a bounded lattice. Thinking of `V → V → Prop` as `Set (V × V)`, a set of darts (i.e., half-edges), then `Subgraph.adj_sub` is that the darts of a subgraph are a subset of the darts of `G`. -/ @[ext] structure Subgraph {V : Type u} (G : SimpleGraph V) where verts : Set V Adj : V → V → Prop adj_sub : ∀ {v w : V}, Adj v w → G.Adj v w edge_vert : ∀ {v w : V}, Adj v w → v ∈ verts symm : Symmetric Adj := by aesop_graph -- Porting note: Originally `by obviously` #align simple_graph.subgraph SimpleGraph.Subgraph initialize_simps_projections SimpleGraph.Subgraph (Adj → adj) variable {ι : Sort*} {V : Type u} {W : Type v} /-- The one-vertex subgraph. -/ @[simps] protected def singletonSubgraph (G : SimpleGraph V) (v : V) : G.Subgraph where verts := {v} Adj := ⊥ adj_sub := False.elim edge_vert := False.elim symm _ _ := False.elim #align simple_graph.singleton_subgraph SimpleGraph.singletonSubgraph /-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts := {v, w} Adj a b := ⟦(v, w)⟧ = ⟦(a, b)⟧ adj_sub h := by rw [← G.mem_edgeSet, ← h] exact hvw edge_vert {a b} h := by apply_fun fun e ↦ a ∈ e at h simp only [Sym2.mem_iff, true_or, eq_iff_iff, iff_true] at h exact h #align simple_graph.subgraph_of_adj SimpleGraph.subgraphOfAdj namespace Subgraph variable {G : SimpleGraph V} {G₁ G₂ : G.Subgraph} {a b : V} protected theorem loopless (G' : Subgraph G) : Irreflexive G'.Adj := fun v h ↦ G.loopless v (G'.adj_sub h) #align simple_graph.subgraph.loopless SimpleGraph.Subgraph.loopless theorem adj_comm (G' : Subgraph G) (v w : V) : G'.Adj v w ↔ G'.Adj w v := ⟨fun x ↦ G'.symm x, fun x ↦ G'.symm x⟩ #align simple_graph.subgraph.adj_comm SimpleGraph.Subgraph.adj_comm @[symm] theorem adj_symm (G' : Subgraph G) {u v : V} (h : G'.Adj u v) : G'.Adj v u := G'.symm h #align simple_graph.subgraph.adj_symm SimpleGraph.Subgraph.adj_symm protected theorem Adj.symm {G' : Subgraph G} {u v : V} (h : G'.Adj u v) : G'.Adj v u := G'.symm h #align simple_graph.subgraph.adj.symm SimpleGraph.Subgraph.Adj.symm protected theorem Adj.adj_sub {H : G.Subgraph} {u v : V} (h : H.Adj u v) : G.Adj u v := H.adj_sub h #align simple_graph.subgraph.adj.adj_sub SimpleGraph.Subgraph.Adj.adj_sub protected theorem Adj.fst_mem {H : G.Subgraph} {u v : V} (h : H.Adj u v) : u ∈ H.verts := H.edge_vert h #align simple_graph.subgraph.adj.fst_mem SimpleGraph.Subgraph.Adj.fst_mem protected theorem Adj.snd_mem {H : G.Subgraph} {u v : V} (h : H.Adj u v) : v ∈ H.verts := h.symm.fst_mem #align simple_graph.subgraph.adj.snd_mem SimpleGraph.Subgraph.Adj.snd_mem protected theorem Adj.ne {H : G.Subgraph} {u v : V} (h : H.Adj u v) : u ≠ v := h.adj_sub.ne #align simple_graph.subgraph.adj.ne SimpleGraph.Subgraph.Adj.ne /-- Coercion from `G' : Subgraph G` to a `SimpleGraph G'.verts`. -/ @[simps] protected def coe (G' : Subgraph G) : SimpleGraph G'.verts where Adj v w := G'.Adj v w symm _ _ h := G'.symm h loopless v h := loopless G v (G'.adj_sub h) #align simple_graph.subgraph.coe SimpleGraph.Subgraph.coe @[simp] theorem coe_adj_sub (G' : Subgraph G) (u v : G'.verts) (h : G'.coe.Adj u v) : G.Adj u v := G'.adj_sub h #align simple_graph.subgraph.coe_adj_sub SimpleGraph.Subgraph.coe_adj_sub -- Given `h : H.Adj u v`, then `h.coe : H.coe.Adj ⟨u, _⟩ ⟨v, _⟩`. protected theorem Adj.coe {H : G.Subgraph} {u v : V} (h : H.Adj u v) : H.coe.Adj ⟨u, H.edge_vert h⟩ ⟨v, H.edge_vert h.symm⟩ := h #align simple_graph.subgraph.adj.coe SimpleGraph.Subgraph.Adj.coe /-- A subgraph is called a *spanning subgraph* if it contains all the vertices of `G`. -/ def IsSpanning (G' : Subgraph G) : Prop := ∀ v : V, v ∈ G'.verts #align simple_graph.subgraph.is_spanning SimpleGraph.Subgraph.IsSpanning theorem isSpanning_iff {G' : Subgraph G} : G'.IsSpanning ↔ G'.verts = Set.univ := Set.eq_univ_iff_forall.symm #align simple_graph.subgraph.is_spanning_iff SimpleGraph.Subgraph.isSpanning_iff /-- Coercion from `Subgraph G` to `SimpleGraph V`. If `G'` is a spanning subgraph, then `G'.spanningCoe` yields an isomorphic graph. In general, this adds in all vertices from `V` as isolated vertices. -/ @[simps] protected def spanningCoe (G' : Subgraph G) : SimpleGraph V where Adj := G'.Adj symm := G'.symm loopless v hv := G.loopless v (G'.adj_sub hv) #align simple_graph.subgraph.spanning_coe SimpleGraph.Subgraph.spanningCoe @[simp] theorem Adj.of_spanningCoe {G' : Subgraph G} {u v : G'.verts} (h : G'.spanningCoe.Adj u v) : G.Adj u v := G'.adj_sub h #align simple_graph.subgraph.adj.of_spanning_coe SimpleGraph.Subgraph.Adj.of_spanningCoe theorem spanningCoe_inj : G₁.spanningCoe = G₂.spanningCoe ↔ G₁.Adj = G₂.Adj := by
simp [Subgraph.spanningCoe]
theorem spanningCoe_inj : G₁.spanningCoe = G₂.spanningCoe ↔ G₁.Adj = G₂.Adj := by
Mathlib.Combinatorics.SimpleGraph.Subgraph.176_0.BlhiAiIDADcXv8t
theorem spanningCoe_inj : G₁.spanningCoe = G₂.spanningCoe ↔ G₁.Adj = G₂.Adj
Mathlib_Combinatorics_SimpleGraph_Subgraph
ι : Sort u_1 V : Type u W : Type v G : SimpleGraph V G₁ G₂ : Subgraph G a b : V G' : Subgraph G e : Sym2 V v : V he : e ∈ edgeSet G' hv : v ∈ e ⊢ v ∈ G'.verts
/- Copyright (c) 2021 Hunter Monroe. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Hunter Monroe, Kyle Miller, Alena Gusakov -/ import Mathlib.Combinatorics.SimpleGraph.Basic #align_import combinatorics.simple_graph.subgraph from "leanprover-community/mathlib"@"c6ef6387ede9983aee397d442974e61f89dfd87b" /-! # Subgraphs of a simple graph A subgraph of a simple graph consists of subsets of the graph's vertices and edges such that the endpoints of each edge are present in the vertex subset. The edge subset is formalized as a sub-relation of the adjacency relation of the simple graph. ## Main definitions * `Subgraph G` is the type of subgraphs of a `G : SimpleGraph V`. * `Subgraph.neighborSet`, `Subgraph.incidenceSet`, and `Subgraph.degree` are like their `SimpleGraph` counterparts, but they refer to vertices from `G` to avoid subtype coercions. * `Subgraph.coe` is the coercion from a `G' : Subgraph G` to a `SimpleGraph G'.verts`. (In Lean 3 this could not be a `Coe` instance since the destination type depends on `G'`.) * `Subgraph.IsSpanning` for whether a subgraph is a spanning subgraph and `Subgraph.IsInduced` for whether a subgraph is an induced subgraph. * Instances for `Lattice (Subgraph G)` and `BoundedOrder (Subgraph G)`. * `SimpleGraph.toSubgraph`: If a `SimpleGraph` is a subgraph of another, then you can turn it into a member of the larger graph's `SimpleGraph.Subgraph` type. * Graph homomorphisms from a subgraph to a graph (`Subgraph.map_top`) and between subgraphs (`Subgraph.map`). ## Implementation notes * Recall that subgraphs are not determined by their vertex sets, so `SetLike` does not apply to this kind of subobject. ## Todo * Images of graph homomorphisms as subgraphs. -/ universe u v namespace SimpleGraph /-- A subgraph of a `SimpleGraph` is a subset of vertices along with a restriction of the adjacency relation that is symmetric and is supported by the vertex subset. They also form a bounded lattice. Thinking of `V → V → Prop` as `Set (V × V)`, a set of darts (i.e., half-edges), then `Subgraph.adj_sub` is that the darts of a subgraph are a subset of the darts of `G`. -/ @[ext] structure Subgraph {V : Type u} (G : SimpleGraph V) where verts : Set V Adj : V → V → Prop adj_sub : ∀ {v w : V}, Adj v w → G.Adj v w edge_vert : ∀ {v w : V}, Adj v w → v ∈ verts symm : Symmetric Adj := by aesop_graph -- Porting note: Originally `by obviously` #align simple_graph.subgraph SimpleGraph.Subgraph initialize_simps_projections SimpleGraph.Subgraph (Adj → adj) variable {ι : Sort*} {V : Type u} {W : Type v} /-- The one-vertex subgraph. -/ @[simps] protected def singletonSubgraph (G : SimpleGraph V) (v : V) : G.Subgraph where verts := {v} Adj := ⊥ adj_sub := False.elim edge_vert := False.elim symm _ _ := False.elim #align simple_graph.singleton_subgraph SimpleGraph.singletonSubgraph /-- The one-edge subgraph. -/ @[simps] def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where verts := {v, w} Adj a b := ⟦(v, w)⟧ = ⟦(a, b)⟧ adj_sub h := by rw [← G.mem_edgeSet, ← h] exact hvw edge_vert {a b} h := by apply_fun fun e ↦ a ∈ e at h simp only [Sym2.mem_iff, true_or, eq_iff_iff, iff_true] at h exact h #align simple_graph.subgraph_of_adj SimpleGraph.subgraphOfAdj namespace Subgraph variable {G : SimpleGraph V} {G₁ G₂ : G.Subgraph} {a b : V} protected theorem loopless (G' : Subgraph G) : Irreflexive G'.Adj := fun v h ↦ G.loopless v (G'.adj_sub h) #align simple_graph.subgraph.loopless SimpleGraph.Subgraph.loopless theorem adj_comm (G' : Subgraph G) (v w : V) : G'.Adj v w ↔ G'.Adj w v := ⟨fun x ↦ G'.symm x, fun x ↦ G'.symm x⟩ #align simple_graph.subgraph.adj_comm SimpleGraph.Subgraph.adj_comm @[symm] theorem adj_symm (G' : Subgraph G) {u v : V} (h : G'.Adj u v) : G'.Adj v u := G'.symm h #align simple_graph.subgraph.adj_symm SimpleGraph.Subgraph.adj_symm protected theorem Adj.symm {G' : Subgraph G} {u v : V} (h : G'.Adj u v) : G'.Adj v u := G'.symm h #align simple_graph.subgraph.adj.symm SimpleGraph.Subgraph.Adj.symm protected theorem Adj.adj_sub {H : G.Subgraph} {u v : V} (h : H.Adj u v) : G.Adj u v := H.adj_sub h #align simple_graph.subgraph.adj.adj_sub SimpleGraph.Subgraph.Adj.adj_sub protected theorem Adj.fst_mem {H : G.Subgraph} {u v : V} (h : H.Adj u v) : u ∈ H.verts := H.edge_vert h #align simple_graph.subgraph.adj.fst_mem SimpleGraph.Subgraph.Adj.fst_mem protected theorem Adj.snd_mem {H : G.Subgraph} {u v : V} (h : H.Adj u v) : v ∈ H.verts := h.symm.fst_mem #align simple_graph.subgraph.adj.snd_mem SimpleGraph.Subgraph.Adj.snd_mem protected theorem Adj.ne {H : G.Subgraph} {u v : V} (h : H.Adj u v) : u ≠ v := h.adj_sub.ne #align simple_graph.subgraph.adj.ne SimpleGraph.Subgraph.Adj.ne /-- Coercion from `G' : Subgraph G` to a `SimpleGraph G'.verts`. -/ @[simps] protected def coe (G' : Subgraph G) : SimpleGraph G'.verts where Adj v w := G'.Adj v w symm _ _ h := G'.symm h loopless v h := loopless G v (G'.adj_sub h) #align simple_graph.subgraph.coe SimpleGraph.Subgraph.coe @[simp] theorem coe_adj_sub (G' : Subgraph G) (u v : G'.verts) (h : G'.coe.Adj u v) : G.Adj u v := G'.adj_sub h #align simple_graph.subgraph.coe_adj_sub SimpleGraph.Subgraph.coe_adj_sub -- Given `h : H.Adj u v`, then `h.coe : H.coe.Adj ⟨u, _⟩ ⟨v, _⟩`. protected theorem Adj.coe {H : G.Subgraph} {u v : V} (h : H.Adj u v) : H.coe.Adj ⟨u, H.edge_vert h⟩ ⟨v, H.edge_vert h.symm⟩ := h #align simple_graph.subgraph.adj.coe SimpleGraph.Subgraph.Adj.coe /-- A subgraph is called a *spanning subgraph* if it contains all the vertices of `G`. -/ def IsSpanning (G' : Subgraph G) : Prop := ∀ v : V, v ∈ G'.verts #align simple_graph.subgraph.is_spanning SimpleGraph.Subgraph.IsSpanning theorem isSpanning_iff {G' : Subgraph G} : G'.IsSpanning ↔ G'.verts = Set.univ := Set.eq_univ_iff_forall.symm #align simple_graph.subgraph.is_spanning_iff SimpleGraph.Subgraph.isSpanning_iff /-- Coercion from `Subgraph G` to `SimpleGraph V`. If `G'` is a spanning subgraph, then `G'.spanningCoe` yields an isomorphic graph. In general, this adds in all vertices from `V` as isolated vertices. -/ @[simps] protected def spanningCoe (G' : Subgraph G) : SimpleGraph V where Adj := G'.Adj symm := G'.symm loopless v hv := G.loopless v (G'.adj_sub hv) #align simple_graph.subgraph.spanning_coe SimpleGraph.Subgraph.spanningCoe @[simp] theorem Adj.of_spanningCoe {G' : Subgraph G} {u v : G'.verts} (h : G'.spanningCoe.Adj u v) : G.Adj u v := G'.adj_sub h #align simple_graph.subgraph.adj.of_spanning_coe SimpleGraph.Subgraph.Adj.of_spanningCoe theorem spanningCoe_inj : G₁.spanningCoe = G₂.spanningCoe ↔ G₁.Adj = G₂.Adj := by simp [Subgraph.spanningCoe] #align simple_graph.subgraph.spanning_coe_inj SimpleGraph.Subgraph.spanningCoe_inj /-- `spanningCoe` is equivalent to `coe` for a subgraph that `IsSpanning`. -/ @[simps] def spanningCoeEquivCoeOfSpanning (G' : Subgraph G) (h : G'.IsSpanning) : G'.spanningCoe ≃g G'.coe where toFun v := ⟨v, h v⟩ invFun v := v left_inv _ := rfl right_inv _ := rfl map_rel_iff' := Iff.rfl #align simple_graph.subgraph.spanning_coe_equiv_coe_of_spanning SimpleGraph.Subgraph.spanningCoeEquivCoeOfSpanning /-- A subgraph is called an *induced subgraph* if vertices of `G'` are adjacent if they are adjacent in `G`. -/ def IsInduced (G' : Subgraph G) : Prop := ∀ {v w : V}, v ∈ G'.verts → w ∈ G'.verts → G.Adj v w → G'.Adj v w #align simple_graph.subgraph.is_induced SimpleGraph.Subgraph.IsInduced /-- `H.support` is the set of vertices that form edges in the subgraph `H`. -/ def support (H : Subgraph G) : Set V := Rel.dom H.Adj #align simple_graph.subgraph.support SimpleGraph.Subgraph.support theorem mem_support (H : Subgraph G) {v : V} : v ∈ H.support ↔ ∃ w, H.Adj v w := Iff.rfl #align simple_graph.subgraph.mem_support SimpleGraph.Subgraph.mem_support theorem support_subset_verts (H : Subgraph G) : H.support ⊆ H.verts := fun _ ⟨_, h⟩ ↦ H.edge_vert h #align simple_graph.subgraph.support_subset_verts SimpleGraph.Subgraph.support_subset_verts /-- `G'.neighborSet v` is the set of vertices adjacent to `v` in `G'`. -/ def neighborSet (G' : Subgraph G) (v : V) : Set V := {w | G'.Adj v w} #align simple_graph.subgraph.neighbor_set SimpleGraph.Subgraph.neighborSet theorem neighborSet_subset (G' : Subgraph G) (v : V) : G'.neighborSet v ⊆ G.neighborSet v := fun _ ↦ G'.adj_sub #align simple_graph.subgraph.neighbor_set_subset SimpleGraph.Subgraph.neighborSet_subset theorem neighborSet_subset_verts (G' : Subgraph G) (v : V) : G'.neighborSet v ⊆ G'.verts := fun _ h ↦ G'.edge_vert (adj_symm G' h) #align simple_graph.subgraph.neighbor_set_subset_verts SimpleGraph.Subgraph.neighborSet_subset_verts @[simp] theorem mem_neighborSet (G' : Subgraph G) (v w : V) : w ∈ G'.neighborSet v ↔ G'.Adj v w := Iff.rfl #align simple_graph.subgraph.mem_neighbor_set SimpleGraph.Subgraph.mem_neighborSet /-- A subgraph as a graph has equivalent neighbor sets. -/ def coeNeighborSetEquiv {G' : Subgraph G} (v : G'.verts) : G'.coe.neighborSet v ≃ G'.neighborSet v where toFun w := ⟨w, w.2⟩ invFun w := ⟨⟨w, G'.edge_vert (G'.adj_symm w.2)⟩, w.2⟩ left_inv _ := rfl right_inv _ := rfl #align simple_graph.subgraph.coe_neighbor_set_equiv SimpleGraph.Subgraph.coeNeighborSetEquiv /-- The edge set of `G'` consists of a subset of edges of `G`. -/ def edgeSet (G' : Subgraph G) : Set (Sym2 V) := Sym2.fromRel G'.symm #align simple_graph.subgraph.edge_set SimpleGraph.Subgraph.edgeSet theorem edgeSet_subset (G' : Subgraph G) : G'.edgeSet ⊆ G.edgeSet := Sym2.ind (fun _ _ ↦ G'.adj_sub) #align simple_graph.subgraph.edge_set_subset SimpleGraph.Subgraph.edgeSet_subset @[simp] theorem mem_edgeSet {G' : Subgraph G} {v w : V} : ⟦(v, w)⟧ ∈ G'.edgeSet ↔ G'.Adj v w := Iff.rfl #align simple_graph.subgraph.mem_edge_set SimpleGraph.Subgraph.mem_edgeSet theorem mem_verts_if_mem_edge {G' : Subgraph G} {e : Sym2 V} {v : V} (he : e ∈ G'.edgeSet) (hv : v ∈ e) : v ∈ G'.verts := by
revert hv
theorem mem_verts_if_mem_edge {G' : Subgraph G} {e : Sym2 V} {v : V} (he : e ∈ G'.edgeSet) (hv : v ∈ e) : v ∈ G'.verts := by
Mathlib.Combinatorics.SimpleGraph.Subgraph.245_0.BlhiAiIDADcXv8t
theorem mem_verts_if_mem_edge {G' : Subgraph G} {e : Sym2 V} {v : V} (he : e ∈ G'.edgeSet) (hv : v ∈ e) : v ∈ G'.verts
Mathlib_Combinatorics_SimpleGraph_Subgraph