-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make rule implicand explicit for the backward chainer #119
Comments
This looks to be the same problem mentioned in opencog/opencog#1441 and opencog/opencog#1593 Note that explicitly defining the output (implicand) of a rule is not always possible. Some rules could generate an infinite possible output (bases on some outgoing set of an input link, for example). I recall @bgoertzel wrote a solution (requiring some special yet to be invented system I recall). I couldn't find it at the moment (is it on google group or wiki... can't remember...) |
Maybe we don't need to have a single rule that expressive (generate an infinite possible output). We can always generate multiple simple rules via some scheme code, right? |
Yeah. I thought the best way to solve this problem was to introduce the On Tue, Jun 30, 2015 at 11:15 PM, Amen Belayneh notifications@github.com
Ben Goertzel, PhD "The reasonable man adapts himself to the world: the unreasonable one |
Deep type alone cannot fix the problem, we still need a way to tell "this is the implicand", and currently, as far as I can tell we don't have one, do we? Or is there already a convention regarding the arguments of the ExecutionOutputLink, like the first arg is the implicand (as suggested by @misgeatgit I believe)? |
Hmmm... I think there may be a couple problems mixed up here... Is one problem that you removed the ImplicationLink from inside the Of course, a PLN rule needs an ImplicationLink --- it is, logically, an A rule needs to be of the form ImplicationLink Not all BindLinks need to involve ImplicationLinks, but PLN rules do I see, you may be right that deep type alone is not enough..... Knowing I wonder if we could express a rule something like ImplicationLink (optional) ... The "template" would be an Atom-structure suitable for matching/chaining. For instance, the rule Evaluation2Member(*,k) described at http://wiki.opencog.org/w/Deep_types would look like ForAllLink $D, $L, $k ThereExists $X, $Y [456] EvaluationLink ... The output template would then be used for chaining, and the actual output -- Ben On Wed, Jul 1, 2015 at 4:26 AM, ngeiswei notifications@github.com wrote:
Ben Goertzel, PhD "The reasonable man adapts himself to the world: the unreasonable one |
@bgoertzel Adding the ImplicationLink back in the BindLink wouldn't add any new information, would it? Regardless of whether removing the ImplicationLink from BindLink was a bad idea, it seems independent of that problem. Maybe I haven't been clear enough, the problem is that currently the formula, which is a black box, doesn't just take care of the TV but also of the whole output, so there is no way, unless the black box is run to get the output pattern. Your example about deep type is a good one, but completely ignores that issue, and the deep type does not reflect the shallow type (the syntactic hypergraph structure) we also want. I guess we want both shallow and deep type checkers that can run over the scheme code black box, it seems difficult to implement (we'd have to fiddle with scheme semantics), but it would indeed be the answer. Surely Shallow + Deep types contain all the information we need to perform the pattern matching on the target so select the rule! Or at least it's good enough (not getting into dependent types). Now till we get good shallow and deep type checkers we still want to be able to run the backward chainer, there is definitely a lot of development to be done on it and I don't think we should postpone URE development till we get good type checkers. So meanwhile what I suggest is to come up with a convention to get that output structure. The SetTVLink is a clean way to split that black box into a clear box part and a black box part containing only the formula, and therefore let the output structure visible. There are other ways. In the absence of other suggestions I'll probably settle with @misgeatgit 's, like the first argument of the formula black box must be the output. I suggest that as soon as the URE is working "well enough", we can start working on the type system. |
On Wed, Jul 1, 2015 at 3:57 PM, ngeiswei notifications@github.com wrote:
Using an ImplicationLin here would just make the Atomspace formulation of An inference rule IS an implication: premises IMPLY conclusions, and the I don't think ImplicationLInks are ALWAYS needed with BindLinks, but in
Yes, but my "OutputTemplate" does address this -- the output template IS Now till we get good shallow and deep type checkers we still want to be
ben |
On 07/01/2015 11:04 AM, bgoertzel wrote:
Well, the ImplicationLink can definitely have a valid PLN interpretation
Sure, it is. I mean that in case the output template is hidden, a Nil
|
I dunno... having the rules represented in such a semantically opaque I guess I'll have to think more about whether this reformulation of the Anyway, I agree this is not the most urgent problem. Getting the chainer
True. But it might be inefficient for the type engine to have to infer it ben |
|
On 07/01/2015 12:29 PM, Amen Belayneh wrote:
It doesn't. You'd still need to split that complex rule into multiple So if it doesn't solve that, what does it solve? It replaces the current
SetTVLink assigns truth value TV to atom Atom and returns Atom. This would be cool, I might implement it, but we can also assume that BTW, IMO the main semantical opacity comes from the black box scheme Hmm, SetTVLink should be pretty easy to implement, maybe I'll do that Or alternatively a rule would be defined as a triplet (Implicant, Implicand, TV formula) Maybe that would be better, it's very terse and can be turned into So 5 options:
If I were the only one working on OpenCog I would probably go with 5 Let me know what you think. Ultimately multiple choices are possible. We However I would definitely not stay in the current situation where any Or I can implement SetTVLink and convert all existing rules to follow
|
Thinking ahead, which solution (1-5) will work best when the DeepType system is eventually implemented (so that when that is implemented, the effort here won't be wasted)? |
But the deep type system isn't gonna fix all the issues, it's not gonna reveal an output structure hidden in a scheme function. I think the best solution is to use 2+5, but meanwhile 3+5 prevents from implementing a SetTVLink. I'll see how the existing rules can fit into 1, if they easily can maybe I'll go that way. |
True, but it is still part of "showing the true rule's output" solution. I am just wondering if any of the solution will became incompatible with the deep type's solution (ie. when deep type's development begin, the developer might end up removing the solution here to get a good representation working for deep type). A representation is needed so both system can coexist I think? |
Having powerful shallow + deep type systems maybe remove the need for expliciting the output structure, but it certainly wouldn't be in contradiction with using a more transparent description, with SetTVLink for instance. Anyway, I do understand your concern about investing too much energy into an temporary solution. I'm about to go through all existing rules to see if solution 1 can easily be used, if that is the case we go that way, end of the debate. If that isn't the case, we must think... |
OK, so here's my report, only looking at PLN rules (I tried to look at relex2logic but the comments were too obscure for me to understand the rules) Rules with output pattern as first argumentabduction.scm Rules with output pattern as last argumentand-breakdown-rule.scm Rules with no output pattern (hidden in the scheme code)and.scm Rules with multiple outputsand-elimination-rule.scm I thinking, there might be another way, more soon... |
OK, so the problem, and I had not realized that before looking at all these rules, some rules have multiple outputs, I don't know if that's a good idea, but if we really wish to support that, here's my suggestion: SuggestionRun the scheme code over the (ungrounded) patterns to unravel the output structure! |
That way we don't care were the output is, or even if there's one. I think it would work, but we'd need to try to know for sure... |
Thinking about it, it is a hacky way to infer the output's shallow type. So once we have a shallow type (and ultimately a deep type) system we can drop this hack (if it's gonna work anyway). |
Only possible if the scheme code is simple. If the rule matched a variable to a link and the scheme code looks inside the link, then the ungrounded pattern will not have the information. But may not be a problem for the PLN rules you listed. Just not in general. |
Would it be better to merge @prateeksaxena2809's changes before changing the rule's format? |
I won't change the rule format, I'll first try the run-scheme-formula hack. But sure, create a pull request and let's merge it. |
I am not sure on which issue that @ngeiswei suggested it, but wouldn't the introduction of regex + and * link and making a modification to the rule definition schema as follows solve black-box rules, for the backward chainer?
I am not that privy of regex. Reference http://wiki.opencog.org/w/SignatureLink |
@amebel thanks for your input. I actually wasn't aware the pattern matcher's type checker was that advanced (I do understand your regex notation are not implemented, I'm basing that on reading the SignatureLink wiki page). So yes, a solution could be to specify the shallow type of the output elsewhere, in addition to the rule definition, and have the backward chainer relies on that. That way it wouldn't change the rule format. It would add an extra burden on the user to declare the type though. In order not to add any extra burden to the user the type checker must be able to infer the type's output, I don't think that's currently possible. But anyway, I'm first gonna see if the hack I've lastly suggest would work, if it does, I'll move on to the next issue. |
is this still an issue? |
This still an issue. |
You implemented your “hack”?
|
It is no longer a hack :-) Of course the BC itself still requires a major rewrite. |
Oh, to answer the question, no I didn't implement the hack consisting to run the GSN with the variables. After exploring a few rules I realized this wouldn't work as William rightly warned. Instead the user has the possibility to specify a number of output patterns. |
Hmm. Can you explain more explicitly, maybe with some good example?
|
@bgoertzel I've improved the wiki http://wiki.opencog.org/wikihome/index.php/URE_Configuration_Format#Rule_Definition and added links to examples using only the forward form and both forward and backward forms. Let me know if it's not clear enough. Of course ultimately with a kick ass deep type checker (such as what we might get by borrowing from Agda's) the backward forms wouldn't be necessary. However till then it is necessary in order to move the BC code forward. |
Got it, that's very clear now, thanks ;) On Thu, Apr 7, 2016 at 7:08 PM, ngeiswei notifications@github.com wrote:
Ben Goertzel, PhD "I am Ubik. Before the universe was, I am. I made the suns. I made the |
There's a fair amount of infrastructure for specifying types. Its mostly unused. it will remain mostly under-developed as long as no one uses it. From what I can tell, the one thing that agda has that atomese doesn't is dependent types. Well, that and I suppose lots of assorted infrastructure; type inference support is weak or unusable depending on what you want to do. I'm convinced that the pattern matcher can do arbitrarily complex type inference. One just has to start experimenting. The DualLink can be used to search not only for premises, but also for consequents, so could be used to identify backwards-direction rule candidates. The initial implementation doesn't do type checking; I thought about that, and punted, since I figued no one wanted that or used that; but it can be added, and should not be hard. I'm pretty sure we've got most of the right infrastructure for this kind of stuff, although there are bugs and rough edges and assorted missing bits and pieces. |
Interesting. Let us remember to discuss this in depth when you and Nil are On Sat, Apr 16, 2016 at 6:42 AM, Linas Vepštas notifications@github.com
Ben Goertzel, PhD "I am Ubik. Before the universe was, I am. I made the suns. I made the |
…thod-without-result-in-gon Fix segfault on calling method without result
The backward chainer needs to know the structure of its implicand in order to select the applicable rules of a target. The problem is that given the way rules are currently represented, the implicand does not need to be explicit. Given the following format
Implicand is usually hidden in an ExecutionOutputLink like
Currently the backward chainer looks at ARG1 to ARGn to guess the implicand, but nothing guaranties that this guess is correct, ARG1 to ARGn may turn out not to represent the implicand at all. Besides, even when the implicand is in there, the rule is harder to filter due to the other arguments which are not the implicand (@williampma correct me if I'm wrong).
We need to set an additional constraint on the rule format to make the implicand explicit. I think ideally we'd use a SetTVLink, see below.
Let's assume SetTVLink has the following format
So this would assign to . It's not clear what should be, it could be a TVLink that takes 2 NumberNode arguments, or something like that, anyway.
The rule would have the following format
For instance a deduction rule would look like
the scheme code deduction-formula would still need to take Implication(A B) and Implication(B C) to get their TVs and compute the TV of Implication(A C).
If we don't want to wait for SetTVLink, we could still use that format replacing SetTVLink by ExecutionOutputLink + some scheme code, like
Slightly more verbose but allows to move on without having to define SetTVLink. Although I think taking the time to implement Set/Get TV links would be a good thing.
Also in both cases we could define some scheme function to build the BindLink given the rule's implicants, implicand and formula code. Or maybe store it that way, and let the URE build the BindLink as appropriate.
The text was updated successfully, but these errors were encountered: