Comment by chamomeal

1 day ago

What do people think of property based testing? I’ve set up a few property based tests and it feels almost like formal verification.

I know it’s not the same thing, but PBT’s can catch all sorts of absolutely crazy bugs that I never would think to check for. Stateful stuff, cross-service stuff. My only gripe with PBTs has always been the tedious setup, but LLMs solve that.

I haven’t seen much discussion around PBTs lately, but you get a ton of bang for your buck in the LLM age

PBT testing and fuzzing are basically the same thing in my mind.

What's funny though is that the reasoning needed to say some sampling is comprehensive....makes it closer fo proofs! AFL — coverage-based fuzzing — was the original innovator here, but imagine an interpreter — code coverage in the interpreter itself isn't so good, you also want to explore the interpreted program!

This is why "is my testing comprehensive?" is actually an open-ended problem that, in the limit, is just as hard as formal verification.

I suspect we're basically going to see a convergence here. Randomized testing can be called "Monte Carlo formal verification" hehe.

  • > This is why "is my testing comprehensive?" is actually an open-ended problem that, in the limit, is just as hard as formal verification.

    Well said! I learned about PBT in the first place because I watched a talk where the speaker referenced the story of foundationDB. Super interesting stuff. If anybody wants a link I can dig it up

I also think property based testing is great.

But they are very different IMO at what they focus on and so they occupy different places when talking about does a piece of software does what it should do and withing the state/parameters specified:

- Property based testing focuses on finding counter examples - Formal verification focuses to prove that a property always holds

More than this I think in all these discussions we are missing the most important piece: validation.

While verification means to prove or test or verify that the software does what is should do, validation means to prove or test or verify that the software is solving user needs.

Property based testing is great because it’s implemented as a library in many languages. You don’t have to rewrite your codebase in Lean.

works really well for simulators, where you usually don't have an oracle but you do have invariants. e.g. in SPICE the low-freq AC gain has to match the slope of the DC sweep. it's cheap to check and it catches sign errors that look totally fine on a plot

So actually I've been testing this — it seems to be useful in limited cases. LLMs have gotten so good now that a properly defined spec is no worse than a spec + property based testing.

I still found it useful for

1. trusting a bit of code is correct

2. rule-dense bits of code (eg something like a date parser)

The real issue so far is that I'm having trouble finding tasks where an LLM can't correctly code up an exhaustively defined spec.

I think there's some bad nomenclature here. "Property based testing" literally means you're writing properties, which can be verified formally, or randomly (fuzzing / constrained random testing).

For example in SystemVerilog you can write properties (literally with the `property` keyword), and then they can be checked in simulation, and with formal tools.

TLA+ can do the same I believe - there are tools to verify a model randomly or formally.

Yeah, LLMs make setting up the annoying things like PBT and mutation testing easy. It’s great.