Hi Mario,
Il 04/11/19 21:49, Mario Carneiro ha scritto:
> Maybe you could bring me up to speed on the details here, but as I see
> it, implication introduction is 'ex'. It is important for this that
> conjuncts be stored as a *left* associated list, possibly beginning with
> a T. if that makes things easier. Whenever you change the context, there
> is a cost associated with pulling any lemmas into the new context
> (including hypotheses) via adantr; you can either compute these lazily
> or precompute them and drop any that you don't end up needing.
Hmm, there are different problems converging here and I am not sure we
are considering the same. Let me state more generally what I want to do.
I want to take an arbitrary ND proof (more specifically, ND proofs as
defined by GAPT[1], generated by GAPT itself munching resolutions found
by Prover9 or similar tools; however, I assume that the proof was
generated by a black box) and generate a Metamath proof of the same
statement.
[1]
https://www.logic.at/gapt/api/gapt/proofs/nd/NDProof.html
Before even starting converting the proof, I need to decide how to
convert statements, i.e., to what to map a ND sequent in Metamath. My
current choice is to map, say, "ph, ps, ch |- th" to the Metamath statement
|- ( ( ph /\ ( ps /\ ( ch /\ T. ) ) ) -> th )
I call this a "reified" ND inference, because the ND turnstile is mapped
to an element of the language, i.e., the implication. I don't know if
the word "reified" is logically/philosophically correct, I will be happy
to use a better one if anybody suggests it.
Using your style, I would choose a global context, say et, and map the
same sequent to
|- ( et -> ph )
& |- ( et -> ps )
& |- ( et -> ch )
=> |- ( et -> th )
Here the ND inference is not reified, because it is mapped to the "=>"
symbol which is not an element of the formal language.
These two Metamath notations are equivalent, as we know, but they are
not equivalently easy to work with when converting ND proofs, as I see
it. Let us consider implication introduction, informally stated as "If
from a context Gamma augmented with ph I can derive ps, then from Gamma
I can derive ph -> ps". In my style this is easily expressed as
|- ( ( ph /\ Gamma ) -> ps )
=> |- ( Gamma -> ( ph -> ps ) )
which is expcom. Choosing a different associativity direction it could
have been ex, but that's not the problem here.
If I used your style, I would have had to use something like:
( |- ( et -> ph ) & |- ( et -> Gamma ) => |- ( et -> ps ) )
=> ( |- ( et -> Gamma ) => |- ( et -> ( ph -> ps ) ) )
but this is clearly not expressible in Metamath, because "&" and "=>"
are not reified.
This means that I cannot recursively convert ND proofs to this style,
because in some cases the recursion terms do not fit the same shape of
the main one. Namely, only antecedents coming from the global context
can be represented in this style; local antecedents need to be reified,
so either I reified everything or I have to keep track of what is
reified and what is not and handle all the cases, which is inconvenient.
On top of that, taken for granted that I will be using the "reified"
style, there is some freedom to decide whether to use a left or right
associated list, or a generic tree. Left vs right is not a big deal, I'd
say, in the worst case one has to prepare an additional layer of lemmata
to adjust things. Since I already use quite some technical lemmata[2]
for building these proofs, it doesn't change much. I discussed in my
previous email the alternative between a fixed list and a tree, but this
difference is in term of efficiency, while the reified vs non-reified ND
style is a more fundamental difference.
[2]
http://us.metamath.org/mpeuni/mmtheorems289.html#mm28865s
> If you are finding subproofs in the manner of a tableau calculus
> (working backwards from the goal), this will not be a problem, but if
> you are reasoning forward and taking context unions all the time, one
> inefficiency that you can end up with is that a subproof Gamma |- ph is
> derived, and then it is used to prove two other subproofs Delta1 |- ps
> and Delta2 |- ch, where Delta1 and Delta2 are incomparable strict
> supersets of Gamma. In this case, if you turn it into an ND proof, you
> will end up replaying the steps Delta1 |- ph and Delta2 |- ph, and some
> sharing is lost. I don't know how problematic this is, but if you look
> for shared subproofs you can in principle determine that Gamma |- ph is
> shared, and so prove Gamma |- ph directly and then do a context change
> (syl*anc) step to get to Delta1 |- ph and Delta2 |- ph.
Yes, this might be a useful optimization (and maybe GAPT is already
doing it under my feet). It doesn't change what I discussed above, though.
> While this is an option, I think it would be much simpler in a
set.mm
> <
http://set.mm> based system to use x R y for representing binary
> relations without additional variables getting in the way.
Nice insight, but this works only for at most binary relations (and
relatedly functors). I would like to not lose generality with respect to
the possibility of translating whatever ND proof to Metamath, as is
currently the case.
> Yes, I dealt with the same problem in peano.mm0. Originally I just had
> wffs and variables, but without a "class" like type it quickly becomes
> difficult to deal with all the "deferred binding" variables involved in
> relations. If you are okay with an axiomatic term constructor, you can
> just declare P(x,y), but if you want P to be a metavariable you need a
> sort for it. (Things become even more complicated if you want a sort for
> n-ary predicates but the universe of discourse doesn't support pairing...)
My target theory is always
set.mm, so pairing is not a problem. At the
same time, I would like to avoid adding further sorts or axioms to it.
Thanks, Giovanni.