(* the type cexpr is inspired by OpenMath. A few primitive constructors
have been added, in order to take into account some special features
of functional expressions. Most notably: case, let in, let rec, and
- explicit substitutons *)
+ explicit substitutions *)
type cexpr =
Symbol of string option * string * subst option * string option
None, Some "cic:/Coq/Init/Logic/not.con"))
:: List.map acic2cexpr args));;
+(* Rinv *)
+Hashtbl.add symbol_table "cic:/Coq/Reals/Rdefinitions/Rinv.con"
+ (fun aid sid args acic2cexpr ->
+ Appl
+ (Some aid, (Symbol (Some sid, "inv",
+ None, Some "cic:/Coq/Reals/Rdefinitions/Rinv.con"))
+ :: List.map acic2cexpr args));;
+
+(* Ropp *)
+Hashtbl.add symbol_table "cic:/Coq/Reals/Rdefinitions/Ropp.con"
+ (fun aid sid args acic2cexpr ->
+ Appl
+ (Some aid, (Symbol (Some sid, "opp",
+ None, Some "cic:/Coq/Reals/Rdefinitions/Rinv.con"))
+ :: List.map acic2cexpr args));;
+
(* exists *)
Hashtbl.add symbol_table "cic:/Coq/Init/Logic/ex.ind#xpointer(1/1)"
(fun aid sid args acic2cexpr ->
None, Some "cic:/Coq/ZArith/fast_integer/Zplus.con"))
:: List.map acic2cexpr args));;
+let rplus_uri =
+ UriManager.uri_of_string "cic:/Coq/Reals/Rdefinitions/Rplus.con" ;;
+let r0_uri = UriManager.uri_of_string "cic:/Coq/Reals/Rdefinitions/R0.con" ;;
+let r1_uri = UriManager.uri_of_string "cic:/Coq/Reals/Rdefinitions/R1.con" ;;
+
Hashtbl.add symbol_table "cic:/Coq/Reals/Rdefinitions/Rplus.con"
(fun aid sid args acic2cexpr ->
- Appl
- (Some aid, (Symbol (Some sid, "plus",
- None, Some "cic:/Coq/Reals/Rdefinitions/Rplus.con"))
- :: List.map acic2cexpr args));;
+ let appl () =
+ Appl
+ (Some aid, (Symbol (Some sid, "plus",
+ None, Some "cic:/Coq/Reals/Rdefinitions/Rplus.con"))
+ :: List.map acic2cexpr args)
+ in
+ let rec aux acc = function
+ | [ Cic.AConst (nid, uri, []); n] when
+ UriManager.eq uri r1_uri ->
+ (match n with
+ | Cic.AConst (_, uri, []) when UriManager.eq uri r1_uri ->
+ Num (Some aid, string_of_int (acc + 2))
+ | Cic.AAppl (_, Cic.AConst (_, uri, []) :: args) when
+ UriManager.eq uri rplus_uri ->
+ aux (acc + 1) args
+ | _ -> appl ())
+ | _ -> appl ()
+ in
+ aux 0 args)
+;;
+
+(* zero and one *)
+
+Hashtbl.add symbol_table "cic:/Coq/Reals/Rdefinitions/R0.con"
+ (fun aid sid args acic2cexpr -> Num (Some sid, "0")) ;;
+
+Hashtbl.add symbol_table "cic:/Coq/Reals/Rdefinitions/R1.con"
+ (fun aid sid args acic2cexpr -> Num (Some sid, "1")) ;;
(* times *)
Hashtbl.add symbol_table "cic:/Coq/Init/Peano/mult.con"
let string_of_sort =
function
- Cic.Prop -> "Prop"
- | Cic.Set -> "Set"
- | Cic.Type -> "Type"
+ Cic.Prop -> "Prop"
+ | Cic.Set -> "Set"
+ | Cic.Type -> "Type"
+ | Cic.CProp -> "Type"
;;
let get_constructors uri i =
(try
(let f = Hashtbl.find symbol_table uri_str in
f aid sid tl acic2cexpr)
- with notfound ->
+ with Not_found ->
Appl (Some aid, Symbol (Some sid,UriManager.name_of_uri uri,
make_subst subst, Some uri_str)::List.map acic2cexpr tl))
| C.AAppl (aid,C.AMutInd (sid,uri,i,subst)::tl) ->
(try
(let f = Hashtbl.find symbol_table puri_str in
f aid sid tl acic2cexpr)
- with notfound ->
+ with Not_found ->
Appl (Some aid, Symbol (Some sid, name,
make_subst subst, Some uri_str)::List.map acic2cexpr tl))
| C.AAppl (id,li) ->
Appl (Some id, List.map acic2cexpr li)
| C.AConst (id,uri,subst) ->
- Symbol (Some id, UriManager.name_of_uri uri,
- make_subst subst, Some (UriManager.string_of_uri uri))
+ let uri_str = UriManager.string_of_uri uri in
+ (try
+ let f = Hashtbl.find symbol_table uri_str in
+ f "dummy" id [] acic2cexpr
+ with Not_found ->
+ Symbol (Some id, UriManager.name_of_uri uri,
+ make_subst subst, Some (UriManager.string_of_uri uri)))
| C.AMutInd (id,uri,i,subst) ->
let inductive_types =
(match CicEnvironment.get_obj uri with