aboutsummaryrefslogtreecommitdiff
path: root/theories/Program/Utils.v
blob: c514d3234d69ed4aeb193f1c530f93bf7def1d55 (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
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

(*i $Id$ i*)

Require Export Coq.Program.Tactics.

Set Implicit Arguments.

(** Wrap a proposition inside a subset. *)

Notation " {{ x }} " := (tt : { y : unit | x }).

(** A simpler notation for subsets defined on a cartesian product. *)

Notation "{ ( x , y )  :  A  |  P }" :=
  (sig (fun anonymous : A => let (x,y) := anonymous in P))
  (x ident, y ident, at level 10) : type_scope.

(** Generates an obligation to prove False. *)

Notation " ! " := (False_rect _ _).

(** Abbreviation for first projection and hiding of proofs of subset objects. *)

(** The scope in which programs are typed (not their types). *)

Delimit Scope program_scope with prg.

Notation " ` t " := (proj1_sig t) (at level 10) : core_scope.

Delimit Scope subset_scope with subset.

(* In [subset_scope] to allow masking by redefinitions for particular types. *)
Notation "( x & ? )" := (@exist _ _ x _) : subset_scope.

(** Coerces objects to their support before comparing them. *)

Notation " x '`=' y " := ((x :>) = (y :>)) (at level 70).

(** Quantifying over subsets. *)

(* Notation "'fun' ( x : A | P ) => Q" := *)
(*   (fun (x :A|P} => Q) *)
(*   (at level 200, x ident, right associativity). *)

(* Notation "'forall' ( x : A | P ), Q" := *)
(*   (forall (x : A | P), Q) *)
(*   (at level 200, x ident, right associativity). *)

Require Import Coq.Bool.Sumbool.

(** Construct a dependent disjunction from a boolean. *)

Notation "'dec'" := (sumbool_of_bool) (at level 0). 

(** The notations [in_right] and [in_left] construct objects of a dependent disjunction. *)


(** These type arguments should be infered from the context. *)

Implicit Arguments left [[A]].
Implicit Arguments right [[B]].

(** Hide proofs and generates obligations when put in a term. *)

Notation left := (left _ _).
Notation right := (right _ _).

(** Extraction directives *)

Extraction Inline proj1_sig.
Extract Inductive unit => "unit" [ "()" ].
Extract Inductive bool => "bool" [ "true" "false" ].
Extract Inductive sumbool => "bool" [ "true" "false" ].
(* Extract Inductive prod "'a" "'b" => " 'a * 'b " [ "(,)" ]. *)
(* Extract Inductive sigT => "prod" [ "" ]. *)