<?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: SUNGMIN BAE</title>
    <description>The latest articles on DEV Community by SUNGMIN BAE (@sungmin_bae_58d4f81fdf16e).</description>
    <link>https://dev.to/sungmin_bae_58d4f81fdf16e</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%2F3817948%2F05c05128-2872-4691-9589-098812acd8ff.png</url>
      <title>DEV Community: SUNGMIN BAE</title>
      <link>https://dev.to/sungmin_bae_58d4f81fdf16e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sungmin_bae_58d4f81fdf16e"/>
    <language>en</language>
    <item>
      <title>Temporal Inversion for MiroFish: Bayesian DAG Reversal in ~46ms (0 LLM calls)</title>
      <dc:creator>SUNGMIN BAE</dc:creator>
      <pubDate>Thu, 12 Mar 2026 09:52:27 +0000</pubDate>
      <link>https://dev.to/sungmin_bae_58d4f81fdf16e/temporal-inversion-for-mirofish-bayesian-dag-reversal-in-46ms-0-llm-calls-4lbm</link>
      <guid>https://dev.to/sungmin_bae_58d4f81fdf16e/temporal-inversion-for-mirofish-bayesian-dag-reversal-in-46ms-0-llm-calls-4lbm</guid>
      <description>&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I forked &lt;a href="https://github.com/666ghj/MiroFish" rel="noopener noreferrer"&gt;MiroFish&lt;/a&gt; (swarm intelligence prediction engine) and added &lt;strong&gt;Temporal Inversion&lt;/strong&gt; — answering &lt;em&gt;"What had to be true for this outcome?"&lt;/em&gt; by reversing the prediction DAG with Bayes' theorem. No LLM in the math core: &lt;strong&gt;~46ms&lt;/strong&gt;, &lt;strong&gt;0 API calls&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Repo: &lt;strong&gt;&lt;a href="https://github.com/BAESY2/MiroFish" rel="noopener noreferrer"&gt;github.com/BAESY2/MiroFish&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The Idea
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;MiroFish&lt;/strong&gt; simulates forward: seed → uncertainty grows → predictions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;This fork&lt;/strong&gt; inverts backward: outcome ← certainty grows ← preconditions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Temporal pincer&lt;/strong&gt;: combine forward and inverted views; the &lt;strong&gt;Turnstile&lt;/strong&gt; is where the outcome becomes effectively inevitable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Inspired by &lt;em&gt;Tenet&lt;/em&gt;’s temporal pincer: &lt;em&gt;"What's happened, happened. But what had to be true?"&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What You Get (math core only)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Analysis&lt;/th&gt;
&lt;th&gt;Question answered&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Necessity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;What had to be true for this outcome?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Turnstile&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;When does the outcome become inevitable?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Sensitivity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Which single factor changes the outcome most?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Monte Carlo&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;How stable is this prediction? (confidence intervals)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;do-Calculus&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;If we force this to change, what happens?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Markov Blanket&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Minimum set to monitor? (strong compression)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;All of the above run in &lt;strong&gt;~46ms&lt;/strong&gt; with &lt;strong&gt;zero LLM calls&lt;/strong&gt;. Optional: a 4-agent verification loop (Prosecutor, Defender, Devil’s Advocate, Judge) can debate findings and adjust the DAG.&lt;/p&gt;




&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Python&lt;/strong&gt;, &lt;strong&gt;Flask&lt;/strong&gt; (existing MiroFish backend)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NetworkX&lt;/strong&gt; for the causal DAG&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bayes’ theorem&lt;/strong&gt; for edge reversal: P(Cause | Effect) from P(Effect | Cause)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shannon entropy&lt;/strong&gt; in both directions to find the Turnstile&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Quick Start
&lt;/h2&gt;

&lt;p&gt;git clone &lt;a href="https://github.com/BAESY2/MiroFish.git" rel="noopener noreferrer"&gt;https://github.com/BAESY2/MiroFish.git&lt;/a&gt;&lt;br&gt;
cd MiroFish/backend&lt;br&gt;
pip install networkx&lt;br&gt;
python test_inversion/test_true_inversion.py&lt;/p&gt;

</description>
      <category>mirofish</category>
      <category>opensource</category>
      <category>python</category>
      <category>ai</category>
    </item>
    <item>
      <title>I built a numpad-only language for PLC programming</title>
      <dc:creator>SUNGMIN BAE</dc:creator>
      <pubDate>Wed, 11 Mar 2026 06:42:47 +0000</pubDate>
      <link>https://dev.to/sungmin_bae_58d4f81fdf16e/i-built-a-numpad-only-language-for-plc-programming-21mc</link>
      <guid>https://dev.to/sungmin_bae_58d4f81fdf16e/i-built-a-numpad-only-language-for-plc-programming-21mc</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;PLC programming in 2025 still looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a 2GB proprietary IDE&lt;/li&gt;
&lt;li&gt;Click "New Rung" &lt;/li&gt;
&lt;li&gt;Drag a NO contact from a palette&lt;/li&gt;
&lt;li&gt;Click to place it&lt;/li&gt;
&lt;li&gt;Type the address in a popup&lt;/li&gt;
&lt;li&gt;Repeat 500 times&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For &lt;code&gt;X1 AND X2 → Y50&lt;/code&gt;, that's &lt;strong&gt;12 mouse clicks&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 2 = 50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;One line. 8 characters. Zero clicks.&lt;/p&gt;

&lt;p&gt;I built &lt;strong&gt;BNS Lang&lt;/strong&gt; — a minimal DSL where numbers are I/O addresses and symbols are logic operators. The entire grammar is 15 lines of BNF.&lt;/p&gt;
&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Numbers     = I/O addresses
Space       = AND (series)
|           = OR (parallel)
-           = NOT (normally closed)
=           = output coil
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Self-holding motor circuit
&lt;/h3&gt;

&lt;p&gt;Every PLC engineer writes this 100 times a year:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 -2 | 100 = 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This compiles to:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;──┤ X1 ├──┤/X2 ├──┬──( Y100 )
                   │
──┤Y100 ├──────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;And outputs IEC 61131-3 Structured Text:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight smalltalk"&gt;&lt;code&gt;&lt;span class="nc"&gt;Y100&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;X1&lt;/span&gt; &lt;span class="nf"&gt;AND&lt;/span&gt; &lt;span class="nf"&gt;NOT&lt;/span&gt; &lt;span class="nf"&gt;X2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;OR&lt;/span&gt; &lt;span class="nf"&gt;Y100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Traffic light controller
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;T302 -T300 = 100       # Green phase
T300 -T301 = 101       # Yellow phase
T301 -T302 = 102       # Red phase
100 = T300 5000        # Green timer 5s
101 = T301 2000        # Yellow timer 2s
102 = T302 5000        # Red timer 5s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Six lines. Complete state machine.&lt;/p&gt;
&lt;h2&gt;
  
  
  AI-native: MCP server for Cursor / Claude Code
&lt;/h2&gt;

&lt;p&gt;This is where it gets interesting. BNS Lang ships with an MCP server, so you can do this inside Cursor:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You: "Make a conveyor controller with emergency stop"

Cursor: [generates BNS] → [validates] → [compiles to ST] → [shows ladder diagram]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Natural language → BNS Lang → IEC 61131-3, without leaving your editor.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;.cursorrules&lt;/code&gt; file is included — clone the repo and Cursor already knows the syntax.&lt;/p&gt;
&lt;h3&gt;
  
  
  Why LLMs + BNS Lang?
&lt;/h3&gt;

&lt;p&gt;Traditional ladder logic is visual (GUI layouts, not text). Structured Text is text-based but verbose — LLMs frequently mess up variable declarations and types.&lt;/p&gt;

&lt;p&gt;BNS Lang is &lt;strong&gt;pure logic, zero boilerplate&lt;/strong&gt;. An LLM only needs to know 5 rules. The compiler handles everything else.&lt;/p&gt;
&lt;h2&gt;
  
  
  Target PLCs
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;LS Electric XGT&lt;/td&gt;
&lt;td&gt;✅ Production&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IEC 61131-3 Generic&lt;/td&gt;
&lt;td&gt;✅ Production&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Inovance H5U/H3U&lt;/td&gt;
&lt;td&gt;🚧 Beta&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Siemens S7&lt;/td&gt;
&lt;td&gt;📋 Planned&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mitsubishi MELSEC&lt;/td&gt;
&lt;td&gt;📋 Planned&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Why I built this
&lt;/h2&gt;

&lt;p&gt;The industrial automation market is $200B+. PLC programming is a bottleneck. Most PLC engineers are aging out with no replacements. &lt;/p&gt;

&lt;p&gt;AI-generated PLC code could be the bridge — but only if there's a language simple enough for AI to reliably produce. BNS Lang is that language.&lt;/p&gt;

&lt;p&gt;MIT licensed. PRs welcome.&lt;/p&gt;

&lt;p&gt;

&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/BAESY2" rel="noopener noreferrer"&gt;
        BAESY2
      &lt;/a&gt; / &lt;a href="https://github.com/BAESY2/bns-lang-" rel="noopener noreferrer"&gt;
        bns-lang-
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Write PLC ladder logic with just a numpad. IEC 61131-3 DSL + MCP for Cursor.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt; ██████╗ ███╗   ██╗███████╗    ██╗      █████╗ ███╗   ██╗ ██████╗
 ██╔══██╗████╗  ██║██╔════╝    ██║     ██╔══██╗████╗  ██║██╔════╝ 
 ██████╔╝██╔██╗ ██║███████╗    ██║     ███████║██╔██╗ ██║██║  ███╗
 ██╔══██╗██║╚██╗██║╚════██║    ██║     ██╔══██║██║╚██╗██║██║   ██║
 ██████╔╝██║ ╚████║███████║    ███████╗██║  ██║██║ ╚████║╚██████╔╝
 ╚═════╝ ╚═╝  ╚═══╝╚══════╝    ╚══════╝╚═╝  ╚═╝╚═╝  ╚═══╝ ╚═════╝ 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Write PLC ladder logic with just a numpad.&lt;/h3&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;A minimal DSL that compiles to IEC 61131-3 ladder diagrams.&lt;/strong&gt;&lt;br&gt;
No IDE needed. No mouse clicking. Just type numbers → get rungs.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/BAESY2/bns-lang-/LICENSE" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667" alt="License: MIT"&gt;&lt;/a&gt;
&lt;a href="https://github.com/BAESY2/bns-lang-/" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/faf75bd5cad9b4c057cd37e8e01c22c2880d6a1358de3d9ebdfe7517d0008333/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4945435f36313133312d2d332d436f6d706c69616e742d626c7565" alt="IEC 61131-3"&gt;&lt;/a&gt;
&lt;a href="https://github.com/BAESY2/bns-lang-/" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/f24d6bf0ca6c8702cbc4967f72b671607f36b78cfab51ebd2799bc4d146f6cd9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5461726765742d4c535f456c6563747269635f5847542d677265656e" alt="PLC"&gt;&lt;/a&gt;
&lt;a href="https://github.com/BAESY2/bns-lang-/" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/9465974d2b6740087b97d619842d095cbc39351159a59625894d20fbfed0a545/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d43502d437572736f725f2532465f436c617564655f436f64652d707572706c65" alt="MCP"&gt;&lt;/a&gt;
&lt;a href="https://github.com/BAESY2/bns-lang-/CONTRIBUTING.md" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/dd0b24c1e6776719edb2c273548a510d6490d8d25269a043dfabbd38419905da/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e737667" alt="PRs Welcome"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/BAESY2/bns-lang-#-quick-start" rel="noopener noreferrer"&gt;Quick Start&lt;/a&gt; · &lt;a href="https://github.com/BAESY2/bns-lang-#-syntax" rel="noopener noreferrer"&gt;Syntax&lt;/a&gt; · &lt;a href="https://github.com/BAESY2/bns-lang-#-examples" rel="noopener noreferrer"&gt;Examples&lt;/a&gt; · &lt;a href="https://github.com/BAESY2/bns-lang-#-why-bns-lang" rel="noopener noreferrer"&gt;Why?&lt;/a&gt; · &lt;a href="https://github.com/BAESY2/bns-lang-#-roadmap" rel="noopener noreferrer"&gt;Roadmap&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;⚡ 3 Seconds to Understand&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Traditional PLC programming requires a GUI IDE, mouse-clicking contacts onto rungs, and navigating nested menus. &lt;strong&gt;BNS Lang lets you type it.&lt;/strong&gt;&lt;/p&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;         BNS Lang                          Ladder Diagram
                                     
    1 2 + 3 = 50                     ──┤ X1 ├──┤ X2 ├──┬──┤ X3 ├──── ( Y50 )
                                                        │
    1 2 | 4 = 50                     ──┤ X1 ├──┤ X2 ├──┤ X4 ├────── ( Y50 )
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;That's it.&lt;/strong&gt; Numbers are I/O addresses. &lt;code&gt;+&lt;/code&gt; is series (AND). &lt;code&gt;|&lt;/code&gt; is…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/BAESY2/bns-lang-" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;




</description>
      <category>opensource</category>
      <category>javascript</category>
      <category>ai</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
