From 75b31b34ac5cb0c4a80bc9bebd89797b90461656 Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Fri, 13 Sep 2002 11:01:39 +0000 Subject: [PATCH] Fourier tactic update --- helm/gTopLevel/fourierR.ml | 77 +++++++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/helm/gTopLevel/fourierR.ml b/helm/gTopLevel/fourierR.ml index 1942e1821..b8d88ae19 100644 --- a/helm/gTopLevel/fourierR.ml +++ b/helm/gTopLevel/fourierR.ml @@ -132,16 +132,6 @@ let flin_emult a f = (*****************************************************************************) -(* - - no idea about helm parser ?????????????????????????????? - -let parse_ast = Pcoq.parse_string Pcoq.Constr.constr;; -let parse s = Astterm.interp_constr Evd.empty (Global.env()) (parse_ast s);; -let pf_parse_constr gl s = - Astterm.interp_constr Evd.empty (pf_env gl) (parse_ast s);; -*) - (** @param t a term @@ -417,36 +407,79 @@ let rec rational_to_fraction x= (x.num,x.den) (* traduction -3 -> (Ropp (Rplus R1 (Rplus R1 R1))) *) -let int_to_real n = +(*et int_to_real n = let nn=abs n in - let s=ref "" in + let s=ref Cic.term if nn=0 then s:="R0" else (s:="R1"; for i=1 to (nn-1) do s:="(Rplus R1 "^(!s)^")"; done;); if n<0 then s:="(Ropp "^(!s)^")"; !s +;;*) +let _Ropp = Cic.Const (UriManager.uri_of_string "cic:/Coq/Reals/Rdefinitions/Ropp.con") 0 ;; + +let _R0 = Cic.Const (UriManager.uri_of_string "cic:/Coq/Reals/Rdefinitions/R0.con") 0 ;; +let _R1 = Cic.Const (UriManager.uri_of_string "cic:/Coq/Reals/Rdefinitions/R1.con") 0 ;; +let _Rplus = Cic.Const (UriManager.uri_of_string "cic:/Coq/Reals/Rdefinitions/Rplus.con") 0 ;; + + +let rec int_to_real_aux n = + match n with + 0 -> _R0 (* o forse R0 + R0 ????? *) + | _ -> Cic.Appl [ _Rplus ; _R1 ; int_to_real_aux (n-1) ] +;; + + +let int_to_real n = + let x = int_to_real_aux (abs n) in + if n < 0 then + Cic.Appl [ _Ropp ; x ] + else + x ;; + (* -1/2 -> (Rmult (Ropp R1) (Rinv (Rplus R1 R1))) *) +let _Rmult = Cic.Const (UriManager.uri_of_string "cic:/Coq/Reals/Rdefinitions/Rmult.con") 0 ;; +let _Rinv = Cic.Const (UriManager.uri_of_string "cic:/Coq/Reals/Rdefinitions/Rinv.con") 0 ;; + + let rational_to_real x = - let (n,d)=rational_to_fraction x in - ("(Rmult "^(int_to_real n)^" (Rinv "^(int_to_real d)^"))") + let (n,d)=rational_to_fraction x in + Cic.Appl [ _Rmult ; int_to_real n ; Cic.Appl [ _Rinv ; int_to_real d ] ] ;; (* preuve que 0