l3lab/ntp-mathlib huggingface dataset:
/-- A multiplicative analogue of `Equiv.arrowCongr`,
where the equivalence between the targets is multiplicative.
-/
@[to_additive (attr := simps apply) "An additive analogue of `Equiv.arrowCongr`,
  where the equivalence between the targets is additive."]
def arrowCongr {M N P Q : Type*} [Mul P] [Mul Q] (f : M ≃ N) (g : P ≃* Q) :
    (M → P) ≃* (N → Q) where
  toFun h n := g (h (f.symm n))
  invFun k m := g.symm (k (f m))
  left_inv h := by ext; simp
  right_inv k := by ext; simp
  map_mul' h k := by ext; 

Proof state:
case h
F : Type u_1
α : Type u_2
β : Type u_3
A : Type u_4
B : Type u_5
M✝ : Type u_6
N✝ : Type u_7
P✝ : Type u_8
Q✝ : Type u_9
G : Type u_10
H : Type u_11
inst✝⁵ : Mul M✝
inst✝⁴ : Mul N✝
inst✝³ : Mul P✝
inst✝² : Mul Q✝
M : Type u_12
N : Type u_13
P : Type u_14
Q : Type u_15
inst✝¹ : Mul P
inst✝ : Mul Q
f : M ≃ N
g : P ≃* Q
h k : M → P
x✝ : N
⊢ Equiv.toFun
      { toFun := fun h n => g (h (f.symm n)), invFun := fun k m => (symm g) (k (f m)),
        left_inv := (_ : ∀ (h : M → P), (fun k m => (symm g) (k (f m))) ((fun h n => g (h (f.symm n))) h) = h),
        right_inv := (_ : ∀ (k : N → Q), (fun h n => g (h (f.symm n))) ((fun k m => (symm g) (k (f m))) k) = k) }
      (h * k) x✝ =
    (Equiv.toFun
          { toFun := fun h n => g (h (f.symm n)), invFun := fun k m => (symm g) (k (f m)),
            left_inv := (_ : ∀ (h : M → P), (fun k m => (symm g) (k (f m))) ((fun h n => g (h (f.symm n))) h) = h),
            right_inv := (_ : ∀ (k : N → Q), (fun h n => g (h (f.symm n))) ((fun k m => (symm g) (k (f m))) k) = k) }
          h *
        Equiv.toFun
          { toFun := fun h n => g (h (f.symm n)), invFun := fun k m => (symm g) (k (f m)),
            left_inv := (_ : ∀ (h : M → P), (fun k m => (symm g) (k (f m))) ((fun h n => g (h (f.symm n))) h) = h),
            right_inv := (_ : ∀ (k : N → Q), (fun h n => g (h (f.symm n))) ((fun k m => (symm g) (k (f m))) k) = k) }
          k)
      x✝

Next tactic:
simp
/-- A multiplicative analogue of `Equiv.arrowCongr`,
for multiplicative maps from a monoid to a commutative monoid.
-/
@[to_additive (attr := simps apply)
  "An additive analogue of `Equiv.arrowCongr`,
  for additive maps from an additive monoid to a commutative additive monoid."]
-- porting note: @[simps apply] removed because it was making a lemma which
-- wasn't in simp normal form.
def monoidHomCongr {M N P Q} [MulOneClass M] [MulOneClass N] [CommMonoid P] [CommMonoid Q]
    (f : M ≃* N) (g : P ≃* Q) : (M →* P) ≃* (N →* Q) where
  toFun h := g.toMonoidHom.comp (h.comp f.symm.toMonoidHom)
  invFun k := g.symm.toMonoidHom.comp (k.comp f.toMonoidHom)
  left_inv h := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
A : Type u_4
B : Type u_5
M✝ : Type u_6
N✝ : Type u_7
P✝ : Type u_8
Q✝ : Type u_9
G : Type u_10
H : Type u_11
inst✝⁷ : Mul M✝
inst✝⁶ : Mul N✝
inst✝⁵ : Mul P✝
inst✝⁴ : Mul Q✝
M : Type ?u.65294
N : Type ?u.65297
P : Type ?u.65300
Q : Type ?u.65303
inst✝³ : MulOneClass M
inst✝² : MulOneClass N
inst✝¹ : CommMonoid P
inst✝ : CommMonoid Q
f : M ≃* N
g : P ≃* Q
h : M →* P
⊢ (fun k => MonoidHom.comp (toMonoidHom (symm g)) (MonoidHom.comp k (toMonoidHom f)))
      ((fun h => MonoidHom.comp (toMonoidHom g) (MonoidHom.comp h (toMonoidHom (symm f)))) h) =
    h

Next tactic:
ext
/-- A multiplicative analogue of `Equiv.arrowCongr`,
for multiplicative maps from a monoid to a commutative monoid.
-/
@[to_additive (attr := simps apply)
  "An additive analogue of `Equiv.arrowCongr`,
  for additive maps from an additive monoid to a commutative additive monoid."]
-- porting note: @[simps apply] removed because it was making a lemma which
-- wasn't in simp normal form.
def monoidHomCongr {M N P Q} [MulOneClass M] [MulOneClass N] [CommMonoid P] [CommMonoid Q]
    (f : M ≃* N) (g : P ≃* Q) : (M →* P) ≃* (N →* Q) where
  toFun h := g.toMonoidHom.comp (h.comp f.symm.toMonoidHom)
  invFun k := g.symm.toMonoidHom.comp (k.comp f.toMonoidHom)
  left_inv h := by ext; 

Proof state:
case h
F : Type u_1
α : Type u_2
β : Type u_3
A : Type u_4
B : Type u_5
M✝ : Type u_6
N✝ : Type u_7
P✝ : Type u_8
Q✝ : Type u_9
G : Type u_10
H : Type u_11
inst✝⁷ : Mul M✝
inst✝⁶ : Mul N✝
inst✝⁵ : Mul P✝
inst✝⁴ : Mul Q✝
M : Type ?u.65294
N : Type ?u.65297
P : Type ?u.65300
Q : Type ?u.65303
inst✝³ : MulOneClass M
inst✝² : MulOneClass N
inst✝¹ : CommMonoid P
inst✝ : CommMonoid Q
f : M ≃* N
g : P ≃* Q
h : M →* P
x✝ : M
⊢ ((fun k => MonoidHom.comp (toMonoidHom (symm g)) (MonoidHom.comp k (toMonoidHom f)))
        ((fun h => MonoidHom.comp (toMonoidHom g) (MonoidHom.comp h (toMonoidHom (symm f)))) h))
      x✝ =
    h x✝

Next tactic:
simp
/-- A multiplicative analogue of `Equiv.arrowCongr`,
for multiplicative maps from a monoid to a commutative monoid.
-/
@[to_additive (attr := simps apply)
  "An additive analogue of `Equiv.arrowCongr`,
  for additive maps from an additive monoid to a commutative additive monoid."]
-- porting note: @[simps apply] removed because it was making a lemma which
-- wasn't in simp normal form.
def monoidHomCongr {M N P Q} [MulOneClass M] [MulOneClass N] [CommMonoid P] [CommMonoid Q]
    (f : M ≃* N) (g : P ≃* Q) : (M →* P) ≃* (N →* Q) where
  toFun h := g.toMonoidHom.comp (h.comp f.symm.toMonoidHom)
  invFun k := g.symm.toMonoidHom.comp (k.comp f.toMonoidHom)
  left_inv h := by ext; simp
  right_inv k := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
A : Type u_4
B : Type u_5
M✝ : Type u_6
N✝ : Type u_7
P✝ : Type u_8
Q✝ : Type u_9
G : Type u_10
H : Type u_11
inst✝⁷ : Mul M✝
inst✝⁶ : Mul N✝
inst✝⁵ : Mul P✝
inst✝⁴ : Mul Q✝
M : Type ?u.65294
N : Type ?u.65297
P : Type ?u.65300
Q : Type ?u.65303
inst✝³ : MulOneClass M
inst✝² : MulOneClass N
inst✝¹ : CommMonoid P
inst✝ : CommMonoid Q
f : M ≃* N
g : P ≃* Q
k : N →* Q
⊢ (fun h => MonoidHom.comp (toMonoidHom g) (MonoidHom.comp h (toMonoidHom (symm f))))
      ((fun k => MonoidHom.comp (toMonoidHom (symm g)) (MonoidHom.comp k (toMonoidHom f))) k) =
    k

Next tactic:
ext
/-- A multiplicative analogue of `Equiv.arrowCongr`,
for multiplicative maps from a monoid to a commutative monoid.
-/
@[to_additive (attr := simps apply)
  "An additive analogue of `Equiv.arrowCongr`,
  for additive maps from an additive monoid to a commutative additive monoid."]
-- porting note: @[simps apply] removed because it was making a lemma which
-- wasn't in simp normal form.
def monoidHomCongr {M N P Q} [MulOneClass M] [MulOneClass N] [CommMonoid P] [CommMonoid Q]
    (f : M ≃* N) (g : P ≃* Q) : (M →* P) ≃* (N →* Q) where
  toFun h := g.toMonoidHom.comp (h.comp f.symm.toMonoidHom)
  invFun k := g.symm.toMonoidHom.comp (k.comp f.toMonoidHom)
  left_inv h := by ext; simp
  right_inv k := by ext; 

Proof state:
case h
F : Type u_1
α : Type u_2
β : Type u_3
A : Type u_4
B : Type u_5
M✝ : Type u_6
N✝ : Type u_7
P✝ : Type u_8
Q✝ : Type u_9
G : Type u_10
H : Type u_11
inst✝⁷ : Mul M✝
inst✝⁶ : Mul N✝
inst✝⁵ : Mul P✝
inst✝⁴ : Mul Q✝
M : Type ?u.65294
N : Type ?u.65297
P : Type ?u.65300
Q : Type ?u.65303
inst✝³ : MulOneClass M
inst✝² : MulOneClass N
inst✝¹ : CommMonoid P
inst✝ : CommMonoid Q
f : M ≃* N
g : P ≃* Q
k : N →* Q
x✝ : N
⊢ ((fun h => MonoidHom.comp (toMonoidHom g) (MonoidHom.comp h (toMonoidHom (symm f))))
        ((fun k => MonoidHom.comp (toMonoidHom (symm g)) (MonoidHom.comp k (toMonoidHom f))) k))
      x✝ =
    k x✝

Next tactic:
simp
@[simp]
theorem forall_smul_mem_iff {R M S : Type*} [Monoid R] [MulAction R M] [SetLike S M]
    [SMulMemClass S R M] {N : S} {x : M} : (∀ a : R, a • x ∈ N) ↔ x ∈ N :=
  ⟨fun h => by 

Proof state:
S✝ : Type u'
T : Type u''
R✝ : Type u
M✝ : Type v
inst✝⁵ : SMul R✝ M✝
inst✝⁴ : SetLike S✝ M✝
hS : SMulMemClass S✝ R✝ M✝
s : S✝
R : Type u_1
M : Type u_2
S : Type u_3
inst✝³ : Monoid R
inst✝² : MulAction R M
inst✝¹ : SetLike S M
inst✝ : SMulMemClass S R M
N : S
x : M
h : ∀ (a : R), a • x ∈ N
⊢ x ∈ N

Next tactic:
simpa using h 1
instance : SetLike (SubMulAction R M) M :=
  ⟨SubMulAction.carrier, fun p q h => by 

Proof state:
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝ : SMul R M
p q : SubMulAction R M
h : p.carrier = q.carrier
⊢ p = q

Next tactic:
cases p
instance : SetLike (SubMulAction R M) M :=
  ⟨SubMulAction.carrier, fun p q h => by cases p; 

Proof state:
case mk
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝ : SMul R M
q : SubMulAction R M
carrier✝ : Set M
smul_mem'✝ : ∀ (c : R) {x : M}, x ∈ carrier✝ → c • x ∈ carrier✝
h : { carrier := carrier✝, smul_mem' := smul_mem'✝ }.carrier = q.carrier
⊢ { carrier := carrier✝, smul_mem' := smul_mem'✝ } = q

Next tactic:
cases q
instance : SetLike (SubMulAction R M) M :=
  ⟨SubMulAction.carrier, fun p q h => by cases p; cases q; 

Proof state:
case mk.mk
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝ : SMul R M
carrier✝¹ : Set M
smul_mem'✝¹ : ∀ (c : R) {x : M}, x ∈ carrier✝¹ → c • x ∈ carrier✝¹
carrier✝ : Set M
smul_mem'✝ : ∀ (c : R) {x : M}, x ∈ carrier✝ → c • x ∈ carrier✝
h :
  { carrier := carrier✝¹, smul_mem' := smul_mem'✝¹ }.carrier = { carrier := carrier✝, smul_mem' := smul_mem'✝ }.carrier
⊢ { carrier := carrier✝¹, smul_mem' := smul_mem'✝¹ } = { carrier := carrier✝, smul_mem' := smul_mem'✝ }

Next tactic:
congr
/-- Embedding of a submodule `p` to the ambient space `M`. -/
protected def subtype : p →[R] M := by 

Proof state:
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝ : SMul R M
p : SubMulAction R M
r : R
x : M
⊢ ↥p →[R] M

Next tactic:
refine' { toFun := Subtype.val.. }
/-- Embedding of a submodule `p` to the ambient space `M`. -/
protected def subtype : p →[R] M := by refine' { toFun := Subtype.val.. }; 

Proof state:
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝ : SMul R M
p : SubMulAction R M
r : R
x : M
⊢ ∀ (m : R) (x : ↥p), ↑(m • x) = m • ↑x

Next tactic:
simp [val_smul]
theorem smul_of_tower_mem (s : S) {x : M} (h : x ∈ p) : s • x ∈ p := by
  

Proof state:
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝⁴ : Monoid R
inst✝³ : MulAction R M
inst✝² : SMul S R
inst✝¹ : SMul S M
inst✝ : IsScalarTower S R M
p : SubMulAction R M
s : S
x : M
h : x ∈ p
⊢ s • x ∈ p

Next tactic:
rw [← one_smul R x, ← smul_assoc]
theorem smul_of_tower_mem (s : S) {x : M} (h : x ∈ p) : s • x ∈ p := by
  rw [← one_smul R x, ← smul_assoc]
  

Proof state:
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝⁴ : Monoid R
inst✝³ : MulAction R M
inst✝² : SMul S R
inst✝¹ : SMul S M
inst✝ : IsScalarTower S R M
p : SubMulAction R M
s : S
x : M
h : x ∈ p
⊢ (s • 1) • x ∈ p

Next tactic:
exact p.smul_mem _ h
/-- Stabilizers in monoid SubMulAction coincide with stabilizers in the ambient space -/
theorem stabilizer_of_subMul.submonoid {p : SubMulAction R M} (m : p) :
    MulAction.stabilizerSubmonoid R m = MulAction.stabilizerSubmonoid R (m : M) := by
  

Proof state:
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝¹ : Monoid R
inst✝ : MulAction R M
p : SubMulAction R M
m : ↥p
⊢ MulAction.stabilizerSubmonoid R m = MulAction.stabilizerSubmonoid R ↑m

Next tactic:
ext
/-- Stabilizers in monoid SubMulAction coincide with stabilizers in the ambient space -/
theorem stabilizer_of_subMul.submonoid {p : SubMulAction R M} (m : p) :
    MulAction.stabilizerSubmonoid R m = MulAction.stabilizerSubmonoid R (m : M) := by
  ext
  

Proof state:
case h
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝¹ : Monoid R
inst✝ : MulAction R M
p : SubMulAction R M
m : ↥p
x✝ : R
⊢ x✝ ∈ MulAction.stabilizerSubmonoid R m ↔ x✝ ∈ MulAction.stabilizerSubmonoid R ↑m

Next tactic:
simp only [MulAction.mem_stabilizerSubmonoid_iff, ← SubMulAction.val_smul, SetLike.coe_eq_coe]
/-- Stabilizers in group SubMulAction coincide with stabilizers in the ambient space -/
theorem stabilizer_of_subMul {p : SubMulAction R M} (m : p) :
    MulAction.stabilizer R m = MulAction.stabilizer R (m : M) := by
  

Proof state:
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝¹ : Group R
inst✝ : MulAction R M
p : SubMulAction R M
m : ↥p
⊢ MulAction.stabilizer R m = MulAction.stabilizer R ↑m

Next tactic:
rw [← Subgroup.toSubmonoid_eq]
/-- Stabilizers in group SubMulAction coincide with stabilizers in the ambient space -/
theorem stabilizer_of_subMul {p : SubMulAction R M} (m : p) :
    MulAction.stabilizer R m = MulAction.stabilizer R (m : M) := by
  rw [← Subgroup.toSubmonoid_eq]
  

Proof state:
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝¹ : Group R
inst✝ : MulAction R M
p : SubMulAction R M
m : ↥p
⊢ (MulAction.stabilizer R m).toSubmonoid = (MulAction.stabilizer R ↑m).toSubmonoid

Next tactic:
exact stabilizer_of_subMul.submonoid m
theorem neg_mem (hx : x ∈ p) : -x ∈ p := by
  

Proof state:
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
p p' : SubMulAction R M
r : R
x y : M
hx : x ∈ p
⊢ -x ∈ p

Next tactic:
rw [← neg_one_smul R]
theorem neg_mem (hx : x ∈ p) : -x ∈ p := by
  rw [← neg_one_smul R]
  

Proof state:
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
p p' : SubMulAction R M
r : R
x y : M
hx : x ∈ p
⊢ -1 • x ∈ p

Next tactic:
exact p.smul_mem _ hx
@[simp]
theorem neg_mem_iff : -x ∈ p ↔ x ∈ p :=
  ⟨fun h => by
    

Proof state:
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
p p' : SubMulAction R M
r : R
x y : M
h : -x ∈ p
⊢ x ∈ p

Next tactic:
rw [← neg_neg x]
@[simp]
theorem neg_mem_iff : -x ∈ p ↔ x ∈ p :=
  ⟨fun h => by
    rw [← neg_neg x]
    

Proof state:
S : Type u'
T : Type u''
R : Type u
M : Type v
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
p p' : SubMulAction R M
r : R
x y : M
h : -x ∈ p
⊢ - -x ∈ p

Next tactic:
exact neg_mem _ h
/-- Infinitely many natural numbers are equal to `d` mod `n`. -/
theorem frequently_modEq {n : ℕ} (h : n ≠ 0) (d : ℕ) : ∃ᶠ m in atTop, m ≡ d [MOD n] :=
  ((tendsto_add_atTop_nat d).comp (tendsto_id.nsmul_atTop h.bot_lt)).frequently <|
    frequently_of_forall fun m => by 

Proof state:
n : ℕ
h : n ≠ 0
d m : ℕ
⊢ ((fun a => a + d) ∘ fun x => n • id x) m ≡ d [MOD n]

Next tactic:
simp [Nat.modEq_iff_dvd, ← sub_sub]
theorem frequently_mod_eq {d n : ℕ} (h : d < n) : ∃ᶠ m in atTop, m % n = d := by
  

Proof state:
d n : ℕ
h : d < n
⊢ ∃ᶠ (m : ℕ) in atTop, m % n = d

Next tactic:
simpa only [Nat.ModEq, mod_eq_of_lt h] using frequently_modEq h.ne_bot d
theorem frequently_even : ∃ᶠ m : ℕ in atTop, Even m := by
  

Proof state:
⊢ ∃ᶠ (m : ℕ) in atTop, Even m

Next tactic:
simpa only [even_iff] using frequently_mod_eq zero_lt_two
theorem frequently_odd : ∃ᶠ m : ℕ in atTop, Odd m := by
  

Proof state:
⊢ ∃ᶠ (m : ℕ) in atTop, Odd m

Next tactic:
simpa only [odd_iff] using frequently_mod_eq one_lt_two
/-- An additive subgroup of an archimedean linear ordered additive commutative group with order
topology is dense provided that for all positive `ε` there exists a positive element of the
subgroup that is less than `ε`. -/
theorem dense_of_not_isolated_zero (S : AddSubgroup G) (hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε) :
    Dense (S : Set G) := by
  

Proof state:
G : Type u_1
inst✝³ : LinearOrderedAddCommGroup G
inst✝² : TopologicalSpace G
inst✝¹ : OrderTopology G
inst✝ : Archimedean G
S : AddSubgroup G
hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε
⊢ Dense ↑S

Next tactic:
cases subsingleton_or_nontrivial G
/-- An additive subgroup of an archimedean linear ordered additive commutative group with order
topology is dense provided that for all positive `ε` there exists a positive element of the
subgroup that is less than `ε`. -/
theorem dense_of_not_isolated_zero (S : AddSubgroup G) (hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε) :
    Dense (S : Set G) := by
  cases subsingleton_or_nontrivial G
  · 

Proof state:
case inl
G : Type u_1
inst✝³ : LinearOrderedAddCommGroup G
inst✝² : TopologicalSpace G
inst✝¹ : OrderTopology G
inst✝ : Archimedean G
S : AddSubgroup G
hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε
h✝ : Subsingleton G
⊢ Dense ↑S

Next tactic:
refine fun x => _root_.subset_closure ?_
/-- An additive subgroup of an archimedean linear ordered additive commutative group with order
topology is dense provided that for all positive `ε` there exists a positive element of the
subgroup that is less than `ε`. -/
theorem dense_of_not_isolated_zero (S : AddSubgroup G) (hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε) :
    Dense (S : Set G) := by
  cases subsingleton_or_nontrivial G
  · refine fun x => _root_.subset_closure ?_
    

Proof state:
case inl
G : Type u_1
inst✝³ : LinearOrderedAddCommGroup G
inst✝² : TopologicalSpace G
inst✝¹ : OrderTopology G
inst✝ : Archimedean G
S : AddSubgroup G
hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε
h✝ : Subsingleton G
x : G
⊢ x ∈ ↑S

Next tactic:
rw [Subsingleton.elim x 0]
/-- An additive subgroup of an archimedean linear ordered additive commutative group with order
topology is dense provided that for all positive `ε` there exists a positive element of the
subgroup that is less than `ε`. -/
theorem dense_of_not_isolated_zero (S : AddSubgroup G) (hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε) :
    Dense (S : Set G) := by
  cases subsingleton_or_nontrivial G
  · refine fun x => _root_.subset_closure ?_
    rw [Subsingleton.elim x 0]
    

Proof state:
case inl
G : Type u_1
inst✝³ : LinearOrderedAddCommGroup G
inst✝² : TopologicalSpace G
inst✝¹ : OrderTopology G
inst✝ : Archimedean G
S : AddSubgroup G
hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε
h✝ : Subsingleton G
x : G
⊢ 0 ∈ ↑S

Next tactic:
exact zero_mem S
/-- An additive subgroup of an archimedean linear ordered additive commutative group with order
topology is dense provided that for all positive `ε` there exists a positive element of the
subgroup that is less than `ε`. -/
theorem dense_of_not_isolated_zero (S : AddSubgroup G) (hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε) :
    Dense (S : Set G) := by
  cases subsingleton_or_nontrivial G
  · refine fun x => _root_.subset_closure ?_
    rw [Subsingleton.elim x 0]
    exact zero_mem S
  

Proof state:
case inr
G : Type u_1
inst✝³ : LinearOrderedAddCommGroup G
inst✝² : TopologicalSpace G
inst✝¹ : OrderTopology G
inst✝ : Archimedean G
S : AddSubgroup G
hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε
h✝ : Nontrivial G
⊢ Dense ↑S

Next tactic:
refine dense_of_exists_between fun a b hlt => ?_
/-- An additive subgroup of an archimedean linear ordered additive commutative group with order
topology is dense provided that for all positive `ε` there exists a positive element of the
subgroup that is less than `ε`. -/
theorem dense_of_not_isolated_zero (S : AddSubgroup G) (hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε) :
    Dense (S : Set G) := by
  cases subsingleton_or_nontrivial G
  · refine fun x => _root_.subset_closure ?_
    rw [Subsingleton.elim x 0]
    exact zero_mem S
  refine dense_of_exists_between fun a b hlt => ?_
  

Proof state:
case inr
G : Type u_1
inst✝³ : LinearOrderedAddCommGroup G
inst✝² : TopologicalSpace G
inst✝¹ : OrderTopology G
inst✝ : Archimedean G
S : AddSubgroup G
hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε
h✝ : Nontrivial G
a b : G
hlt : a < b
⊢ ∃ c ∈ ↑S, a < c ∧ c < b

Next tactic:
rcases hS (b - a) (sub_pos.2 hlt) with ⟨g, hgS, hg0, hg⟩
/-- An additive subgroup of an archimedean linear ordered additive commutative group with order
topology is dense provided that for all positive `ε` there exists a positive element of the
subgroup that is less than `ε`. -/
theorem dense_of_not_isolated_zero (S : AddSubgroup G) (hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε) :
    Dense (S : Set G) := by
  cases subsingleton_or_nontrivial G
  · refine fun x => _root_.subset_closure ?_
    rw [Subsingleton.elim x 0]
    exact zero_mem S
  refine dense_of_exists_between fun a b hlt => ?_
  rcases hS (b - a) (sub_pos.2 hlt) with ⟨g, hgS, hg0, hg⟩
  

Proof state:
case inr.intro.intro.intro
G : Type u_1
inst✝³ : LinearOrderedAddCommGroup G
inst✝² : TopologicalSpace G
inst✝¹ : OrderTopology G
inst✝ : Archimedean G
S : AddSubgroup G
hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε
h✝ : Nontrivial G
a b : G
hlt : a < b
g : G
hgS : g ∈ S
hg0 : 0 < g
hg : g < b - a
⊢ ∃ c ∈ ↑S, a < c ∧ c < b

Next tactic:
rcases (existsUnique_add_zsmul_mem_Ioc hg0 0 a).exists with ⟨m, hm⟩
/-- An additive subgroup of an archimedean linear ordered additive commutative group with order
topology is dense provided that for all positive `ε` there exists a positive element of the
subgroup that is less than `ε`. -/
theorem dense_of_not_isolated_zero (S : AddSubgroup G) (hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε) :
    Dense (S : Set G) := by
  cases subsingleton_or_nontrivial G
  · refine fun x => _root_.subset_closure ?_
    rw [Subsingleton.elim x 0]
    exact zero_mem S
  refine dense_of_exists_between fun a b hlt => ?_
  rcases hS (b - a) (sub_pos.2 hlt) with ⟨g, hgS, hg0, hg⟩
  rcases (existsUnique_add_zsmul_mem_Ioc hg0 0 a).exists with ⟨m, hm⟩
  

Proof state:
case inr.intro.intro.intro.intro
G : Type u_1
inst✝³ : LinearOrderedAddCommGroup G
inst✝² : TopologicalSpace G
inst✝¹ : OrderTopology G
inst✝ : Archimedean G
S : AddSubgroup G
hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε
h✝ : Nontrivial G
a b : G
hlt : a < b
g : G
hgS : g ∈ S
hg0 : 0 < g
hg : g < b - a
m : ℤ
hm : 0 + m • g ∈ Ioc a (a + g)
⊢ ∃ c ∈ ↑S, a < c ∧ c < b

Next tactic:
rw [zero_add] at hm
/-- An additive subgroup of an archimedean linear ordered additive commutative group with order
topology is dense provided that for all positive `ε` there exists a positive element of the
subgroup that is less than `ε`. -/
theorem dense_of_not_isolated_zero (S : AddSubgroup G) (hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε) :
    Dense (S : Set G) := by
  cases subsingleton_or_nontrivial G
  · refine fun x => _root_.subset_closure ?_
    rw [Subsingleton.elim x 0]
    exact zero_mem S
  refine dense_of_exists_between fun a b hlt => ?_
  rcases hS (b - a) (sub_pos.2 hlt) with ⟨g, hgS, hg0, hg⟩
  rcases (existsUnique_add_zsmul_mem_Ioc hg0 0 a).exists with ⟨m, hm⟩
  rw [zero_add] at hm
  

Proof state:
case inr.intro.intro.intro.intro
G : Type u_1
inst✝³ : LinearOrderedAddCommGroup G
inst✝² : TopologicalSpace G
inst✝¹ : OrderTopology G
inst✝ : Archimedean G
S : AddSubgroup G
hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε
h✝ : Nontrivial G
a b : G
hlt : a < b
g : G
hgS : g ∈ S
hg0 : 0 < g
hg : g < b - a
m : ℤ
hm : m • g ∈ Ioc a (a + g)
⊢ ∃ c ∈ ↑S, a < c ∧ c < b

Next tactic:
refine ⟨m • g, zsmul_mem hgS _, hm.1, hm.2.trans_lt ?_⟩
/-- An additive subgroup of an archimedean linear ordered additive commutative group with order
topology is dense provided that for all positive `ε` there exists a positive element of the
subgroup that is less than `ε`. -/
theorem dense_of_not_isolated_zero (S : AddSubgroup G) (hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε) :
    Dense (S : Set G) := by
  cases subsingleton_or_nontrivial G
  · refine fun x => _root_.subset_closure ?_
    rw [Subsingleton.elim x 0]
    exact zero_mem S
  refine dense_of_exists_between fun a b hlt => ?_
  rcases hS (b - a) (sub_pos.2 hlt) with ⟨g, hgS, hg0, hg⟩
  rcases (existsUnique_add_zsmul_mem_Ioc hg0 0 a).exists with ⟨m, hm⟩
  rw [zero_add] at hm
  refine ⟨m • g, zsmul_mem hgS _, hm.1, hm.2.trans_lt ?_⟩
  

Proof state:
case inr.intro.intro.intro.intro
G : Type u_1
inst✝³ : LinearOrderedAddCommGroup G
inst✝² : TopologicalSpace G
inst✝¹ : OrderTopology G
inst✝ : Archimedean G
S : AddSubgroup G
hS : ∀ ε > 0, ∃ g ∈ S, g ∈ Ioo 0 ε
h✝ : Nontrivial G
a b : G
hlt : a < b
g : G
hgS : g ∈ S
hg0 : 0 < g
hg : g < b - a
m : ℤ
hm : m • g ∈ Ioc a (a + g)
⊢ a + g < b

Next tactic:
rwa [lt_sub_iff_add_lt'] at hg
/-- Let `S` be a nontrivial additive subgroup in an archimedean linear ordered additive commutative
group `G` with order topology. If the set of positive elements of `S` does not have a minimal
element, then `S` is dense `G`. -/
theorem dense_of_no_min (S : AddSubgroup G) (hbot : S ≠ ⊥)
    (H : ¬∃ a : G, IsLeast { g : G | g ∈ S ∧ 0 < g } a) : Dense (S : Set G) := by
  

Proof state:
G : Type u_1
inst✝³ : LinearOrderedAddCommGroup G
inst✝² : TopologicalSpace G
inst✝¹ : OrderTopology G
inst✝ : Archimedean G
S : AddSubgroup G
hbot : S ≠ ⊥
H : ¬∃ a, IsLeast {g | g ∈ S ∧ 0 < g} a
⊢ Dense ↑S

Next tactic:
refine S.dense_of_not_isolated_zero fun ε ε0 => ?_