Hacker News new | ask | show | jobs
by fritzo 12 days ago
You don't need a model of your programming language in Lean, that's overkill.

It's already useful to isolate a DSL in your software and model that in Lean. Sure that only proves that the domain specific code is correct, but now you've factored your proof into proving high-level correctness and low-level correctness.

1 comments

What are you proving in Lean if you don't have the semantics of the thing that you're writing a proof about?
You need to pick an abstraction level. I don't prove in lean the impact of my programs on the price of eggs at the local market. I don't prove in lean how much energy my programs consume, or even how much RAM they consume. I do prove that say a particular pair of functions commute, or that another function is idempotent, or that under a denotational semantics a collection of functions can be composed without error.
I think that is a valid level to use formal verification but I would argue it is much more powerful to also have a formal model of code. For example, if I have:

  my_value = run_some_function(some_arg_1, some_arg_2)
  for some_value in my_value.some_list:
     run_some_action(some_value)
Yes it is very helpful to know some properties about `run_some_function` (maybe it is commutative? idempotent?), but it is much more valuable to have a model which can translate what ultimately is being passed to `run_some_action` at the end and how that derives from the return of `run_some_function`, grounding the LLM's reasoning in something deterministic it can't break from.