Synthetic Computability

Reductions


Require Import Setoid.

Set Implicit Arguments.

DLW: replace with INFORMATIVE reductions We prove informative reductions in here

(* Definition reduces X Y (p : X -> Prop) (q : Y -> Prop) := exists f : X -> Y, forall x, p x <-> q (f x).
Notation "p ⪯ q" := (reduces p q) (at level 50). *)


(* Definition *)

Definition reduces X Y (P : X Prop) (Q : Y Prop) :=
        { f : X Y | x, P x Q (f x) }.

Infix "⪯" := reduces (at level 70).

(* Pre-order properties *)

Lemma reduces_reflexive X (P : X Prop) : P P.
Proof. exists ( x x); tauto. Qed.

Fact reduces_transitive X P Y Q Z R :
        @reduces X Y P Q @reduces Y Z Q R P R.
Proof.
  intros (f & Hf) (g & Hg).
  exists ( x g (f x)).
  intro; rewrite Hf, Hg; tauto.
Qed.


(* An equivalent dependent definition *)

Fact reduction_dependent X Y (P : X Prop) (Q : Y Prop) :
         (P Q x, { y | P x Q y })
       * (( x, { y | P x Q y }) P Q).
Proof.
  split.
  + intros (f & Hf).
    intros x; exists (f x); auto.
  + intros f.
    exists ( x proj1_sig (f x)).
    intros; apply (proj2_sig (f x)).
Qed.