aboutsummaryrefslogtreecommitdiffhomepage
path: root/theories/Init/Logic_TypeSyntax.v
blob: a1cce77a572a997f798e7c820295867a0e79fb73 (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
(***********************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team    *)
(* <O___,, *        INRIA-Rocquencourt  &  LRI-CNRS-Orsay              *)
(*   \VV/  *************************************************************)
(*    //   *      This file is distributed under the terms of the      *)
(*         *       GNU Lesser General Public License Version 2.1       *)
(***********************************************************************)

(* $Id$ *)

Require Logic_Type.

(* Parsing of things in Logic_type.v *)

Grammar command command1 :=
  eqT_expl [ "<" lcommand($l1) ">" command0($c1) "==" command0($c2) ] ->
          [<<(eqT $l1 $c1 $c2)>>]
| eqT_impl [ command0($c) "==" command0($c2) ] -> [<<(eqT ? $c $c2)>>]
| idT_expl [ "<" lcommand($l1) ">" command0($c1) "===" command0($c2) ] ->
          [<<(identityT $l1 $c1 $c2)>>]
| idT_impl [ command0($c) "===" command0($c2) ] -> [<<(identityT ? $c $c2)>>]

with command10 :=
  allTexplicit [ "ALLT" ident($v) ":" command($t) "|" command($c1) ]
                          -> [<<(allT $t [$v : $t]$c1)>>]
| allTimplicit [ "ALLT" ident($v) "|" command($c1) ] 
                          -> [<<(allT ? [$v]$c1)>>]
| exTexplicit [ "EXT" ident($v) ":" command($t) "|" command($c1) ]
                          -> [<<(exT $t [$v : $t]$c1)>>]
| exTimplicit [ "EXT" ident($v) "|" command($c1) ] 
                          -> [<<(exT ? [$v]$c1)>>]
| exT2explicit [ "EXT" ident($v) ":" command($t) "|" command($c1) "&"
           command($c2) ] -> [<<(exT2 $t [$v : $t]$c1 [$v : $t]$c2)>>]
| exT2implicit [ "EXT" ident($v) "|" command($c1) "&" 
           command($c2) ] -> [<<(exT2 ? [$v]$c1 [$v]$c2)>>].

(* Pretty-printing of things in Logic_type.v *)

Syntax constr
  level 10:
    allT_pred [ (allT $_ $p) ] -> [ [<hov 0> "AllT " $p:L ] ]
  | allT [ (allT $T [$x : $T]$p) ]
       -> [ [<hov 3> "ALLT " $x ":" $T:L " |" [1 0] $p:L ] ]

  | exT_pred [ (exT $_ $p) ] -> [ [<hov 4> "ExT " $p:L ] ]
  | exT [ (exT $t1 [$x : $T]$p) ] 
       -> [ [<hov 4> "EXT " $x ":" $T:L " |" [1 0] $p:L ] ]

  | exT2_pred [ (exT2 $_ $p1 $p2) ]
       -> [ [<hov 4> "ExT2 " $p1:L [1 0] $p2:L ] ]
  | exT2 [ (exT2 $T [$x : $T]$P1 [$x : $T]$P2) ] 
       -> [ [<hov 2> "EXT " $x ":" $T:L " |" [1 2] $P1:L [1 0] "& " $P2:L] ]
  ;

  level 1:
    eqT [ (eqT $_ $c1 $c2) ] -> [ [<hov 1> $c1:E [0 0] "==" $c2:E ] ]

  | identityT [ (identityT $_ $c1 $c2) ]
       -> [ [<hov 1> $c1:E [0 0] "===" $c2:E ] ].