Section validity.
Context {ff : falsity_flag}.
Variable R : BSRS.
Fixpoint prep (x : string bool) (t : term) : term :=
match x with
| nil => t
| b::x => t_f b (prep x t)
end.
Definition enc s := (prep s t_e).
Fixpoint iprep {domain} {I : interp domain} (x : list bool) (y : domain) :=
match x with
| nil => y
| b::x => i_f b (iprep x y)
end.
Definition F1 := map (fun '(x,y) => Pr (enc x) (enc y)) R.
Definition F2 := map (fun '(x, y) => ∀ ∀ Pr $1 $0 --> Pr (prep x $1) (prep y $0)) R.
Definition F3 := (∀ Pr $0 $0 --> Q).
Definition F : form := F1 ==> F2 ==> F3 --> Q.

Lemma iprep_eval domain (I : interp domain) rho x s :
eval rho (prep x s) = iprep x (eval rho s).