Skip to content
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

Search hangs #118

Open
lambdacalculator opened this issue Feb 21, 2019 · 6 comments
Open

Search hangs #118

lambdacalculator opened this issue Feb 21, 2019 · 6 comments

Comments

@lambdacalculator
Copy link

In an earlier version of Abella, the searches in this (small) theorem completed almost instantly with the witnesses indicated in the comments. Now they hang, or at least take more time than I was willing to wait.
comb.zip

@chaudhuri
Copy link
Member

chaudhuri commented Feb 22, 2019 via email

@yvting
Copy link
Contributor

yvting commented Mar 1, 2019

... search has moved the exponential search space around since it changed the order of depth-bounded search.

Can you elaborate on this?

@chaudhuri
Copy link
Member

chaudhuri commented Mar 1, 2019 via email

@yvting
Copy link
Contributor

yvting commented Mar 2, 2019

Can you point to me the commit that introduces this change? Is it before v2.0.5 or after?

What I noticed is that there is huge performance decrease from v2.0.5 to v2.0.6 on the example provided by Todd. If the change you mentioned is not introduced between v2.0.5 and v2.0.6, then it is likely not relevant to the performance decrease. I suspect the performance decrease is caused by the new heuristics I implemented for searching for type-generic proofs.

@chaudhuri
Copy link
Member

chaudhuri commented Mar 2, 2019 via email

@yvting
Copy link
Contributor

yvting commented Mar 7, 2019

Here is what I find out after some investigation using the provided example.

The performance decrease seems to be caused by the combination of

  1. Performance decrease in unification because of the introduction of type unification and backtracking

  2. An unusually large amount of calls to unification in a single search which significantly magnifies the previous performance decrease

I added code to track the average runtime and the number of calls to relevant functions in the implementation of "search". I then run the modified code on "comb.thm" up to the first search.

For v2.0.5, there are

Num of calls to try_right_unify_cpairs: 2901528
Num of calls to claus_aux: 515434
Average time to run clause_aux: 0.001095
Average time to run try_right_unify_cpairs: 0.000198

For the master branch, there are

Num of calls to try_right_unify_cpairs_fully_inferred: 2901528
Num of calls to claus_aux: 515434
Average time to run clause_aux: 0.005483
Average time to run try_right_unify_cpairs_fully_inferred: 0.000990

So there are about 5 times of performance decrease for a single call to try_right_unify_cpairs. However, because there is a huge amount of calls to this function, the performance decrease is magnified significantly.

The thing I don't understand is why there are so many calls to clause_aux for a single search. Is this related to the change Kaustuv mentioned?

Edit:
The clause_aux function is defined in the search function in "tactics.ml". It performs backchaining on program clauses, in this process it calls try_right_unify_cpairs (or try_right_unify_cpairs_fully_inferred after the introduction of schematic polymorphism) for unification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants