Skip to content
Snippets Groups Projects
Commit 1f6c31c0 authored by Björn Brandenburg's avatar Björn Brandenburg
Browse files

add helper lemmas about zero sums

parent 128a1c51
No related branches found
No related tags found
1 merge request!20Port more service and completion facts
......@@ -110,6 +110,28 @@ Section ExtraLemmas.
}
Qed.
(* Trivial identity: any sum of zeros is zero. *)
Lemma sum0 m n:
\sum_(m <= i < n) 0 = 0.
Proof.
by rewrite big_const_nat iter_addn mul0n addn0 //.
Qed.
(* A sum of natural numbers equals zero iff all terms are zero. *)
Lemma big_nat_eq0 m n F:
\sum_(m <= i < n) F i = 0 <-> (forall i, m <= i < n -> F i = 0).
Proof.
split.
- rewrite /index_iota => /eqP.
rewrite -sum_nat_eq0_nat => /allP ZERO i.
rewrite -mem_index_iota /index_iota => IN.
by apply/eqP; apply ZERO.
- move=> ZERO.
have ->: \sum_(m <= i < n) F i = \sum_(m <= i < n) 0
by apply eq_big_nat => //.
by apply sum0.
Qed.
Lemma leq_pred_sum:
forall (T:eqType) (r: seq T) (P1 P2: pred T) F,
(forall i, P1 i -> P2 i) ->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment