Skip to content

Commit 22584fd

Browse files
committed
Many One Reductions.
1 parent 8cfcc80 commit 22584fd

File tree

2 files changed

+214
-1
lines changed

2 files changed

+214
-1
lines changed
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
Require Import init.imports.
2+
Require Import Decidability.DecidablePredicates.
3+
4+
5+
Section ManyOneReducibility.
6+
7+
Definition ismanyonereduction {X Y : UU} (p : X → hProp) (q : Y → hProp) (f : X → Y) := ∏ (x : X), p x <-> q (f x).
8+
9+
Definition reduction {X Y : UU} (p : X → hProp) (q : Y → hProp) := ∑ (f : X → Y), ismanyonereduction p q f.
10+
11+
Definition make_reduction {X Y : UU} (p : X → hProp) (q : Y → hProp) (f : X → Y) (isrct : ismanyonereduction p q f) : (reduction p q) := (f,, isrct).
12+
13+
Definition ismanyonereducible {X Y : UU} (p : X → hProp) (q : Y → hProp) := ∥reduction p q∥.
14+
15+
Notation "p ≼ q" := (ismanyonereducible p q) (at level 500).
16+
17+
Lemma isapropismanyonereduction {X Y : UU} (p : X → hProp) (q : Y → hProp) (f : X → Y) : (isaprop (ismanyonereduction p q f)).
18+
Proof.
19+
apply impred_isaprop; intros.
20+
apply isapropdirprod; apply isapropimpl; apply propproperty.
21+
Qed.
22+
23+
Lemma reductiontodecidability {X Y : UU} (p : X → hProp) (q : Y → hProp) : (p ≼ q) → (deptypeddecider q) → (deptypeddecider p).
24+
Proof.
25+
intros rct dep1.
26+
use squash_to_prop.
27+
- exact (reduction p q).
28+
- exact rct.
29+
- apply isapropdeptypeddecider.
30+
- intros [f isrct] x.
31+
destruct (isrct x) as [impl1 impl2].
32+
induction (dep1 (f x)).
33+
+ left. exact (impl2 a).
34+
+ right. intros px. apply b. exact (impl1 px).
35+
Qed.
36+
37+
Lemma isreductionidfun {X : UU} (p : X → hProp) : (ismanyonereduction p p (idfun X)).
38+
Proof.
39+
intros x; split; apply idfun.
40+
Qed.
41+
42+
(* Many one reducibility is a preorder. *)
43+
44+
Lemma reductionrefl {X : UU} (p : X → hProp) : reduction p p.
45+
Proof.
46+
use make_reduction.
47+
- exact (idfun X).
48+
- exact (isreductionidfun p).
49+
Qed.
50+
51+
Lemma reductioncomp {X Y Z : UU} (p : X → hProp) (q : Y → hProp) (r : Z → hProp) : (reduction p q) → (reduction q r) → (reduction p r).
52+
Proof.
53+
intros [f rf] [g rg].
54+
use make_reduction.
55+
- exact (λ x : X, (g (f x))).
56+
- intros x; destruct (rf x) as [rf1 rf2]; destruct (rg (f x)) as [rg1 rg2]; split; intros pp.
57+
+ exact (rg1 (rf1 pp)).
58+
+ exact (rf2 (rg2 pp)).
59+
Qed.
60+
61+
Lemma isreduciblerefl {X : UU} (p : X → hProp) : (p ≼ p).
62+
Proof.
63+
apply hinhpr.
64+
apply reductionrefl.
65+
Qed.
66+
67+
Lemma isreduciblecomp {X Y Z : UU} (p : X → hProp) (q : Y → hProp) (r : Z → hProp) : (p ≼ q) → (q ≼ r) → (p ≼ r).
68+
Proof.
69+
apply hinhfun2.
70+
apply reductioncomp.
71+
Qed.
72+
73+
(* Many one reducibility forms an upper semi-lattice *)
74+
75+
Definition coprod_pred {X Y : UU} (p : X → hProp) (q : Y → hProp) : (X ⨿ Y) → hProp.
76+
Proof.
77+
intros [a | b].
78+
- exact (p a).
79+
- exact (q b).
80+
Defined.
81+
82+
Notation "p + q" := (coprod_pred p q).
83+
84+
Lemma isreduction_ii1 {X Y : UU} (p : X → hProp) (q : Y → hProp) : (ismanyonereduction p (p + q) ii1).
85+
Proof.
86+
intros x.
87+
split; apply idfun.
88+
Defined.
89+
90+
Lemma isreduction_ii2 {X Y : UU} (p : X → hProp) (q : Y → hProp) : (ismanyonereduction q (p + q) ii2).
91+
Proof.
92+
intros x.
93+
split; apply idfun.
94+
Defined.
95+
96+
Lemma reduction_coprod1 {X Y : UU} (p : X → hProp) (q : Y → hProp) : (reduction p (p+q)).
97+
Proof.
98+
use make_reduction.
99+
- apply ii1.
100+
- apply isreduction_ii1.
101+
Defined.
102+
103+
Lemma reduction_coprod2 {X Y : UU} (p : X → hProp) (q : Y → hProp) : (reduction q (p + q)).
104+
Proof.
105+
use make_reduction.
106+
- apply ii2.
107+
- apply isreduction_ii2.
108+
Defined.
109+
110+
Lemma isreducible_coprod1 {X Y : UU} (p : X → hProp) (q : Y → hProp) : (p ≼ (p + q)).
111+
Proof.
112+
apply hinhpr.
113+
apply reduction_coprod1.
114+
Qed.
115+
116+
Lemma isreducible_coprod2 {X Y : UU} (p : X → hProp) (q : Y → hProp) : (q ≼ (p + q)).
117+
Proof.
118+
apply hinhpr.
119+
apply reduction_coprod2.
120+
Qed.
121+
122+
Lemma isreduction_sumofmaps {X Y Z : UU} (p : X → hProp) (q : Y → hProp) (r : Z → hProp) (f : X → Z) (g : Y → Z) : (ismanyonereduction p r f) → (ismanyonereduction q r g) → (ismanyonereduction (p + q) r (sumofmaps f g)).
123+
Proof.
124+
intros isf isg x.
125+
induction x.
126+
- exact (isf a).
127+
- exact (isg b).
128+
Qed.
129+
130+
Lemma reduction_coprod {X Y Z : UU} (p : X → hProp) (q : Y → hProp) (r : Z → hProp) : (reduction p r) → (reduction q r) → (reduction (p + q) r).
131+
Proof.
132+
intros [f irf] [g irg].
133+
use make_reduction.
134+
- exact (sumofmaps f g).
135+
- exact (isreduction_sumofmaps p q r f g irf irg).
136+
Defined.
137+
138+
Lemma isreducible_coprod {X Y Z : UU} (p : X → hProp) (q : Y → hProp) (r : Z → hProp) : (p ≼ r) → (q≼ r) → ((p + q) ≼ r).
139+
Proof.
140+
apply hinhfun2, reduction_coprod.
141+
Qed.
142+
143+
Definition predcompl {X : UU} (p : X → hProp) : X → hProp := (λ x : X, (hneg (p x))).
144+
145+
(* If a predicate is reducible to a predicate q, then its complement is reducible to the complement of q *)
146+
147+
Lemma isreductioncompl {X Y : UU} (p : X → hProp) (q : Y → hProp) (f : X → Y) : (ismanyonereduction p q f) → (ismanyonereduction (predcompl p) (predcompl q) f).
148+
Proof.
149+
intros isr x.
150+
destruct (isr x) as [isr1 isr2].
151+
split.
152+
- intros npx qfx.
153+
exact (npx (isr2 qfx)).
154+
- intros nqfx px.
155+
exact (nqfx (isr1 px)).
156+
Defined.
157+
158+
Lemma reductioncompl {X Y : UU} (p : X → hProp) (q : Y → hProp) : (reduction p q) → (reduction (predcompl p) (predcompl q)).
159+
Proof.
160+
intros rect.
161+
exact (make_reduction (predcompl p) (predcompl q) (pr1 rect) (isreductioncompl p q (pr1 rect) (pr2 rect))).
162+
Defined.
163+
164+
Lemma isreduciblecompl {X Y : UU} (p : X → hProp) (q : Y → hProp) : (p ≼ q) → ((predcompl p) ≼ (predcompl q)).
165+
Proof.
166+
intros rdct.
167+
use squash_to_prop.
168+
- exact (reduction p q).
169+
- exact rdct.
170+
- apply propproperty.
171+
- intros rect.
172+
apply hinhpr.
173+
apply reductioncompl.
174+
exact rect.
175+
Qed.
176+
177+
Definition lem := ∏ (P : UU), (isaprop P) → P ⨿ ¬P.
178+
179+
Definition isstable {X : UU} (p : X → hProp) := ∏ (x : X), (hneg (hneg (p x))) → (p x).
180+
181+
Lemma isapropisstable {X : UU} (p : X → hProp) : (isaprop (isstable p)).
182+
Proof.
183+
apply impred_isaprop.
184+
intros t; apply isapropimpl.
185+
apply propproperty.
186+
Qed.
187+
188+
Lemma fundneg {X Y : UU} (f : X → Y) : (¬¬ X) → (¬¬ Y).
189+
Proof.
190+
intros nnx ny.
191+
apply nnx.
192+
intros x.
193+
exact (ny (f x)).
194+
Qed.
195+
196+
Lemma isreduciblestable {X Y : UU} (p : X → hProp) (q : Y → hProp) : (isstable q) → (p ≼ q) → (isstable p).
197+
Proof.
198+
intros.
199+
use squash_to_prop.
200+
- exact (reduction p q).
201+
- exact X1.
202+
- apply isapropisstable.
203+
- intros [f isr] x; destruct (isr x) as [isr1 isr2].
204+
simpl.
205+
intros nnpx.
206+
set (nf := fundneg isr1).
207+
apply isr2, (X0 (f x)).
208+
exact (nf nnpx).
209+
Qed.
210+
211+
End ManyOneReducibility.

code/_CoqProject

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ init/imports.v
88
init/all.v
99

1010
Decidability/DecidablePredicates.v
11-
Decidability/DiscreteTypes.v
11+
Decidability/DiscreteTypes.v
12+
13+
Reducibility/ManyOneReductions.v

0 commit comments

Comments
 (0)