Skip to content

Commit 4bdd803

Browse files
committed
Small golf
1 parent 56ffb26 commit 4bdd803

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

Mathlib/Geometry/Manifold/ExistsRiemannianMetric2.lean

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,20 @@ noncomputable def mynorm (φ : G →L[ℝ] G →L[ℝ] ℝ) : Seminorm ℝ G whe
285285

286286
noncomputable def aux (φ : G →L[ℝ] G →L[ℝ] ℝ) : SeminormFamily ℝ G (Fin 1) := fun _ ↦ mynorm φ
287287

288-
lemma bar (φ : G →L[ℝ] G →L[ℝ] ℝ) : WithSeminorms (aux φ) :=
288+
lemma bar (φ : G →L[ℝ] G →L[ℝ] ℝ) (hpos : ∀ v : G, v ≠ 00 < φ v v) : WithSeminorms (aux φ) :=
289289
-- In finite dimension there is a single topological vector space structure...
290290
-- and mynorm defines a norm, hence a TVS structure.
291291
sorry
292292

293293
end aux
294294

295+
-- golfing suggestions welcome
296+
lemma qux {α : Type*} [Unique α] (s : Finset α) : s = ∅ ∨ s = {default} := by
297+
by_cases h : s = ∅
298+
· simp [h]
299+
· rw [Finset.eq_singleton_iff_nonempty_unique_mem]
300+
refine Or.inr ⟨Finset.nonempty_iff_ne_empty.mpr h, fun x hx ↦ Unique.uniq _ _⟩
301+
295302
lemma aux_tvs (G : Type*) [AddCommGroup G] [TopologicalSpace G] [Module ℝ G]
296303
[ContinuousAdd G] [ContinuousSMul ℝ G] [FiniteDimensional ℝ G]
297304
(φ : G →L[ℝ] G →L[ℝ] ℝ) (hpos : ∀ v : G, v ≠ 00 < φ v v) :
@@ -301,19 +308,13 @@ lemma aux_tvs (G : Type*) [AddCommGroup G] [TopologicalSpace G] [Module ℝ G]
301308
-- (as in finite dimension there is a single topological vector space structure).
302309
-- The unit ball for the norm is von Neumann bounded wrt the topology defined by the norm
303310
-- (we have this in mathlib), so also for the initial topology.
304-
rw [WithSeminorms.isVonNBounded_iff_finset_seminorm_bounded (p := aux φ) (bar φ)]
311+
rw [WithSeminorms.isVonNBounded_iff_finset_seminorm_bounded (p := aux φ) (bar φ hpos)]
305312
intro I
306-
let J : Finset (Fin 1) := {1}
313+
letI J : Finset (Fin 1) := {1}
307314
suffices ∃ r > 0, ∀ x ∈ {v | (φ v) v < 1}, (J.sup (aux φ)) x < r by
308-
-- All other finsets of Fin 1 are the empty set, where things are boring.
309-
-- XXX: can a simproc help here?
310-
by_cases h : I = ∅
311-
· use 1; simp [h]
312-
· have h : I = J := by
313-
ext a
314-
apply iff_of_true ?_ (by simp [Subsingleton.eq_one a, J])
315-
sorry -- mathematically obvious
316-
rwa [h]
315+
obtain (rfl | h) := qux I
316+
· use 1; simp
317+
· convert this
317318
simp only [Set.mem_setOf_eq, Finset.sup_singleton, J]
318319
refine ⟨1, by norm_num, fun x h ↦ ?_⟩
319320
simp only [aux, mynorm]

0 commit comments

Comments
 (0)