§ Logical Relations (Sterling)

§ Logical relations for function spaces

(fl:σlτl,fr:σrτr):Rστ(xl:σl,xr:σr)Rσ,(fl(xl),fr(xr))Rτ (f_l: \sigma_l \to \tau_l, f_r: \sigma_r \to \tau_r) : R_{\sigma \to \tau} \equiv \forall (x_l : \sigma_l , x_r : \sigma_r) \in R_\sigma, (f_l(x_l), f_r(x_r)) \in R_\tau

§ Logical relations for data types

Rbool{(true, true),(false, false)} R_{\texttt{bool}} \equiv \{ (\texttt{true, true}), (\texttt{false, false}) \}

§ Logical relations for parametric types

Rα,τ(α){(fl:α,τl(α),fr:α,τr(α))Rα,(fl(αl),fr(αr))Rτ(α)} R_{\forall \alpha, \tau (\alpha)} \equiv \{ (f_l : \forall \alpha, \tau_l(\alpha), f_r: \forall \alpha, \tau_r(\alpha)) \mid \forall R_\alpha, (f_l(\alpha_l), f_r(\alpha_r)) \in R_{\tau(\alpha)} \}

§ Proving things using logical relations

Rα,(xl,xr)Rα,((f(xl),f(xr))Rbool) \forall R_\alpha, \forall (x_l, x_r) \in R_\alpha, ((f(x_l), f(x_r)) \in R_{\texttt{bool}})
Rα,(xl,xr)Rα,(f(xl)=f(xr)) \forall R_\alpha, \forall (x_l, x_r) \in R_\alpha, (f(x_l) = f(x_r))

§ (x/p)(x/p) is x(p1)/2x^{(p-1)/2}