Commit 0efd8519 by MARCHE Claude

### New example: Lagrange Inequality

parent 69d9b32c
 theory LagrangeInequality (* sum_squares a \times sum_squares b = (scalar product a.b)^2 + sum {1 <= i = 0.0 lemma Lagrange : forall a1 a2 b1 b2 : real . norm2 a1 a2 * norm2 b1 b2 = sqr (dot a1 a2 b1 b2) + sqr (a1 * b2 - a2 * b1) end theory CauchySchwarzInequality use import real.Real use import real.Square use import LagrangeInequality lemma CauchySchwarz_aux: forall x1 x2 y1 y2 : real. sqr (dot x1 x2 y1 y2) <= norm2 x1 x2 * norm2 y1 y2 (** norm of a vector *) function norm (x1:real) (x2:real) : real = sqrt (norm2 x1 x2) (** norm is non-negative *) lemma norm_pos : forall x1 x2:real. norm x1 x2 >= 0.0 (** lemma to help the next one *) lemma sqr_le_sqrt : forall x y:real. 0.0 <= x /\ 0.0 <= sqr x <= y -> x <= sqrt y lemma CauchySchwarz: forall x1 x2 y1 y2 : real. dot x1 x2 y1 y2 <= norm x1 x2 * norm y1 y2 end theory TriangleInequality use import real.Real use import real.Square use import LagrangeInequality use import CauchySchwarzInequality (** Triangle inequality, proved thanks to ||x+y||² = ||x||² + 2 + ||y||² <= ||x||² + 2||x||*||y|| + ||y||² = (||x|| + ||y||)² *) lemma triangle_aux : forall x1 x2 y1 y2 : real. norm2 (x1+y1) (x2+y2) <= sqr (norm x1 x2 + norm y1 y2) (* lemma to help the next one *) lemma sqr_sqrt_le : forall x y:real. 0.0 <= y /\ 0.0 <= x <= sqr y -> sqrt x <= y lemma triangle : forall x1 x2 y1 y2 : real. norm (x1+y1) (x2+y2) <= norm x1 x2 + norm y1 y2 end \ No newline at end of file

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!