236 points · by montyanderson · 2y ago · 102 comments
I never really got to use it, and all I've ever done with it is a few of the toy examples on their website, but I haven't completely given up on it either. I think it's a much more approachable system than Coq or Agda, but still gives you sexy dependent types.
My PhD stuff is in Isabelle, and I do really like Isabelle, but I find that dependent types translate a bit more directly to "real code" than Isabelle's higher-order logic, so I would really like to utilize it for something, particularly with its .NET integration.
We have built verified systems and components in the TLS ecosystem, including parts of TLS, QUIC and related protocols, and continue to do so: https://project-everest.github.io/
Some of it is deployed in production systems:
* Verified parsers in the Windows kernel and elsewhere: https://www.microsoft.com/en-us/research/blog/everparse-hard...
* Verified crypto in Linux, Firefox, Python, ... https://github.com/hacl-star/hacl-star
We've also had a pretty nice emacs mode for a while: https://github.com/FStarLang/fstar-mode.el
The Emacs mode was fine, I didn't think it was bad, but it was still a tough sell to my team; none of them wanted to install Emacs, they wanted a Visual Studio or JetBrains experience. I'm aware that's an uphill battle, and maybe it would be a different story if the VSCode extension existed in 2018.
A language isn't enough, a language recognized from its support in ide/production and community
At Jet we managed to get to pretty decent scale with F#, and for the most part got pretty ok performance. Often I would use the C# versions of libraries simply because they were updated more frequently. Everyone says that the C# interop is clunky and I think that's just not true, I found it relatively easy to work with C# libraries and utilize the .NET Framework. I used ConcurrentDictionary and SemaphoreSlim pretty heavily, for example. For the stuff was a little cludgy, I found it pretty straightforward to simply make wrapper functions that did what I needed.
I even found the object-oriented support in F# to be pleasant, though I didn't use it a lot. The syntax was really terse but easy to read, so in the rare cases where I had to extend a class or something, it wasn't hard. If I needed to implement an interface, it was also pretty easy to write an anonymous interface and plop that into a wrapper function.
One thing that I didn't like about F# was the kind of unpredictable performance with the async monad. It was hard to measure, and it didn't seem to work completely deterministically due to some kind of laziness that I never completely understood. The task monad released a bit later seemed to fix that, but that was integrated a bit later than my time at Jet.
Still, I found it a pretty decent language, to a point where if I started a company I would genuinely consider utilizing F#.
I use F# in .NET Interactive Jupyter notebooks daily at work and it works quite well.
The community around the language is very helpful and the Discord is great for all sorts of issues ranging from beginner to advanced.
I love the Fable compiler which targets JS, TS, Python and Rust and makes for a wonderful way to share a domain design across multiple code bases.
Still, once Rider got a few updates and was stable, it was kind of hard to go back. I'm a pretty dedicated Vim dude normally, but for a lot of "enterprisey" things like .NET and Java the ability to do smart refactoring of lots of files and integrated debuggers really do become a pretty substantial value-add for me.
University jobs?
The Rider release was a shitshow, lots of bugs that went unfixed. Productivity went way down when I had to switch to a mac laptop (keep in mind this is 2017 on a Microsoft language). Had similar experiences with Rubymine in 2022 (poor YARD support, lots of bugs in type inference even with simple things, bug tickets left open for years, thank god for Sorbet-lsp). The tooling is probably better these days but I don't trust Jetbrains for anything, they are a rent-seeking company.
But yeah, compiler checked properties are something kinda magical. Even more when you can specify the property to check.
Are there libraries available for general programming in Lean? Can you compile to another lower-level language like C?
I would be interested in writing some embedded code that could formally be verified. Right now, I have put some time in to SPARK2014, the subset of Ada.
Some day, I'd love to write proofs instead of tests in some places.
Writing the proofs is one thing but writing the automation that scales those proofs to a larger system and which makes it easy to extend the system without breaking the proofs constantly is key and requires more "engineering" focused people rather than proof-focused ones.
As an example, having proofs of various properties of strcat, strcpy, etc. will help less in large programs than having proofs for all Java’s methods on String. In the former, you’ll also have to proof that covers all accesses to your data. In the latter, the JVM guarantees that.
In my mind it would have to be built from the ground up, sub unit tests for function proofs and maintain 100% coverage as you go along. As long as the constituent parts are proven you don't have to zoom out to a macro level.
Believe my, you only want to do that if the proof assistent accepts "I leave the details as an exercise to the reader" ;)
It's become a running joke in my grad school of "when in doubt, there's always 'proof by sorry'".
I'm not as familiar with a lot of the other proof assistants but I suspect there are similar constructs?
I always thought that unsafe { .. } blocks in Rust should be called trustme { .. }
But sorry { .. } is even better!
I get the general complaint, though. I wish I could have the syntax-based interactive proof system everywhere.
- attempt a proof, could pass or fail, but if it times out, then fall back to...
- property-based test case generation, using logical statements and data generators, shrinking, etc.; many will pass, some will fail, but if some time out ...
- generate simple tests, and edge cases, which may trivially pass, but could be edited by hand to become more useful
If you add a timeout, then exponential runtimes, and even the Halting Problem, always give an answer, even if the answer is to try something simpler.
[Note that this meta-programming is very powerful, but also extremely hard to use from what I have managed to see; do not expect LISP style ergonomics here. It doesn't help that the meta-programming book shows some trivial examples of macro rules and then delves deep into proof tactics for the next 2 chapters, leaving the reader who wants general code transformations stranded].
In order to use Lean for proving properties for serious amounts of code, you need to write an entire tactics library similar to mathlib (but for code). Nobody has done this. Maybe it is reasonably hard, or maybe unreasonably hard; the point is, there is no serious collaborative effort that I know of.
SPARK's pre-/postconditions and assertions can be statically checked, they aren't just for runtime enforcement. This is its key value proposition, if it were just runtime enforcement it'd be nice, but not that great.
I thought the partnership was already over? AdaCore left Ferrocene, and released its own support for a Rust toolchain lacking formal verification tools.
The highlights seem to be:
- extensional equality (similar to nuprl)
- undecidable type-checking
- combination of both SMT and tactics, metaprogramming
- focus on compilation to mainstream languages, programming more than formalizing math
The F* Programming Language - https://news.ycombinator.com/item?id=31517176 - May 2022 (6 comments)
Verified Programming in F*: A Tutorial - https://news.ycombinator.com/item?id=25629058 - Jan 2021 (76 comments)
F* – An ML-like functional programming language aimed at program verification - https://news.ycombinator.com/item?id=15582969 - Oct 2017 (95 comments)
KreMlin: from (a subset of) F* to C - https://news.ycombinator.com/item?id=12753788 - Oct 2016 (2 comments)
Verified Programming in F*: A Tutorial - https://news.ycombinator.com/item?id=10949288 - Jan 2016 (28 comments)
F*: A Verifying ML Compiler for Distributed Programming - https://news.ycombinator.com/item?id=2663240 - June 2011 (9 comments)
[1] https://link.springer.com/book/10.1007/978-1-4612-3228-5
[2] https://dl.acm.org/doi/10.1145/2499370.2491978
[3] It pretty much boils down to looking at your code and asking yourself "what has to be true for this to work?" and then writing code that ensures whatever is necessary is true for all possible code paths. Naturally that means limiting possible code paths. There's just one more reason why spaghetti code is bad.
Wait a moment: are there people who write and ship code without continually asking this question, at least to handwaving precision?
improve or remove performance ((0-1) though the 2 questions are related; it's enough to point out that if necessity is the mother of invention, then paradox is the father of discovery)?
(0-1)
https://quillette.com/2022/04/05/noise-a-flaw-in-human-judgm...
https://www.newscientist.com/article/2431131-buildings-that-...
Everyone, even the atheist furry and the cis-Baptist, professes belief in equal outcomes for equal situations; the problems arise both because we all have differing discretion functions to determine situations given facts and law, and because we all have different equivalence* relations on outcomes.
All a n i m a l s are e q u a l
(but some are more equal than others)
* consider reflexive vs irreflexive symmetric transitive rel'ns, or the US doctrine of "separate but equal" (1896-1954)And I get it, I've been phasing out this username, which I picked with bad timing, to avoid unintended connotations, even though I was simply thinking of Robotnik and not anything russian. I've got nothing to do with their language, so it just isn't worth it.
That said I do actually love that Soviet propaganda aesthetic. Can appreciate not wanting to be associated with the existing madman running Russia though.
0: https://erlang.org/pipermail/erlang-questions/2018-February/...
That is, once you've brought types into the value level, modules themselves become redundant - they're just records, and functors are just functions. The point of 1ML, IIUC, is to accomplish a similar unification without demanding full dependent types and the attendant complexities they bring.
But other than that, I don't think it has any other relation.
About the name: https://fstar-lang.org/tutorial/book/intro.html#a-bit-of-f-h...