proposition: Lemma AlignedDecode_shift_if_Sumb {A B C : Type} (decode_A : DecodeM (A * _) ByteString) (decode_B : A -> DecodeM (B * _) ByteString) (decode_C : A -> B -> DecodeM (C * _) ByteString) (P : A -> Prop) (cond : forall a, {P a} + {~P a}) (aligned_decoder : forall numBytes : nat, AlignedDecodeM C numBytes) : DecodeMEquivAlignedDecodeM (fun bs cd => `(a, bs', cd') <- decode_A bs cd; `(b, bs', cd') <- decode_B a bs' cd'; if cond a then decode_C a b bs' cd' else None) aligned_decoder -> DecodeMEquivAlignedDecodeM (fun bs cd => `(a, bs', cd') <- decode_A bs cd; if cond a then `(b, bs', cd') <- decode_B a bs' cd'; decode_C a b bs' cd' else None) aligned_decoder.
proof: Proof. intros; eapply DecodeMEquivAlignedDecodeM_trans; eauto; intros; simpl; try reflexivity. simpl; destruct (decode_A b cd) as [ [ [? ?] ?] | ]; simpl; eauto. find_if_inside; eauto. destruct (decode_B a b0 c) as [ [ [? ?] ?] | ]; simpl; eauto. Qed.
imports: Fiat.Common.Coq__8_4__8_5__Compat Coq.ZArith.ZArith Coq.Strings.String Coq.Arith.Mult Coq.Vectors.Vector Fiat.Common.SumType Fiat.Common.BoundedLookup Fiat.Common.ilist Fiat.Common.DecideableEnsembles Fiat.Computation Fiat.QueryStructure.Specification.Representation.Notations Fiat.QueryStructure.Specification.Representation.Heading Fiat.QueryStructure.Specification.Representation.Tuple Fiat.Narcissus.BinLib.AlignedEncodeMonad Fiat.Narcissus.BinLib.AlignedByteString Fiat.Narcissus.BinLib.AlignWord Fiat.Narcissus.BinLib.AlignedString Fiat.Narcissus.BinLib.AlignedDecodeMonad Fiat.Narcissus.Common.Specs Fiat.Narcissus.Common.ComposeOpt Fiat.Narcissus.Formats.WordOpt Fiat.Narcissus.Formats.NatOpt Fiat.Narcissus.Formats.StringOpt Fiat.Narcissus.Formats.EnumOpt Fiat.Narcissus.Formats.FixListOpt Fiat.Narcissus.Formats.SumTypeOpt Fiat.Narcissus.Formats.EnumOpt Fiat.Narcissus.Formats.DomainNameOpt Fiat.Common.IterateBoundedIndex Fiat.Common.Tactics.CacheStringConstant Fiat.Narcissus.Formats.IPChecksum Fiat.Narcissus.Common.ComposeCheckSum Bedrock.Word