From joe at gilith.com Tue Sep 25 19:58:43 2012 From: joe at gilith.com (Joe Leslie-Hurd) Date: Tue, 25 Sep 2012 12:58:43 -0700 Subject: [metis-users] TermNets In-Reply-To: References: <8D43D4DA-AB75-448C-92F6-0B1976718739@cam.ac.uk> Message-ID: [cc'ing to the metis-users mailing list] Hi James, Sorry for the late reply: I just got back from my honeymoon. > I've been looking at the TermNet code with the aim of understanding it. I > have a few quick questions regarding the forward pointers you refer to in > your e-mail. > > First, are these the same as McCune's Jump Lists as in his 1990 paper > "Experiments with Discrimination-Tree Indexing and Path Indexing for Term > Retrieval" ? (Caveat: I've just today seen this paper, and my implementation was developed independently.) In the paper it seems jump lists always include forward pointers, and plain discrimination trees never do. My term-nets include forward pointers only for Single constructors (see below). > In the actual implementation, is this the purpose of the > > Single qterm* a' net > constructor in the a' net datatype? > > Lastly, with a Single constructor is the a' net part always of type Result ? > (i.e. is it always a single path down to the tree leaf?) The term-net works by flattening each term to a list (using a pre-order traversal) and then combining terms with a common list prefix to form a tree with Multiple nodes at the branch points and Result nodes at the leaves. My initial implementation had just these constructors, but the common case is that when traversing the tree from root to leaf there will be some initial Multiple constructors with more than one child, then a long sequence of Multiple constructors with just one child branch eventually leading to a Result. The Single constructor is an optimization for the long sequence portion of the tree by storing whole subterms instead of flattening them into lists. As a side-benefit the Single constructor allows you to easily skip subterms a la jump lists. Hope this helps to explain what's going on. Cheers, Joe From jpb65 at cam.ac.uk Wed Sep 26 08:19:11 2012 From: jpb65 at cam.ac.uk (James Bridge) Date: 26 Sep 2012 09:19:11 +0100 Subject: [metis-users] TermNets In-Reply-To: References: <8D43D4DA-AB75-448C-92F6-0B1976718739@cam.ac.uk> Message-ID: Hi Joe, Thank you for the explanation. Just to ensure that I have a proper understanding, when you say >a long sequence of Multiple >constructors with just one child branch eventually leading to a >Result. The Single constructor is an optimization for the long >sequence portion of the tree is there ever a case where there is branching behaviour after a long single sequence or do all Single sequences always terminate in a Result without connecting to a Multiple (branch) point on the way? (From the code it looks like Single sequences grow from Results upwards and are converted to Multiple at a branching point which, if my reading is correct, implies that Singles must connect to a Result and never to a Multiple.) Thanks, James On Sep 25 2012, Joe Leslie-Hurd wrote: >[cc'ing to the metis-users mailing list] > >Hi James, > >Sorry for the late reply: I just got back from my honeymoon. > >> I've been looking at the TermNet code with the aim of understanding it. I >> have a few quick questions regarding the forward pointers you refer to in >> your e-mail. >> >> First, are these the same as McCune's Jump Lists as in his 1990 paper >> "Experiments with Discrimination-Tree Indexing and Path Indexing for Term >> Retrieval" ? > >(Caveat: I've just today seen this paper, and my implementation was >developed independently.) In the paper it seems jump lists always >include forward pointers, and plain discrimination trees never do. My >term-nets include forward pointers only for Single constructors (see >below). > >> In the actual implementation, is this the purpose of the >> >> Single qterm* a' net >> constructor in the a' net datatype? >> >> Lastly, with a Single constructor is the a' net part always of type >> Result ? (i.e. is it always a single path down to the tree leaf?) > >The term-net works by flattening each term to a list (using a >pre-order traversal) and then combining terms with a common list >prefix to form a tree with Multiple nodes at the branch points and >Result nodes at the leaves. My initial implementation had just these >constructors, but the common case is that when traversing the tree >from root to leaf there will be some initial Multiple constructors >with more than one child, then a long sequence of Multiple >constructors with just one child branch eventually leading to a >Result. The Single constructor is an optimization for the long >sequence portion of the tree by storing whole subterms instead of >flattening them into lists. As a side-benefit the Single constructor >allows you to easily skip subterms a la jump lists. > >Hope this helps to explain what's going on. > >Cheers, > >Joe > From jpb65 at cam.ac.uk Wed Sep 26 08:23:00 2012 From: jpb65 at cam.ac.uk (James Bridge) Date: 26 Sep 2012 09:23:00 +0100 Subject: [metis-users] TermNets In-Reply-To: References: <8D43D4DA-AB75-448C-92F6-0B1976718739@cam.ac.uk> Message-ID: On Sep 25 2012, Joe Leslie-Hurd wrote: >[cc'ing to the metis-users mailing list] > >Hi James, > >Sorry for the late reply: I just got back from my honeymoon. > Hi Joe, On my first reading of your e-mail I somehow missed your first sentence, I was eagerly scanning the technical bits. Many congratulations! James From joe at gilith.com Wed Sep 26 18:51:23 2012 From: joe at gilith.com (Joe Leslie-Hurd) Date: Wed, 26 Sep 2012 11:51:23 -0700 Subject: [metis-users] TermNets In-Reply-To: References: <8D43D4DA-AB75-448C-92F6-0B1976718739@cam.ac.uk> Message-ID: Hi James, > Just to ensure that I have a proper understanding, when you say > >> a long sequence of Multiple >> constructors with just one child branch eventually leading to a >> Result. The Single constructor is an optimization for the long >> sequence portion of the tree > > is there ever a case where there is branching behaviour after a long > single sequence or do all Single sequences always terminate in a > Result without connecting to a Multiple (branch) point on the way? Though the Single constructor was created with the purpose of optimizing long Single sequences leading to Results, they can appear in other places too. For example, consider adding the two terms f(t,u) f(t,v) to an empty term-net. The resulting term-net will look something like Multiple (NONE, f/2 |-> Single (t, Multiple (...))) where the Single is used to indicate that at the subterm position "first argument of f" it has only ever seen one term "t". The second argument of the Single constructor is a choice point using Multiple, because there are two terms "u" and "v" to be discriminated at the next subterm position "second argument of f". Hope that helps, Joe From jpb65 at cam.ac.uk Thu Sep 27 08:08:50 2012 From: jpb65 at cam.ac.uk (James Bridge) Date: 27 Sep 2012 09:08:50 +0100 Subject: [metis-users] TermNets In-Reply-To: References: <8D43D4DA-AB75-448C-92F6-0B1976718739@cam.ac.uk> Message-ID: Thanks Joe, that has clarified things. James On Sep 26 2012, Joe Leslie-Hurd wrote: >Hi James, > >> Just to ensure that I have a proper understanding, when you say >> >>> a long sequence of Multiple >>> constructors with just one child branch eventually leading to a >>> Result. The Single constructor is an optimization for the long >>> sequence portion of the tree >> >> is there ever a case where there is branching behaviour after a long >> single sequence or do all Single sequences always terminate in a >> Result without connecting to a Multiple (branch) point on the way? > >Though the Single constructor was created with the purpose of >optimizing long Single sequences leading to Results, they can appear >in other places too. For example, consider adding the two terms > >f(t,u) >f(t,v) > >to an empty term-net. The resulting term-net will look something like > >Multiple (NONE, f/2 |-> Single (t, Multiple (...))) > >where the Single is used to indicate that at the subterm position >"first argument of f" it has only ever seen one term "t". The second >argument of the Single constructor is a choice point using Multiple, >because there are two terms "u" and "v" to be discriminated at the >next subterm position "second argument of f". > >Hope that helps, > >Joe >