proposition: Lemma AlignedEncoder_fixed {S} {cache : Cache} (enc' : EncodeM S ByteString) (enc : forall sz, AlignedEncodeM sz) (enc_OK : EncodeMEquivAlignedEncodeM enc' enc) (enc'_aligned : forall s ce t ce', enc' s ce = Some (t, ce') -> padding t = 0) n n1 : forall (t : Vector.t Core.char n) s ce v idx ce', enc _ t n1 s ce = Some (v, idx, ce') -> enc _ v n1 s ce = Some (v, idx, ce').
proof: Proof. intros. edestruct @AlignedEncoder_inv as [n2 [n3 [t1 [t2 [t3 [v2 ?]]]]]]; eauto. destruct_conjs. subst. simpl in *. assert (n2 = numBytes (build_aligned_ByteString v2)) as L by eauto. match goal with | |- ?x = _ => destruct x eqn:? end. destruct_conjs. edestruct @AlignedEncoder_inv'; try apply Heqo; eauto. destruct_conjs. subst. repeat f_equal. eauto using build_aligned_ByteString_inj. exfalso. eapply AlignedEncoder_none_inv in Heqo; 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