diprism / fggs

Factor Graph Grammars in Python
MIT License
13 stars 3 forks source link

Conjunction and factorization #143

Open davidweichiang opened 2 years ago

davidweichiang commented 2 years ago

Using conjunction to actually parse a string in parser.py is still not implemented, and one of the sticking points is that conjunction doesn't interact well with factorization. The FGG has rules of many different sizes, which factorization breaks into smaller rules. If we do conjunction before factorization, then we have to construct a FGG-to-conjoin-with that has many rules (n^{k+1} where k is the maximum size of a right-hand side). But if we do conjunction after factorization, we don't know how to construct the FGG-to-conjoin-with, because we don't know how the factorization goes.

davidweichiang commented 2 years ago

The best solution I can think of so far is to allow conjunction of an FGG and a factor graph, so it will be insensitive to factorization. This would involve:

This conjunction operation would be much more complicated but it can mostly be reused from the HRG parser I wrote way back when.

ccshan commented 1 year ago

This thought is not fully formed, but can factorization apply to two FGGs at once?

davidweichiang commented 1 year ago

Yes, but (1) the objection still stands that you'd have to make an FGG-to-conjoin-with that has a rule for every RHS size, and (2) you'd have to orchestrate the factorization of the two FGGs to use the same tree decomposition.

I think (2) is probably easy, since the two FGGs are required to have the same nodes.