Zulip Chat Archive

Stream: new members

Topic: Dealing with inequalities


Christian K (Mar 18 2024 at 16:46):

import Mathlib.Data.Real.Basic
import Mathlib.Data.Real.Sqrt
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic


noncomputable abbrev sq_2 := Real.sqrt 2
example : -(1 / 2)  1 / 2 * Real.cos (n * sq_2) := by
  sorry


example : Real.sin (n * sq_2) * Real.sin sq_2 * (-1 / 2) 
      1 / 2 + Real.cos (n * sq_2) * Real.cos sq_2 * (1 / 2) := by
  sorry

I want to prove these two inequalites, but I have no idea how to simplify them. With equalities I would use apply_fun to simplify the expression, but this does not work for <=. It says that I need to prove that the function I'm using is monotone but I have no idea how.
Do you have some general tips about proving such inequalities?

Jireh Loreaux (Mar 18 2024 at 16:48):

For the first you should use docs#Real.neg_one_le_cos

Christian K (Mar 18 2024 at 16:49):

Yeah, I know about this, but how do i get rid of the 1/2?

Jireh Loreaux (Mar 18 2024 at 16:52):

gcongr is a handy tactic for this kind of thing:

example : -(1 / 2)  1 / 2 * Real.cos (n * sq_2) := by
  calc
    -(1 / 2)  (1 / 2) * (-1) := by simp
    _  (1 / 2) * (Real.cos (n * sq_2)) := by
      gcongr
      exact Real.neg_one_le_cos (n * sq_2)

Jireh Loreaux (Mar 18 2024 at 16:54):

Also, what is the type of n supposed to be? With autoimplicits on, Lean assumes it to be , but you have a in your statement. Is n supposed to have type ?

Christian K (Mar 18 2024 at 16:57):

Ohh, i forgot to include this in the mwe, you guessed it correctly, n is supposed to have type Nat.

Christian K (Mar 18 2024 at 17:36):

And how about the second lemma, I don't really see how i should use a calc proof with the gcongr tactic to solve it?

Christian K (Mar 18 2024 at 17:36):

lemma sin_le_cos (x : Real) : Real.sin x  1 + Real.cos x := by
  sorry

could a lemma like this help?

Jireh Loreaux (Mar 18 2024 at 19:12):

that inequality is not true.

Jireh Loreaux (Mar 18 2024 at 19:12):

Take x := -π/3

Jireh Loreaux (Mar 18 2024 at 19:15):

Your second result follows from the angle addition formula docs#Real.cos_sub

Christian K (Mar 19 2024 at 09:52):

Ohh ok, thank you, I figured it out


Last updated: May 02 2025 at 03:31 UTC