From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p92GuK3T024317 for ; Sun, 2 Oct 2011 18:56:21 +0200 X-IronPort-AV: E=Sophos;i="4.68,477,1312149600"; d="scan'208,217";a="111429815" Received: from zmbs4.inria.fr ([128.93.142.17]) by mail4-relais-sop.national.inria.fr with ESMTP; 02 Oct 2011 18:56:15 +0200 Date: Sun, 2 Oct 2011 18:56:15 +0200 (CEST) From: Xavier Clerc To: Diego Olivier Fernandez Pons Cc: caml-list Message-ID: <158987471.115296.1317574575744.JavaMail.root@zmbs4.inria.fr> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_115295_55590788.1317574575744" X-Originating-IP: [82.216.0.149] X-Mailer: Zimbra 6.0.14_GA_2928 (ZimbraWebClient - FF3.0 (Mac)/6.0.14_GA_2928) Subject: Re: [Caml-list] How to simplify an arithmetic expression ? ------=_Part_115295_55590788.1317574575744 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable ----- Mail original ----- > De: "Diego Olivier Fernandez Pons" > =C0: "caml-list" > Envoy=E9: Dimanche 2 Octobre 2011 13:51:13 > Objet: [Caml-list] How to simplify an arithmetic expression ? > OCaml list, > It's easy to encapsulate a couple of arithmetic simplifications into a > function that applies them bottom up to an expression represented as a > tree Not absolutely sure it will fit your needs, but it will at least advertise = a nice tool... The "moca" preprocessor allows you to add properties to cons= tructors of a sum type (e. g. associativity, commutativity, etc.). Example = from the webpage (*): type t =3D private | Zero | One | Opp = of t | Add of t * t begin associative commuta= tive neutral (Zero) opposite (Opp) end ;; Regard= s, Xavier Clerc (*) http://moca.inria.fr/eng.htm= ------=_Part_115295_55590788.1317574575744 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <= div style=3D'font-family: Times New Roman; font-size: 12pt; color: #000000'= >

De: "Diego Olivier Fernand= ez Pons" <dofp.ocaml@gmail.com>
=C0: "caml-list" <caml-l= ist@inria.fr>
Envoy=E9: Dimanche 2 Octobre 2011 13:51:13
Objet: [Caml-list] How to simplify an arithmetic expression ?

&= nbsp;   OCaml list,

It's easy to enca= psulate a couple of arithmetic simplifications into a function that applies= them bottom up to an expression represented as a tree
No= t absolutely sure it will fit your needs, but it will at least advertise a = nice tool...
The "moca" preprocessor allows you to add properties to con= structors of a sum type
(e. g. associativity, commutativity, etc.).
<= br>Example from the webpage (*):
   type t =3D private
      | Zero
      | One
      | Opp of t
      | Add of t * t
        begin
          associative
          commutative
          neutral (Zero)
          opposite (Opp)
        end
   ;;

Regards,

Xavier Clerc


(*) http://moca.inri= a.fr/eng.htm

= ------=_Part_115295_55590788.1317574575744--