caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus@mail4.ai.univie.ac.at>
To: Thorsten Ohl <ohl@hep.tu-darmstadt.de>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] "super-compaction" of values
Date: Wed, 1 Aug 2001 17:25:51 +0200	[thread overview]
Message-ID: <20010801172551.A14242@kastanie.ai.univie.ac.at> (raw)
In-Reply-To: <15208.4700.18141.346738@heplix4.ikp.physik.tu-darmstadt.de>; from ohl@hep.tu-darmstadt.de on Wed, Aug 01, 2001 at 16:29:48 +0200

Thorsten Ohl schrieb am Mittwoch, den 01. August 2001:
> This implies that you either have a good comparison function for your
> (sub-)trees or a unique representation or that you can live with a
> small fraction of program trees that are not recognized as equivalent.

Comparing program trees for equivalence is straightforward. Their concrete
representation is:

  type tree = Tree of int * tree array | Leaf of int

"Tree (1, [| Leaf 2 |])" would read "from the current nonterminal (e.g.
start symbol), choose production 1, which contains a terminal in state 2".

Of course, semantic equivalence doesn't imply syntactic equivalence.
Exploitation of semantic equivalences is handled by preprocessing programs
with user specified rewrite rules to get normal forms. The latter can
then be exploited with syntactic equivalences again.

> In this case you can represent trees as maps from parent nodes to sets
> of child nodes and you get a DAG representation with automatically
> shared common subexpressions for free.

This is the non-generic solution I currently have in mind. I'd only
have to convert between my representation and this one so it shouldn't
be terribly difficult.

> A different solution could probably be build on a variation of Chris
> Okasaki's Tries of Trees. [I have only a bare bones O'Caml version,
> but the usual tricks for working around the lack of polymorphic
> recursion work.]

Yes, I remember this chapter (though I currently don't have the book
at hand). I'll probably take another look at it, maybe it inspires me
to implement a solution I like. I had hoped that somebody might have
already implemented a generic solution, but so I'll have to continue
experimenting...

Thanks a lot for the help!

Regards,
Markus Mottl

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2001-08-01 15:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-01 10:20 Markus Mottl
2001-08-01 13:41 ` Thorsten Ohl
2001-08-01 14:09   ` Markus Mottl
2001-08-01 14:29     ` Thorsten Ohl
2001-08-01 15:25       ` Markus Mottl [this message]
2001-08-02  1:48 ` Alexander V. Voinov
2001-08-01 13:12 Damien Doligez
     [not found] <200108011606.JAA29019@dhpc0010.pdx.intel.com>
2001-08-02  9:42 ` Markus Mottl
2001-08-02 13:46 Dave Berry
2001-08-02 13:28 ` Gregory Morrisett
2001-08-02 15:56   ` Markus Mottl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010801172551.A14242@kastanie.ai.univie.ac.at \
    --to=markus@mail4.ai.univie.ac.at \
    --cc=caml-list@inria.fr \
    --cc=ohl@hep.tu-darmstadt.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).