bneb-dev
See https://github.com/bneb/lattice/blob/main/docs/deep-dives/z3...
Salt has some different ergonomics and performance goals though, which makes this project unique.
---
Invariants aren't always inferred automatically. When they aren't, they can be made explicit for Z3 to check.
At the moment, bubble sort with array-content invariants is fully provable:
fn bubble_sort(arr: Ptr<i32>, n: i64)
requires n > 0
ensures forall i in 0..(n-1) => arr[i] <= arr[i+1]
{
for i in 0..n {
invariant forall k in 0..(i-1) => arr[k] <= arr[k+1];
// bubble pass
}
}
Z3 proves the base case (vacuously true at i=0) and the inductive step for each iteration. Both loops have fixed trip counts regardless of data, so the frame axioms are concrete. At concrete sizes the compiler unrolls the loop: for i in 0..4 produces 8 Z3 checks (4 iterations × 2), all proven at compile time, outputting Z3: 8/8 checks proven (100%), 0 deferred to runtime.And insertion sort is partially provable:
This starts with the same `forall` invariant structure. After the base case, the outer for-loop inductive step is wired but the inner while-loop's trip count depends on the data which can't be determined statically for which indices were modified, so the frame axioms can't fully constrain the array state. This would require splitting on the case for the while condition, which is future work, and wasn't part of my v1.0.0 plans.
There are several points you made where I think we just fundamentally disagree so I'll decline to engage further at this point.
Hope you have better luck with your candidates and your own projects. I look forward do seeing them on HN down the road!
With that said, I think it's pretty easy to infer the meaning there.
I'm not really sure how else to be more transparent about things, but I am using an AI-augmented engineering as the core workflow for the project, and that includes drafting docs and this post.
I read and edit the work. For a side-project with no current community support or users, I need to make a judicious decision when to spend time and effort. IMO it is reasonable _not_ to try to trick anyone into thinking that AI is not used. My proof reading and editing will miss things from time-to-time. I'm OK with it at the current scale of the project.
let mut i = 0;
while i < 5 {
arr[i] = val;
i += 1;
}
So in that case, the compiler detects `i < N` with monotonic increment and synthesizes `i >= 0 && i < N` automatically.(Works with `<`, `<=`, `i += 1`, and `i = i + 1` via the same mechanism as for-loop induction variables.)
Complex loops (`while i + j < n`, `while p.addr() != 0`) require syntax that I have slopped together an explicit `invariant` keyword that I am not 100% happy with, but will refine later. Z3 checks base case + inductive step via Hoare logic and reports counterexamples on failure.
---
RE: "gnarliest invariant"
`ensures(result != 0)` on the SYN cookie in the kernel contract for the OS project in the monorepo.
The designed arena allocation is both faster and more predictable than GC. The trade-off is that you have to think about memory regions, but you never pay a GC pause.
I put an effort in to de-slop the project wherever I can. If you've noticed anything specific, I'd kindly request that you open an issue on Github or respond here with your findings so that I might correct them in the future.
Thanks for taking an in-depth look at Salt.
Do you happen to know if Venus has a Result type with canonical error codes, pipes, and other ergonomics?
Does it have C parity performance?
- C performance? - Generics? - Syntax ergonomics?
Thanks for sharing!
I have been pretty diligent about trying to de-slop the project after long RALPH loops and `/goal` prompts, and I review and edit documentation. Based on your feedback, I just made another pass.
Please feel free to let me know if there is anything specific lacking from the docs, and I will update them in the future.
Show HN: Trytet – Deterministic WASM substrate for stateful AI agents
Hey HN,I built Trytet to fix the state and geography constraints of autonomous agents.Giving an LLM unverified host execution breaks security, and streaming embeddings back and forth over HTTP is heavy. Furthermore, when your agent hits an API rate limit or context boundary, you typically drop its execution thread entirely.Trytet is an embeddable, sub-millisecond Wasm substrate. What it...
Show HN: Parsing hostile industrial data in 64MB WASM sandboxes
Hey all, back again.Ingelt is a Rust/Axum gateway that compiles 33 different legacy protocols (Modbus, BACnet, X12, SECS/GEM, etc.) into isolated WebAssembly sandboxes.I have some background in data engineering and in the past, it was so frustrating seeing data pipelines fail due to some quirk on a single row, special character, badly escaped quote, etc... to bring down an entire pipeline.I've...
Show HN: Autonomous Prover Running > 1hr
Hi, I am building an autonomous proof engine that is chasing its second result. Via GitHub gist, you can follow it live.
Show HN: Aacyn v0.7.0 – A bare-metal observability engine (5M events/SEC)
Hey HN,I wanted to try mapping telemetry ingestion to the bare metal. What started as an exploratory project turned into an explorartory product (maybe). I built aacyn, a single-binary engine that drops onto a $600 consumer Mini PC and confortably ingests and queries 5 million events per second without a cloud cluster.Some info about how it works:- the memory model: It writes directly to a...
Show HN: Write and Run Salt v0.9.2 in the Browser
https://salt-lang.dev/playground/
Hey HN,I wanted to share the new online playground for Salt (https://salt-lang.dev/playground/), a sovereign systems language designed for high-performance, distributed workloads where paying an "abstraction tax" is no longer acceptable.We started building Salt to bridge the gap between the raw power of manual pointer arithmetic and the safety guarantees of modern high-level languages. The...