proposition: Lemma sequence_Compose_format_decode_correct' {cache : Cache} {S V1 T : Type} {P : CacheDecode -> Prop} {P_inv1 P_inv2 : (CacheDecode -> Prop) -> Prop} (P_inv_pf : cache_inv_Property P (fun P => P_inv1 P /\ P_inv2 P)) (monoid : Monoid T) (view : S -> V1 -> Prop) (Source_Predicate : S -> Prop) (View_Predicate1 : V1 -> Prop) (format1 : FormatM V1 T) (format2 : FormatM S T ) (decode1 : DecodeM (V1 * T) T) (decode_1_OK : cache_inv_Property P P_inv1 -> CorrectDecoder monoid View_Predicate1 View_Predicate1 eq format1 decode1 P format1) (View_Predicate_OK : forall s v, Source_Predicate s -> view s v -> View_Predicate1 v) (decode2 : V1 -> DecodeM (S * T) T) (decode2_pf : forall v1 : V1, cache_inv_Property P P_inv2 -> View_Predicate1 v1 -> CorrectDecoder monoid (fun s => Source_Predicate s /\ view s v1) (fun s => Source_Predicate s /\ view s v1) eq format2 (decode2 v1) P format2) : CorrectDecoder monoid Source_Predicate (fun v1v2 => View_Predicate1 (fst v1v2) /\ (Source_Predicate (snd v1v2) /\ view (snd v1v2) (fst v1v2))) (fun s v1v2 => view s (fst v1v2) /\ s = (snd v1v2)) (Compose_Format format1 view ++ format2) (sequence_Decode' decode1 decode2) P (fun v1s => ComposeOpt.compose monoid (format1 (fst v1s)) (format2 (snd v1s))).
proof: Proof. eapply Sequence_decode_correct with (view1 := view) (view2 := fun _ => eq) (View_Predicate2 := fun v1 v2 => Source_Predicate v2 /\ view v2 v1) (consistency_predicate := fun v1 s => view s v1); try eassumption; eauto. - intros; eapply Compose_decode_correct; try eassumption; intros; eauto. - instantiate (1 := fun _ => format2); eauto. - simpl; intros. unfold sequence_Format, ComposeOpt.compose, Bind2, Projection_Format, Compose_Format. apply unfold_computes. apply unfold_computes in H. apply unfold_computes in H0. eauto. Qed.
imports: Coq.ZArith.ZArith Fiat.Common Fiat.Computation.Notations Fiat.Narcissus.Common.Specs Fiat.Narcissus.Common.WordFacts Fiat.Computation.Refinements.General Fiat.Narcissus.BaseFormats