summaryrefslogtreecommitdiff
path: root/theories/Logic/ClassicalDescription.v
blob: 2fd6e68e4571b7823964598b65f7702e1477d29a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, *   INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012     *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

(** This file provides classical logic and definite description, which is
    equivalent to providing classical logic and Church's iota operator *)

(** Classical logic and definite descriptions implies excluded-middle
    in [Set] and leads to a classical world populated with non
    computable functions. It conflicts with the impredicativity of
    [Set] *)

Set Implicit Arguments.

Require Export Classical.   (* Axiomatize classical reasoning *)
Require Export Description. (* Axiomatize constructive form of Church's iota *)
Require Import ChoiceFacts.

Local Notation inhabited A := A (only parsing).

(** The idea for the following proof comes from [ChicliPottierSimpson02] *)

Theorem excluded_middle_informative : forall P:Prop, {P} + {~ P}.
Proof.
apply
  (constructive_definite_descr_excluded_middle
   constructive_definite_description classic).
Qed.

Theorem classical_definite_description :
  forall (A : Type) (P : A->Prop), inhabited A ->
  { x : A | (exists! x : A, P x) -> P x }.
Proof.
intros A P i.
destruct (excluded_middle_informative (exists! x, P x)) as [Hex|HnonP].
  apply constructive_definite_description with (P:= fun x => (exists! x : A, P x) -> P x).
  destruct Hex as (x,(Hx,Huni)).
  exists x; split.
    intros _; exact Hx.
    firstorder.
exists i; tauto.
Qed.

(** Church's iota operator *)

Definition iota (A : Type) (i:inhabited A) (P : A->Prop) : A
  := proj1_sig (classical_definite_description P i).

Definition iota_spec (A : Type) (i:inhabited A) (P : A->Prop) :
  (exists! x:A, P x) -> P (iota i P)
  := proj2_sig (classical_definite_description P i).

(** Axiom of unique "choice" (functional reification of functional relations) *)
Theorem dependent_unique_choice :
  forall (A:Type) (B:A -> Type) (R:forall x:A, B x -> Prop),
    (forall x:A, exists! y : B x, R x y) ->
    (exists f : (forall x:A, B x), forall x:A, R x (f x)).
Proof.
intros A B R H.
assert (Hexuni:forall x, exists! y, R x y).
  intro x. apply H.
exists (fun x => proj1_sig (constructive_definite_description (R x) (Hexuni x))).
intro x.
apply (proj2_sig (constructive_definite_description (R x) (Hexuni x))).
Qed.

Theorem unique_choice :
  forall (A B:Type) (R:A -> B -> Prop),
    (forall x:A,  exists! y : B, R x y) ->
    (exists f : A -> B, forall x:A, R x (f x)).
Proof.
intros A B.
apply dependent_unique_choice with (B:=fun _:A => B).
Qed.

(** Compatibility lemmas *)

Unset Implicit Arguments.

Definition dependent_description := dependent_unique_choice.
Definition description := unique_choice.