跳过正文
  1. Docs/

Coq 证明几何不等式

·267 字·1 分钟· loading · loading · · ·
Algorithms Mathematical Math Coq
Pacyu
作者
Pacyu
程序员

一开始是想形式化几何不等式(均值不等式),然后想用来证明一些简单的不等式问题玩下,但发现直接证明 \( a + b \ge 2\sqrt{a b} \) 太难,没想到好办法,应该是我太菜。。。于是选择证明 \( \sqrt{(a + b)^2} \ge \sqrt{4ab} \longrightarrow a + b \ge 2\sqrt{a b} \) 的情形。

From Coq.Reals Require Import Reals RIneq R_sqrt.


Lemma rdiv_r:
 forall r, (r <> 0 -> r / r = r * / r)%R.
Proof.
  intros.
  auto.
Qed.

Lemma two_pow2_eq_4: (2 ^ 2 = 4)%R.
Proof.
  simpl.
  rewrite <- Rmult_comm.
  rewrite Rmult_assoc.
  rewrite Rmult_1_l.
  auto.
Qed.

Lemma two_eq_sqrt_4 : (2 = sqrt 4)%R.
Proof.
  rewrite <- two_pow2_eq_4.
  rewrite sqrt_pow2.
  - reflexivity.
  - intuition.
Qed. 

Theorem ineq_arith_means:
 forall a b, (0 <= a -> 0 <= b -> sqrt (4 * a * b) <= sqrt ((a + b)^2)  -> 2 * sqrt(a * b) <= a + b)%R.
Proof.
  intros a b H1 H2 H3.
  rewrite <- sqrt_pow2 with (a + b)%R.
  rewrite <- sqrt_pow2 with (2 * sqrt (a * b))%R.
  rewrite Rpow_mult_distr.
  rewrite pow2_sqrt.
  rewrite two_pow2_eq_4.
  *
    rewrite <- Rmult_assoc.
    assumption.
  *
    apply Rmult_le_pos.
    auto.
    auto.
  *
    rewrite two_eq_sqrt_4.
    rewrite <- sqrt_mult.
    apply sqrt_positivity.
    + apply Rmult_le_pos.
      - intuition.
      - apply Rmult_le_pos. auto. auto.
    + intuition.
    + apply Rmult_le_pos. auto. auto.
  *
    apply Rplus_le_le_0_compat.
    auto.
    auto.
Qed.

相关文章

斐波那契数O(lgn)算法及证明
·1196 字·3 分钟· loading · loading
Algorithms Mathematical Math C/C++
介绍一种对数时间复杂度的斐波那契数列算法。 指数时间 # 我们都知
矩阵运算
·4964 字·10 分钟· loading · loading
Algorithms Mathematical Math C/C++
这篇主要介绍一些矩阵运算相关算法。 矩阵乘法 # 矩阵相乘:\( C
牛顿法(Newton's method)
·961 字·2 分钟· loading · loading
Algorithms Mathematical C/C++ Math
牛顿法也是数值分析中很常见的算法了。嘛,网上对它的各种介绍也
数学-导数篇(持续更新)
·1794 字·4 分钟· loading · loading
Mathematical Math
这里主要存放一些导数题。 题目 # 1.已知向量 \( a = (\sin(x), \frac{3}{4}), b = (\cos(x), -1)
高等数学-积分方程篇(持续更新)
·631 字·2 分钟· loading · loading
Mathematical Math
这里存放一些积分方程题的题解。 题目 # 1.求 \( \int_{0}^{\frac{\pi}{4}} x \ \prod cos(\frac{x}{2^k}) dx \) (from
高中数学-向量篇(持续更新)
·424 字·1 分钟· loading · loading
Mathematical Math
这里是关于向量运算的题目题解,题目质量大概参差不齐。 向量在现