An unofficial, read-only Hacker News reader. Join the beta →

I checked Clojure's core with Lean and found unreported bugs (opens external site)

238 points by encyclopedism 2 days ago | s.conao3.com | 84 comments on HN

View full thread · View on Hacker News

Comment thread (4)

  1. Can someone help me understand how this works? I’ve briefly looked at lean for helping me verify my chip designs, given recent hype. My take away was “not worth it” after the design stage. The hang up I kept running into is that there is no linkage between RTL and lean, so it’s up to me to model it in lean, and any apparent errors are 9 times out of 10 be my crappy model.

    To be fair this is true in more traditional verification too but Systemverilog is designed to model digital logic with multiple levels of abstraction.

    My first thought in reading the title is how likely is it they got their models right?

    Modeling mathematical theorems is probably much more natural in lean, but even there it seems like flawed models are a huge risk. I think it’s mitigated by a greater set of peers skilled in validating these sorts of models. I m skeptical that is true of software or chip designs.

    Now, during the design and architecture stage I imagine there can be a lot of value in proving a model before you commit to a design.

    Replies (2)
    1. This seems like a valid question, though it sounds like he validated each finding with writing real counter examples against real code. So any errors in the model would lead to missed findings rather than erroneous bugs.
      Replies (1)
      1. One of the bug is erroneous; see the first issue at the top of this thread. So, either the model for byte-array was erroneous or the translation of the counterexample into code was wrong.
    2. As different tools (e.g., SPIN, Z3) have been used as "checking engines" to realize verification solutions, I think trying to use Lean as a checking engine is understandable; more so, if Lean provides additional benefits (e.g., richer library, higher level of abstractions, performant checking) over other tools that help reduce modeling tedium, improve model fidelity, or speed up checking.

      That said, I think the issue of model fidelity and spec/property correctness will still exist in a reduced form. Also, simpler solutions/tools may be better suited for certain classes of properties.

      As for how this exercise worked, my guess is that the agent models both the SUT and the environment, encodes the property based on property templates, and checks the model for bugs (w/ counterexample) or correctness proof using a set of tactics; see https://github.com/hirosassa/lean-verify/blob/main/skills/le.... I hope the author or others can provide a better explanation.