proposition: Lemma GEN_GEN_HYB_EVAL_equiv i: GEN_HYB_EVAL_pkg i ∘ EVAL false ≈₀ GEN_HYB_pkg i.+1.
proof: Proof. apply eq_rel_perf_ind with ( (heap_ignore (fset1 T_loc)) ⋊ couple_lhs count_loc T_loc (fun count T => count <= i -> T = emptym) ). 1: { ssprove_invariant => //=. 1: rewrite fsub1set. all: by rewrite /GEN_HYB_locs /EVAL_locs_ff !fset_cons !in_fsetU !in_fset1 eq_refl !Bool.orb_true_r. } simplify_eq_rel m. ssprove_code_simpl. apply: r_get_vs_get_remember => count. case: (eq_dec count i) => Heq. - rewrite Heq eq_refl ltnn ltnSn /=. ssprove_swap_lhs 0. apply: r_get_remember_lhs => T. apply: (r_rem_couple_lhs count_loc T_loc) => Hinv. rewrite Hinv //=. apply: r_put_vs_put. ssprove_sync=> x. apply: r_put_lhs. apply: r_get_remind_lhs. 1: { apply: is_remembering_lhs => s0 s1 [h [_ ->]] /=. by rewrite get_set_heap_eq. } rewrite setmE /=. ssprove_sync=> y. apply: r_put_lhs. ssprove_restore_mem; last by apply: r_ret. ssprove_invariant. 2: by rewrite -subnE subSnn. move {Hinv T Heq} => s0 s1 [[[Hinv A] B] C] loc H /=. rewrite !(get_set_heap_neq _ T_loc) -?in_fset1 //. case: (eq_dec loc count_loc)=> Heq. + by rewrite Heq !get_set_heap_eq. + move /eqP in Heq. by rewrite !get_set_heap_neq // Hinv. - move /eqP /negPf in Heq. rewrite Heq /=. destruct (count < i) eqn:Hlt. all: apply: r_put_vs_put. 1: rewrite ltnW //. 2: rewrite ltnS leq_eqVlt Heq Hlt /=. all: ssprove_sync => x. 1: ssprove_sync => y. all: ssprove_restore_mem; last by apply: r_ret. all: ssprove_invariant. all: move=> s0 s1 [[Hinv H] _] /=. all: rewrite /couple_lhs get_set_heap_eq get_set_heap_neq //. all: move /eqP in Hlt. + rewrite Hinv // H -subnE eqnE. by rewrite subn_eq0 ltnW // -subn_eq0 Hlt. + move /eqP /negPf in Hlt. by rewrite -subnE eqnE Hlt. Qed.
imports: Relational(OrderEnrichedCategory GenericRulesSimple) mathcomp(all_ssreflect all_algebra reals distr realsum ssrnat ssreflect ssrfun ssrbool ssrnum eqtype choice seq) Mon(SPropBase) Crypt(Axioms ChoiceAsOrd SubDistr Couplings UniformDistrLemmas FreeProbProg Theta_dens RulesStateProb pkg_core_definition choice_type pkg_composition pkg_rhl Package Prelude) extructures(ord fset fmap) Equations(Equations)