Skip to main content
Back to insights
Evaluation & TestingLLM Engineering
David BresslerNOV 23, 20265 min read

Jev Makes the Judgments. Lean Proves the Logic.

Share:

A clinical note drawn in white line art on a coral background, linked to three gauges with partly filled rings. The gauges lead to a column of five slots: four ticked, one left empty and drawn dashed. A line runs from the slots to a solid white square.

Compile-Time Intelligence, Part 8

What if the intelligence behind a decision could remain probabilistic, while the logic that turns it into action was mathematically verified?

TypeSafe has a simple principle: "Jev makes judgments, code makes decisions." [1] Instead of asking an AI model to reason through an entire policy, give it narrow questions about the evidence and let ordinary code make the decision. Decision models, which TypeSafe calls System One models, answer one narrow question with a typed answer and a probability, and write no text.

We wanted to take the second half of that principle further. If code makes the decision, can we prove that it applies the policy correctly, no matter what inputs it receives? At Eventum, an AI engineering consultancy, we built a small clinical example using Jev and Lean 4 to explore what such a system might look like. [2] Our earlier posts on Jev measured what examples can teach it, from an 84,000-token casebook to eight labeled images. [3] [4]

Why prove something you could just test?

Consider a clinical rule with five conditions. Each condition can hold, fail or be unresolved. The decision procedure is straightforward: recommend starting treatment if all five hold, rule out that recommendation if any fails, and otherwise return "unresolved".

A few lines of Python could implement this. With only 243 possible input combinations, exhaustive testing would be feasible. But a real decision system might have hundreds of conditions, nested exceptions, alternative pathways and interactions between rules. Even 20 three-state conditions allow nearly 3.5 billion combinations. Testing representative cases is useful, but it does not establish that a property holds for every permitted input.

Why prove something you could just test? Five conditions give 243 combinations, few enough to test them all. Twenty give nearly 3.5 billion. Every combination of holds, fails and unresolved for five conditions, by the decision the procedure returns: a grid of 243 squares, 1 recommend starting, 31 unresolved, 211 no recommendation. 5 three-state conditions: 243. Exhaustive testing would be feasible. 20 three-state conditions: 3,486,784,401. A proof covers all inputs within the formal model. 243 is 3 to the power 5 and 3,486,784,401 is 3 to the power 20. Start if all five hold, no recommendation if any fails, otherwise unresolved.

Lean offers a different approach. It lets us define a specification (what the rule requires), write an executable decision procedure (how the rule is applied), and construct a mathematical proof that the procedure satisfies the specification. Lean checks that proof. Rather than testing combinations one by one, the proof covers all inputs within the formal model. Constructing proofs for complex rules can itself require substantial engineering.

Five conditions, one missing fact

Our example comes from Part 7 of our Compile-Time Intelligence series. [5] It is an illustrative pathway for starting a statin, not a prescribing protocol. It requires age 40 to 75, at least one of four specified risk factors, an estimated ten-year cardiovascular risk of at least 10%, no dialysis dependence, and no current statin.

A 63-year-old patient has hypertension, dyslipidemia, a risk estimate of 12.4%, and takes no statin. Four conditions hold. But the patient receives hemodialysis three times a week. A justification that mentions only the four true statements is not sufficient to establish eligibility.

In our Lean implementation, attempting to construct an eligibility proof from those four statements produces the error "Fields missing: `noDialysis`". We also prove that a checker whose requirements come from the approved rule accepts only recommendations supported by that rule, and accepts an honest, complete justification. [6]

From AI judgments to verified decisions

Lean does not read clinical notes. Jev does that. It answers fourteen narrow yes-or-no questions in a single request, returning probabilities. Ordinary code converts nine of those answers into evidence for the risk factor, dialysis and statin conditions; the other five are retained for review. Age and cardiovascular risk come from structured inputs. Each condition is represented as holds, fails or unresolved; a condition read from the note counts as settled only when one answer is at least 0.7 and the opposite answer at most 0.3, the starting cut-offs TypeSafe's documentation suggests. [7]

Where each check sits. Lean does not read clinical notes. Jev does that. A flow from top to bottom. Clinical note: “His father is on hemodialysis and pt shares the driving.” Then Jev, TypeSafe’s System One model: fourteen narrow yes-or-no questions in a single request, returning probabilities. Beside it: measure the reading; Lean cannot check it. Then ordinary code: each condition holds, fails or is unresolved, settled only when one answer is at least 0.7 and the opposite at most 0.3. Then the Lean decision procedure: recommend starting, no recommendation, unresolved. Beside it: prove the logic, for every possible evidence report. Below, with an arrow up into the procedure: the approved rule, written in Lean: five conditions for starting a statin. Beside it: attack the rule; Lean cannot tell if it is the right rule. An illustrative pathway, not a prescribing protocol. Age and cardiovascular risk come from structured inputs.

For example, a note says that the patient's father receives hemodialysis. Jev recognizes the reference to another person, but that does not establish that the patient is not on dialysis. The condition remains unresolved. With the other four conditions satisfied, the decision procedure returns "unresolved" rather than recommending treatment.

One note, end to end. Jev recognizes the reference to another person. The condition remains unresolved. The note: PRE-OP ASSESSMENT. 50 M for elective L knee arthroscopy. HTN, hyperlipidemia. Not on a statin. His father is on hemodialysis and pt shares the driving. Jev’s answers, questions shortened: Is the patient currently on maintenance dialysis? 0.01, below 0.7. Does the note say the patient is not on dialysis now? 0.37, below 0.7. Is the dialysis mentioned that of another person? 0.98, kept for review. Does the patient have hypertension? 0.96, risk factor. Does the patient have dyslipidemia? 0.98, risk factor. Is the patient taking a statin now? 0.03. Does the note say the patient is not taking a statin? 0.98, no statin. Evidence for the five conditions: age 50 holds; risk factor holds; risk 13.0% holds; no dialysis unresolved; no current statin holds. Lean decision: unresolved. No dialysis is not established, so the procedure does not recommend treatment. A synthetic note from the 120-note test. Jev 1.14.0; cut-offs 0.7 and 0.3.

We proved that the same procedure, for every possible evidence report, recommends starting exactly when all five conditions are reported as holding. Any confirmed failure prevents a recommendation. If the settled evidence is correct, its definitive decisions are correct relative to the formal rule. There is no need to prove the logic again for each new patient. [6]

Can a decision model handle the evidence?

We tested Jev on 120 synthetic clinical notes generated from scripted cases. They included ambiguous, historical, family-related and missing dialysis information. Claude Haiku 5.5 classified the same conditions directly, and both readers fed the same verified procedure.

Evidence readerJev 1.14.0Claude Haiku 5.5
Decisions matching key120/120120/120
Wrongly settled facts0/3600/360
Known facts left open0/2401/240
Est. cost / 1,000 notes$0.045$0.24

Jev uses published input-token pricing; Haiku's direct API cost is estimated from its Claude Code run ($1.08 per 1,000 notes). [8]

Counting wrong answers and unresolved ones separately, as the table does, is also how An, Bayless and colleagues, including Byron Cook, Ferhat Erata and Aman Goel, report automated policy checks. [9]

Jev matched all 120 decisions and settled every fact the answer key settled, at about one fifth of Haiku's estimated cost. The evaluation is preliminary: Jev's questions were developed on these same notes, while Haiku's instructions were fixed. The notes were not human-validated, and only six cases recommended starting. Real clinical use would require independent testing on human-labeled notes.

What the proof cannot tell us

There are two things Lean cannot establish here. First, whether Jev interpreted the evidence correctly. Second, whether the formal rule captures the intended clinical policy. We deliberately wrote a version of the rule that omits dialysis. Lean accepts it, and the patient becomes eligible under that version.

This is why there are three distinct engineering tasks: prove the logic, measure the reading, and attack the rule. Oleg Mürk's suggestion to find vulnerabilities in a control layer, patch them and repeat is particularly relevant to that last task. [10] [11]

The five-condition example is small by design. The larger opportunity is to build decision systems with hundreds of interacting rules and many AI-generated judgments, while retaining mathematical guarantees about the properties that matter. We cannot eliminate uncertainty about the world. But we can rule out entire classes of logical errors in how a system acts on its understanding of the world.

The Lean files are public at github.com/EventumAI/lean-clinical-rule. They have not yet been reviewed by an independent Lean expert; corrections are welcome.

Relationship disclosure. Eventum is an official TypeSafe technology partner. Erik Gafni, TypeSafe's CTO, is also Eventum's lead advisor. [12] The experiment and its interpretation are Eventum's work.

Sources

  1. Laabs A. Don't Call It a Decision Model. TypeSafe, Nov. 3, 2026.
  2. de Moura L, Ullrich S. The Lean 4 Theorem Prover and Programming Language. CADE, 2021.
  3. Bressler D. In-context learning at scale: what Jev changes. Eventum, Oct. 16, 2026.
  4. Bressler D. Sometimes it's easier to show than explain: teaching Jev a visual standard. Eventum, Oct. 31, 2026.
  5. Bressler D. The Recommendation Explained Itself. Did Anything Check the Explanation? Eventum, Nov. 2, 2026. Compile-Time Intelligence, Part 7.
  6. Eventum. lean-clinical-rule: Part7.lean and TwoCheckers.lean. GitHub, Nov. 23, 2026.
  7. TypeSafe. Noul. Documentation, Nov. 23, 2026.
  8. TypeSafe. Models. Published pricing, Nov. 18, 2026.
  9. An C, Bayless S, Buliani S, Cassel D, Cook B, et al. A Neurosymbolic Approach to Natural Language Formalization and Verification. arXiv, version 2, July 13, 2026.
  10. Mürk O. LLM-Based Firewalls and Proof-Carrying Actions. X, Oct. 30, 2026, and reply to the author, Nov. 8, 2026.
  11. Bressler D. The Proof Checked. Does the Spec Say What the Guideline Says? Eventum, Oct. 28, 2026. Compile-Time Intelligence, Part 6.
  12. Eventum. About Eventum.

Summarize with AI:

ChatGPTGrokGeminiClaude
Related service

Discovery, architecture, build, evaluation, deployment, handoff. Senior technical ownership end-to-end.

Diagonal halftone representing the AI project delivery flow.