@[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
        

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✝⁶}
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✝⁵}
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:
all_goals apply ContinuousMap.isOpen_gen isCompact_singleton; assumption