Skip to content

Commit

Permalink
chore: tidy various files (#7009)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben-VandeVelde committed Sep 7, 2023
1 parent 4f3418a commit 23ffa51
Show file tree
Hide file tree
Showing 22 changed files with 101 additions and 111 deletions.
2 changes: 1 addition & 1 deletion Counterexamples/Monic_nonRegular.lean
Expand Up @@ -27,7 +27,7 @@ open Polynomial

namespace Counterexample.NonRegular

/-- `N₃` is going to be a `Commsemiring` where addition and multiplication are truncated at `3`. -/
/-- `N₃` is going to be a `CommSemiring` where addition and multiplication are truncated at `3`. -/
inductive N₃
| zero
| one
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Algebra/Basic.lean
Expand Up @@ -44,7 +44,7 @@ See the implementation notes for remarks about non-associative and non-unital al
* `algebraNat`
* `algebraInt`
* `algebraRat`
* `module.End.algebra`
* `Module.End.instAlgebra`
## Implementation notes
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Algebra/Opposite.lean
Expand Up @@ -155,7 +155,7 @@ theorem toRingEquiv_op (f : A ≃ₐ[R] B) :
(AlgEquiv.op f).toRingEquiv = RingEquiv.op f.toRingEquiv :=
rfl

/-- The 'unopposite' of an algebra iso `Aᵐᵒᵖ ≃ₐ[R] Bᵐᵒᵖ`. Inverse to `alg_equiv.op`. -/
/-- The 'unopposite' of an algebra iso `Aᵐᵒᵖ ≃ₐ[R] Bᵐᵒᵖ`. Inverse to `AlgEquiv.op`. -/
abbrev unop : (Aᵐᵒᵖ ≃ₐ[R] Bᵐᵒᵖ) ≃ A ≃ₐ[R] B := AlgEquiv.op.symm

theorem toAlgHom_unop (f : Aᵐᵒᵖ ≃ₐ[R] Bᵐᵒᵖ) : f.unop.toAlgHom = AlgHom.unop f.toAlgHom :=
Expand Down
8 changes: 4 additions & 4 deletions Mathlib/Algebra/Free.lean
Expand Up @@ -195,7 +195,7 @@ theorem mul_seq {α β : Type u} {f g : FreeMagma (α → β)} {x : FreeMagma α
#align free_magma.mul_seq FreeMagma.mul_seq

@[to_additive]
instance instLawfulMonadFreeMagma : LawfulMonad FreeMagma.{u} := LawfulMonad.mk'
instance instLawfulMonad : LawfulMonad FreeMagma.{u} := LawfulMonad.mk'
(pure_bind := fun f x ↦ rfl)
(bind_assoc := fun x f g ↦ FreeMagma.recOnPure x (fun x ↦ rfl) fun x y ih1 ih2 ↦ by
rw [mul_bind, mul_bind, mul_bind, ih1, ih2])
Expand Down Expand Up @@ -266,7 +266,7 @@ theorem mul_map_seq (x y : FreeMagma α) :

@[to_additive]
instance : LawfulTraversable FreeMagma.{u} :=
{ instLawfulMonadFreeMagma with
{ instLawfulMonad with
id_traverse := fun x ↦
FreeMagma.recOnPure x (fun x ↦ rfl) fun x y ih1 ih2 ↦ by
rw [traverse_mul, ih1, ih2, mul_map_seq]
Expand Down Expand Up @@ -619,7 +619,7 @@ theorem mul_seq {f g : FreeSemigroup (α → β)} {x : FreeSemigroup α} :
#align free_semigroup.mul_seq FreeSemigroup.mul_seq

@[to_additive]
instance instLawfulMonadFreeSemigroup : LawfulMonad FreeSemigroup.{u} := LawfulMonad.mk'
instance instLawfulMonad : LawfulMonad FreeSemigroup.{u} := LawfulMonad.mk'
(pure_bind := fun _ _ ↦ rfl)
(bind_assoc := fun x g f ↦
recOnPure x (fun x ↦ rfl) fun x y ih1 ih2 ↦ by rw [mul_bind, mul_bind, mul_bind, ih1, ih2])
Expand Down Expand Up @@ -682,7 +682,7 @@ theorem mul_map_seq (x y : FreeSemigroup α) :

@[to_additive]
instance : LawfulTraversable FreeSemigroup.{u} :=
{ instLawfulMonadFreeSemigroup with
{ instLawfulMonad with
id_traverse := fun x ↦
FreeSemigroup.recOnMul x (fun x ↦ rfl) fun x y ih1 ih2 ↦ by
rw [traverse_mul, ih1, ih2, mul_map_seq]
Expand Down
67 changes: 32 additions & 35 deletions Mathlib/Analysis/Calculus/Inverse.lean
Expand Up @@ -204,7 +204,7 @@ theorem surjOn_closedBall_of_nonlinearRightInverse (hf : ApproximatesLinearOn f
have Icf' : (c : ℝ) * f'symm.nnnorm < 1 := by rwa [inv_eq_one_div, lt_div_iff If'] at hc
have Jf' : (f'symm.nnnorm : ℝ) ≠ 0 := ne_of_gt If'
have Jcf' : (1 : ℝ) - c * f'symm.nnnorm ≠ 0 := by apply ne_of_gt; linarith
/- We have to show that `y` can be written as `f x` for some `x ∈ closed_ball b ε`.
/- We have to show that `y` can be written as `f x` for some `x ∈ closedBall b ε`.
The idea of the proof is to apply the Banach contraction principle to the map
`g : x ↦ x + f'symm (y - f x)`, as a fixed point of this map satisfies `f x = y`.
When `f'symm` is a genuine linear inverse, `g` is a contracting map. In our case, since `f'symm`
Expand Down Expand Up @@ -304,11 +304,11 @@ theorem surjOn_closedBall_of_nonlinearRightInverse (hf : ApproximatesLinearOn f
exact (D n).1
_ = f'symm.nnnorm * dist (f b) y * ((c : ℝ) * f'symm.nnnorm) ^ n := by ring
obtain ⟨x, hx⟩ : ∃ x, Tendsto u atTop (𝓝 x) := cauchySeq_tendsto_of_complete this
-- As all the `uₙ` belong to the ball `closed_ball b ε`, so does their limit `x`.
-- As all the `uₙ` belong to the ball `closedBall b ε`, so does their limit `x`.
have xmem : x ∈ closedBall b ε :=
isClosed_ball.mem_of_tendsto hx (eventually_of_forall fun n => C n _ (D n).2)
refine' ⟨x, xmem, _⟩
-- It remains to check that `f x = y`. This follows from continuity of `f` on `closed_ball b ε`
-- It remains to check that `f x = y`. This follows from continuity of `f` on `closedBall b ε`
-- and from the fact that `f uₙ` is converging to `y` by construction.
have hx' : Tendsto u atTop (𝓝[closedBall b ε] x) := by
simp only [nhdsWithin, tendsto_inf, hx, true_and_iff, ge_iff_le, tendsto_principal]
Expand All @@ -324,7 +324,8 @@ theorem surjOn_closedBall_of_nonlinearRightInverse (hf : ApproximatesLinearOn f

theorem open_image (hf : ApproximatesLinearOn f f' s c) (f'symm : f'.NonlinearRightInverse)
(hs : IsOpen s) (hc : Subsingleton F ∨ c < f'symm.nnnorm⁻¹) : IsOpen (f '' s) := by
cases' hc with hE hc; · skip; apply isOpen_discrete
cases' hc with hE hc
· exact isOpen_discrete _
simp only [isOpen_iff_mem_nhds, nhds_basis_closedBall.mem_iff, ball_image_iff] at hs ⊢
intro x hx
rcases hs x hx with ⟨ε, ε0, hε⟩
Expand Down Expand Up @@ -359,15 +360,13 @@ We also assume that either `E = {0}`, or `c < ‖f'⁻¹‖⁻¹`. We use `N` as

variable {f' : E ≃L[𝕜] F} {s : Set E} {c : ℝ≥0}

-- mathport name: exprN
local notation "N" => ‖(f'.symm : F →L[𝕜] E)‖₊

protected theorem antilipschitz (hf : ApproximatesLinearOn f (f' : E →L[𝕜] F) s c)
(hc : Subsingleton E ∨ c < N⁻¹) : AntilipschitzWith (N⁻¹ - c)⁻¹ (s.restrict f) := by
cases' hc with hE hc
· haveI : Subsingleton s := ⟨fun x y => Subtype.eq <| @Subsingleton.elim _ hE _ _⟩
exact AntilipschitzWith.of_subsingleton
convert(f'.antilipschitz.restrict s).add_lipschitzWith hf.lipschitz_sub hc
· exact AntilipschitzWith.of_subsingleton
convert (f'.antilipschitz.restrict s).add_lipschitzWith hf.lipschitz_sub hc
simp [restrict]
#align approximates_linear_on.antilipschitz ApproximatesLinearOn.antilipschitz

Expand Down Expand Up @@ -445,7 +444,7 @@ section
variable (f s)

/-- Given a function `f` that approximates a linear equivalence on an open set `s`,
returns a local homeomorph with `to_fun = f` and `source = s`. -/
returns a local homeomorph with `toFun = f` and `source = s`. -/
def toLocalHomeomorph (hf : ApproximatesLinearOn f (f' : E →L[𝕜] F) s c)
(hc : Subsingleton E ∨ c < N⁻¹) (hs : IsOpen s) : LocalHomeomorph E F where
toLocalEquiv := hf.toLocalEquiv hc
Expand All @@ -456,12 +455,31 @@ def toLocalHomeomorph (hf : ApproximatesLinearOn f (f' : E →L[𝕜] F) s c)
continuous_invFun := hf.inverse_continuousOn hc
#align approximates_linear_on.to_local_homeomorph ApproximatesLinearOn.toLocalHomeomorph

@[simp]
theorem toLocalHomeomorph_coe (hf : ApproximatesLinearOn f (f' : E →L[𝕜] F) s c)
(hc : Subsingleton E ∨ c < N⁻¹) (hs : IsOpen s) :
(hf.toLocalHomeomorph f s hc hs : E → F) = f :=
rfl
#align approximates_linear_on.to_local_homeomorph_coe ApproximatesLinearOn.toLocalHomeomorph_coe

@[simp]
theorem toLocalHomeomorph_source (hf : ApproximatesLinearOn f (f' : E →L[𝕜] F) s c)
(hc : Subsingleton E ∨ c < N⁻¹) (hs : IsOpen s) : (hf.toLocalHomeomorph f s hc hs).source = s :=
rfl
#align approximates_linear_on.to_local_homeomorph_source ApproximatesLinearOn.toLocalHomeomorph_source

@[simp]
theorem toLocalHomeomorph_target (hf : ApproximatesLinearOn f (f' : E →L[𝕜] F) s c)
(hc : Subsingleton E ∨ c < N⁻¹) (hs : IsOpen s) :
(hf.toLocalHomeomorph f s hc hs).target = f '' s :=
rfl
#align approximates_linear_on.to_local_homeomorph_target ApproximatesLinearOn.toLocalHomeomorph_target

/-- A function `f` that approximates a linear equivalence on the whole space is a homeomorphism. -/
def toHomeomorph (hf : ApproximatesLinearOn f (f' : E →L[𝕜] F) univ c)
(hc : Subsingleton E ∨ c < N⁻¹) : E ≃ₜ F := by
refine' (hf.toLocalHomeomorph _ _ hc isOpen_univ).toHomeomorphOfSourceEqUnivTargetEqUniv rfl _
change f '' univ = univ
rw [image_univ, range_iff_surjective]
rw [toLocalHomeomorph_target, image_univ, range_iff_surjective]
exact hf.surjective hc
#align approximates_linear_on.to_homeomorph ApproximatesLinearOn.toHomeomorph

Expand Down Expand Up @@ -492,31 +510,11 @@ theorem exists_homeomorph_extension {E : Type*} [NormedAddCommGroup E] [NormedSp

end

@[simp]
theorem toLocalHomeomorph_coe (hf : ApproximatesLinearOn f (f' : E →L[𝕜] F) s c)
(hc : Subsingleton E ∨ c < N⁻¹) (hs : IsOpen s) :
(hf.toLocalHomeomorph f s hc hs : E → F) = f :=
rfl
#align approximates_linear_on.to_local_homeomorph_coe ApproximatesLinearOn.toLocalHomeomorph_coe

@[simp]
theorem toLocalHomeomorph_source (hf : ApproximatesLinearOn f (f' : E →L[𝕜] F) s c)
(hc : Subsingleton E ∨ c < N⁻¹) (hs : IsOpen s) : (hf.toLocalHomeomorph f s hc hs).source = s :=
rfl
#align approximates_linear_on.to_local_homeomorph_source ApproximatesLinearOn.toLocalHomeomorph_source

@[simp]
theorem toLocalHomeomorph_target (hf : ApproximatesLinearOn f (f' : E →L[𝕜] F) s c)
(hc : Subsingleton E ∨ c < N⁻¹) (hs : IsOpen s) :
(hf.toLocalHomeomorph f s hc hs).target = f '' s :=
rfl
#align approximates_linear_on.to_local_homeomorph_target ApproximatesLinearOn.toLocalHomeomorph_target

theorem closedBall_subset_target (hf : ApproximatesLinearOn f (f' : E →L[𝕜] F) s c)
(hc : Subsingleton E ∨ c < N⁻¹) (hs : IsOpen s) {b : E} (ε0 : 0 ≤ ε) (hε : closedBall b ε ⊆ s) :
closedBall (f b) ((N⁻¹ - c) * ε) ⊆ (hf.toLocalHomeomorph f s hc hs).target :=
(hf.surjOn_closedBall_of_nonlinearRightInverse f'.toNonlinearRightInverse ε0 hε).mono hε
(Subset.refl _)
Subset.rfl
#align approximates_linear_on.closed_ball_subset_target ApproximatesLinearOn.closedBall_subset_target

end ApproximatesLinearOn
Expand Down Expand Up @@ -565,8 +563,7 @@ theorem approximates_deriv_on_open_nhds (hf : HasStrictFDerivAt f (f' : E →L[
∃ s : Set E, a ∈ s ∧ IsOpen s ∧
ApproximatesLinearOn f (f' : E →L[𝕜] F) s (‖(f'.symm : F →L[𝕜] E)‖₊⁻¹ / 2) := by
simp only [← and_assoc]
refine' ((nhds_basis_opens a).exists_iff _).1 _
exact fun s t => ApproximatesLinearOn.mono_set
refine ((nhds_basis_opens a).exists_iff fun s t => ApproximatesLinearOn.mono_set).1 ?_
exact
hf.approximates_deriv_on_nhds <|
f'.subsingleton_or_nnnorm_symm_pos.imp id fun hf' => half_pos <| inv_pos.2 hf'
Expand Down Expand Up @@ -657,7 +654,7 @@ theorem localInverse_unique (hf : HasStrictFDerivAt f (f' : E →L[𝕜] F) a) {
#align has_strict_fderiv_at.local_inverse_unique HasStrictFDerivAt.localInverse_unique

/-- If `f` has an invertible derivative `f'` at `a` in the sense of strict differentiability `(hf)`,
then the inverse function `hf.local_inverse f` has derivative `f'.symm` at `f a`. -/
then the inverse function `hf.localInverse f` has derivative `f'.symm` at `f a`. -/
theorem to_localInverse (hf : HasStrictFDerivAt f (f' : E →L[𝕜] F) a) :
HasStrictFDerivAt (hf.localInverse f f' a) (f'.symm : F →L[𝕜] E) (f a) :=
(hf.toLocalHomeomorph f).hasStrictFDerivAt_symm hf.image_mem_toLocalHomeomorph_target <| by
Expand Down
3 changes: 0 additions & 3 deletions Mathlib/Analysis/InnerProductSpace/Orientation.lean
Expand Up @@ -175,9 +175,6 @@ section VolumeForm

variable [_i : Fact (finrank ℝ E = n)] (o : Orientation ℝ E (Fin n))

-- Porting note: added instance
instance : IsEmpty (Fin Nat.zero) := by simp only [Nat.zero_eq]; infer_instance

/-- The volume form on an oriented real inner product space, a nonvanishing top-dimensional
alternating form uniquely defined by compatibility with the orientation and inner product structure.
-/
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Part.lean
Expand Up @@ -540,7 +540,7 @@ theorem bind_toOption (f : α → Part β) (o : Part α) [Decidable o.Dom] [∀
theorem bind_assoc {γ} (f : Part α) (g : α → Part β) (k : β → Part γ) :
(f.bind g).bind k = f.bind fun x => (g x).bind k :=
ext fun a => by
simp
simp only [mem_bind_iff]
exact ⟨fun ⟨_, ⟨_, h₁, h₂⟩, h₃⟩ => ⟨_, h₁, _, h₂, h₃⟩,
fun ⟨_, h₁, _, h₂, h₃⟩ => ⟨_, ⟨_, h₁, h₂⟩, h₃⟩⟩
#align part.bind_assoc Part.bind_assoc
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Seq/Computation.lean
Expand Up @@ -1220,7 +1220,7 @@ theorem liftRel_congr {R : α → β → Prop} {ca ca' : Computation α} {cb cb'
and_congr
(forall_congr' fun _ => imp_congr (ha _) <| exists_congr fun _ => and_congr (hb _) Iff.rfl)
(forall_congr' fun _ => imp_congr (hb _) <| exists_congr fun _ => and_congr (ha _) Iff.rfl)
#align computation.lift_gcongr Computation.liftRel_congr
#align computation.lift_rel_congr Computation.liftRel_congr

theorem liftRel_map {δ} (R : α → β → Prop) (S : γ → δ → Prop) {s1 : Computation α}
{s2 : Computation β} {f1 : α → γ} {f2 : β → δ} (h1 : LiftRel R s1 s2)
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Data/Seq/WSeq.lean
Expand Up @@ -839,10 +839,10 @@ theorem head_terminates_of_head_tail_terminates (s : WSeq α) [T : Terminates (h

theorem destruct_some_of_destruct_tail_some {s : WSeq α} {a} (h : some a ∈ destruct (tail s)) :
∃ a', some a' ∈ destruct s := by
unfold tail Functor.map at h; simp at h
unfold tail Functor.map at h; simp only [destruct_flatten] at h
rcases exists_of_mem_bind h with ⟨t, tm, td⟩; clear h
rcases Computation.exists_of_mem_map tm with ⟨t', ht', ht2⟩; clear tm
cases' t' with t' <;> rw [← ht2] at td <;> simp at td
cases' t' with t' <;> rw [← ht2] at td <;> simp only [destruct_nil] at td
· have := mem_unique td (ret_mem _)
contradiction
· exact ⟨_, ht'⟩
Expand Down
8 changes: 4 additions & 4 deletions Mathlib/Geometry/Manifold/ContMDiffMFDeriv.lean
Expand Up @@ -70,7 +70,7 @@ where the derivative is taken as a continuous linear map.
We have to assume that `f` is `C^n` at `(x₀, g(x₀))` for `n ≥ m + 1` and `g` is `C^m` at `x₀`.
We have to insert a coordinate change from `x₀` to `x` to make the derivative sensible.
This result is used to show that maps into the 1-jet bundle and cotangent bundle are smooth.
`cont_mdiff_at.mfderiv_id` and `ContMDiffAt.mfderiv_const` are special cases of this.
`ContMDiffAt.mfderiv_const` is a special case of this.
This result should be generalized to a `ContMDiffWithinAt` for `mfderivWithin`.
If we do that, we can deduce `ContMDiffOn.contMDiffOn_tangentMapWithin` from this.
Expand Down Expand Up @@ -596,9 +596,9 @@ end TangentBundle

namespace ContMDiffMap

-- These helpers for dot notation have been moved here from `geometry.manifold.cont_mdiff_map`
-- to avoid needing to import `geometry.manifold.cont_mdiff_mfderiv` there.
-- (However as a consequence we import `geometry.manifold.cont_mdiff_map` here now.)
-- These helpers for dot notation have been moved here from
-- `Mathlib/Geometry/Manifold/ContMDiffMap.lean` to avoid needing to import this file there.
-- (However as a consequence we import `Mathlib/Geometry/Manifold/ContMDiffMap.lean` here now.)
-- They could be moved to another file (perhaps a new file) if desired.
open scoped Manifold

Expand Down
6 changes: 3 additions & 3 deletions Mathlib/Geometry/Manifold/Instances/Sphere.lean
Expand Up @@ -346,7 +346,7 @@ In this section we construct a charted space structure on the unit sphere in a f
real inner product space `E`; that is, we show that it is locally homeomorphic to the Euclidean
space of dimension one less than `E`.
The restriction to finite dimension is for convenience. The most natural `charted_space`
The restriction to finite dimension is for convenience. The most natural `ChartedSpace`
structure for the sphere uses the stereographic projection from the antipodes of a point as the
canonical chart at this point. However, the codomain of the stereographic projection constructed
in the previous section is `(ℝ ∙ v)ᗮ`, the orthogonal complement of the vector `v` in `E` which is
Expand Down Expand Up @@ -467,8 +467,8 @@ variable {H : Type*} [TopologicalSpace H] {I : ModelWithCorners ℝ F H}

variable {M : Type*} [TopologicalSpace M] [ChartedSpace H M] [SmoothManifoldWithCorners I M]

/-- If a `cont_mdiff` function `f : M → E`, where `M` is some manifold, takes values in the
sphere, then it restricts to a `cont_mdiff` function from `M` to the sphere. -/
/-- If a `ContMDiff` function `f : M → E`, where `M` is some manifold, takes values in the
sphere, then it restricts to a `ContMDiff` function from `M` to the sphere. -/
theorem ContMDiff.codRestrict_sphere {n : ℕ} [Fact (finrank ℝ E = n + 1)] {m : ℕ∞} {f : M → E}
(hf : ContMDiff I 𝓘(ℝ, E) m f) (hf' : ∀ x, f x ∈ sphere (0 : E) 1) :
ContMDiff I (𝓡 n) m (Set.codRestrict _ _ hf' : M → sphere (0 : E) 1) := by
Expand Down
13 changes: 6 additions & 7 deletions Mathlib/LinearAlgebra/QuadraticForm/Basic.lean
Expand Up @@ -630,7 +630,7 @@ end QuadraticForm
Over a commutative ring with an inverse of 2, the theory of quadratic forms is
basically identical to that of symmetric bilinear forms. The map from quadratic
forms to bilinear forms giving this identification is called the `Associated`
forms to bilinear forms giving this identification is called the `associated`
quadratic form.
-/

Expand Down Expand Up @@ -773,8 +773,7 @@ general ring with no nontrivial distinguished commutative subring, use `Quadrati
which gives an additive homomorphism (or more precisely a `ℤ`-linear map.) -/
def associatedHom : QuadraticForm R M →ₗ[S] BilinForm R M where
toFun Q :=
((· • ·) : Submonoid.center R → BilinForm R M → BilinForm R M)
⟨⅟ 2, fun x => (Commute.ofNat_right x 2).invOf_right⟩ Q.polarBilin
(⟨⅟ 2, fun x => (Commute.ofNat_right x 2).invOf_right⟩ : Submonoid.center R) • Q.polarBilin
map_add' Q Q' := by
ext
simp only [BilinForm.add_apply, BilinForm.smul_apply, coeFn_mk, polarBilin_apply, polar_add,
Expand Down Expand Up @@ -832,7 +831,7 @@ theorem associated_rightInverse :
fun Q => toQuadraticForm_associated S Q
#align quadratic_form.associated_right_inverse QuadraticForm.associated_rightInverse

/-- `Associated'` is the `ℤ`-linear map that sends a quadratic form on a module `M` over `R` to its
/-- `associated'` is the `ℤ`-linear map that sends a quadratic form on a module `M` over `R` to its
associated symmetric bilinear form. -/
abbrev associated' : QuadraticForm R M →ₗ[ℤ] BilinForm R M :=
associatedHom ℤ
Expand Down Expand Up @@ -958,12 +957,12 @@ theorem PosDef.anisotropic {Q : QuadraticForm R₂ M} (hQ : Q.PosDef) : Q.Anisot
exact this
#align quadratic_form.pos_def.anisotropic QuadraticForm.PosDef.anisotropic

theorem posDefOfNonneg {Q : QuadraticForm R₂ M} (h : ∀ x, 0 ≤ Q x) (h0 : Q.Anisotropic) :
theorem posDef_of_nonneg {Q : QuadraticForm R₂ M} (h : ∀ x, 0 ≤ Q x) (h0 : Q.Anisotropic) :
PosDef Q := fun x hx => lt_of_le_of_ne (h x) (Ne.symm fun hQx => hx <| h0 _ hQx)
#align quadratic_form.pos_def_of_nonneg QuadraticForm.posDefOfNonneg
#align quadratic_form.pos_def_of_nonneg QuadraticForm.posDef_of_nonneg

theorem posDef_iff_nonneg {Q : QuadraticForm R₂ M} : PosDef Q ↔ (∀ x, 0 ≤ Q x) ∧ Q.Anisotropic :=
fun h => ⟨h.nonneg, h.anisotropic⟩, fun ⟨n, a⟩ => posDefOfNonneg n a⟩
fun h => ⟨h.nonneg, h.anisotropic⟩, fun ⟨n, a⟩ => posDef_of_nonneg n a⟩
#align quadratic_form.pos_def_iff_nonneg QuadraticForm.posDef_iff_nonneg

theorem PosDef.add (Q Q' : QuadraticForm R₂ M) (hQ : PosDef Q) (hQ' : PosDef Q') :
Expand Down
3 changes: 3 additions & 0 deletions Mathlib/Logic/IsEmpty.lean
Expand Up @@ -39,6 +39,9 @@ instance : IsEmpty False :=
instance Fin.isEmpty : IsEmpty (Fin 0) :=
fun n ↦ Nat.not_lt_zero n.1 n.2

instance Fin.isEmpty' : IsEmpty (Fin Nat.zero) :=
Fin.isEmpty

protected theorem Function.isEmpty [IsEmpty β] (f : α → β) : IsEmpty α :=
fun x ↦ IsEmpty.false (f x)⟩
#align function.is_empty Function.isEmpty
Expand Down

0 comments on commit 23ffa51

Please sign in to comment.