(** * FOL Reductions *)
Require Export FOL.PCP Deduction.
(** ** Validity *)
Section validity.
Notation u := 0. Notation v := 1.
Context {b : logic}.
Variable R : BSRS.
Definition prep (x : string bool) (t : term) : term := fold_right t_f t x.
Definition iprep domain eta {I : interp domain eta} (x : list bool) (y : domain) := fold_right i_f y x.
Definition enc s := (prep s t_e).
Definition F1 := map (fun '(x,y) => Pr (enc x) (enc y)) R.
Definition F2 := map (fun '(x, y) => ∀ u; ∀ v; Pr u v --> Pr (prep x u) (prep y v)) R.
Definition F3 := (∀ u; Pr u u --> Q).
Definition F : form b := F1 ==> F2 ==> F3 --> Q.

(* Specifications: *)
Lemma enc_vars x :
vars_t (enc x) = [].
Lemma prep_subst y t1 x t :
subst_t y t1 (prep x t) = prep x (subst_t y t1 t).
Lemma prep_vars x t :
vars_t (prep x t) = vars_t t.
Lemma iprep_eval domain eta (I : interp domain eta) rho x s :
eval rho (prep x s) = iprep x (eval rho s).
Lemma iprep_app domain eta (I : interp domain eta) x y d :
iprep (x ++ y) d = iprep x (iprep y d).