proposition: Lemma CorrectAlignedEncoderEither_T {S : Type} {cache : Cache} (format_T format_E : FormatM S ByteString) (encode : forall sz, AlignedEncodeM sz) (encode_T_OK : CorrectAlignedEncoder format_T encode) : (forall s env, exists (v : ByteString * CacheFormat), projT1 encode_T_OK s env = Some v) -> CorrectAlignedEncoder (composeIf format_T format_E) encode.
proof: Proof. intros; eapply refine_CorrectAlignedEncoder; eauto. unfold composeIf, Union_Format; split; intros. - intros ? ?; apply unfold_computes; eexists Fin.F1; simpl; eauto. - intros ? ; specialize (H s env); destruct_ex. apply (H0 x); eauto. destruct x. apply (proj1 (projT2 encode_T_OK)) in H; eapply H. eauto. Defined.
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