Ada SPARK Office Hours - 2026-08-28

This Friday is the next instance of our Ada SPARK Office Hours. Proposed topics:

And of course open to any other topics people are interested to talk about.

More detail and links are here: Ada SPARK Office Hours | AdaCore , 10am-11am ET!

Feel free to propose additional topics by commenting on this article. Recording and summary will be posted typically within a week.

3 Likes

I will try to make this one.

If I can’t, I really would like to ask people who work at AdaCore or have used both Ada and Rust about how they compare and contrast when it comes to memory safety.

I’ve been playing around with Ada SPARK a lot more recently since I feel like conceptually SPARK is like Rust’s borrow checker but on steroids. But, as I’ve looked more into it, it seems like SPARK is weaker in some other areas (since SPARK can only be used on certain files in your Ada project, and SPARK assumes things about the external environment that might not necessarily hold true).

I would be interested if anyone has used SPARK to create something that is wholly memory safe and proven to be memory safe from top to bottom (including Ada’s standard library).

Rust can almost do that with its borrow checker, but low level standard library primitives are made using unsafe Rust, and can, in rare cases, lead to memory vulnerabilities if that part of the standard library hasn’t been audited yet.

(though there is an effort to prove rust’s standard library is memory safe, as shown here: GitHub - model-checking/verify-rust-std: Verifying the Rust standard library · GitHub)

4 Likes

Fantastic topic, let’s dig into that!

Hope you can make it, if not, I can start the discussion and you can see the recording.

Thanks for the suggestion!

1 Like

A few examples, roughly in chronological order of completion, with a few relevant URLs:

  1. NSA Tokeneer demonstrator:
    AdaCore - “NSA Releases Secure Software Project to Open Source Community” - NSA Releases Secure Software Project to Open Source… | AdaCore
    Jim Woodcock - “The Tokeneer Experiments” - https://pdfs.semanticscholar.org/bac9/2b06182a24f4ae866185a9d24da699723a56.pdf
    Martyn Thomas - “Making Software ‘Correct by Construction’” - Making Software 'Correct by Construction'
    Yannick Moy - “Tokeneer Fully Verified with SPARK 2014” - Tokeneer Fully Verified with SPARK 2014 | AdaCore
  2. iFACTS - UK air traffic control:
    AdaCore - “GNAT Pro Chosen for UK’s Next Generation ATC System” - GNAT Pro Chosen for UK’s Next Generation ATC System | AdaCore
    Altran Praxis - “The Use of Formal Methods on the iFACTS Air Traffic Control Project” - The Use of Formal Methods on the iFACTS Air Traffic Control Project | PPT
  3. SPARKNaCl - cryptographic library:
    Yannick Moy - “SPARKNaCl - Two Years of Optimizing Crypto Code in SPARK (and counting)” - SPARKNaCl - Two Years of Optimizing Crypto Code in SPARK… | AdaCore
    Roderick Chapman - “SPARKNaCl: A verified, fast cryptographic library” - SPARKNaCl: A verified, fast… | High Integrity Software Conference 2026
    Roderick Chapman - “SPARKNaCl: A Verified, Fast Re-implementation of TweetNaCl” - FOSDEM 2022 - SPARKNaCl: A Verified, Fast Re-implementation of TweetNaCl
    Rod Chapman on GitHub - GitHub - rod-chapman/SPARKNaCl: SPARK 2014 re-implementation of the TweetNaCl crypto library · GitHub
  4. For more leads, search for “SPARK” on the “Awesome Ada” list at GitHub - ohenley/awesome-ada: A curated list of awesome resources related to the Ada and SPARK programming language · GitHub

An interesting overview article by Roderick Chapman and Florian Schanda is:
“Are We There Yet? 20 Years of Industrial Theorem Proving with SPARK”

As well as another paper, from Communications of the ACM, by Roderick Chapman, Claire Dross, Stuart Matthews, and Yannick Moy:
“The SPARK programming language and analyzer. Co-Developing Programs and Their Proof of Correctness”

HTH

Dirk

5 Likes

Could you post the link here to join the online meeting?

When I click the Join button on the above page, all that happens is a .ics file is downloaded but the event is not added to my calendar. Probably a wrong setup somewhere on my side…

1 Like

Here’s the link from the .ics: https://meet.google.com/tgu-wyof-cpq

I feel so embarrassed, I set two alarms to wake up on time this morning to join the meeting, but I somehow slept through both of them :sweat_smile:

I hope you all had a good time talking about this stuff without me haha…

2 Likes

Sooo sorry. The recording should be up soon! Thanks again for the question!

2 Likes

The recording of the session is available here:

AI Summary

Discussions regarding language memory safety and formal verification methods integrated with artificial intelligence for code optimization.

Language Safety and Standards
Memory safety differences between languages were contrasted, highlighting how formal proof reduces testing needs. Standards still mandate comprehensive coverage despite high trust in formal methods.

AI for Code Development
Frontier artificial intelligence models effectively generate contracts and support lifting codebases to Spark Silver levels. Utilizing paid model tiers is required to ensure accurate hardware code translation.

Expanding Academic Formal Verification
Efforts to broaden adoption in universities emphasize industrial applications of formal verification. Dedicated learning resources now pair course material with interactive model assistance.

Anonymized Notes

  • Comparison of Ada and Spark to Rust for Memory Safety: A participant introduced a discussion comparing memory safety across Ada, Spark, and Rust by referencing a blog post utilizing the Common Weakness Enumeration list published by the Software Engineering Institute. Another participant argued that Spark focuses on formal proof, whereas Rust and Ada feature unsafe elements, though Ada allows developers to isolate unsafe code into a very small, distinct portion of a program, thereby lowering overall anxiety compared to C and C++.
  • AI-Generated Code, Benchmarks, and Formal Verification for Spark: A participant raised challenges regarding benchmarking and data sets for fine-tuning AI models to generate correct Spark code while managing context and looping variants. A participant shared an evaluation data set link and noted that commercial models excel at generating Spark contracts, whereas models like DeepSeek achieve about 75% accuracy and Qwen struggles with Ada. Another participant suggested leveraging advanced frontier models to frame specifications and development paths.
  • Memory Safety in Ada, Rust, and C++: A participant resumed the discussion on memory safety, noting that while newer C++ versions offer benefits, backwards compatibility allows unsafe pointer references. A participant summarized that Rust handles memory safety better via static checks, Ada offers superior general program correctness through type expressiveness, and Spark combines memory safety with static proof of runtime checks. A participant outlined Ada 22 efforts to minimize unchecked deallocation and reduce reliance on access types to eliminate major memory safety vulnerabilities.
  • Formal Proof Versus Testing and AI Codebase Lifting: Participants highlighted that Spark formal proof verifies all execution paths and reduces the need for extensive unit testing, catching problems earlier. A participant offered to run public GitHub or GitLab repositories through AI tools to lift existing Ada codebases to Spark Silver using spare AI tokens. A participant noted that Spark Silver provides an optimal balance of effort and benefit, whereas Spark Gold functional correctness is more challenging for cryptography like SHA-3 implementations, which often rely on traditional test vectors.
  • Runtime Checks and Functional Safety Standards: A participant used a skiing analogy to describe Ada runtime checks as a gauntlet of hoops that helps validate program behavior when combined with minimal testing. Participants discussed functional safety standards like ISO 26262, noting that while formal methods provide high trust and can sometimes reduce code coverage requirements such as full MCDC to statement coverage, standards still mandate high coverage to verify that all code serves a required purpose.
  • Expanding Ada and Spark in Universities: Participants discussed initiatives to broaden Ada and Spark adoption in universities through collateral, guest lectures, and capstone projects. A participant suggested that pitching the industrial application of formal verification engages academics more effectively than focusing strictly on specific language names. A participant inquired about overlaying Spark on existing codebases, and a participant reiterated the offer to lift codebases using AI tokens. A participant reported submitting five capstone projects to Penn State Great Valley and offered to present them.
  • Embedded Development, Hardware Integration, and AI Model Tiers: A participant shared an embedded project experience involving ST Micro, I2C interfaces, and display hardware troubleshooting, noting that AI tools struggled with hardware-specific code translation and required manual translation and reference to working Arduino libraries. Participants emphasized that utilizing paid frontier AI models rather than free or cheap tiers is critical to avoid poor code generation and wasted time. A participant compared software engineering management to overseeing a team of AI agents.
  • Beginner Resources for Learning Ada and Spark: A participant asked about beginner resources for undergraduates outside of aerospace or nuclear engineering fields. A participant directed them to learn.adacore.com for Spark courses and recommended pairing the material with a capable AI model acting as an interactive learning assistant.
4 Likes