proposition: Lemma ByteString_enqueue_ByteString_padding_eq : forall b b', padding (ByteString_enqueue_ByteString b b') = NPeano.modulo (padding b + padding b') 8.
proof: Proof. intros. rewrite (ByteString_into_queue_eq b), (ByteString_into_queue_eq b'). rewrite ByteString_enqueue_ByteString_into_BitString. rewrite queue_into_ByteString_app. generalize (queue_into_ByteString (ByteString_into_queue b)). induction (ByteString_into_queue b'); intros; simpl fold_left. - rewrite <- NPeano.Nat.add_mod_idemp_r by omega. replace (padding (queue_into_ByteString []%list) mod 8) with 0 by reflexivity. rewrite NPeano.Nat.mod_small; destruct b0; simpl; eauto. omega. - rewrite IHb0. rewrite !queue_into_ByteString_padding_eq. rewrite !NPeano.Nat.add_mod_idemp_r by omega. rewrite ByteString_enqueue_padding_eq. rewrite plus_comm. rewrite !NPeano.Nat.add_mod_idemp_r by omega. f_equal; simpl length; omega. Qed.
imports: Fiat.Common.Coq__8_4__8_5__Compat Bedrock.Word Coq.ZArith.ZArith Coq.NArith.NArith Coq.Arith.Arith Coq.Numbers.Natural.Peano.NPeano Coq.Logic.Eqdep_dec Fiat.Narcissus.Common.Specs Fiat.Narcissus.BinLib.Core Fiat.Narcissus.Formats.ByteBuffer Coq.Strings.String Coq.Vectors.Vector Fiat.Narcissus.Formats.WordOpt Fiat.Common.Equality List