Skip to content
Snippets Groups Projects
Commit 8ed0149e authored by Felipe Cerqueira's avatar Felipe Cerqueira
Browse files

Add more lemmas about bigcat

parent 1213a684
No related branches found
No related tags found
No related merge requests found
...@@ -354,21 +354,33 @@ Section BigCatLemmas. ...@@ -354,21 +354,33 @@ Section BigCatLemmas.
} }
Qed. Qed.
Lemma size_bigcat_ord {T} n (i: 'I_n) (f: 'I_n -> seq T) : Lemma map_bigcat_ord {T} {T'} n (f: 'I_n -> seq T) (g: T -> T') :
(forall x, size (f x) <= 1) -> map g (\cat_(i < n) (f i)) = \cat_(i < n) (map g (f i)).
size (\cat_(i < n) (f i)) <= n. Proof.
destruct n; first by rewrite 2!big_ord0.
induction n; first by rewrite 2!big_ord_recr 2!big_ord0.
rewrite big_ord_recr [\cat_(cpu < n.+2)_]big_ord_recr /=.
by rewrite map_cat; f_equal; apply IHn.
Qed.
Lemma size_bigcat_ord {T} n (f: 'I_n -> seq T) :
size (\cat_(i < n) (f i)) = \sum_(i < n) (size (f i)).
Proof.
destruct n; first by rewrite 2!big_ord0.
induction n; first by rewrite 2!big_ord_recr 2!big_ord0 /= add0n.
rewrite big_ord_recr [\sum_(i0 < n.+2)_]big_ord_recr size_cat /=.
by f_equal; apply IHn.
Qed.
Lemma size_bigcat_ord_max {T} n (f: 'I_n -> seq T) m :
(forall x, size (f x) <= m) ->
size (\cat_(i < n) (f i)) <= m*n.
Proof. Proof.
intros SIZE. intros SIZE.
destruct n; first by rewrite big_ord0. rewrite size_bigcat_ord.
induction n; first by rewrite big_ord_recl big_ord0 size_cat addn0. apply leq_trans with (n := \sum_(i0 < n) m);
rewrite big_ord_recr size_cat. last by rewrite big_const_ord iter_addn addn0.
apply leq_trans with (n.+1 + 1); last by rewrite addn1. by apply leq_sum; ins; apply SIZE.
apply leq_add; last by apply SIZE.
apply IHn; last by ins; apply SIZE.
{
assert (LT: 0 < n.+1). by done.
by apply (Ordinal LT).
}
Qed. Qed.
End BigCatLemmas. End BigCatLemmas.
......
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