File: Mathlib/Topology/LocallyConstant/Basic.lean

full_name: IsLocallyConstant
code: /-- A function between topological spaces is locally constant if the preimage of any set is open. -/
def IsLocallyConstant (f : X → Y) : Prop 
goal: Prop

full_name: IsLocallyConstant.tfae
code: protected theorem tfae (f : X → Y) :
    TFAE [IsLocallyConstant f,
      ∀ x, ∀ᶠ x' in 𝓝 x, f x' = f x,
      ∀ x, IsOpen { x' | f x' = f x },
      ∀ y, IsOpen (f ⁻¹' {y}),
      ∀ x, ∃ U : Set X, IsOpen U ∧ x ∈ U ∧ ∀ x' ∈ U, f x' = f x] 
goal: [IsLocallyConstant f, ∀ (x : X), ∀ᶠ (x' : X) in 𝓝 x, f x' = f x, ∀ (x : X), IsOpen {x' | f x' = f x},
    ∀ (y : Y), IsOpen (f ⁻¹' {y}), ∀ (x : X), ∃ U, IsOpen U ∧ x ∈ U ∧ ∀ x' ∈ U, f x' = f x].TFAE

full_name: IsLocallyConstant.of_discrete
code: @[nontriviality]
theorem of_discrete [DiscreteTopology X] (f : X → Y) : IsLocallyConstant f 
goal: IsLocallyConstant f

full_name: IsLocallyConstant.isOpen_fiber
code: theorem isOpen_fiber {f : X → Y} (hf : IsLocallyConstant f) (y : Y) : IsOpen { x | f x = y } 
goal: IsOpen {x | f x = y}

full_name: IsLocallyConstant.isClosed_fiber
code: theorem isClosed_fiber {f : X → Y} (hf : IsLocallyConstant f) (y : Y) : IsClosed { x | f x = y } 
goal: IsClosed {x | f x = y}

full_name: IsLocallyConstant.isClopen_fiber
code: theorem isClopen_fiber {f : X → Y} (hf : IsLocallyConstant f) (y : Y) : IsClopen { x | f x = y } 
goal: IsClopen {x | f x = y}

full_name: IsLocallyConstant.iff_exists_open
code: theorem iff_exists_open (f : X → Y) :
    IsLocallyConstant f ↔ ∀ x, ∃ U : Set X, IsOpen U ∧ x ∈ U ∧ ∀ x' ∈ U, f x' = f x 
goal: IsLocallyConstant f ↔ ∀ (x : X), ∃ U, IsOpen U ∧ x ∈ U ∧ ∀ x' ∈ U, f x' = f x

full_name: IsLocallyConstant.iff_eventually_eq
code: theorem iff_eventually_eq (f : X → Y) : IsLocallyConstant f ↔ ∀ x, ∀ᶠ y in 𝓝 x, f y = f x 
goal: IsLocallyConstant f ↔ ∀ (x : X), ∀ᶠ (y : X) in 𝓝 x, f y = f x

full_name: IsLocallyConstant.exists_open
code: theorem exists_open {f : X → Y} (hf : IsLocallyConstant f) (x : X) :
    ∃ U : Set X, IsOpen U ∧ x ∈ U ∧ ∀ x' ∈ U, f x' = f x 
goal: ∃ U, IsOpen U ∧ x ∈ U ∧ ∀ x' ∈ U, f x' = f x

full_name: IsLocallyConstant.eventually_eq
code: protected theorem eventually_eq {f : X → Y} (hf : IsLocallyConstant f) (x : X) :
    ∀ᶠ y in 𝓝 x, f y = f x 
goal: ∀ᶠ (y : X) in 𝓝 x, f y = f x

full_name: IsLocallyConstant.iff_isOpen_fiber_apply
code: theorem iff_isOpen_fiber_apply {f : X → Y} : IsLocallyConstant f ↔ ∀ x, IsOpen (f ⁻¹' {f x}) 
goal: IsLocallyConstant f ↔ ∀ (x : X), IsOpen (f ⁻¹' {f x})

full_name: IsLocallyConstant.iff_isOpen_fiber
code: theorem iff_isOpen_fiber {f : X → Y} : IsLocallyConstant f ↔ ∀ y, IsOpen (f ⁻¹' {y}) 
goal: IsLocallyConstant f ↔ ∀ (y : Y), IsOpen (f ⁻¹' {y})

full_name: IsLocallyConstant.continuous
code: protected theorem continuous [TopologicalSpace Y] {f : X → Y} (hf : IsLocallyConstant f) :
    Continuous f 
goal: Continuous f

full_name: IsLocallyConstant.iff_continuous
code: theorem iff_continuous {_ : TopologicalSpace Y} [DiscreteTopology Y] (f : X → Y) :
    IsLocallyConstant f ↔ Continuous f 
goal: ∀ {x : TopologicalSpace Y} [inst : DiscreteTopology Y] (f : X → Y), IsLocallyConstant f ↔ Continuous f

full_name: IsLocallyConstant.of_constant
code: theorem of_constant (f : X → Y) (h : ∀ x y, f x = f y) : IsLocallyConstant f 
goal: IsLocallyConstant f

full_name: IsLocallyConstant.const
code: protected theorem const (y : Y) : IsLocallyConstant (Function.const X y) 
goal: IsLocallyConstant (Function.const X y)

full_name: IsLocallyConstant.comp
code: protected theorem comp {f : X → Y} (hf : IsLocallyConstant f) (g : Y → Z) :
    IsLocallyConstant (g ∘ f) 
goal: IsLocallyConstant (g ∘ f)

full_name: IsLocallyConstant.prod_mk
code: theorem prod_mk {Y'} {f : X → Y} {f' : X → Y'} (hf : IsLocallyConstant f)
    (hf' : IsLocallyConstant f') : IsLocallyConstant fun x => (f x, f' x) 
goal: IsLocallyConstant fun x => (f x, f' x)

full_name: IsLocallyConstant.comp₂
code: theorem comp₂ {Y₁ Y₂ Z : Type*} {f : X → Y₁} {g : X → Y₂} (hf : IsLocallyConstant f)
    (hg : IsLocallyConstant g) (h : Y₁ → Y₂ → Z) : IsLocallyConstant fun x => h (f x) (g x) 
goal: IsLocallyConstant fun x => h (f x) (g x)

full_name: IsLocallyConstant.comp_continuous
code: theorem comp_continuous [TopologicalSpace Y] {g : Y → Z} {f : X → Y} (hg : IsLocallyConstant g)
    (hf : Continuous f) : IsLocallyConstant (g ∘ f) 
goal: IsLocallyConstant (g ∘ f)

full_name: IsLocallyConstant.apply_eq_of_isPreconnected
code: /-- A locally constant function is constant on any preconnected set. -/
theorem apply_eq_of_isPreconnected {f : X → Y} (hf : IsLocallyConstant f) {s : Set X}
    (hs : IsPreconnected s) {x y : X} (hx : x ∈ s) (hy : y ∈ s) : f x = f y 
goal: f x = f y

full_name: IsLocallyConstant.apply_eq_of_preconnectedSpace
code: theorem apply_eq_of_preconnectedSpace [PreconnectedSpace X] {f : X → Y} (hf : IsLocallyConstant f)
    (x y : X) : f x = f y 
goal: f x = f y

full_name: IsLocallyConstant.eq_const
code: theorem eq_const [PreconnectedSpace X] {f : X → Y} (hf : IsLocallyConstant f) (x : X) :
    f = Function.const X (f x) 
goal: f = Function.const X (f x)

full_name: IsLocallyConstant.exists_eq_const
code: theorem exists_eq_const [PreconnectedSpace X] [Nonempty Y] {f : X → Y} (hf : IsLocallyConstant f) :
    ∃ y, f = Function.const X y 
goal: ∃ y, f = Function.const X y

full_name: IsLocallyConstant.iff_is_const
code: theorem iff_is_const [PreconnectedSpace X] {f : X → Y} : IsLocallyConstant f ↔ ∀ x y, f x = f y 
goal: IsLocallyConstant f ↔ ∀ (x y : X), f x = f y

full_name: IsLocallyConstant.range_finite
code: theorem range_finite [CompactSpace X] {f : X → Y} (hf : IsLocallyConstant f) :
    (Set.range f).Finite 
goal: (Set.range f).Finite

full_name: IsLocallyConstant.zero
code: @[to_additive]
theorem one [One Y] : IsLocallyConstant (1 : X → Y) 
goal: IsLocallyConstant 0

full_name: IsLocallyConstant.one
code: @[to_additive]
theorem one [One Y] : IsLocallyConstant (1 : X → Y) 
goal: IsLocallyConstant 1

full_name: IsLocallyConstant.neg
code: @[to_additive]
theorem inv [Inv Y] ⦃f : X → Y⦄ (hf : IsLocallyConstant f) : IsLocallyConstant f⁻¹ 
goal: IsLocallyConstant (-f)

full_name: IsLocallyConstant.inv
code: @[to_additive]
theorem inv [Inv Y] ⦃f : X → Y⦄ (hf : IsLocallyConstant f) : IsLocallyConstant f⁻¹ 
goal: IsLocallyConstant f⁻¹

full_name: IsLocallyConstant.add
code: @[to_additive]
theorem mul [Mul Y] ⦃f g : X → Y⦄ (hf : IsLocallyConstant f) (hg : IsLocallyConstant g) :
    IsLocallyConstant (f * g) 
goal: IsLocallyConstant (f + g)

full_name: IsLocallyConstant.mul
code: @[to_additive]
theorem mul [Mul Y] ⦃f g : X → Y⦄ (hf : IsLocallyConstant f) (hg : IsLocallyConstant g) :
    IsLocallyConstant (f * g) 
goal: IsLocallyConstant (f * g)

full_name: IsLocallyConstant.sub
code: @[to_additive]
theorem div [Div Y] ⦃f g : X → Y⦄ (hf : IsLocallyConstant f) (hg : IsLocallyConstant g) :
    IsLocallyConstant (f / g) 
goal: IsLocallyConstant (f - g)

full_name: IsLocallyConstant.div
code: @[to_additive]
theorem div [Div Y] ⦃f g : X → Y⦄ (hf : IsLocallyConstant f) (hg : IsLocallyConstant g) :
    IsLocallyConstant (f / g) 
goal: IsLocallyConstant (f / g)

full_name: IsLocallyConstant.desc
code: /-- If a composition of a function `f` followed by an injection `g` is locally
constant, then the locally constant property descends to `f`. -/
theorem desc {α β : Type*} (f : X → α) (g : α → β) (h : IsLocallyConstant (g ∘ f))
    (inj : Function.Injective g) : IsLocallyConstant f 
goal: IsLocallyConstant f

full_name: IsLocallyConstant.of_constant_on_connected_components
code: theorem of_constant_on_connected_components [LocallyConnectedSpace X] {f : X → Y}
    (h : ∀ x, ∀ y ∈ connectedComponent x, f y = f x) : IsLocallyConstant f 
goal: IsLocallyConstant f

full_name: IsLocallyConstant.of_constant_on_connected_clopens
code: theorem of_constant_on_connected_clopens [LocallyConnectedSpace X] {f : X → Y}
    (h : ∀ U : Set X, IsConnected U → IsClopen U → ∀ x ∈ U, ∀ y ∈ U, f y = f x) :
    IsLocallyConstant f 
goal: IsLocallyConstant f

full_name: IsLocallyConstant.of_constant_on_preconnected_clopens
code: theorem of_constant_on_preconnected_clopens [LocallyConnectedSpace X] {f : X → Y}
    (h : ∀ U : Set X, IsPreconnected U → IsClopen U → ∀ x ∈ U, ∀ y ∈ U, f y = f x) :
    IsLocallyConstant f 
goal: IsLocallyConstant f

full_name: LocallyConstant.isLocallyConstant
code: /-- A (bundled) locally constant function from a topological space `X` to a type `Y`. -/
structure LocallyConstant (X Y : Type*) [TopologicalSpace X] where
  /-- The underlying function. -/
  protected toFun : X → Y
  /-- The map is locally constant. -/
  protected isLocallyConstant : IsLocallyConstant toFun
goal: IsLocallyConstant self.toFun

full_name: LocallyConstant.toFun
code: /-- A (bundled) locally constant function from a topological space `X` to a type `Y`. -/
structure LocallyConstant (X Y : Type*) [TopologicalSpace X] where
  /-- The underlying function. -/
  protected toFun : X → Y
  /-- The map is locally constant. -/
  protected isLocallyConstant : IsLocallyConstant toFun
goal: X → Y

full_name: LocallyConstant
code: /-- A (bundled) locally constant function from a topological space `X` to a type `Y`. -/
structure LocallyConstant (X Y : Type*) [TopologicalSpace X] where
  /-- The underlying function. -/
  protected toFun : X → Y
  /-- The map is locally constant. -/
  protected isLocallyConstant : IsLocallyConstant toFun
goal: Type (max u_5 u_6)

full_name: LocallyConstant.instInhabited
code: instance [Inhabited Y] : Inhabited (LocallyConstant X Y) 
goal: Inhabited (LocallyConstant X Y)

full_name: LocallyConstant.instFunLike
code: instance : FunLike (LocallyConstant X Y) X Y 
goal: FunLike (LocallyConstant X Y) X Y

full_name: LocallyConstant.Simps.apply
code: /-- See Note [custom simps projections]. -/
def Simps.apply (f : LocallyConstant X Y) : X → Y 
goal: X → Y

full_name: LocallyConstant.toFun_eq_coe
code: @[simp]
theorem toFun_eq_coe (f : LocallyConstant X Y) : f.toFun = f 
goal: f.toFun = ⇑f

full_name: LocallyConstant.coe_mk
code: @[simp]
theorem coe_mk (f : X → Y) (h) : ⇑(⟨f, h⟩ : LocallyConstant X Y) = f 
goal: ⇑{ toFun := f, isLocallyConstant := h } = f

full_name: LocallyConstant.congr_fun
code: protected theorem congr_fun {f g : LocallyConstant X Y} (h : f = g) (x : X) : f x = g x 
goal: f x = g x

full_name: LocallyConstant.congr_arg
code: protected theorem congr_arg (f : LocallyConstant X Y) {x y : X} (h : x = y) : f x = f y 
goal: f x = f y

full_name: LocallyConstant.coe_injective
code: theorem coe_injective : @Function.Injective (LocallyConstant X Y) (X → Y) (↑) 
goal: Function.Injective DFunLike.coe

full_name: LocallyConstant.coe_inj
code: @[norm_cast]
theorem coe_inj {f g : LocallyConstant X Y} : (f : X → Y) = g ↔ f = g 
goal: ⇑f = ⇑g ↔ f = g

full_name: LocallyConstant.ext
code: @[ext]
theorem ext ⦃f g : LocallyConstant X Y⦄ (h : ∀ x, f x = g x) : f = g 
goal: f = g

full_name: LocallyConstant.ext_iff
code: theorem ext_iff {f g : LocallyConstant X Y} : f = g ↔ ∀ x, f x = g x 
goal: f = g ↔ ∀ (x : X), f x = g x

full_name: LocallyConstant.continuous
code: protected theorem continuous : Continuous f 
goal: Continuous ⇑f

full_name: LocallyConstant.toContinuousMap
code: /-- We can turn a locally-constant function into a bundled `ContinuousMap`. -/
@[coe] def toContinuousMap : C(X, Y) 
goal: C(X, Y)

full_name: LocallyConstant.instCoeContinuousMap
code: /-- As a shorthand, `LocallyConstant.toContinuousMap` is available as a coercion -/
instance : Coe (LocallyConstant X Y) C(X, Y) 
goal: Coe (LocallyConstant X Y) C(X, Y)

full_name: LocallyConstant.coe_continuousMap
code: @[simp] theorem coe_continuousMap : ((f : C(X, Y)) : X → Y) = (f : X → Y) 
goal: ⇑↑f = ⇑f

full_name: LocallyConstant.toContinuousMap_injective
code: theorem toContinuousMap_injective :
    Function.Injective (toContinuousMap : LocallyConstant X Y → C(X, Y)) 
goal: Function.Injective LocallyConstant.toContinuousMap

full_name: LocallyConstant.const
code: /-- The constant locally constant function on `X` with value `y : Y`. -/
def const (X : Type*) {Y : Type*} [TopologicalSpace X] (y : Y) : LocallyConstant X Y 
goal: LocallyConstant X Y

full_name: LocallyConstant.coe_const
code: @[simp]
theorem coe_const (y : Y) : (const X y : X → Y) = Function.const X y 
goal: ⇑(LocallyConstant.const X y) = Function.const X y

full_name: LocallyConstant.ofIsClopen
code: /-- The locally constant function to `Fin 2` associated to a clopen set. -/
def ofIsClopen {X : Type*} [TopologicalSpace X] {U : Set X} [∀ x, Decidable (x ∈ U)]
    (hU : IsClopen U) : LocallyConstant X (Fin 2) 
goal: LocallyConstant X (Fin 2)

full_name: LocallyConstant.ofIsClopen_fiber_zero
code: @[simp]
theorem ofIsClopen_fiber_zero {X : Type*} [TopologicalSpace X] {U : Set X} [∀ x, Decidable (x ∈ U)]
    (hU : IsClopen U) : ofIsClopen hU ⁻¹' ({0} : Set (Fin 2)) = U 
goal: ⇑(LocallyConstant.ofIsClopen hU) ⁻¹' {0} = U

full_name: LocallyConstant.ofIsClopen_fiber_one
code: @[simp]
theorem ofIsClopen_fiber_one {X : Type*} [TopologicalSpace X] {U : Set X} [∀ x, Decidable (x ∈ U)]
    (hU : IsClopen U) : ofIsClopen hU ⁻¹' ({1} : Set (Fin 2)) = Uᶜ 
goal: ⇑(LocallyConstant.ofIsClopen hU) ⁻¹' {1} = Uᶜ

full_name: LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
code: theorem locallyConstant_eq_of_fiber_zero_eq {X : Type*} [TopologicalSpace X]
    (f g : LocallyConstant X (Fin 2)) (h : f ⁻¹' ({0} : Set (Fin 2)) = g ⁻¹' {0}) : f = g 
goal: f = g

full_name: LocallyConstant.range_finite
code: theorem range_finite [CompactSpace X] (f : LocallyConstant X Y) : (Set.range f).Finite 
goal: (Set.range ⇑f).Finite

full_name: LocallyConstant.apply_eq_of_isPreconnected
code: theorem apply_eq_of_isPreconnected (f : LocallyConstant X Y) {s : Set X} (hs : IsPreconnected s)
    {x y : X} (hx : x ∈ s) (hy : y ∈ s) : f x = f y 
goal: f x = f y

full_name: LocallyConstant.apply_eq_of_preconnectedSpace
code: theorem apply_eq_of_preconnectedSpace [PreconnectedSpace X] (f : LocallyConstant X Y) (x y : X) :
    f x = f y 
goal: f x = f y

full_name: LocallyConstant.eq_const
code: theorem eq_const [PreconnectedSpace X] (f : LocallyConstant X Y) (x : X) : f = const X (f x) 
goal: f = LocallyConstant.const X (f x)

full_name: LocallyConstant.exists_eq_const
code: theorem exists_eq_const [PreconnectedSpace X] [Nonempty Y] (f : LocallyConstant X Y) :
    ∃ y, f = const X y 
goal: ∃ y, f = LocallyConstant.const X y

full_name: LocallyConstant.map
code: /-- Push forward of locally constant maps under any map, by post-composition. -/
def map (f : Y → Z) (g : LocallyConstant X Y) : LocallyConstant X Z 
goal: LocallyConstant X Z

full_name: LocallyConstant.map_apply
code: @[simp]
theorem map_apply (f : Y → Z) (g : LocallyConstant X Y) : ⇑(map f g) = f ∘ g 
goal: ⇑(LocallyConstant.map f g) = f ∘ ⇑g

full_name: LocallyConstant.map_id
code: @[simp]
theorem map_id : @map X Y Y _ id = id 
goal: LocallyConstant.map id = id

full_name: LocallyConstant.map_comp
code: @[simp]
theorem map_comp {Y₁ Y₂ Y₃ : Type*} (g : Y₂ → Y₃) (f : Y₁ → Y₂) :
    @map X _ _ _ g ∘ map f = map (g ∘ f) 
goal: LocallyConstant.map g ∘ LocallyConstant.map f = LocallyConstant.map (g ∘ f)

full_name: LocallyConstant.flip
code: /-- Given a locally constant function to `α → β`, construct a family of locally constant
functions with values in β indexed by α. -/
def flip {X α β : Type*} [TopologicalSpace X] (f : LocallyConstant X (α → β)) (a : α) :
    LocallyConstant X β 
goal: LocallyConstant X β

full_name: LocallyConstant.unflip
code: /-- If α is finite, this constructs a locally constant function to `α → β` given a
family of locally constant functions with values in β indexed by α. -/
def unflip {X α β : Type*} [Finite α] [TopologicalSpace X] (f : α → LocallyConstant X β) :
    LocallyConstant X (α → β) 
goal: LocallyConstant X (α → β)

full_name: LocallyConstant.unflip_flip
code: @[simp]
theorem unflip_flip {X α β : Type*} [Finite α] [TopologicalSpace X]
    (f : LocallyConstant X (α → β)) : unflip f.flip = f 
goal: LocallyConstant.unflip f.flip = f

full_name: LocallyConstant.flip_unflip
code: @[simp]
theorem flip_unflip {X α β : Type*} [Finite α] [TopologicalSpace X]
    (f : α → LocallyConstant X β) : (unflip f).flip = f 
goal: (LocallyConstant.unflip f).flip = f

full_name: LocallyConstant.comap
code: /-- Pull back of locally constant maps under a continuous map, by pre-composition. -/
def comap (f : C(X, Y)) (g : LocallyConstant Y Z) : LocallyConstant X Z 
goal: LocallyConstant X Z

full_name: LocallyConstant.coe_comap
code: @[simp]
theorem coe_comap (f : C(X, Y)) (g : LocallyConstant Y Z) :
    (comap f g) = g ∘ f 
goal: ⇑(LocallyConstant.comap f g) = ⇑g ∘ ⇑f

full_name: LocallyConstant.coe_comap_apply
code: theorem coe_comap_apply (f : C(X, Y)) (g : LocallyConstant Y Z) (x : X) :
    comap f g x = g (f x) 
goal: (LocallyConstant.comap f g) x = g (f x)

full_name: LocallyConstant.comap_id
code: @[simp]
theorem comap_id : comap (@ContinuousMap.id X _) = @id (LocallyConstant X Z) 
goal: LocallyConstant.comap (ContinuousMap.id X) = id

full_name: LocallyConstant.comap_comp
code: theorem comap_comp {W : Type*} [TopologicalSpace W] (f : C(W, X)) (g : C(X, Y)) :
    comap (Z := Z) (g.comp f) = comap f ∘ comap g 
goal: LocallyConstant.comap (g.comp f) = LocallyConstant.comap f ∘ LocallyConstant.comap g

full_name: LocallyConstant.comap_comap
code: theorem comap_comap {W : Type*} [TopologicalSpace W] (f : C(W, X)) (g : C(X, Y))
    (x : LocallyConstant Y Z) : comap f (comap g x) = comap (g.comp f) x 
goal: LocallyConstant.comap f (LocallyConstant.comap g x) = LocallyConstant.comap (g.comp f) x

full_name: LocallyConstant.comap_const
code: theorem comap_const (f : C(X, Y)) (y : Y) (h : ∀ x, f x = y) :
    (comap f : LocallyConstant Y Z → LocallyConstant X Z) = fun g => const X (g y) 
goal: LocallyConstant.comap f = fun g => LocallyConstant.const X (g y)

full_name: LocallyConstant.comap_injective
code: lemma comap_injective (f : C(X, Y)) (hfs : f.1.Surjective) :
    (comap (Z := Z) f).Injective 
goal: Function.Injective (LocallyConstant.comap f)

full_name: LocallyConstant.desc
code: /-- If a locally constant function factors through an injection, then it factors through a locally
constant function. -/
def desc {X α β : Type*} [TopologicalSpace X] {g : α → β} (f : X → α) (h : LocallyConstant X β)
    (cond : g ∘ f = h) (inj : Function.Injective g) : LocallyConstant X α 
goal: LocallyConstant X α

full_name: LocallyConstant.coe_desc
code: @[simp]
theorem coe_desc {X α β : Type*} [TopologicalSpace X] (f : X → α) (g : α → β)
    (h : LocallyConstant X β) (cond : g ∘ f = h) (inj : Function.Injective g) :
    ⇑(desc f h cond inj) = f 
goal: ⇑(LocallyConstant.desc f h cond inj) = f

full_name: LocallyConstant.mulIndicator_apply
code: /-- Given a clopen set `U` and a locally constant function `f`, `LocallyConstant.mulIndicator`
  returns the locally constant function that is `f` on `U` and `1` otherwise. -/
@[to_additive (attr := simps) "Given a clopen set `U` and a locally constant function `f`,
  `LocallyConstant.indicator` returns the locally constant function that is `f` on `U` and `0`
  otherwise. "]
noncomputable def mulIndicator (hU : IsClopen U) : LocallyConstant X R 
goal: (f.mulIndicator hU) x = U.mulIndicator (⇑f) x

full_name: LocallyConstant.mulIndicator
code: /-- Given a clopen set `U` and a locally constant function `f`, `LocallyConstant.mulIndicator`
  returns the locally constant function that is `f` on `U` and `1` otherwise. -/
@[to_additive (attr := simps) "Given a clopen set `U` and a locally constant function `f`,
  `LocallyConstant.indicator` returns the locally constant function that is `f` on `U` and `0`
  otherwise. "]
noncomputable def mulIndicator (hU : IsClopen U) : LocallyConstant X R 
goal: LocallyConstant X R

full_name: LocallyConstant.indicator
code: /-- Given a clopen set `U` and a locally constant function `f`, `LocallyConstant.mulIndicator`
  returns the locally constant function that is `f` on `U` and `1` otherwise. -/
@[to_additive (attr := simps) "Given a clopen set `U` and a locally constant function `f`,
  `LocallyConstant.indicator` returns the locally constant function that is `f` on `U` and `0`
  otherwise. "]
noncomputable def mulIndicator (hU : IsClopen U) : LocallyConstant X R 
goal: LocallyConstant X R

full_name: LocallyConstant.indicator_apply
code: /-- Given a clopen set `U` and a locally constant function `f`, `LocallyConstant.mulIndicator`
  returns the locally constant function that is `f` on `U` and `1` otherwise. -/
@[to_additive (attr := simps) "Given a clopen set `U` and a locally constant function `f`,
  `LocallyConstant.indicator` returns the locally constant function that is `f` on `U` and `0`
  otherwise. "]
noncomputable def mulIndicator (hU : IsClopen U) : LocallyConstant X R 
goal: (f.indicator hU) x = U.indicator (⇑f) x

full_name: LocallyConstant.mulIndicator_apply_eq_if
code: @[to_additive]
theorem mulIndicator_apply_eq_if (hU : IsClopen U) :
    mulIndicator f hU a = if a ∈ U then f a else 1 
goal: (f.mulIndicator hU) a = if a ∈ U then f a else 1

full_name: LocallyConstant.indicator_apply_eq_if
code: @[to_additive]
theorem mulIndicator_apply_eq_if (hU : IsClopen U) :
    mulIndicator f hU a = if a ∈ U then f a else 1 
goal: (f.indicator hU) a = if a ∈ U then f a else 0

full_name: LocallyConstant.mulIndicator_of_mem
code: @[to_additive]
theorem mulIndicator_of_mem (hU : IsClopen U) (h : a ∈ U) : f.mulIndicator hU a = f a 
goal: (f.mulIndicator hU) a = f a

full_name: LocallyConstant.indicator_of_mem
code: @[to_additive]
theorem mulIndicator_of_mem (hU : IsClopen U) (h : a ∈ U) : f.mulIndicator hU a = f a 
goal: (f.indicator hU) a = f a

full_name: LocallyConstant.mulIndicator_of_not_mem
code: @[to_additive]
theorem mulIndicator_of_not_mem (hU : IsClopen U) (h : a ∉ U) : f.mulIndicator hU a = 1 
goal: (f.mulIndicator hU) a = 1

full_name: LocallyConstant.indicator_of_not_mem
code: @[to_additive]
theorem mulIndicator_of_not_mem (hU : IsClopen U) (h : a ∉ U) : f.mulIndicator hU a = 1 
goal: (f.indicator hU) a = 0

full_name: LocallyConstant.congrLeft_apply
code: /--
The equivalence between `LocallyConstant X Z` and `LocallyConstant Y Z` given a
homeomorphism `X ≃ₜ Y`
-/
@[simps]
def congrLeft [TopologicalSpace Y] (e : X ≃ₜ Y) : LocallyConstant X Z ≃ LocallyConstant Y Z 
goal: (LocallyConstant.congrLeft e) g = LocallyConstant.comap e.symm.toContinuousMap g

full_name: LocallyConstant.congrLeft
code: /--
The equivalence between `LocallyConstant X Z` and `LocallyConstant Y Z` given a
homeomorphism `X ≃ₜ Y`
-/
@[simps]
def congrLeft [TopologicalSpace Y] (e : X ≃ₜ Y) : LocallyConstant X Z ≃ LocallyConstant Y Z 
goal: LocallyConstant X Z ≃ LocallyConstant Y Z

full_name: LocallyConstant.congrLeft_symm_apply
code: /--
The equivalence between `LocallyConstant X Z` and `LocallyConstant Y Z` given a
homeomorphism `X ≃ₜ Y`
-/
@[simps]
def congrLeft [TopologicalSpace Y] (e : X ≃ₜ Y) : LocallyConstant X Z ≃ LocallyConstant Y Z 
goal: (LocallyConstant.congrLeft e).symm g = LocallyConstant.comap e.toContinuousMap g

full_name: LocallyConstant.congrRight_symm_apply
code: /--
The equivalence between `LocallyConstant X Y` and `LocallyConstant X Z` given an
equivalence `Y ≃ Z`
-/
@[simps]
def congrRight (e : Y ≃ Z) : LocallyConstant X Y ≃ LocallyConstant X Z 
goal: (LocallyConstant.congrRight e).symm g = LocallyConstant.map (⇑e.symm) g

full_name: LocallyConstant.congrRight_apply
code: /--
The equivalence between `LocallyConstant X Y` and `LocallyConstant X Z` given an
equivalence `Y ≃ Z`
-/
@[simps]
def congrRight (e : Y ≃ Z) : LocallyConstant X Y ≃ LocallyConstant X Z 
goal: (LocallyConstant.congrRight e) g = LocallyConstant.map (⇑e) g

full_name: LocallyConstant.congrRight
code: /--
The equivalence between `LocallyConstant X Y` and `LocallyConstant X Z` given an
equivalence `Y ≃ Z`
-/
@[simps]
def congrRight (e : Y ≃ Z) : LocallyConstant X Y ≃ LocallyConstant X Z 
goal: LocallyConstant X Y ≃ LocallyConstant X Z

full_name: LocallyConstant.equivClopens
code: /--
The set of clopen subsets of a topological space is equivalent to the locally constant maps to
a two-element set
-/
def equivClopens [∀ (s : Set X) x, Decidable (x ∈ s)] :
    LocallyConstant X (Fin 2) ≃ TopologicalSpace.Clopens X 
goal: LocallyConstant X (Fin 2) ≃ TopologicalSpace.Clopens X

full_name: LocallyConstant.piecewise
code: /-- Given two closed sets covering a topological space, and locally constant maps on these two sets,
    then if these two locally constant maps agree on the intersection, we get a piecewise defined
    locally constant map on the whole space.

TODO: Generalise this construction to `ContinuousMap`. -/
def piecewise {C₁ C₂ : Set X} (h₁ : IsClosed C₁) (h₂ : IsClosed C₂) (h : C₁ ∪ C₂ = Set.univ)
    (f : LocallyConstant C₁ Z) (g : LocallyConstant C₂ Z)
    (hfg : ∀ (x : X) (hx : x ∈ C₁ ∩ C₂), f ⟨x, hx.1⟩ = g ⟨x, hx.2⟩)
    [DecidablePred (· ∈ C₁)] : LocallyConstant X Z 
goal: LocallyConstant X Z

full_name: LocallyConstant.piecewise_apply_left
code: @[simp]
lemma piecewise_apply_left {C₁ C₂ : Set X} (h₁ : IsClosed C₁) (h₂ : IsClosed C₂)
    (h : C₁ ∪ C₂ = Set.univ) (f : LocallyConstant C₁ Z) (g : LocallyConstant C₂ Z)
    (hfg : ∀ (x : X) (hx : x ∈ C₁ ∩ C₂), f ⟨x, hx.1⟩ = g ⟨x, hx.2⟩)
    [DecidablePred (· ∈ C₁)] (x : X) (hx : x ∈ C₁) :
    piecewise h₁ h₂ h f g hfg x = f ⟨x, hx⟩ 
goal: (LocallyConstant.piecewise h₁ h₂ h f g hfg) x = f ⟨x, hx⟩

full_name: LocallyConstant.piecewise_apply_right
code: @[simp]
lemma piecewise_apply_right {C₁ C₂ : Set X} (h₁ : IsClosed C₁) (h₂ : IsClosed C₂)
    (h : C₁ ∪ C₂ = Set.univ) (f : LocallyConstant C₁ Z) (g : LocallyConstant C₂ Z)
    (hfg : ∀ (x : X) (hx : x ∈ C₁ ∩ C₂), f ⟨x, hx.1⟩ = g ⟨x, hx.2⟩)
    [DecidablePred (· ∈ C₁)] (x : X) (hx : x ∈ C₂) :
    piecewise h₁ h₂ h f g hfg x = g ⟨x, hx⟩ 
goal: (LocallyConstant.piecewise h₁ h₂ h f g hfg) x = g ⟨x, hx⟩

full_name: LocallyConstant.piecewise'
code: /-- A variant of `LocallyConstant.piecewise` where the two closed sets cover a subset.

TODO: Generalise this construction to `ContinuousMap`. -/
def piecewise' {C₀ C₁ C₂ : Set X} (h₀ : C₀ ⊆ C₁ ∪ C₂) (h₁ : IsClosed C₁)
    (h₂ : IsClosed C₂) (f₁ : LocallyConstant C₁ Z) (f₂ : LocallyConstant C₂ Z)
    [DecidablePred (· ∈ C₁)] (hf : ∀ x (hx : x ∈ C₁ ∩ C₂), f₁ ⟨x, hx.1⟩ = f₂ ⟨x, hx.2⟩) :
    LocallyConstant C₀ Z 
goal: LocallyConstant (↑C₀) Z

full_name: LocallyConstant.piecewise'_apply_left
code: @[simp]
lemma piecewise'_apply_left {C₀ C₁ C₂ : Set X} (h₀ : C₀ ⊆ C₁ ∪ C₂) (h₁ : IsClosed C₁)
    (h₂ : IsClosed C₂) (f₁ : LocallyConstant C₁ Z) (f₂ : LocallyConstant C₂ Z)
    [DecidablePred (· ∈ C₁)] (hf : ∀ x (hx : x ∈ C₁ ∩ C₂), f₁ ⟨x, hx.1⟩ = f₂ ⟨x, hx.2⟩)
    (x : C₀) (hx : x.val ∈ C₁) :
    piecewise' h₀ h₁ h₂ f₁ f₂ hf x = f₁ ⟨x.val, hx⟩ 
goal: (LocallyConstant.piecewise' h₀ h₁ h₂ f₁ f₂ hf) x = f₁ ⟨↑x, hx⟩

full_name: LocallyConstant.piecewise'_apply_right
code: @[simp]
lemma piecewise'_apply_right {C₀ C₁ C₂ : Set X} (h₀ : C₀ ⊆ C₁ ∪ C₂) (h₁ : IsClosed C₁)
    (h₂ : IsClosed C₂) (f₁ : LocallyConstant C₁ Z) (f₂ : LocallyConstant C₂ Z)
    [DecidablePred (· ∈ C₁)] (hf : ∀ x (hx : x ∈ C₁ ∩ C₂), f₁ ⟨x, hx.1⟩ = f₂ ⟨x, hx.2⟩)
    (x : C₀) (hx : x.val ∈ C₂) :
    piecewise' h₀ h₁ h₂ f₁ f₂ hf x = f₂ ⟨x.val, hx⟩ 
goal: (LocallyConstant.piecewise' h₀ h₁ h₂ f₁ f₂ hf) x = f₂ ⟨↑x, hx⟩