%token <string> ID
%token <int> META
%token <int> NUM
+%token <int> RNUM
%token <UriManager.uri> CONURI
%token <UriManager.uri> VARURI
%token <UriManager.uri * int> INDTYURI
%token LPAREN RPAREN PROD LAMBDA COLON DOT SET PROP TYPE CAST IMPLICIT NONE
%token LETIN FIX COFIX SEMICOLON LCURLY RCURLY CASE ARROW LBRACKET RBRACKET EOF
%token DOLLAR
-%token PLUS MINUS TIMES EQ
+%token RPLUS RMINUS RTIMES RDIV
+%token PLUS MINUS TIMES EQT EQ
%right ARROW
-%right EQ
-%right PLUS MINUS
-%right TIMES
+%right EQ EQT
+%right PLUS MINUS RPLUS RMINUS
+%right TIMES RTIMES RDIV
%start main
%type <CicTextualParser0.interpretation_domain_item list * (CicTextualParser0.interpretation -> Cic.term)> main
%%
*/
;
expr2:
- NUM
+ | RNUM
+ { [], function interp ->
+ let rec cic_real_of_real =
+ function
+ 0 ->
+ Cic.Const
+ (UriManager.uri_of_string
+ "cic:/Coq/Reals/Rdefinitions/R0.con",[])
+ | 1 ->
+ Cic.Const
+ (UriManager.uri_of_string "cic:/Coq/Reals/Rdefinitions/R1.con",[])
+ | n ->
+ Cic.Appl
+ [ Cic.Const
+ (UriManager.uri_of_string
+ "cic:/Coq/Reals/Rdefinitions/Rplus.con",[]) ;
+ Cic.Const (UriManager.uri_of_string
+ "cic:/Coq/Reals/Rdefinitions/R1.con",[]);
+ cic_real_of_real (n - 1)
+ ]
+ in
+ cic_real_of_real $1
+ }
+ | NUM
{ [], function interp ->
let rec cic_int_of_int =
function
in
cic_int_of_int $1
}
+ | expr2 RPLUS expr2
+ { let dom1,mk_expr1 = $1 in
+ let dom2,mk_expr2 = $3 in
+ let dom = union dom1 dom2 in
+ dom, function interp ->
+ Cic.Appl
+ [Cic.Const
+ (UriManager.uri_of_string
+ "cic:/Coq/Reals/Rdefinitions/Rplus.con",[]) ;
+ (mk_expr1 interp) ;
+ (mk_expr2 interp)
+ ]
+ }
+ | expr2 RMINUS expr2
+ { let dom1,mk_expr1 = $1 in
+ let dom2,mk_expr2 = $3 in
+ let dom = union dom1 dom2 in
+ dom, function interp ->
+ Cic.Appl
+ [Cic.Const
+ (UriManager.uri_of_string
+ "cic:/Coq/Reals/Rdefinitions/Rminus.con",[]) ;
+ (mk_expr1 interp) ;
+ (mk_expr2 interp)
+ ]
+ }
+ | expr2 RTIMES expr2
+ { let dom1,mk_expr1 = $1 in
+ let dom2,mk_expr2 = $3 in
+ let dom = union dom1 dom2 in
+ dom, function interp ->
+ Cic.Appl
+ [Cic.Const
+ (UriManager.uri_of_string
+ "cic:/Coq/Reals/Rdefinitions/Rmult.con",[]) ;
+ (mk_expr1 interp) ;
+ (mk_expr2 interp)
+ ]
+ }
+ | expr2 RDIV expr2
+ { let dom1,mk_expr1 = $1 in
+ let dom2,mk_expr2 = $3 in
+ let dom = union dom1 dom2 in
+ dom, function interp ->
+ Cic.Appl
+ [Cic.Const
+ (UriManager.uri_of_string
+ "cic:/Coq/Reals/Rdefinitions/Rdiv.con",[]) ;
+ (mk_expr1 interp) ;
+ (mk_expr2 interp)
+ ]
+ }
| expr2 PLUS expr2
{ let dom1,mk_expr1 = $1 in
let dom2,mk_expr2 = $3 in
(mk_expr2 interp)
]
}
+ | expr2 EQT expr2
+ { let dom1,mk_expr1 = $1 in
+ let dom2,mk_expr2 = $3 in
+ let dom3,mk_expr3 = mk_implicit () in
+ let dom = union dom1 (union dom2 dom3) in
+ dom, function interp ->
+ Cic.Appl
+ [Cic.MutInd
+ (UriManager.uri_of_string "cic:/Coq/Init/Logic_Type/eqT.ind",0,[]) ;
+ (mk_expr3 interp) ;
+ (mk_expr1 interp) ;
+ (mk_expr2 interp)
+ ]
+ }
| expr2 EQ expr2
{ let dom1,mk_expr1 = $1 in
let dom2,mk_expr2 = $3 in