F* – A Proof-Oriented Programming Language
fstar-lang.org
fstar-lang.org
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.
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.
For verifying code Lean is not great right now (see a sibling comment in this post). For embedded code in particular, I remember there was a low-level formalizer, but I cannot remember what it was. This post here has many discussions and links: https://news.ycombinator.com/item?id=31775216
Maybe I am remembering this: https://en.wikipedia.org/wiki/ATS_(programming_language)
But I was under the impression there was an almost assembly-level functional programming language with formal verification capabilities; I cannot recall it.
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.
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.
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.
It’s most likely your experience today would be a polar opposite to this.
Some day, I'd love to write proofs instead of tests in some places.
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.
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.
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.
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!
The worst part is when you forget to remove a sorry (or three) because of a linked file you didn't check, and you submit stuff to other people on the team thinking you discovered something pretty cool, only to find out that you didn't actually prove anything.
This "function" has a superficial similarity to unsafePerformIO but it is in fact a malevolent agent of chaos. It unpicks the seams of reality (and the IO monad) so that the normal rules no longer apply. It lulls you into thinking it is reasonable, but when you are not looking it stabs you in the back and aliases all of your mutable buffers. The carcass of many a seasoned Haskell programmer lie strewn at its feet.I prefer the slightly more ominous "surely".
Of course, any junior member of a team that is willing to stand up and state that, no, the assertion is anything but obvious to them, should get an immediate promotion, and be quickly moved to another group!
[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.
The reason I code in Lean is because I find it fun, and I think it is a very nice general purpose language; for instance, I like Lean much better than Haskell. If Lean ever gets the libraries Haskell has, I will be really excited.
- I like Lean's inductive type system much better that Haskell's,
- I prefer eager evaluation by default,
- I like the syntax better,
- I like dependent types; they are dangerous, but it is great to have the option.
I suspect some people may also prefer Lean's macro system to Haskell's, but I haven't worked much with either, so I don't know about that.
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.
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-...
My diagram would be: (Exercise: who is the contemporary hedgehog X?)
Hesse ---------> Pynchon
| |
| |
V V
X ----------> Stephenson
Compare https://en.wikipedia.org/wiki/Cyril_M._Kornbluth#Personality... (and some of YT's more discursive HN commentary).[to what degree are foxes cohedgehogs, or hedgehogs cofoxes? can we get the plurality of ideas of a fox by reversing arrows such that each of the fox's multiple ideas maps back, in the image, to a shared thematic point?]
I agree that Pynchon was more or less an aloof observer of the von Neumann denouement.. maybe you can have Lem in your corner depending on how optimistic you think he is, but I would put Kim Stanley Robinson in that corner (been thinking about the Mondragon Accord). The median HN'er, I don't know, Iain Banks/Gibson. Feel free to take it to another level with some cryptic pointers (/arrows) :) H https://en.wikipedia.org/wiki/Mondragon_Corporation#Mondrago...
And checkout KSR's influences.
I admit to not having read <<DGPS>> in its entirety (or any majority,really) -- reason being that I read Demian E2E and surmised that the apple hedgehog didn't land too far from the tree fox. Trying to reconsider now :)
Sorry, you have to find citations for that, should be an interesting exercise
(if you have a personality suitable to attempt inner emigration, you can claim the State, as an object with little intellectual content, is maya, mere illusion, but like Berkeley's [well, Johnson's] rock it usually sullenly refuses to wither away even if you don't believe in it. cf PKD)
* on that theme: "They delight in acting in bad faith, since they seek not to persuade by sound argument but to intimidate and disconcert." is another change rung.
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)EDIT: in case you missed it, follow-up on ANK (not KANs) https://scottaaronson.blog/?p=762
> Perhaps Andrey Nikolaevich's approach to teaching was also influenced by the free postgraduate existence, which he later recalled as his happiest time. At that time, a graduate student was supposed to pass 14 exams in 14 different mathematical sciences. But the exam could be replaced by an independent result in the relevant field. Andrey Nikolaevich said that he never passed a single exam, but instead wrote 14 articles on various topics with new results. "One of the results, concluded Andrey Nikolaevich, "turned out to be incorrect, but I realized this after the exam was completed."
Now, that is the good stuff: Нужны Парижу деньги се ля ви / А рыцари ему нужны тем паче!
0: https://erlang.org/pipermail/erlang-questions/2018-February/...
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.
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...