Articles
About building software in Lean, from this site and the community
- Sungrow in Lean, part 4
In part 3 we implemented chunked (block) reading of registers and also writing control registers. The next step is to implement our own charging algorithms and manual overrides so that we can control the inverter and battery in real time. In the Go implementation, charging algorithms and state (the…
- Checking agent code against your intent
Coding agents write more code than anyone can read. Uncle Bob's answer is to stop reading. Mine is to get agents to write less code, and better code. Tools like Microsoft's NFV help with the better: they write down what a change is meant to do, have an agent prove the code does it, and let Lean or Dafny check the proof. What does such a proof tell you? That the code has the property. What can't it tell you? Whether the property was the right one. Can you stop reading the code? No.
- Sungrow in Lean, part 3
In part 2 we implemented metrics and basic register reads (one at a time). Now we will implement chunked (block) reads since this is more efficient as it involves fewer TCP round trips. At the end, we’ll also try writing to the inverter’s control registers to force the battery to charge and stop.…
- Sungrow in Lean, part 2
In part 1 we implemented a simple Modbus TCP library and read a single sensor from the Sungrow inverter. Our next step is to parse the full list of registers so that we can read all the values of interest like real time solar production, battery state of charge, grid draw, etc. YAML and JSON data…
- Sungrow in Lean, part 1
What better way to learn Lean, than to implement a bespoke home battery management system? I’m going to do that in this series of blog posts, porting my Go implementation over to Lean4. The UI will naturally use the Lean Datastar SDK that I developed with Valentin Erokhin. Also check out…
- I built the RealWorld app in Lean 4
I built RealWorld, the reference full-stack app with official test suites, entirely in Lean 4. Can it be done? Yes. Is it ready for production? Somewhat. Can it be made correct by construction? Partly. It can certainly be made more robust than the average full-stack app, though.
Have you written about Lean? Share it in #blog-posts on the Discord and it shows up here.