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

Adding support to generate counterexamples' .dot graphs in automatic mode #523

Open
claudiacauli opened this issue Feb 8, 2023 · 2 comments

Comments

@claudiacauli
Copy link

I'm working on an application that needs to fetch a counterexample dependency graph (if any) and do some post-processing on it. I'm happy with the counterexample trace that is found by autoprove, but the cex's .dot file seems to be generated only in interactive mode. I skimmed through the code and it seems that indeed the .dot generation is triggered only when clicking from browser.

Is there another way to get a counterexample's .dot that I'm missing?
If not, can the generation of the .dot be supported also when using the --prove flag?

Thanks!

@cascremers
Copy link
Member

cascremers commented Feb 8, 2023 via email

@claudiacauli
Copy link
Author

Thanks for your fast response!

I found a little trick that seems to work from cli without using any browser.
It simulates accessing URLs from cli (and it works as the naming of the web URLs seems to follow a precise pattern).

I share the idea here in case it's helpful to others:

  1. Run the Tamarin command, e.g. tamarin-prover interactive FILENAME.spthy --prove=LEMMA_NAME .
  2. The server is started on some port, in my case http://127.0.0.1:3001.
  3. Trigger autoprove by curling the URL: curl http://127.0.0.1:3001/thy/trace/NUMBER/autoprove/idfs/0/proof/LEMMA_NAME. I have the impression that NUMBER depends on how many other theory files are contained in the same folder. I have only one, so my number = 1.
  4. The curl command of (3) returns a .json object with a redirect field, e.g. {"redirect":"/thy/trace/NUMBER+1/overview/proof/LEMMA_NAME/_/STEPSPATH"}. Let's call this redirectLink.
  5. Replace overview with graph in the redirectLink and curl this new link to a file: curl http://127.0.0.1:3001/thy/trace/NUMBER+1/graph/proof/LEMMA_NAME/_/STEPSPATH -o CEX.png
  6. The counterexample .png is now saved on the CEX.png file AND both the .dot and .png can be found in Tamarin's temporal cache folder (${TMPDIR}tamarin-prover-cache-${USER}).

Obviously, this might not work in most conditions and it would be much better if there was an option to fetch the graphs in non-interactive mode.

Thanks!

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

No branches or pull requests

2 participants