coq-tactician / coq-tactician-api

An API for interfacing with Coq through Tactician by external agents
https://coq-tactician.github.io/api/introduction
MIT License
2 stars 1 forks source link

Do not merge: Option demo #7

Closed LasseBlaauwbroek closed 2 years ago

LasseBlaauwbroek commented 2 years ago

@pestun Here is a demo of how you can use options. I added in some boilerplate code that helps you easily make options for bools, ints and strings. Other things can also be done, but I strongly recommend that you restrict yourself to these datatypes.

Warning: In order to allow the system to properly register these options, you have to read them lazily (i.e. only when you really need them). Otherwise the desired option may not have been set yet. In this example this is ensured by checking options only in the empty function, which is called lazily.

In the benchmarking system, I have added options -inject string and -inject-file file, to which you can add arbitrary Coq vernacular. To test this demo, you can create a file Test.v:

Set Tactician Neural MyBool.
Set Tactician Neural MyInt 42.
Set Tactician Neural MyPassword "correct horse battery staple".

And then benchmark using

tactician-benchmark ../../benchmark-data/ coq-tactician-reinforce \
  git+ssh://git@github.com/coq-tactician/coq-tactician-reinforce option-demo \
  10 2 unit-test-prop-chain-5-100 \
  -inject-file Test.v

Alternatively, you can avoid creating the file and benchmark using

tactician-benchmark ../../benchmark-data/ coq-tactician-reinforce \
  git+file:///home/lasse/Documents/Projects/Tactician/develop/coq-tactician-reinforce option-demo \
  10 2 unit-test-prop-chain-5-100 \
  -inject "Set Tactician Neural MyBool." \
  -inject "Set Tactician Neural MyInt 42." \
  -inject "Set Tactician Neural MyPassword \"correct horse battery staple\"."