l3lab/ntp-mathlib huggingface dataset:
@[to_additive]
theorem closedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] :
    ClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) :=
  ⟨embedding_toContinuousMap A B,
    ⟨by
      suffices
        Set.range (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) =
          ({ f | f '' {1} ⊆ {1}ᶜ } ∪
              ⋃ (x) (y) (U) (V) (W) (_ : IsOpen U) (_ : IsOpen V) (_ : IsOpen W) (_ :
                Disjoint (U * V) W),
                { f | f '' {x} ⊆ U } ∩ { f | f '' {y} ⊆ V } ∩ { f | f '' {x * y} ⊆ W } :
                  Set C(A , B))ᶜ by
        rw [this, compl_compl]
        refine' (ContinuousMap.isOpen_gen isCompact_singleton isOpen_compl_singleton).union _
        repeat' apply isOpen_iUnion; intro
        repeat' apply IsOpen.inter
        all_goals 

Proof state:
case h.h.h.h.h.h.h.h.h.h₁.h₂
F : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
D : Type u_5
E : Type u_6
inst✝¹² : Monoid A
inst✝¹¹ : Monoid B
inst✝¹⁰ : Monoid C
inst✝⁹ : Monoid D
inst✝⁸ : CommGroup E
inst✝⁷ : TopologicalSpace A
inst✝⁶ : TopologicalSpace B
inst✝⁵ : TopologicalSpace C
inst✝⁴ : TopologicalSpace D
inst✝³ : TopologicalSpace E
inst✝² : TopologicalGroup E
inst✝¹ : ContinuousMul B
inst✝ : T2Space B
this :
  Set.range toContinuousMap =
    ({f | ⇑f '' {1} ⊆ {1}ᶜ} ∪
        ⋃ x,
          ⋃ y,
            ⋃ U,
              ⋃ V,
                ⋃ W,
                  ⋃ (_ : IsOpen U),
                    ⋃ (_ : IsOpen V),
                      ⋃ (_ : IsOpen W),
                        ⋃ (_ : Disjoint (U * V) W),
                          {f | ⇑f '' {x} ⊆ U} ∩ {f | ⇑f '' {y} ⊆ V} ∩ {f | ⇑f '' {x * y} ⊆ W})ᶜ
i✝⁸ i✝⁷ : A
i✝⁶ i✝⁵ i✝⁴ : Set B
i✝³ : IsOpen i✝⁶
i✝² : IsOpen i✝⁵
i✝¹ : IsOpen i✝⁴
i✝ : Disjoint (i✝⁶ * i✝⁵) i✝⁴
⊢ IsOpen {f | ⇑f '' {i✝⁷} ⊆ i✝⁵}

Next tactic:
apply ContinuousMap.isOpen_gen isCompact_singleton
@[to_additive]
theorem closedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] :
    ClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) :=
  ⟨embedding_toContinuousMap A B,
    ⟨by
      suffices
        Set.range (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) =
          ({ f | f '' {1} ⊆ {1}ᶜ } ∪
              ⋃ (x) (y) (U) (V) (W) (_ : IsOpen U) (_ : IsOpen V) (_ : IsOpen W) (_ :
                Disjoint (U * V) W),
                { f | f '' {x} ⊆ U } ∩ { f | f '' {y} ⊆ V } ∩ { f | f '' {x * y} ⊆ W } :
                  Set C(A , B))ᶜ by
        rw [this, compl_compl]
        refine' (ContinuousMap.isOpen_gen isCompact_singleton isOpen_compl_singleton).union _
        repeat' apply isOpen_iUnion; intro
        repeat' apply IsOpen.inter
        all_goals apply ContinuousMap.isOpen_gen isCompact_singleton; 

Proof state:
case h.h.h.h.h.h.h.h.h.h₁.h₂
F : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
D : Type u_5
E : Type u_6
inst✝¹² : Monoid A
inst✝¹¹ : Monoid B
inst✝¹⁰ : Monoid C
inst✝⁹ : Monoid D
inst✝⁸ : CommGroup E
inst✝⁷ : TopologicalSpace A
inst✝⁶ : TopologicalSpace B
inst✝⁵ : TopologicalSpace C
inst✝⁴ : TopologicalSpace D
inst✝³ : TopologicalSpace E
inst✝² : TopologicalGroup E
inst✝¹ : ContinuousMul B
inst✝ : T2Space B
this :
  Set.range toContinuousMap =
    ({f | ⇑f '' {1} ⊆ {1}ᶜ} ∪
        ⋃ x,
          ⋃ y,
            ⋃ U,
              ⋃ V,
                ⋃ W,
                  ⋃ (_ : IsOpen U),
                    ⋃ (_ : IsOpen V),
                      ⋃ (_ : IsOpen W),
                        ⋃ (_ : Disjoint (U * V) W),
                          {f | ⇑f '' {x} ⊆ U} ∩ {f | ⇑f '' {y} ⊆ V} ∩ {f | ⇑f '' {x * y} ⊆ W})ᶜ
i✝⁸ i✝⁷ : A
i✝⁶ i✝⁵ i✝⁴ : Set B
i✝³ : IsOpen i✝⁶
i✝² : IsOpen i✝⁵
i✝¹ : IsOpen i✝⁴
i✝ : Disjoint (i✝⁶ * i✝⁵) i✝⁴
⊢ IsOpen i✝⁵

Next tactic:
assumption
@[to_additive]
theorem closedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] :
    ClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) :=
  ⟨embedding_toContinuousMap A B,
    ⟨by
      suffices
        Set.range (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) =
          ({ f | f '' {1} ⊆ {1}ᶜ } ∪
              ⋃ (x) (y) (U) (V) (W) (_ : IsOpen U) (_ : IsOpen V) (_ : IsOpen W) (_ :
                Disjoint (U * V) W),
                { f | f '' {x} ⊆ U } ∩ { f | f '' {y} ⊆ V } ∩ { f | f '' {x * y} ⊆ W } :
                  Set C(A , B))ᶜ by
        rw [this, compl_compl]
        refine' (ContinuousMap.isOpen_gen isCompact_singleton isOpen_compl_singleton).union _
        repeat' apply isOpen_iUnion; intro
        repeat' apply IsOpen.inter
        all_goals 

Proof state:
case h.h.h.h.h.h.h.h.h.h₂
F : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
D : Type u_5
E : Type u_6
inst✝¹² : Monoid A
inst✝¹¹ : Monoid B
inst✝¹⁰ : Monoid C
inst✝⁹ : Monoid D
inst✝⁸ : CommGroup E
inst✝⁷ : TopologicalSpace A
inst✝⁶ : TopologicalSpace B
inst✝⁵ : TopologicalSpace C
inst✝⁴ : TopologicalSpace D
inst✝³ : TopologicalSpace E
inst✝² : TopologicalGroup E
inst✝¹ : ContinuousMul B
inst✝ : T2Space B
this :
  Set.range toContinuousMap =
    ({f | ⇑f '' {1} ⊆ {1}ᶜ} ∪
        ⋃ x,
          ⋃ y,
            ⋃ U,
              ⋃ V,
                ⋃ W,
                  ⋃ (_ : IsOpen U),
                    ⋃ (_ : IsOpen V),
                      ⋃ (_ : IsOpen W),
                        ⋃ (_ : Disjoint (U * V) W),
                          {f | ⇑f '' {x} ⊆ U} ∩ {f | ⇑f '' {y} ⊆ V} ∩ {f | ⇑f '' {x * y} ⊆ W})ᶜ
i✝⁸ i✝⁷ : A
i✝⁶ i✝⁵ i✝⁴ : Set B
i✝³ : IsOpen i✝⁶
i✝² : IsOpen i✝⁵
i✝¹ : IsOpen i✝⁴
i✝ : Disjoint (i✝⁶ * i✝⁵) i✝⁴
⊢ IsOpen {f | ⇑f '' {i✝⁸ * i✝⁷} ⊆ i✝⁴}

Next tactic:
apply ContinuousMap.isOpen_gen isCompact_singleton
@[to_additive]
theorem closedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] :
    ClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) :=
  ⟨embedding_toContinuousMap A B,
    ⟨by
      suffices
        Set.range (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) =
          ({ f | f '' {1} ⊆ {1}ᶜ } ∪
              ⋃ (x) (y) (U) (V) (W) (_ : IsOpen U) (_ : IsOpen V) (_ : IsOpen W) (_ :
                Disjoint (U * V) W),
                { f | f '' {x} ⊆ U } ∩ { f | f '' {y} ⊆ V } ∩ { f | f '' {x * y} ⊆ W } :
                  Set C(A , B))ᶜ by
        rw [this, compl_compl]
        refine' (ContinuousMap.isOpen_gen isCompact_singleton isOpen_compl_singleton).union _
        repeat' apply isOpen_iUnion; intro
        repeat' apply IsOpen.inter
        all_goals apply ContinuousMap.isOpen_gen isCompact_singleton; 

Proof state:
case h.h.h.h.h.h.h.h.h.h₂
F : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
D : Type u_5
E : Type u_6
inst✝¹² : Monoid A
inst✝¹¹ : Monoid B
inst✝¹⁰ : Monoid C
inst✝⁹ : Monoid D
inst✝⁸ : CommGroup E
inst✝⁷ : TopologicalSpace A
inst✝⁶ : TopologicalSpace B
inst✝⁵ : TopologicalSpace C
inst✝⁴ : TopologicalSpace D
inst✝³ : TopologicalSpace E
inst✝² : TopologicalGroup E
inst✝¹ : ContinuousMul B
inst✝ : T2Space B
this :
  Set.range toContinuousMap =
    ({f | ⇑f '' {1} ⊆ {1}ᶜ} ∪
        ⋃ x,
          ⋃ y,
            ⋃ U,
              ⋃ V,
                ⋃ W,
                  ⋃ (_ : IsOpen U),
                    ⋃ (_ : IsOpen V),
                      ⋃ (_ : IsOpen W),
                        ⋃ (_ : Disjoint (U * V) W),
                          {f | ⇑f '' {x} ⊆ U} ∩ {f | ⇑f '' {y} ⊆ V} ∩ {f | ⇑f '' {x * y} ⊆ W})ᶜ
i✝⁸ i✝⁷ : A
i✝⁶ i✝⁵ i✝⁴ : Set B
i✝³ : IsOpen i✝⁶
i✝² : IsOpen i✝⁵
i✝¹ : IsOpen i✝⁴
i✝ : Disjoint (i✝⁶ * i✝⁵) i✝⁴
⊢ IsOpen i✝⁴

Next tactic:
assumption
@[to_additive]
theorem closedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] :
    ClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) :=
  ⟨embedding_toContinuousMap A B,
    ⟨by
      suffices
        Set.range (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) =
          ({ f | f '' {1} ⊆ {1}ᶜ } ∪
              ⋃ (x) (y) (U) (V) (W) (_ : IsOpen U) (_ : IsOpen V) (_ : IsOpen W) (_ :
                Disjoint (U * V) W),
                { f | f '' {x} ⊆ U } ∩ { f | f '' {y} ⊆ V } ∩ { f | f '' {x * y} ⊆ W } :
                  Set C(A , B))ᶜ by
        rw [this, compl_compl]
        refine' (ContinuousMap.isOpen_gen isCompact_singleton isOpen_compl_singleton).union _
        repeat' apply isOpen_iUnion; intro
        repeat' apply IsOpen.inter
        all_goals apply ContinuousMap.isOpen_gen isCompact_singleton; assumption
      

Proof state:
F : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
D : Type u_5
E : Type u_6
inst✝¹² : Monoid A
inst✝¹¹ : Monoid B
inst✝¹⁰ : Monoid C
inst✝⁹ : Monoid D
inst✝⁸ : CommGroup E
inst✝⁷ : TopologicalSpace A
inst✝⁶ : TopologicalSpace B
inst✝⁵ : TopologicalSpace C
inst✝⁴ : TopologicalSpace D
inst✝³ : TopologicalSpace E
inst✝² : TopologicalGroup E
inst✝¹ : ContinuousMul B
inst✝ : T2Space B
⊢ Set.range toContinuousMap =
    ({f | ⇑f '' {1} ⊆ {1}ᶜ} ∪
        ⋃ x,
          ⋃ y,
            ⋃ U,
              ⋃ V,
                ⋃ W,
                  ⋃ (_ : IsOpen U),
                    ⋃ (_ : IsOpen V),
                      ⋃ (_ : IsOpen W),
                        ⋃ (_ : Disjoint (U * V) W),
                          {f | ⇑f '' {x} ⊆ U} ∩ {f | ⇑f '' {y} ⊆ V} ∩ {f | ⇑f '' {x * y} ⊆ W})ᶜ

Next tactic:
simp_rw [Set.compl_union, Set.compl_iUnion, Set.image_singleton, Set.singleton_subset_iff,
        Set.ext_iff, Set.mem_inter_iff, Set.mem_iInter, Set.mem_compl_iff]
@[to_additive]
theorem closedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] :
    ClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) :=
  ⟨embedding_toContinuousMap A B,
    ⟨by
      suffices
        Set.range (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) =
          ({ f | f '' {1} ⊆ {1}ᶜ } ∪
              ⋃ (x) (y) (U) (V) (W) (_ : IsOpen U) (_ : IsOpen V) (_ : IsOpen W) (_ :
                Disjoint (U * V) W),
                { f | f '' {x} ⊆ U } ∩ { f | f '' {y} ⊆ V } ∩ { f | f '' {x * y} ⊆ W } :
                  Set C(A , B))ᶜ by
        rw [this, compl_compl]
        refine' (ContinuousMap.isOpen_gen isCompact_singleton isOpen_compl_singleton).union _
        repeat' apply isOpen_iUnion; intro
        repeat' apply IsOpen.inter
        all_goals apply ContinuousMap.isOpen_gen isCompact_singleton; assumption
      simp_rw [Set.compl_union, Set.compl_iUnion, Set.image_singleton, Set.singleton_subset_iff,
        Set.ext_iff, Set.mem_inter_iff, Set.mem_iInter, Set.mem_compl_iff]
      

Proof state:
F : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
D : Type u_5
E : Type u_6
inst✝¹² : Monoid A
inst✝¹¹ : Monoid B
inst✝¹⁰ : Monoid C
inst✝⁹ : Monoid D
inst✝⁸ : CommGroup E
inst✝⁷ : TopologicalSpace A
inst✝⁶ : TopologicalSpace B
inst✝⁵ : TopologicalSpace C
inst✝⁴ : TopologicalSpace D
inst✝³ : TopologicalSpace E
inst✝² : TopologicalGroup E
inst✝¹ : ContinuousMul B
inst✝ : T2Space B
⊢ ∀ (x : C(A, B)),
    x ∈ Set.range toContinuousMap ↔
      x ∉ {f | f 1 ∉ {1}} ∧
        ∀ (i i_1 : A) (i_2 i_3 i_4 : Set B),
          IsOpen i_2 →
            IsOpen i_3 →
              IsOpen i_4 → Disjoint (i_2 * i_3) i_4 → x ∉ {f | f i ∈ i_2} ∩ {f | f i_1 ∈ i_3} ∩ {f | f (i * i_1) ∈ i_4}

Next tactic:
refine' fun f => ⟨_, _⟩
@[to_additive]
theorem closedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] :
    ClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) :=
  ⟨embedding_toContinuousMap A B,
    ⟨by
      suffices
        Set.range (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) =
          ({ f | f '' {1} ⊆ {1}ᶜ } ∪
              ⋃ (x) (y) (U) (V) (W) (_ : IsOpen U) (_ : IsOpen V) (_ : IsOpen W) (_ :
                Disjoint (U * V) W),
                { f | f '' {x} ⊆ U } ∩ { f | f '' {y} ⊆ V } ∩ { f | f '' {x * y} ⊆ W } :
                  Set C(A , B))ᶜ by
        rw [this, compl_compl]
        refine' (ContinuousMap.isOpen_gen isCompact_singleton isOpen_compl_singleton).union _
        repeat' apply isOpen_iUnion; intro
        repeat' apply IsOpen.inter
        all_goals apply ContinuousMap.isOpen_gen isCompact_singleton; assumption
      simp_rw [Set.compl_union, Set.compl_iUnion, Set.image_singleton, Set.singleton_subset_iff,
        Set.ext_iff, Set.mem_inter_iff, Set.mem_iInter, Set.mem_compl_iff]
      refine' fun f => ⟨_, _⟩
      · 

Proof state:
case refine'_1
F : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
D : Type u_5
E : Type u_6
inst✝¹² : Monoid A
inst✝¹¹ : Monoid B
inst✝¹⁰ : Monoid C
inst✝⁹ : Monoid D
inst✝⁸ : CommGroup E
inst✝⁷ : TopologicalSpace A
inst✝⁶ : TopologicalSpace B
inst✝⁵ : TopologicalSpace C
inst✝⁴ : TopologicalSpace D
inst✝³ : TopologicalSpace E
inst✝² : TopologicalGroup E
inst✝¹ : ContinuousMul B
inst✝ : T2Space B
f : C(A, B)
⊢ f ∈ Set.range toContinuousMap →
    f ∉ {f | f 1 ∉ {1}} ∧
      ∀ (i i_1 : A) (i_2 i_3 i_4 : Set B),
        IsOpen i_2 →
          IsOpen i_3 →
            IsOpen i_4 → Disjoint (i_2 * i_3) i_4 → f ∉ {f | f i ∈ i_2} ∩ {f | f i_1 ∈ i_3} ∩ {f | f (i * i_1) ∈ i_4}

Next tactic:
rintro ⟨f, rfl⟩
@[to_additive]
theorem closedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] :
    ClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) :=
  ⟨embedding_toContinuousMap A B,
    ⟨by
      suffices
        Set.range (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) =
          ({ f | f '' {1} ⊆ {1}ᶜ } ∪
              ⋃ (x) (y) (U) (V) (W) (_ : IsOpen U) (_ : IsOpen V) (_ : IsOpen W) (_ :
                Disjoint (U * V) W),
                { f | f '' {x} ⊆ U } ∩ { f | f '' {y} ⊆ V } ∩ { f | f '' {x * y} ⊆ W } :
                  Set C(A , B))ᶜ by
        rw [this, compl_compl]
        refine' (ContinuousMap.isOpen_gen isCompact_singleton isOpen_compl_singleton).union _
        repeat' apply isOpen_iUnion; intro
        repeat' apply IsOpen.inter
        all_goals apply ContinuousMap.isOpen_gen isCompact_singleton; assumption
      simp_rw [Set.compl_union, Set.compl_iUnion, Set.image_singleton, Set.singleton_subset_iff,
        Set.ext_iff, Set.mem_inter_iff, Set.mem_iInter, Set.mem_compl_iff]
      refine' fun f => ⟨_, _⟩
      · rintro ⟨f, rfl⟩
        

Proof state:
case refine'_1.intro
F : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
D : Type u_5
E : Type u_6
inst✝¹² : Monoid A
inst✝¹¹ : Monoid B
inst✝¹⁰ : Monoid C
inst✝⁹ : Monoid D
inst✝⁸ : CommGroup E
inst✝⁷ : TopologicalSpace A
inst✝⁶ : TopologicalSpace B
inst✝⁵ : TopologicalSpace C
inst✝⁴ : TopologicalSpace D
inst✝³ : TopologicalSpace E
inst✝² : TopologicalGroup E
inst✝¹ : ContinuousMul B
inst✝ : T2Space B
f : ContinuousMonoidHom A B
⊢ toContinuousMap f ∉ {f | f 1 ∉ {1}} ∧
    ∀ (i i_1 : A) (i_2 i_3 i_4 : Set B),
      IsOpen i_2 →
        IsOpen i_3 →
          IsOpen i_4 →
            Disjoint (i_2 * i_3) i_4 → toContinuousMap f ∉ {f | f i ∈ i_2} ∩ {f | f i_1 ∈ i_3} ∩ {f | f (i * i_1) ∈ i_4}

Next tactic:
exact
          ⟨fun h => h (map_one f), fun x y U V W _hU _hV _hW h ⟨⟨hfU, hfV⟩, hfW⟩ =>
            h.le_bot ⟨Set.mul_mem_mul hfU hfV, (congr_arg (· ∈ W) (map_mul f x y)).mp hfW⟩⟩
@[to_additive]
theorem closedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] :
    ClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) :=
  ⟨embedding_toContinuousMap A B,
    ⟨by
      suffices
        Set.range (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) =
          ({ f | f '' {1} ⊆ {1}ᶜ } ∪
              ⋃ (x) (y) (U) (V) (W) (_ : IsOpen U) (_ : IsOpen V) (_ : IsOpen W) (_ :
                Disjoint (U * V) W),
                { f | f '' {x} ⊆ U } ∩ { f | f '' {y} ⊆ V } ∩ { f | f '' {x * y} ⊆ W } :
                  Set C(A , B))ᶜ by
        rw [this, compl_compl]
        refine' (ContinuousMap.isOpen_gen isCompact_singleton isOpen_compl_singleton).union _
        repeat' apply isOpen_iUnion; intro
        repeat' apply IsOpen.inter
        all_goals apply ContinuousMap.isOpen_gen isCompact_singleton; assumption
      simp_rw [Set.compl_union, Set.compl_iUnion, Set.image_singleton, Set.singleton_subset_iff,
        Set.ext_iff, Set.mem_inter_iff, Set.mem_iInter, Set.mem_compl_iff]
      refine' fun f => ⟨_, _⟩
      · rintro ⟨f, rfl⟩
        exact
          ⟨fun h => h (map_one f), fun x y U V W _hU _hV _hW h ⟨⟨hfU, hfV⟩, hfW⟩ =>
            h.le_bot ⟨Set.mul_mem_mul hfU hfV, (congr_arg (· ∈ W) (map_mul f x y)).mp hfW⟩⟩
      · 

Proof state:
case refine'_2
F : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
D : Type u_5
E : Type u_6
inst✝¹² : Monoid A
inst✝¹¹ : Monoid B
inst✝¹⁰ : Monoid C
inst✝⁹ : Monoid D
inst✝⁸ : CommGroup E
inst✝⁷ : TopologicalSpace A
inst✝⁶ : TopologicalSpace B
inst✝⁵ : TopologicalSpace C
inst✝⁴ : TopologicalSpace D
inst✝³ : TopologicalSpace E
inst✝² : TopologicalGroup E
inst✝¹ : ContinuousMul B
inst✝ : T2Space B
f : C(A, B)
⊢ (f ∉ {f | f 1 ∉ {1}} ∧
      ∀ (i i_1 : A) (i_2 i_3 i_4 : Set B),
        IsOpen i_2 →
          IsOpen i_3 →
            IsOpen i_4 → Disjoint (i_2 * i_3) i_4 → f ∉ {f | f i ∈ i_2} ∩ {f | f i_1 ∈ i_3} ∩ {f | f (i * i_1) ∈ i_4}) →
    f ∈ Set.range toContinuousMap

Next tactic:
rintro ⟨hf1, hf2⟩
@[to_additive]
theorem closedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] :
    ClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) :=
  ⟨embedding_toContinuousMap A B,
    ⟨by
      suffices
        Set.range (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) =
          ({ f | f '' {1} ⊆ {1}ᶜ } ∪
              ⋃ (x) (y) (U) (V) (W) (_ : IsOpen U) (_ : IsOpen V) (_ : IsOpen W) (_ :
                Disjoint (U * V) W),
                { f | f '' {x} ⊆ U } ∩ { f | f '' {y} ⊆ V } ∩ { f | f '' {x * y} ⊆ W } :
                  Set C(A , B))ᶜ by
        rw [this, compl_compl]
        refine' (ContinuousMap.isOpen_gen isCompact_singleton isOpen_compl_singleton).union _
        repeat' apply isOpen_iUnion; intro
        repeat' apply IsOpen.inter
        all_goals apply ContinuousMap.isOpen_gen isCompact_singleton; assumption
      simp_rw [Set.compl_union, Set.compl_iUnion, Set.image_singleton, Set.singleton_subset_iff,
        Set.ext_iff, Set.mem_inter_iff, Set.mem_iInter, Set.mem_compl_iff]
      refine' fun f => ⟨_, _⟩
      · rintro ⟨f, rfl⟩
        exact
          ⟨fun h => h (map_one f), fun x y U V W _hU _hV _hW h ⟨⟨hfU, hfV⟩, hfW⟩ =>
            h.le_bot ⟨Set.mul_mem_mul hfU hfV, (congr_arg (· ∈ W) (map_mul f x y)).mp hfW⟩⟩
      · rintro ⟨hf1, hf2⟩
        

Proof state:
case refine'_2.intro
F : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
D : Type u_5
E : Type u_6
inst✝¹² : Monoid A
inst✝¹¹ : Monoid B
inst✝¹⁰ : Monoid C
inst✝⁹ : Monoid D
inst✝⁸ : CommGroup E
inst✝⁷ : TopologicalSpace A
inst✝⁶ : TopologicalSpace B
inst✝⁵ : TopologicalSpace C
inst✝⁴ : TopologicalSpace D
inst✝³ : TopologicalSpace E
inst✝² : TopologicalGroup E
inst✝¹ : ContinuousMul B
inst✝ : T2Space B
f : C(A, B)
hf1 : f ∉ {f | f 1 ∉ {1}}
hf2 :
  ∀ (i i_1 : A) (i_2 i_3 i_4 : Set B),
    IsOpen i_2 →
      IsOpen i_3 →
        IsOpen i_4 → Disjoint (i_2 * i_3) i_4 → f ∉ {f | f i ∈ i_2} ∩ {f | f i_1 ∈ i_3} ∩ {f | f (i * i_1) ∈ i_4}
⊢ f ∈ Set.range toContinuousMap

Next tactic:
suffices ∀ x y, f (x * y) = f x * f y by
          refine'
            ⟨({ f with
                  map_one' := of_not_not hf1
                  map_mul' := this } :
                ContinuousMonoidHom A B),
              ContinuousMap.ext fun _ => rfl⟩
@[to_additive]
theorem closedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] :
    ClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) :=
  ⟨embedding_toContinuousMap A B,
    ⟨by
      suffices
        Set.range (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) =
          ({ f | f '' {1} ⊆ {1}ᶜ } ∪
              ⋃ (x) (y) (U) (V) (W) (_ : IsOpen U) (_ : IsOpen V) (_ : IsOpen W) (_ :
                Disjoint (U * V) W),
                { f | f '' {x} ⊆ U } ∩ { f | f '' {y} ⊆ V } ∩ { f | f '' {x * y} ⊆ W } :
                  Set C(A , B))ᶜ by
        rw [this, compl_compl]
        refine' (ContinuousMap.isOpen_gen isCompact_singleton isOpen_compl_singleton).union _
        repeat' apply isOpen_iUnion; intro
        repeat' apply IsOpen.inter
        all_goals apply ContinuousMap.isOpen_gen isCompact_singleton; assumption
      simp_rw [Set.compl_union, Set.compl_iUnion, Set.image_singleton, Set.singleton_subset_iff,
        Set.ext_iff, Set.mem_inter_iff, Set.mem_iInter, Set.mem_compl_iff]
      refine' fun f => ⟨_, _⟩
      · rintro ⟨f, rfl⟩
        exact
          ⟨fun h => h (map_one f), fun x y U V W _hU _hV _hW h ⟨⟨hfU, hfV⟩, hfW⟩ =>
            h.le_bot ⟨Set.mul_mem_mul hfU hfV, (congr_arg (· ∈ W) (map_mul f x y)).mp hfW⟩⟩
      · rintro ⟨hf1, hf2⟩
        suffices ∀ x y, f (x * y) = f x * f y by
          

Proof state:
F : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
D : Type u_5
E : Type u_6
inst✝¹² : Monoid A
inst✝¹¹ : Monoid B
inst✝¹⁰ : Monoid C
inst✝⁹ : Monoid D
inst✝⁸ : CommGroup E
inst✝⁷ : TopologicalSpace A
inst✝⁶ : TopologicalSpace B
inst✝⁵ : TopologicalSpace C
inst✝⁴ : TopologicalSpace D
inst✝³ : TopologicalSpace E
inst✝² : TopologicalGroup E
inst✝¹ : ContinuousMul B
inst✝ : T2Space B
f : C(A, B)
hf1 : f ∉ {f | f 1 ∉ {1}}
hf2 :
  ∀ (i i_1 : A) (i_2 i_3 i_4 : Set B),
    IsOpen i_2 →
      IsOpen i_3 →
        IsOpen i_4 → Disjoint (i_2 * i_3) i_4 → f ∉ {f | f i ∈ i_2} ∩ {f | f i_1 ∈ i_3} ∩ {f | f (i * i_1) ∈ i_4}
this : ∀ (x y : A), f (x * y) = f x * f y
⊢ f ∈ Set.range toContinuousMap

Next tactic:
refine'
            ⟨({ f with
                  map_one' := of_not_not hf1
                  map_mul' := this } :
                ContinuousMonoidHom A B),
              ContinuousMap.ext fun _ => rfl⟩
@[to_additive]
theorem closedEmbedding_toContinuousMap [ContinuousMul B] [T2Space B] :
    ClosedEmbedding (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) :=
  ⟨embedding_toContinuousMap A B,
    ⟨by
      suffices
        Set.range (toContinuousMap : ContinuousMonoidHom A B → C(A, B)) =
          ({ f | f '' {1} ⊆ {1}ᶜ } ∪
              ⋃ (x) (y) (U) (V) (W) (_ : IsOpen U) (_ : IsOpen V) (_ : IsOpen W) (_ :
                Disjoint (U * V) W),
                { f | f '' {x} ⊆ U } ∩ { f | f '' {y} ⊆ V } ∩ { f | f '' {x * y} ⊆ W } :
                  Set C(A , B))ᶜ by
        rw [this, compl_compl]
        refine' (ContinuousMap.isOpen_gen isCompact_singleton isOpen_compl_singleton).union _
        repeat' apply isOpen_iUnion; intro
        repeat' apply IsOpen.inter
        all_goals apply ContinuousMap.isOpen_gen isCompact_singleton; assumption
      simp_rw [Set.compl_union, Set.compl_iUnion, Set.image_singleton, Set.singleton_subset_iff,
        Set.ext_iff, Set.mem_inter_iff, Set.mem_iInter, Set.mem_compl_iff]
      refine' fun f => ⟨_, _⟩
      · rintro ⟨f, rfl⟩
        exact
          ⟨fun h => h (map_one f), fun x y U V W _hU _hV _hW h ⟨⟨hfU, hfV⟩, hfW⟩ =>
            h.le_bot ⟨Set.mul_mem_mul hfU hfV, (congr_arg (· ∈ W) (map_mul f x y)).mp hfW⟩⟩
      · rintro ⟨hf1, hf2⟩
        suffices ∀ x y, f (x * y) = f x * f y by
          refine'
            ⟨({ f with
                  map_one' := of_not_not hf1
                  map_mul' := this } :
                ContinuousMonoidHom A B),
              ContinuousMap.ext fun _ => rfl⟩
        

Proof state:
case refine'_2.intro
F : Type u_1
A : Type u_2
B : Type u_3
C : Type u_4
D : Type u_5
E : Type u_6
inst✝¹² : Monoid A
inst✝¹¹ : Monoid B
inst✝¹⁰ : Monoid C
inst✝⁹ : Monoid D
inst✝⁸ : CommGroup E
inst✝⁷ : TopologicalSpace A
inst✝⁶ : TopologicalSpace B
inst✝⁵ : TopologicalSpace C
inst✝⁴ : TopologicalSpace D
inst✝³ : TopologicalSpace E
inst✝² : TopologicalGroup E
inst✝¹ : ContinuousMul B
inst✝ : T2Space B
f : C(A, B)
hf1 : f ∉ {f | f 1 ∉ {1}}
hf2 :
  ∀ (i i_1 : A) (i_2 i_3 i_4 : Set B),
    IsOpen i_2 →
      IsOpen i_3 →
        IsOpen i_4 → Disjoint (i_2 * i_3) i_4 → f ∉ {f | f i ∈ i_2} ∩ {f | f i_1 ∈ i_3} ∩ {f | f (i * i_1) ∈ i_4}
⊢ ∀ (x y : A), f (x * y) = f x * f y

Next tactic:
intro x y