frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Dafny: Verification-Aware Programming Language

https://dafny.org/
48•handfuloflight•6h ago

Comments

dionian•5h ago
Reminds me of Eiffel, in a good way. Looks awesome. Is there anything close to this in Scala by chance?
gz09•4h ago
It's similar in spirit, but in Dafny one can express much more complicated and complex invariants which get checked at build time -- compared to eiffel where pre/post conditions are checked at runtime (in dev builds mostly).
ted_dunning•4h ago
Interestingly, though, you can have some runtime checking with Dafny as well as the formidable dependent type checking and formal verification that happens at build time.

That means that most of the proof can be done ahead of time with just some loose ends verified using an SMT prover at runtime.

esafak•1h ago
This expressiveness is a curious point, because a common charge leveled against Scala is that it is too expressive.
ted_dunning•4h ago
Dafny is quite different from Scala in that it is a formal language that can be compiled to a number of different targets such as Go or Python or C#. This allows an algorithm to be formally verified while still producing executable code.

You could add Scala as a compilation target or you could just use the Java output and call formally verified Java functions from Scala. Even if you do get an implementation that produces Scala, don't expect the full power of idiomatic Scala to be available in the code you formally verify. To verify code, you have to write the code in Dafny with associated assertions to be proven. Since there are multiple compilation targets multiple formal constraints on what can usefully be verified, the data types available will not match the data types that you would use natively from Scala.

fjfaase•5h ago
Looks interesting. I saw some C# files, from which it seems it is implemented in C#. Is there going to be an implementation in Dafny?
algorithmsRcool•3h ago
It could be done, but what would be the virtue of it? Most programming languages are not self-hoisted for a reason.
fooker•4h ago
This might be a stupid question, but why a separate programming language rather than aiming to verify/synthesize invariants in languages people use?
quamserena•4h ago
Most existing mainstream languages aren’t expressive enough to encode these invariants. For languages outside of the mainstream, Lean 4 is a language supporting verification, and it’s also a full programming language, so you can write your proofs/theorems in the same language that you program in.
fooker•2h ago
What's an invariant you can not encode in a general purpose programming language?

I'd have assumed, by virtue of being Turing complete, you could express any invariant in almost any language?

voxl•4h ago
Dafny has been around for a while and people do in fact use it. People also apply contract languages to C and all matter of other things, so really question boils down to "Why arent you doing what I expect of you?"
ashton314•4h ago
> … verify/synthesize invariants in languages people use?

Good question. This is the holy grail. This is what everyone in PL research would love. This is where we want to get to.

Turns out a language as “simple” as C has sufficiently complicated semantics as to limit rigorous analysis to the basics. One example is loop analysis: it’s very useful to know that a loop will terminate eventually; if a loop is modifying some state and—worse—if the iteration variable gets modified—kiss your analysis goodbye because mechanically synthesizing strong pre- and post-conditions becomes insurmountable. It’s not an engineering challenge. It’s a math/pure CS theory challenge.

fooker•2h ago
Dafny seems to have loops too, and the way it solves the problem you mentioned is forcing the user to write these invariants.

I assume if you were to develop such a system for C, C++, or Rust you'd similarly expect the user to do this.

ashton314•20m ago
Right. The problem is that those languages are relatively permissive in their type systems. Obviously Rust can capture more in its type system than C can. You would probably want a type like “decreasing unsigned integer” for Rust and some way to enforce monotonic decreasing, which Rust doesn’t give you.

(Any experts on formal verification please correct any inaccuracies in what I say here.)

The upshot of it is that C, C++, and Rust permit too much behavior that isn’t capturable in the type system. Thus, the properties that you’re interested in are semantic (as opposed to syntactic; type systems turn semantic properties into syntactic ones) so Rice’s theorem applies and there’s no computable way to do the analysis right.

porcoda•4h ago
Not a stupid question at all. There are two reasons verification tends to happen in these specialized languages: the languages we usually use are often not expressive enough to write things like specifications, and a bit too expressive in the sense of letting people write program logic that is insanely difficult to verify (think untyped pointers into a dynamically allocated heap for example). So these verification related languages often are more expressive on the spec side and more restrictive in terms of what kind of code you can write.
fooker•1h ago
Yeah I can see pointer weirdness being an issue.

As for being not expressive enough for specifications, isn't the code itself a form of specification? :)

cake-rusk•8m ago
Yes, but the quality of the spec varies. For example many (most?) C programs have undefined behaviors which means the spec is incomplete and unreliable. Dafny gives you better tools to avoid this. So in the end you get a higher quality spec with Dafny.
nextos•4h ago
The semantics of Dafny is carefully designed to make verification efficient.

Dafny can compile to and interface with a few languages, including C#.

fooker•2h ago
What does it mean for verification to be efficient?

Are there benchmarks showing dafny is faster than other inefficient options ?

hatefulmoron•1h ago
Dafny and similar languages use SMT; their semantics need to be such that you're giving enough information for your proof to verify in sufficient time, otherwise you'll be waiting for a very long time or your proof is basically undecidable.

I'm not sure about benchmarks comparing languages, but Dafny goes through a lot of tweaking to make the process faster.

sriku•3h ago
I quite like Dafny, despite my first run up with it (verification aspect) being frustrating. The language is well designed for this. Also, it looks like it is a great candidate as a code generation target for LLMs because you can generate the proof of correctness and run a feedback loop with Dafny's checker.

Try writing a^b in integers and proving its correctness. The simple version works (based on a x a^(b-1)). But if you write an "optimised one" using (with handwaved details) (a^(b/2))^2 .... pulled some serious hair trying to prove this function works.

sriku•3h ago
Am working on rewriting an imperative programming course to use Dafny to present verified algorithms and data structures.
mikiskk•2h ago
This formal verification course I took by Manos Kapritsos and Jon Howell is taught in Dafny and assumes no former experience with the subject. Most of the exercises are to some degree “self-grading” as proof success means you have a correct solution, provided your spec is correct. I highly recommend.

https://glados-michigan.github.io/verification-class/fall202...

AI will make formal verification go mainstream

https://martin.kleppmann.com/2025/12/08/ai-formal-verification.html
460•evankhoury•8h ago•223 comments

alpr.watch

https://alpr.watch/
699•theamk•12h ago•341 comments

No Graphics API

https://www.sebastianaaltonen.com/blog/no-graphics-api
505•ryandrake•10h ago•91 comments

Announcing the Beta release of ty

https://astral.sh/blog/ty
427•gavide•8h ago•82 comments

GPT Image 1.5

https://openai.com/index/new-chatgpt-images-is-here/
371•charlierguo•11h ago•184 comments

Pricing Changes for GitHub Actions

https://resources.github.com/actions/2026-pricing-changes-for-github-actions/
565•kevin-david•12h ago•638 comments

VA Linux: The biggest dotcom IPO

https://dfarq.homeip.net/va-linux-the-biggest-dotcom-ipo/
16•giuliomagnifico•5d ago•0 comments

Various locale mismatch scenarios in Windows clipboard text format synthesis

https://devblogs.microsoft.com/oldnewthing/20251211-37/?p=111858
5•ibobev•4d ago•0 comments

Introduction to Software Development Tooling (2024)

https://bernsteinbear.com/isdt/
46•vismit2000•4h ago•4 comments

I ported JustHTML from Python to JavaScript with Codex CLI and GPT-5.2 in hours

https://simonwillison.net/2025/Dec/15/porting-justhtml/
107•pbowyer•6h ago•64 comments

Show HN: Titan – JavaScript-first framework that compiles into a Rust server

https://www.npmjs.com/package/@ezetgalaxy/titan
19•soham_byte•5d ago•7 comments

No AI* Here – A Response to Mozilla's Next Chapter

https://www.waterfox.com/blog/no-ai-here-response-to-mozilla/
201•MrAlex94•7h ago•118 comments

40 percent of fMRI signals do not correspond to actual brain activity

https://www.tum.de/en/news-and-events/all-news/press-releases/details/40-percent-of-mri-signals-d...
419•geox•15h ago•179 comments

Mozilla appoints new CEO Anthony Enzor-Demeo

https://blog.mozilla.org/en/mozilla/leadership/mozillas-next-chapter-anthony-enzor-demeo-new-ceo/
463•recvonline•15h ago•718 comments

Sei AI (YC W22) Is Hiring

https://www.ycombinator.com/companies/sei/jobs/TYbKqi0-llm-engineer-mid-senior
1•ramkumarvenkat•4h ago

Thin desires are eating life

https://www.joanwestenberg.com/thin-desires-are-eating-your-life/
393•mitchbob•1d ago•157 comments

Dafny: Verification-Aware Programming Language

https://dafny.org/
48•handfuloflight•6h ago•23 comments

Testing a cheaper laminar flow hood

https://chillphysicsenjoyer.substack.com/p/testing-a-cheaper-laminar-flow-hood
30•surprisetalk•4d ago•6 comments

Japan to revise romanization rules for first time in 70 years

https://www.japantimes.co.jp/news/2025/08/21/japan/panel-hepburn-style-romanization/
155•rgovostes•20h ago•133 comments

Show HN: Learn Japanese contextually while browsing

https://lingoku.ai/learn-japanese
41•englishcat•4h ago•20 comments

Sega Channel: VGHF Recovers over 100 Sega Channel ROMs (and More)

https://gamehistory.org/segachannel/
240•wicket•16h ago•38 comments

The World Happiness Report is beset with methodological problems

https://yaschamounk.substack.com/p/the-world-happiness-report-is-a-sham
103•thatoneengineer•1d ago•124 comments

Nvidia Nemotron 3 Family of Models

https://research.nvidia.com/labs/nemotron/Nemotron-3/
170•ewt-nv•1d ago•32 comments

Chat-tails: Throwback terminal chat, built on Tailscale

https://tailscale.com/blog/chat-tails-terminal-chat
71•nulbyte•8h ago•12 comments

Writing a blatant Telegram clone using Qt, QML and Rust. And C++

https://kemble.net/blog/provoke/
98•tempodox•14h ago•58 comments

Twin suction turbines and 3-Gs in slow corners? Meet the DRG-Lola

https://arstechnica.com/cars/2025/11/an-electric-car-thats-faster-than-f1-around-monaco-thats-the...
10•PaulHoule•5d ago•3 comments

A Guide to Magnetizing N48 Magnets in Ansys Maxwell

https://blog.ozeninc.com/resources/from-datasheet-to-demagnetization-a-guide-to-magnetizing-n48-m...
4•peter_d_sherman•1h ago•0 comments

Show HN: Sqlit – A lazygit-style TUI for SQL databases

https://github.com/Maxteabag/sqlit
129•MaxTeabag•1d ago•19 comments

Show HN: TheAuditor v2.0 – A “Flight Computer” for AI Coding Agents

https://github.com/TheAuditorTool/Auditor
17•ThailandJohn•15h ago•7 comments

Rust GCC backend: Why and how

https://blog.guillaume-gomez.fr/articles/2025-12-15+Rust+GCC+backend%3A+Why+and+how
173•ahlCVA•16h ago•98 comments