<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Manish Sarmah</title>
    <description>The latest articles on DEV Community by Manish Sarmah (@manisarmah).</description>
    <link>https://dev.to/manisarmah</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3707574%2Fab28c502-2323-40a1-8069-3bc7e33effe4.jpeg</url>
      <title>DEV Community: Manish Sarmah</title>
      <link>https://dev.to/manisarmah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/manisarmah"/>
    <language>en</language>
    <item>
      <title>Beyond the Vibe-Check: Using Z3 Theorem Provers to Guardrail LLM Logic</title>
      <dc:creator>Manish Sarmah</dc:creator>
      <pubDate>Mon, 12 Jan 2026 19:11:24 +0000</pubDate>
      <link>https://dev.to/manisarmah/beyond-the-vibe-check-using-z3-theorem-provers-to-guardrail-llm-logic-46pi</link>
      <guid>https://dev.to/manisarmah/beyond-the-vibe-check-using-z3-theorem-provers-to-guardrail-llm-logic-46pi</guid>
      <description>&lt;p&gt;The Problem: The "Almost Correct" Trap&lt;br&gt;
We’ve all been there: You ask an LLM to generate a complex validation function or a scheduling algorithm. It looks perfect. It passes three test cases. Then, in production, it hits an edge case—a null pointer, an integer overflow, or a logic flip—and everything breaks.&lt;/p&gt;

&lt;p&gt;Unit tests only prove your code works for the inputs you thought of. In the age of AI-generated code, we need something better. We need Formal Verification.&lt;/p&gt;

&lt;p&gt;The Niche Solution: Neuro-Symbolic Workflows&lt;br&gt;
Instead of just asking an AI to "write a function," we can use a Neuro-Symbolic approach:&lt;/p&gt;

&lt;p&gt;Neural: The LLM generates the logic.&lt;/p&gt;

&lt;p&gt;Symbolic: A theorem prover (like Microsoft’s Z3) checks that logic against a set of "ground truth" rules.&lt;/p&gt;

&lt;p&gt;A Quick Example in Python&lt;br&gt;
Imagine you’re building a discount engine. You tell the AI: "Give me a function that applies a 20% discount but never lets the price drop below $10."&lt;/p&gt;

&lt;p&gt;The AI might write:&lt;/p&gt;

&lt;p&gt;Python&lt;/p&gt;

&lt;p&gt;def apply_discount(price):&lt;br&gt;
    return max(10, price * 0.8)&lt;br&gt;
Seems fine? But what if price is negative? What if it's a string? We can use the z3 library to prove if this function can ever violate our safety constraints.&lt;/p&gt;

&lt;p&gt;Python&lt;/p&gt;

&lt;p&gt;from z3 import *&lt;/p&gt;

&lt;h1&gt;
  
  
  Define our variables
&lt;/h1&gt;

&lt;p&gt;price = Real('price')&lt;br&gt;
discounted_price = If(price * 0.8 &amp;gt; 10, price * 0.8, 10.0)&lt;/p&gt;

&lt;h1&gt;
  
  
  Create a solver
&lt;/h1&gt;

&lt;p&gt;s = Solver()&lt;/p&gt;

&lt;h1&gt;
  
  
  Define a "Safety Property": Price must be &amp;gt; 0 and
&lt;/h1&gt;

&lt;h1&gt;
  
  
  the resulting discount must NEVER be less than $10.
&lt;/h1&gt;

&lt;p&gt;s.add(price &amp;gt; 0)&lt;br&gt;
s.add(Not(discounted_price &amp;gt;= 10))&lt;/p&gt;

&lt;h1&gt;
  
  
  Check for counter-examples
&lt;/h1&gt;

&lt;p&gt;if s.check() == sat:&lt;br&gt;
    print("Logic Flaw Found:", s.model())&lt;br&gt;
else:&lt;br&gt;
    print("Logic Mathematically Verified.")&lt;br&gt;
Why This is the Future of AI Dev&lt;br&gt;
As we move into 2026, the industry is shifting from "AI as a toy" to "AI as a component in critical systems." Learning how to "wrap" LLM outputs in formal solvers is the difference between a junior developer using Copilot and a senior engineer building reliable AI systems.&lt;/p&gt;

&lt;p&gt;Key Takeaways:&lt;/p&gt;

&lt;p&gt;LLMs are probabilistic; Solvers are deterministic.&lt;/p&gt;

&lt;p&gt;Z3 and SMT-Lib are the secret weapons for building "Self-Healing" code that verifies itself.&lt;/p&gt;

&lt;p&gt;The next big skill isn't prompt engineering—it's Verification Engineering.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
