proposition: Theorem rsame_head_cmd_alt : ∀ {A B : ord_choiceType} {f₀ f₁ : A → raw_code B} (m : command A) pre (post : postcond B B), ⊢ ⦃ pre ⦄ x ← cmd m ;; ret x ≈ x ← cmd m ;; ret x ⦃ λ '(a₀, s₀) '(a₁, s₁), pre (s₀, s₁) ∧ a₀ = a₁ ⦄ → (∀ a, ⊢ ⦃ pre ⦄ f₀ a ≈ f₁ a ⦃ post ⦄) → ⊢ ⦃ pre ⦄ x ← cmd m ;; f₀ x ≈ x ← cmd m ;; f₁ x ⦃ post ⦄.
proof: Proof. intros A B f₀ f₁ m pre post hm hf. eapply from_sem_jdg. rewrite !repr_cmd_bind. eapply (bind_rule_pp (repr_cmd m) (repr_cmd m)). - eapply to_sem_jdg in hm. rewrite !repr_cmd_bind in hm. rewrite bindrFree_ret in hm. eauto. - intros a₀ a₁. eapply to_sem_jdg. eapply rpre_hypothesis_rule. intros s₀ s₁ [h e]. subst. eapply rpre_weaken_rule. 1: eapply hf. simpl. intros ? ? [? ?]. subst. auto. Qed.
imports: Coq(Utf8) Relational(OrderEnrichedCategory OrderEnrichedRelativeMonadExamples) mathcomp(ssrnat ssreflect ssrfun ssrbool ssrnum eqtype choice reals distr seq all_algebra fintype realsum) extructures(ord fset fmap) Mon(SPropBase) Crypt(Prelude Axioms ChoiceAsOrd SubDistr Couplings RulesStateProb UniformStateProb UniformDistrLemmas StateTransfThetaDens StateTransformingLaxMorph choice_type pkg_core_definition pkg_notation pkg_tactics pkg_composition pkg_heap pkg_semantics pkg_lookup pkg_advantage pkg_invariants pkg_distr) Equations.Prop.DepElim Equations(Equations) Crypt(FreeProbProg)