proposition: Lemma AlignedEncoder_sz_destruct {S} {cache : Cache} (enc' : EncodeM S ByteString) (enc : forall sz, AlignedEncodeM sz) (enc_OK : EncodeMEquivAlignedEncodeM enc' enc) n2 (enc'_sz_eq : forall s ce t ce', enc' s ce = Some (t, ce') -> numBytes t = n2) (enc'_aligned : forall s ce t ce', enc' s ce = Some (t, ce') -> padding t = 0) : forall sz (t : Vector.t Core.char sz) n1 (s : S) v ni ce ce', enc _ t n1 s ce = Some (v, ni, ce') -> sz = n1 + ((ni-n1) + (sz-ni)) /\ n2 = ni - n1.
proof: Proof. intros. edestruct @AlignedEncoder_some_inv' as [b [? ?]]; eauto. assert (sz = n1 + (numBytes b + (sz-(n1+numBytes b)))) by eauto using AlignedEncoder_sz_destruct'. revert dependent t. revert v. rewrite H1. intros. destruct (Vector_append_destruct3 t) as [t1 [t2 [t3 ?]]]. subst. edestruct enc_OK as [? _]. edestruct H2; eauto. clear H2. destruct_conjs. rewrite H2 in H. injections. split. omega. erewrite enc'_sz_eq; eauto. 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.Common.BoundedLookup Fiat.Narcissus.Common.Specs Fiat.Narcissus.Common.ComposeOpt Fiat.Narcissus.Common.ComposeIf Fiat.Narcissus.BaseFormats Fiat.Narcissus.BinLib.Core Fiat.Narcissus.BinLib.AlignedByteString