Loading Lion artifact…
Inspect Lion Program Source (JSON)
[
  "begin",
  [
    "relation",
    "ctrl",
    [
      "k",
      "v"
    ],
    {
      "key": [
        "k"
      ]
    }
  ],
  [
    "fact",
    [
      "ctrl",
      "wf_enabled",
      false
    ],
    [
      "ctrl",
      "wal_fault",
      false
    ],
    [
      "ctrl",
      "wal_depth",
      3
    ]
  ],
  [
    "define",
    "quorum_step",
    [
      "lambda",
      [
        "s",
        "act"
      ],
      [
        "cond",
        [
          [
            "=",
            "act",
            "stutter"
          ],
          "s"
        ],
        [
          [
            "and",
            [
              "=",
              "act",
              "advance"
            ],
            [
              "number/lessThan",
              "s",
              3
            ]
          ],
          [
            "number/add",
            "s",
            1
          ]
        ],
        [
          "else",
          null
        ]
      ]
    ]
  ],
  [
    "define",
    "make_wal_step",
    [
      "lambda",
      [
        "bound",
        "fault"
      ],
      [
        "lambda",
        [
          "s",
          "act"
        ],
        [
          "cond",
          [
            [
              "and",
              "fault",
              [
                "=",
                "act",
                "crash_skip"
              ],
              [
                "number/lessThan",
                [
                  "object/get",
                  "s",
                  "c"
                ],
                "bound"
              ]
            ],
            {
              "c": [
                "number/add",
                [
                  "object/get",
                  "s",
                  "c"
                ],
                2
              ],
              "pending": 0
            }
          ],
          [
            [
              "and",
              [
                "=",
                "act",
                "enqueue"
              ],
              [
                "number/lessThan",
                [
                  "number/add",
                  [
                    "object/get",
                    "s",
                    "c"
                  ],
                  [
                    "object/get",
                    "s",
                    "pending"
                  ]
                ],
                "bound"
              ]
            ],
            {
              "c": [
                "object/get",
                "s",
                "c"
              ],
              "pending": [
                "number/add",
                [
                  "object/get",
                  "s",
                  "pending"
                ],
                1
              ]
            }
          ],
          [
            [
              "and",
              [
                "=",
                "act",
                "flush"
              ],
              [
                "number/greaterThan",
                [
                  "object/get",
                  "s",
                  "pending"
                ],
                0
              ]
            ],
            {
              "c": [
                "number/add",
                [
                  "object/get",
                  "s",
                  "c"
                ],
                1
              ],
              "pending": [
                "number/subtract",
                [
                  "object/get",
                  "s",
                  "pending"
                ],
                1
              ]
            }
          ],
          [
            "else",
            null
          ]
        ]
      ]
    ]
  ],
  [
    "define",
    "view",
    [
      "lambda",
      [],
      [
        "begin",
        [
          "define",
          "wf_enabled",
          [
            "array/head",
            [
              "find",
              "?v",
              [
                "ctrl",
                [
                  "quote",
                  "wf_enabled"
                ],
                "?v"
              ]
            ]
          ]
        ],
        [
          "define",
          "wal_fault",
          [
            "array/head",
            [
              "find",
              "?v",
              [
                "ctrl",
                [
                  "quote",
                  "wal_fault"
                ],
                "?v"
              ]
            ]
          ]
        ],
        [
          "define",
          "wal_depth",
          [
            "array/head",
            [
              "find",
              "?v",
              [
                "ctrl",
                [
                  "quote",
                  "wal_depth"
                ],
                "?v"
              ]
            ]
          ]
        ],
        [
          "define",
          "live_res",
          [
            "cond",
            [
              "wf_enabled",
              [
                "proof/liveness",
                {
                  "actions": [
                    "array/make",
                    "stutter",
                    "advance"
                  ],
                  "init": [
                    "array/make",
                    0
                  ],
                  "p": 0,
                  "q": 3,
                  "step": "quorum_step",
                  "wf": [
                    "array/make",
                    "advance"
                  ]
                }
              ]
            ],
            [
              "else",
              [
                "proof/liveness",
                {
                  "actions": [
                    "array/make",
                    "stutter",
                    "advance"
                  ],
                  "init": [
                    "array/make",
                    0
                  ],
                  "p": 0,
                  "q": 3,
                  "step": "quorum_step"
                }
              ]
            ]
          ]
        ],
        [
          "define",
          "live_ok",
          [
            "object/get",
            "live_res",
            "holds"
          ]
        ],
        [
          "define",
          "live_valid",
          [
            "proof/valid?",
            "live_res"
          ]
        ],
        [
          "define",
          "ref_res",
          [
            "proof/refines",
            {
              "abstract": {
                "init": [
                  "array/make",
                  0
                ],
                "step": [
                  "lambda",
                  [
                    "a1",
                    "a2"
                  ],
                  [
                    "=",
                    "a2",
                    [
                      "number/add",
                      "a1",
                      1
                    ]
                  ]
                ]
              },
              "concrete": {
                "actions": [
                  "cond",
                  [
                    "wal_fault",
                    [
                      "array/make",
                      "enqueue",
                      "flush",
                      "crash_skip"
                    ]
                  ],
                  [
                    "else",
                    [
                      "array/make",
                      "enqueue",
                      "flush"
                    ]
                  ]
                ],
                "init": [
                  "array/make",
                  {
                    "c": 0,
                    "pending": 0
                  }
                ],
                "step": [
                  "make_wal_step",
                  "wal_depth",
                  "wal_fault"
                ]
              },
              "map": [
                "lambda",
                [
                  "s"
                ],
                [
                  "object/get",
                  "s",
                  "c"
                ]
              ],
              "maxStates": 400
            }
          ]
        ],
        [
          "define",
          "ref_ok",
          [
            "object/get",
            "ref_res",
            "refines"
          ]
        ],
        [
          "define",
          "ref_valid",
          [
            "proof/valid?",
            "ref_res"
          ]
        ],
        [
          "define",
          "total_states",
          [
            "number/add",
            [
              "object/get",
              "live_res",
              "checkedStates"
            ],
            [
              "object/get",
              "ref_res",
              "checkedStates"
            ]
          ]
        ],
        [
          "define",
          "nodes",
          [
            "array/make",
            {
              "group": "phase",
              "id": "proposed",
              "label": "s0: Proposed",
              "metric": "p = 0",
              "subtitle": "leader broadcast",
              "tone": [
                "cond",
                [
                  "live_ok",
                  "ok"
                ],
                [
                  "else",
                  "error"
                ]
              ]
            },
            {
              "group": "phase",
              "id": "prepared",
              "label": "s1: Prepared",
              "subtitle": "quorum acks",
              "tone": [
                "cond",
                [
                  "live_ok",
                  "ok"
                ],
                [
                  "else",
                  "warn"
                ]
              ]
            },
            {
              "group": "phase",
              "id": "precommit",
              "label": "s2: Pre-Commit",
              "subtitle": "WAL fsync",
              "tone": [
                "cond",
                [
                  "ref_ok",
                  "ok"
                ],
                [
                  "else",
                  "error"
                ]
              ]
            },
            {
              "group": "phase",
              "id": "committed",
              "label": "s3: Committed",
              "metric": "q = 3",
              "subtitle": "client ack",
              "tone": [
                "cond",
                [
                  [
                    "and",
                    "live_ok",
                    "ref_ok"
                  ],
                  "ok"
                ],
                [
                  "else",
                  "error"
                ]
              ]
            },
            {
              "group": "wal",
              "id": "wal_buf",
              "label": "Buffered WAL",
              "metric": [
                "string/concat",
                "depth ",
                [
                  "number/toString",
                  "wal_depth"
                ]
              ],
              "subtitle": "concrete {c, pending}",
              "tone": [
                "cond",
                [
                  "ref_ok",
                  "ok"
                ],
                [
                  "else",
                  "error"
                ]
              ]
            },
            {
              "group": "spec",
              "id": "abs_spec",
              "label": "Abstract Counter",
              "subtitle": "spec a -> a + 1",
              "tone": "ok"
            }
          ]
        ],
        [
          "define",
          "edges",
          [
            "array/make",
            {
              "from": "proposed",
              "label": [
                "cond",
                [
                  "wf_enabled",
                  "WF(advance)"
                ],
                [
                  "else",
                  "unfair stutter loop!"
                ]
              ],
              "to": "prepared",
              "tone": [
                "cond",
                [
                  "live_ok",
                  "ok"
                ],
                [
                  "else",
                  "error"
                ]
              ]
            },
            {
              "from": "prepared",
              "label": "advance",
              "to": "precommit",
              "tone": [
                "cond",
                [
                  "live_ok",
                  "ok"
                ],
                [
                  "else",
                  "warn"
                ]
              ]
            },
            {
              "from": "precommit",
              "label": "commit",
              "to": "committed",
              "tone": [
                "cond",
                [
                  "live_ok",
                  "ok"
                ],
                [
                  "else",
                  "warn"
                ]
              ]
            },
            {
              "from": "wal_buf",
              "label": [
                "cond",
                [
                  "ref_ok",
                  "stuttering refinement"
                ],
                [
                  "else",
                  "crash_skip (+2 violation!)"
                ]
              ],
              "to": "abs_spec",
              "tone": [
                "cond",
                [
                  "ref_ok",
                  "ok"
                ],
                [
                  "else",
                  "error"
                ]
              ]
            },
            {
              "from": "wal_buf",
              "label": "fsync",
              "to": "precommit",
              "tone": [
                "cond",
                [
                  "ref_ok",
                  "ok"
                ],
                [
                  "else",
                  "error"
                ]
              ]
            }
          ]
        ],
        [
          "define",
          "prop_rows",
          [
            "array/make",
            {
              "checked": [
                "string/concat",
                [
                  "number/toString",
                  [
                    "object/get",
                    "live_res",
                    "checkedStates"
                  ]
                ],
                " states"
              ],
              "id": "liveness",
              "kernel": [
                "cond",
                [
                  "live_valid",
                  "VERIFIED"
                ],
                [
                  "else",
                  "REFUTED"
                ]
              ],
              "property": "Quorum Liveness (s0 ~> s3)",
              "spec": [
                "cond",
                [
                  "wf_enabled",
                  "Weak Fairness WF(advance)"
                ],
                [
                  "else",
                  "No scheduler fairness (adversarial stutter)"
                ]
              ]
            },
            {
              "checked": [
                "string/concat",
                [
                  "number/toString",
                  [
                    "object/get",
                    "ref_res",
                    "checkedStates"
                  ]
                ],
                " states"
              ],
              "id": "refinement",
              "kernel": [
                "cond",
                [
                  "ref_valid",
                  "VERIFIED"
                ],
                [
                  "else",
                  "REFUTED"
                ]
              ],
              "property": "WAL Abstraction Refinement (h(s) = s.c)",
              "spec": [
                "cond",
                [
                  "wal_fault",
                  "Injected crash_skip (+2 jump) bug"
                ],
                [
                  "else",
                  "Stuttering enqueue + monotonic flush"
                ]
              ]
            }
          ]
        ],
        [
          "ui/stack",
          {
            "gap": "lg"
          },
          [
            "ui/hero",
            {
              "eyebrow": "LION-ONLY PROOF · TLA+ LIVENESS & ABSTRACTION REFINEMENT",
              "subtitle": "Safety tests never catch infinite livelocks or subtle buffered-WAL refinement bugs. Toggle Weak Fairness and WAL crash faults below to watch Lion synthesize lasso starvation counterexamples or emit kernel-checked proofs.",
              "title": "Prove distributed progress & zero silent WAL skips."
            },
            [
              "ui/badge",
              {
                "tone": [
                  "cond",
                  [
                    [
                      "and",
                      "live_ok",
                      "ref_ok"
                    ],
                    "ok"
                  ],
                  [
                    "else",
                    "error"
                  ]
                ]
              },
              [
                "cond",
                [
                  [
                    "and",
                    "live_ok",
                    "ref_ok"
                  ],
                  "LIVENESS + REFINEMENT KERNEL-VERIFIED"
                ],
                [
                  [
                    "not",
                    "live_ok"
                  ],
                  "LIVENESS COUNTEREXAMPLE: STUTTER STARVATION"
                ],
                [
                  "else",
                  "REFINEMENT VIOLATION: SILENT COMMIT SKIP"
                ]
              ]
            ]
          ],
          [
            "ui/grid",
            {
              "columns": 4,
              "gap": "md"
            },
            [
              "ui/metric",
              {
                "caption": [
                  "cond",
                  [
                    "live_ok",
                    "WF(advance) rules out infinite stutter"
                  ],
                  [
                    "else",
                    "Lasso counterexample synthesized live"
                  ]
                ],
                "label": "Quorum Liveness",
                "tone": [
                  "cond",
                  [
                    "live_ok",
                    "ok"
                  ],
                  [
                    "else",
                    "error"
                  ]
                ],
                "value": [
                  "cond",
                  [
                    "live_ok",
                    "PROVED"
                  ],
                  [
                    "else",
                    "LIVELOCK"
                  ]
                ]
              }
            ],
            [
              "ui/metric",
              {
                "caption": [
                  "cond",
                  [
                    "ref_ok",
                    "Every concrete step stutters or simulates spec"
                  ],
                  [
                    "else",
                    "Concrete crash_skip jumps past abstract step"
                  ]
                ],
                "label": "WAL Refinement",
                "tone": [
                  "cond",
                  [
                    "ref_ok",
                    "ok"
                  ],
                  [
                    "else",
                    "error"
                  ]
                ],
                "value": [
                  "cond",
                  [
                    "ref_ok",
                    "REFINES"
                  ],
                  [
                    "else",
                    "BROKEN"
                  ]
                ]
              }
            ],
            [
              "ui/metric",
              {
                "caption": "Exhaustively checked across both transition graphs",
                "label": "States Explored",
                "tone": "ok",
                "value": [
                  "number/toString",
                  "total_states"
                ]
              }
            ],
            [
              "ui/metric",
              {
                "caption": "Independent proof/valid? kernel check",
                "label": "Prevented P0 Risk",
                "tone": [
                  "cond",
                  [
                    [
                      "and",
                      "live_ok",
                      "ref_ok"
                    ],
                    "ok"
                  ],
                  [
                    "else",
                    "warn"
                  ]
                ],
                "value": [
                  "cond",
                  [
                    [
                      "and",
                      "live_ok",
                      "ref_ok"
                    ],
                    "$0 Risk"
                  ],
                  [
                    "else",
                    "$1.4M/hr"
                  ]
                ]
              }
            ]
          ],
          [
            "ui/section",
            {
              "step": "01",
              "subtitle": "Toggle scheduler fairness and WAL fault injection to watch Lion's temporal model checker switch between lasso counterexamples and kernel-checked certificates.",
              "title": "Protocol Fairness & Crash-Fault Controls"
            },
            [
              "ui/card",
              {
                "title": "Distributed Protocol Parameters"
              },
              [
                "ui/grid",
                {
                  "columns": 3,
                  "gap": "md"
                },
                [
                  "ui/toggle",
                  {
                    "checked": "wf_enabled",
                    "label": "Enforce Weak Fairness WF(advance)",
                    "onChange": [
                      "quote",
                      [
                        "fact",
                        [
                          "ctrl",
                          "wf_enabled",
                          "value"
                        ]
                      ]
                    ]
                  }
                ],
                [
                  "ui/toggle",
                  {
                    "checked": "wal_fault",
                    "label": "Inject WAL crash_skip (+2) Fault",
                    "onChange": [
                      "quote",
                      [
                        "fact",
                        [
                          "ctrl",
                          "wal_fault",
                          "value"
                        ]
                      ]
                    ]
                  }
                ],
                [
                  "ui/slider",
                  {
                    "label": "WAL Buffer Depth Bound",
                    "max": 6,
                    "min": 2,
                    "onChange": [
                      "quote",
                      [
                        "fact",
                        [
                          "ctrl",
                          "wal_depth",
                          "value"
                        ]
                      ]
                    ],
                    "step": 1,
                    "value": "wal_depth"
                  }
                ]
              ]
            ],
            [
              "ui/graph",
              {
                "edges": "edges",
                "height": 230,
                "layout": "layered",
                "nodes": "nodes",
                "title": "Consensus State Machine & WAL Abstraction Map"
              }
            ]
          ],
          [
            "ui/section",
            {
              "step": "02",
              "subtitle": "Both certificates are checked locally by Lion's trusted kernel without trusting the search engine.",
              "title": "Live Temporal Proof Certificates & Counterexamples"
            },
            [
              "ui/grid",
              {
                "columns": 2,
                "gap": "md"
              },
              [
                "ui/proof",
                {
                  "summary": [
                    "cond",
                    [
                      "live_ok",
                      "Under Weak Fairness WF(advance), every proposed transaction (s0) is mathematically guaranteed to reach Committed (s3)."
                    ],
                    [
                      "else",
                      "Without fairness, an adversarial scheduler loops on stutter forever — inspect the synthesized lasso cycle above."
                    ]
                  ],
                  "title": "Quorum Progress (proof/liveness)",
                  "valid": "live_valid"
                },
                "live_res"
              ],
              [
                "ui/proof",
                {
                  "summary": [
                    "cond",
                    [
                      "ref_ok",
                      "Buffered WAL {c, pending} is a stuttering-invariant refinement of the monotonic commit spec across all reachable buffer states."
                    ],
                    [
                      "else",
                      "Crash-recovery skip jumps commit counter by +2 in a single step — violating the abstract specification."
                    ]
                  ],
                  "title": "WAL Refinement (proof/refines)",
                  "valid": "ref_valid"
                },
                "ref_res"
              ]
            ],
            [
              "ui/table",
              {
                "columns": [
                  "quote",
                  [
                    {
                      "key": "property",
                      "label": "Formal Property"
                    },
                    {
                      "key": "spec",
                      "label": "Active Assumption / Fault"
                    },
                    {
                      "key": "checked",
                      "label": "State Space"
                    },
                    {
                      "key": "kernel",
                      "label": "Kernel Seal"
                    }
                  ]
                ],
                "rowKey": "id",
                "rows": "prop_rows",
                "title": "Verified Temporal Invariants Summary"
              }
            ]
          ]
        ]
      ]
    ],
    {
      "persist": true
    }
  ],
  [
    "view"
  ]
]