News for hackers. Stuff that matters.

hwayne

Re:What TLA+ can and can't check on Wednesday September 30, 2026 @04:05PM (#49913585)
On top of what Andrew said, "failure as reachability" is a property of the implementing model checker, not the formalism itself! If you convert "we can win the game" to "it's not true that always we haven't won" and write that up as a TLA+ formula, you get `![](!won)". But that means "we win in every behavior", aka `<>won`!

A really good paper on the difference between "possible" and "eventual" is '"Sometime" is sometimes "not never"': https://dl.acm.org/doi/10.1145/567446.567463

Re:Developing provably correct Rust code with Verus on Thursday September 17, 2026 @10:08AM (#49741003)
There's a huge difference between "Verus can prove the safety of unsafe code" and "Verus can EASILY prove the safety of unsafe code." And I bet it can't prove everything, like calls to a C ABI.
Re:Developing provably correct Rust code with Verus on Thursday September 17, 2026 @10:02AM (#49740903)
Not the first time Microsoft employees invented a formal methods tool, Microsoft ignored them, and AWS scooped them up. Not the second or third time, either.
Re:When AI Writes the Software, Who Verifies It? on Tuesday March 03, 2026 @10:17PM (#47242585)
The key bit is that specifications don't need to be "obviously computable", so they can be a lot simpler than the code that implements them. Consider the property "if some function has a reference to a value, that value will not change unless that function explicitly changes it". It's simple enough to express, but to implement it Rust needs the borrow checker, which is a pretty heavy piece of engineering. And proving the implementation actually guarantees that property isn't easy, either!
Re:Some silly Z3 scripts I wrote on Thursday February 26, 2026 @01:31PM (#47170053)
...Whoops. Yup, SMT solvers can famously return `unknown` on top of `sat` and `unsat`. Just added a post addendum about the mistake.
Re:My Gripes with Prolog on Thursday January 15, 2026 @08:40PM (#46641977)
I'll warn you that Picat is very much a "research language" and a lot of the affordances you'd expect with a polished PL just aren't there yet. There's also this really great "field notes" repo from another person who learned it: https://github.com/dsagman/picat
Re:My Gripes with Prolog on Thursday January 15, 2026 @07:43PM (#46641597)
Check out datalog! https://learn-some.com/ The tutorial there uses Clojure syntax but Datalog normally uses a Prolog syntax.
Re:TLA+ Modeling Tips on Wednesday December 17, 2025 @04:37PM (#46305866)
Also:

- Have a clear notion of what part of the specs represents the system under your control (the "machine"), and what part represents the broader world it interacts with. The world can do more than the machine, and the properties on the world are much more serious.

- Make lots of helpers. You need them more than you think.

- Add way more comments than you normally would. Specs are for analyzing very high-level ideas, and you should be explaining your high-level ideas.

- Make the spec assumptions clear. What has to be true about the operating environment for the spec to be sensible in the first place?

- Use lots of model values, use lots of constants, use lots of ASSUME statements. Constrain your fairness clauses as narrowly as possible.

- Understand the difference between the semantics of TLA+ as an abstract notation and the semantics of TLA+ as something concretely model-checked. For example, TLA+ is untyped, but the model checker is typed. Also, a lot of TLA+ features are not available in different model checkers. OTOH, you can break TLA+ semantics with use of TLCSet and TLCGet.

The last tip applies to whatever modeling language you use: most have the same distinction.

Re:TLA+ Modeling Tips on Wednesday December 17, 2025 @04:35PM (#46305851)
I've had to help a client with something not exactly like, but with similar properties as, Google Docs. One of the big properties they had to engineer in was "the doc should eventually look the same for all open browser tabs on the same computer".

The other big question: what happens if user A makes change X and user B makes change Y? There's a lot of outcomes the product can pick between, but whatever they pick it should be consistent. That consistency in conflict resolution is a good property to model.

Re:TLA+ Modeling Tips on Wednesday December 17, 2025 @04:27PM (#46305750)
I think the "high school math" slogan is untrue and ultimately scares people away from TLA+, by making it sound like it's their fault for not understanding a tough tool. I don't think you could show an AP calculus student the equation `<>[](ENABLED <<A>>_v) => []<><<A>>_v` and have them immediately go "ah yes, I understand how that's only weak fairness"
Re:Prediction: AI will make formal verification go mainstream on Wednesday December 17, 2025 @04:22PM (#46305679)
Those things, unlike floats, have approximable-enough facsimiles that you can verify instead. No tools support even fixed point decimals.

This has burned me before when I e.g needed to take the mean of a sequence.

Re:Prediction: AI will make formal verification go mainstream on Tuesday December 16, 2025 @09:07PM (#46297372)
I really do wish that PRISM can one day add some quality of life features like "strings" and "functions"

(Then again, AIUI it's basically a thin wrapper over stochastic matrices, so maybe that's asking too much...)

Re:Prediction: AI will make formal verification go mainstream on Tuesday December 16, 2025 @09:06PM (#46297362)
> No problem with floats or strings as far as specification goes. The particular verification tools you choose to run on your TLA+ spec may or may not have limitations in these areas, though.

I think it's disingenuous to say that TLA+ verifiers "may or may not have limitations" wrt floats when none of the available tools support floats. People should know going in that they won't be able to verify specs with floats!

Re:When would you ever want bubblesort? (2023) on Wednesday December 10, 2025 @11:09PM (#46227552)
Thanks for sharing the general term! I didn't know about it.
Re:A Early History of Algebraic Data Types on Thursday October 16, 2025 @10:32AM (#45605838)
Now you just gotta go to the first submission and post a link here. Complete the circle!
Re:A Early History of Algebraic Data Types on Wednesday October 15, 2025 @11:19AM (#45593926)
Since writing this I've been informed of some gaps (mostly through email and a lobsters [1] thread). Some of the main ones:

- McCarthy's "Direct Union" is probably conflating "disjoint union" and "direct sum".

- ML probably got the sum/product names from Dana Scott's work. It's unclear if Scott knew of McCarthy's paper or was inspired by it.

- I called ALGOL-68 a "curious dead end" but that's not true: Dennis Ritchie said that he was inspired by 68 when developing C. Also, 68 had exhaustive pattern matching earlier than ML.

- Hoare cites McCarthy in an earlier version of his record paper [2].

Also I kinda mixed up the words for "tagged unions" and "labeled unions". Hope that didn't confuse anybody!

[1] https://lobste.rs/s/ppm44i/very_early_history_algebraic_data...

[2] https://dl.acm.org/doi/10.5555/1061032.1061041

Re:A Dumb Introduction to z3 using Rust on Wednesday September 17, 2025 @11:11AM (#45276824)
I love how you create dataclasses to abstract over constraints!
Re:A Dumb Introduction to z3 using Rust on Wednesday September 17, 2025 @10:48AM (#45276521)
Even worse than that, SMT can encode things like Goldbach's conjecture:

    from z3 import \*

    a, b, c = Ints('a b c')
    x, y = Ints('x y')
    s = Solver()

    s.add(a > 5)
    s.add(a % 2 == 0)
    theorem = Exists([b, c],
                     And(
                         a == b + c,
                         And(
                             Not(Exists([x, y], And(x > 1, y > 1, x \* y == b))),
                             Not(Exists([x, y], And(x > 1, y > 1, x \* y == c))),
                             )
                         )
                     )

    if s.check(Not(theorem)) == sat:
        print(f"Counterexample: {s.model()}")
    else:
        print("Theorem true")
Re:A Dumb Introduction to z3 using Rust on Wednesday September 17, 2025 @10:45AM (#45276488)
It really depends on the kind of solving you want to do. Mathematical optimization, as in finding the cheapest/smallest/whatever solution that fits a problem? OR-Tools. Satisfaction problems, like finding counterexamples in rulesets or reverse engineering code? Z3.
Re:Crimes with Python's Pattern Matching (2022) on Friday August 22, 2025 @12:13AM (#44980932)
Now I'm mad I didn't remember the word "antics". It's so much more evocative than "crimes"!
Re:Stith Thompson's Motif-Index of Folk-Literature [pdf] on Tuesday August 05, 2025 @10:54AM (#44798799)
Entertaining collection of Folklore classifications. Some examples:

- T550.6. T550.6. Only half a son is born by queen who ate merely half of mango.

- A1066. A1066. Sun will lock moon in deep ditch in earth's bottom and will eat up stars at end of world.

- K87.1. K87.1. Laughing contest: dead horse winner.

Re:Fast on Thursday July 31, 2025 @09:43AM (#44745576)
Main way we're validating that now is by using TLA+ models to generate test suites. Mongo came out with a new paper on this recently: https://will62794.github.io/assets/papers/mdb-txns-modular-v...
Re:Ask HN: What Are You Working On? (June 2025) on Monday June 30, 2025 @10:22AM (#44423684)
If you put the spec online I'd be happy to give it a quick optimization skim!
Re:Solving LinkedIn Queens with SMT on Thursday June 12, 2025 @04:41PM (#44262962)
Apparently they're getting very good: https://emschwartz.me/new-life-hack-using-llms-to-generate-c...

I try not to use them too much because I want to build the skill of using SMTs directly for now.

Re:Solving LinkedIn Queens with SMT on Thursday June 12, 2025 @02:31PM (#44261195)
I remember you showing me this! Wow that was a long time ago.
Re:Best Illusion of the Year 2023 Winners on Wednesday June 11, 2025 @11:33AM (#44248738)
My favorite is the third place, "Cornelia". Mostly because I feel like it's something that could have been made in the Renaissance and would have been considered among the Greatest Art of All Time if it was.
Re:What works (and doesn't) selling formal methods on Thursday June 05, 2025 @11:16AM (#44192494)
I think of the two P-lang probably has a brighter future. I don't know how many people are working on Spin besides Holzmann, while P has a lot of institutional support and development budget at AWS.

Older ยป