我在Coq标准库中找不到import a.b.c.d.e.f as ref
g1 = ref.g1
h1 = ref.h.h1
是集成的证明。这个引理的简短的自包含证明是什么?
N choose k
我看到他们在ssreflect.binomial.v中通过递归定义{{1}} Lemma fact_divides N k: k <= N -> Nat.divide (fact k * fact (N - k)) (fact N).
并显示choose
来回避了整个问题。
但是,也可以直接证明以上内容而无需求助于pascal的三角形,这将是很好的。当我在Stack。*上搜索时,出现了许多“非正式”证明。对于有理数,它们隐式地使用了代数步长,而他们并没有显示出严格地用于choose(N,k) = choose(N-1,k) + choose(N-1,k-1)
除法。
编辑: 感谢以下@Bubbler的回答(基于this math),证明只是
choose(N,k) * k! * (N-k)! = N!
答案 0 :(得分:1)
我将其声明为如下:
Theorem fact_div_fact_fact : forall x y, exists e, fact (x + y) = e * (fact x * fact y).
我相信您可以从中得出自己的引理,并结合Coq标准库中有关<=
和-
的事实。
这是使用pure algebraic approach的独立的,不太简短的证明。您可以尝试运行here online。
From Coq Require Import Arith.
(* Let's prove that (n+m)! is divisible by n! * m!. *)
(* fact2 x y = (x+1) * (x+2) * .. * (x+y) *)
Fixpoint fact2 x y := match y with
| O => 1
| S y' => (x + y) * fact2 x y'
end.
Lemma fact2_0 : forall x, fact2 0 x = fact x.
Proof.
induction x.
- auto.
- simpl. rewrite IHx. auto. Qed.
Lemma fact_fact2 : forall x y, fact x * fact2 x y = fact (x + y).
Proof.
induction x.
- intros. simpl. rewrite fact2_0. ring.
- induction y.
+ simpl. replace (x + 0) with x by ring. ring.
+ simpl. replace (x + S y) with (S x + y) by ring. rewrite <- IHy. simpl. ring. Qed.
Lemma fact2_left : forall x y, fact2 x (S y) = S x * fact2 (S x) y.
Proof. intros x y. generalize dependent x. induction y.
- intros. simpl. ring.
- intros. unfold fact2. fold (fact2 x (S y)). fold (fact2 (S x) y).
rewrite IHy. ring. Qed.
Lemma fact_div_fact2 : forall x y, exists e, fact2 x y = e * fact y.
Proof. intros x y. generalize dependent x. induction y.
- intros. simpl. exists 1. auto.
- induction x.
+ unfold fact2. fold (fact2 0 y). unfold fact. fold (fact y). destruct (IHy 0). rewrite H.
exists x. ring.
+ unfold fact2. fold (fact2 (S x) y).
destruct (IHy (S x)). destruct IHx. exists (x0 + x1).
replace ((S x + S y) * fact2 (S x) y) with (S x * fact2 (S x) y + S y * fact2 (S x) y) by ring.
rewrite <- fact2_left. rewrite H0. rewrite H.
replace (S y * (x0 * fact y)) with (x0 * (S y * fact y)) by ring.
unfold fact. fold (fact y). ring. Qed.
Theorem fact_div_fact_fact : forall x y, exists e, fact (x + y) = e * (fact x * fact y).
Proof. intros x y. destruct (fact_div_fact2 x y). exists x0.
rewrite <- fact_fact2. rewrite H. ring. Qed.