proposition: Theorem distro_iso_eq : forall (A B C D : Set)(f : C -> D)(f_inv : D -> C)(d : Comp D)(c : Comp C)(f1 : D -> Comp B)(f2 : C -> Comp A)(a : A)(b : B), (forall x, In x (getSupport d) -> f (f_inv x) = x) -> (forall x, In x (getSupport c) -> f_inv (f x) = x) -> (forall x, In x (getSupport d) -> In (f_inv x) (getSupport c)) -> (forall x, In x (getSupport c) -> (evalDist d (f x)) == (evalDist c x)) -> (forall x, In x (getSupport c) -> (evalDist (f1 (f x)) b) == (evalDist (f2 x) a)) -> (evalDist (Bind d f1) b == evalDist (Bind c f2) a).
proof: Proof. intuition. simpl. eapply eqRat_trans. eapply fold_add_rat_perm. eapply Permutation_sym. eapply evalDist_getSupport_perm; eauto. intuition. symmetry. eauto. intuition. rewrite <- (H a0) at 1. eapply H2. eauto. trivial. eapply eqRat_refl. intuition. eapply ratMult_eqRat_compat. rewrite <- H at 1. eauto. trivial. rewrite <- H at 1. eapply H3. eauto. trivial. eapply eqRat_trans. 2:{ eapply fold_add_f_inverse; eauto. eapply eqRat_refl. } simpl. eapply eqRat_refl. Qed.
imports: FCF.DistSem FCF.Fold Permutation FCF.SemEquiv FCF.DetSem FCF.NotationV1 micromega.Lia