Zulip Chat Archive

Stream: lean4

Topic: slimcheck tactic for lean 4?


Daniel Patterson (Mar 24 2023 at 00:00):

I see that the bulk of SlimCheck has been ported to Lean 4 (both inside of Mathlib4, and also existing sort of independently in LSpec). It doesn't seem to have the tactic that existed in the Lean 3 version, that ran it and, if no counter-example was found, admited the proof. Does anyone have an implementation of that floating around?

Mario Carneiro (Mar 24 2023 at 00:02):

not as far as I know

Mario Carneiro (Mar 24 2023 at 00:02):

it is on the todo list, it should not be too hard

Alex J. Best (Mar 24 2023 at 00:04):

I've not used it but maybe Lspec is helpful here in the interim https://github.com/lurk-lab/LSpec#integration-with-slimcheck

Daniel Patterson (Mar 24 2023 at 00:19):

@Alex J. Best I can _run_ the tests fine, I just was hoping for the tactic connection.

@Mario Carneiro Yes, doesn't seem like it would be hard with knowledge of elab / etc... which I was hoping to not have to learn, at least not _right now_ :)

Scott Morrison (Mar 24 2023 at 03:20):

!4#1103 is the issue tracking this. Maybe soon, perhaps. :-)

Daniel Patterson (Mar 24 2023 at 12:59):

@Scott Morrison thanks :) Though hoped for in Dec and not yet done... :(

Scott Morrison (Mar 26 2023 at 22:04):

@Daniel Patterson , please review !4#3114.

Daniel Patterson (Mar 26 2023 at 23:39):

@Scott Morrison Wow! This looks amazing! I haven't been able to try it though as my binary search for a toolchain that'll build it hasn't been successful (tried latest, 2023-03-25, then 2023-03-17, whats in mathlib4 repo, then 2023-02-22, what's in aesop, then 2023-02-24, whats in std4, and then I gave up -- each had build errors on different modules, all in dependencies before Mathlib.Tactic.SlimCheck...)

Scott Morrison (Mar 27 2023 at 02:42):

That's strange, and surely something messed up on your system, given that it builds in CI.

Scott Morrison (Mar 27 2023 at 02:43):

In that branch I have

% cat lean-toolchain
leanprover/lean4:nightly-2023-03-17

so you certainly shouldn't be trying anything except that.

Scott Morrison (Mar 27 2023 at 02:44):

I would checkout the branch, maybe try some of:

  • git clean -xfd
  • rm -rf lake-packages/
  • lake exe cache get
  • lake exe cache get!

Scott Morrison (Mar 29 2023 at 01:35):

@Daniel Patterson, did you ever get this sorted? I don't like the idea of leaving you without a working toolchain. :-)

Daniel Patterson (Mar 30 2023 at 16:20):

@Scott Morrison Sorry for the delay. It's been a very busy week! I just rebuilt stuff, and obviously there was some stale cached thing that was breaking stuff, as it all built fine, and the tactic works, so thanks!

So, really, thanks again -- it'll be in front of a couple hundred students next week (as a demo, not in their hands...). It allows me to sort of come full circle in a nice way, as we _started_ with property-based testing (not in Lean), then moved to lean (in order to do _proofs_), and being able to circle back to PBT as we get to the last few weeks of class is really nice.

Scott Morrison (Mar 30 2023 at 21:02):

@Daniel Patterson, are you missing the functionality for testing lists? I noticed that this was missing from the existing port of the core slim_check code, but didn't investigate adding it. If this is useful I can either try it myself or prod someone with better comparative advantage. :-)

Daniel Patterson (Mar 30 2023 at 21:12):

It would certainly be nice (for examples) but I can probably work around it. It’s not just a matter of declaring type class instances for them?

Scott Morrison (Mar 30 2023 at 21:30):

Yes, presumably it's easy.


Last updated: Dec 20 2023 at 11:08 UTC