Wednesday, 21 May 2014

Day 1: Parsers, Part II

Today was adding the important code to the SPASS parser that was built yesterday: the parser no longer discards input, but rather stores it and attempts to build a proof from it. That's not done yet--resolutions are not operational as I think I don't have the handling of functions down quite right yet. In order to explain, perhaps an example is in order. An example input line starts with following:

1[0:Inp] || eq(f(U),0) ...

For now, the stuff to the left of || can be ignored: it's a description of what the line is doing, and in this case it's saying we've received this formulas input (as an axiom, say), and the first predicate of the formula is that f(U) = 0, where U is an implicitly universally quantified variable. Okay; that's straightforward, but Skeptik did not have a (direct) way to deal with either of the f(U), or the eq() expressions, or at least not from my previous experience with the E (expression) class.

For the function f, I think this was already something that could be dealt with: using an App expression (which maybe stands for function application?), I think I've defined a suitable expression by first creating an Arrow object, which, to be perfectly honest, I only did because the App class requires one (though the names do seem to match what I'm looking to do). But then I also created new versions App (App2, App3 respectively--I'm still coming up with a better name) to take two or three arguments, as opposed to one, and did the same for Arrow (ArrowPair, ArrowTriple) to describe functions that take as input multiple expressions.

Now the question that really matters is was this the right choice? I know that I need to keep the functions or predicates as instances of expression, so that I can eventually pass them off to one of the resolution classes (which will likely need to be modified to handle whatever new form), but beyond the similar names (and I think code functionality?), I'm not sure if this made sense. Or did I just miss something, and is there already support for these types of expressions somewhere in the code?

No comments:

Post a Comment