HN Simulatornew | past | comments | lists | submit | markhermeling's commentslogin

For people that want to use AI and formal methods to solve these problems:

https://forum.ada-lang.io/t/charity-advent-of-ada-spark-2026...


Neat. Lots of 'unsafe' hardware access in this. Always makes me wonder if Rust should look into something like Representation Clauses like in Ada.

https://learn.adacore.com/courses/advanced-ada/parts/data_ty...

It would allow for compiler level protection from writing wrong data into a register.

Anybody know if that is planned for Rust.


Any hardware access is always going to be unsafe, because the compiler cannot know what the hardware does. For all it knows, it could change the memory of the running app. There's no implementation that cares about ownership where that goes away.

I was specifically thinking about register access. That you can make safe if you provide a way to describe what the hardware needs.

Something like this: https://en.wikibooks.org/wiki/Ada_Programming/Representation...


You cannot make it safe. The data representation part is already mostly covered by packed!, enum and ranged_integers. But that doesn't make register access safe.

Any time you touch hardware, all guarantees Rust makes disappear. And anything you place in mapped io can change when you don't expect it.


Well written piece and certainly on-topic. There is a ton of conversation going on how AI can assist with formal methods.

Personally I am having great success using Ada SPARK. The SPARK subset has been greatly enhanced over the past years. I spent yesterday taking existing C repos, translating to SPARK, lifting it to SPARK Silver (absence of runtime errors) and then reporting the findings to the various maintainers. All as a background activity.

Result: integer overflows, typically on boundary conditions, some logic mistakes, again on boundary conditions.

I have not looked into Magmide, but I think the next breakthrough is a combination of something like SysMLv2 to describe architecture and requirements, TLA+ for modeling and formal proofs at the system level and then Lean or SPARK for the implementation.


I was told before that there was a minimum number of seats one had to buy for around $25,000 which came with a consulting or support contract to sweeten the deal. Many of us would rather drop a few hundred or a thousand for one seat. Do you know id they have per-seat, single-seat pricing for SPARK Pro?

GNAT Pro and SPARK Pro is really aimed at commercial use, projects that need long lifecycles, commercial support and warranty and specific hardware environments with or without certification.

For individual commercial, or non-commercial use, the open source gnatprove has the same features and is available through the Alire package manager and the license is applicable to commercial use. There is a great community at https://forum.ada-lang.io/ where you can post questions.

Is there any reason why the open source tooling would not suit your project?


A presentation I saw on it years ago said they only supported one prover/solver in the open-source version but four in the paid version. Then, there was a SPARK to C or C++ compiler that would be really useful. Looking at it again, I'm seeing they both use the same solvers now. SPARK Pro has better runtime support.

There was also a license issue with GNAT Community. It appears they fixed that, too. Now, you only have to copyleft your code if you make changes to the compiler's, intermediate code or the runtime your code depends on. That wouldn't be an issue for most developers.

Well, that's a much better situation for people wanting to use SPARK Ada. Thanks for letting me know the open source version is now more usable in many ways.


Thank you for your work on improving Ada/SPARK projects!

He's converting C to Ada/SPARK and then reporting errors back to the C projects.

Oops, didn't get that.

The way I see it is that there are 2 places where formal methods help: - Proof the absence of runtime-errors/panics - Proof functional correctness

The sweet spot for many users is the first. Make sure that the application cannot crash. No array-out-of-bounds read/write, no memory issue on ANY input, formally proven at compile time.

This requires additional work in the program to annotate (in SPARK at leasts) and knowledge from the programmer, which meant that there was a barrier to entry.

Well, LLMs COMPLETELY remove this barrier to entry. You can write the logic and have the LLM add the contracts to get to the proof. This works in most cases.

And then, for truly critical code, you can look at functional correctness as a cherry on top of your cheesecake.


Agreed. The GNAT Compiler has the largest market share of any Ada compiler in the space and is fully open source.

And the ecosystem is following! There are a lot more new middleware layers, frameworks, operating systems and such being released in Ada over the past few years.

See https://forum.ada-lang.io/ for discussion and pop into the live Community Office Hours that AdaCore hosts (https://www.adacore.com/ada-spark-office-hours) to see what is going on in the space.


And if you'd like to try to run some easy proofs, here are instructions on how to get started with AI and FM in minutes:

https://substack.com/home/post/p-226407436


Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: