-
Notifications
You must be signed in to change notification settings - Fork 4
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
Transition to AML: sorts #40
Comments
I don't think it is right, if |
Have we reached an agreement on the names |
Just to clarify, the
|
Suppose there are two sorts Since in AML, sorts are something that are defined, not built-in, we need to formalize what do we mean by saying a pattern
Does this make sense? In other words, we define
|
I would separate this step into two, namely first replace |
I'm going to use the word local declarations to talk about the goal-level declarations,
I don't see why the behaviour of
I think in the long run what we need is a nelson-oppen + DPLL equivalent for AML to separate the reasoning about sort/set membership and specific theories. |
This is probably a misunderstanding. I wanted to say that we want it to return the same list, and that it is important. The rest of the paragraph is about how to do that (basically, we need to use the equation
Yes, a ground term.
The sort inference routine needs to be able to work with equalities. From
Yes, that makes sense. If we do it this way, then the prover needs to understand both \subset
where
|
We need the generated equalities to be easily accessible for the sort inference routine, and in the left-hand side of the goal that is an implication they are not easily accessible. Morever, the equalities would be usable only when reasoning about the RHS of an implication, so we would need two versions of the sort inference routine, or a parameter whether to use the LHS, which is weird. It would be much cleaner if strategies work with the local context and a goal of a non-implication shape. |
Yes. Both |
I didn't know that you were thinking of sort inference. I was thinking about sort checking. Sort inference is definitely something good to have, but we need to be more careful here, as it infers new information. Let's come back to my previous example (with some modification). Consider For sort inference, maybe one of |
I think that the strategy However, if the goal is of the shape |
Currently, we have sorted variables. Maybe what we need to do here is to keep them, so instead of the above we write |
Do you mean that we could specify a type of a variable, or that we would have to do that? On the latter case, how could we specify the membership axioms, where we need to quantify over all elements? |
When thinking about the four uses from the initial comment, we probably do not need inference (represented by function |
A few remarks
and again, propagate the information about sorts to #match. But there is another solution: it would work with the goal of the shape
where
|
Purify - afaik it is not used for SL properties, which means we do not have to worry about propagating sorts through equations. |
Suppose we have a function
or:
Lets say we have a pattern P=
This is easier for the sorting routine to understand. Eventually, we can turn this axiom into a claim and prove it from the original axiom. This way, the advanced reasoning might be deferred to a specialized strategy. |
A few other observations. Assume the
This axiom combines pattern functionality with sorting information. If we wanted to prove that the pattern But if we used slightly more modular form of the axiom:
and a more modular version of the goal: We may try being more modular and split A2 into A3 and A4 as follows:
The drawback here is that attempting to prove
If we care only about functionality, we still need to check sorts of subterms. We cannot completely get rid of that issue, but there is also a performance aspect: to prove |
When we remove the information about sorts from variables and symbols, we need a way to recover it for the strategies that need it. This is a proposal how to do it.
Which strategies use sorts?
Sorts, in the form of the function
getReturnSort
, are currently used by the following tactics:purify
match
(andmatch-pto
)instantiate-universals-with-ground-terms
smt
General idea
The idea is that
getReturnSort
will examine the context searching for typing information, using a simple heuristic. (The heuristic may also be exported as a separate strategy for proving typing-related claims.) The prelude will provide a notationand the prover will understand axioms of the shape
and axioms for (not necessarily function) symbols
and equality axioms
and the function
getSorts()
will search for such axioms and generate a list of sorts for given term. (Note that if two terms are equal, then they also share their sorts).Looking at the strategies, it seems to me that they need the information that a term can be assigned some sort, but they do not need to know a term can not be assigned a given sort.
Modifying strategies
The strategy
purify
(transforms assumptionsS(T, Vs)
toS(V, Vs) /\ V = T
could work without sorts, but it is important that after applying this strategy,getSorts(S(V,Vs))
returns the same list of sorts as did previouslyS(T, Vs)
. Currently, the strategy works on the LHS of the goal that is an implication and generates conjunction; it would need to be changed so that it worked on the local axiom set instead. Instead of generating conjunction, it would turn one axiom into two axioms, one of which would beV=T
. The functiongetSorts
would then be able to use the generated equality. Btw: moving the assumptions to the local context means that the variable V would no longer be a variable, but a constant symbol. Another note: when the context is no longer on LHS, the smt strategies need to be able to work with the local context.The matching strategies need to match variables against other terms. Removing sorts here would mean that variables can match more things. However, they work on the goal (whose RHS is) of the shape
\exists { Vs } Rest
, where variables inVs
are currently typed. The typing information fromVs
is then propagated to the#match
function. After the transition, the strategies would work on goals of the shape\exists { Vs } \typeof(x1, S1) /\ \typeof(xn, Sn) /\ Rest
, so we can extract the typing information from the\typeof
s. Btw, a strategy that splits a conjunction in the proof context might be useful.The strategy
instantiate-universals-with-ground-terms
would need to operate on the local context and understand assumptions of the shape\forall x. \typeof(x, S) -> Phi
, so that it does not plug typed terms to non-matching assumptions. However, when searching for ground terms, we will lose free variables, because they will not have associated a type. To recover this, we need the goal to not contain free variables - they need to be universally quantified and the formula guarded by typeof. Also, the strategy might want to plug even terms without a type to assumptions that work with untyped foralls.Smt. The problem is that smtlib does not support subsorting, and imho assumes that terms of different sorts cannot be equal. One idea is that we would have two strategies for SMT - one that would work with builtin sorts (like Int), and other that would work just with one universal sort. The consequence is that we would not be able to let SMT reason much about goals with mixed builtin and user-defined sorts, e.g. about arithmetic and other stuff at once.
Variants
Another variant of the same idea is having two symbols
Maybe we need the prover to understand also subseq of inhabitant sets.
The text was updated successfully, but these errors were encountered: