{
  "meta": {
    "version": "DungLang Federation 4.0",
    "disclaimer": "prototype / demo / showcase — not a full compiler, formal proof system, or distributed processing framework.",
    "history": [
      {
        "version": "Federation 1.0",
        "highlight": "Odor IR integration · CEK Cave Machine · Error Federation representative cases confirmed"
      },
      {
        "version": "Civilization v2.0",
        "highlight": "OdorOptimizer · Kont Federation · History Federation"
      },
      {
        "version": "Civilization v2.1",
        "highlight": "Temporal Banana Rewrite · Ghost Odor Archaeology · Causality Leak Detector"
      },
      {
        "version": "Civilization v2.2",
        "highlight": "OdorTypeInference · TwoPhaseCommit · WitnessCouncil"
      },
      {
        "version": "Civilization v3.0",
        "highlight": "Constitution Federation · Election System · CivMetrics · MythGenerator"
      },
      {
        "version": "Federation 4.0",
        "highlight": "Full-layer integration showcase · public release"
      }
    ]
  },
  "cek_demos": [
    {
      "name": "x=5, flush x",
      "frontend": "💩ScatLang",
      "ok": true,
      "steps": 17,
      "observed": [
        "💩×5"
      ]
    },
    {
      "name": "x=5, flush x",
      "frontend": "🌊SeaIR",
      "ok": true,
      "steps": 17,
      "observed": [
        "💩×5"
      ]
    },
    {
      "name": "x=5, flush x",
      "frontend": "🍠YakiimoIR",
      "ok": true,
      "steps": 17,
      "observed": [
        "💩×5"
      ]
    },
    {
      "name": "DungLang faint-odor demo",
      "frontend": "🦍DungLang",
      "phenomenon": {
        "odor": "faint",
        "suspect": "roasted sweet potato",
        "side_effect_level": 1
      },
      "ok": true,
      "odor_events": [
        {
          "level": 2,
          "source": "roasted sweet potato"
        }
      ]
    },
    {
      "name": "DungLang omnidirectional demo (diplomatic incident)",
      "frontend": "🦍DungLang",
      "phenomenon": {
        "odor": "omnidirectional",
        "suspect": "Mammoth",
        "side_effect_level": 3
      },
      "ok": false,
      "error": {
        "step": 68,
        "control_kind": "ReturnValue",
        "expr_kind": "💩×10",
        "kont_kind": "DiplomaticFlushK",
        "kont_depth": 1,
        "env_keys": [
          "odor_level"
        ],
        "observed_count": 0,
        "frontend": "🦍DungLang",
        "error_type": "CrossBorderOdorException",
        "error_message": "UhoTribe→BananaTribe Concentration:10 Reparations:20 bananas"
      },
      "note": "CrossBorderOdorException is an error by design. Blame-shifting engine: MeteorologicalGorilla's fault (by convention)"
    },
    {
      "name": "BananaGC demo",
      "frontend": "🍠YakiimoIR",
      "ok": true,
      "gc_banana": 3,
      "gc_erased": 0,
      "note": "Did something happen? Oh well. Uho 🍌"
    }
  ],
  "odor_optimizer": [
    {
      "original_level": 0,
      "optimized_level": 0,
      "strategy": "zero_elim"
    },
    {
      "original_level": 1,
      "optimized_level": 1,
      "strategy": "local_only"
    },
    {
      "original_level": 2,
      "optimized_level": 2,
      "strategy": "local_only"
    },
    {
      "original_level": 3,
      "optimized_level": 3,
      "strategy": "diplomatic_check_required"
    },
    {
      "original_level": 5,
      "optimized_level": 5,
      "strategy": "diplomatic_check_required"
    },
    {
      "original_level": 7,
      "optimized_level": 7,
      "strategy": "diplomatic_violation_const"
    },
    {
      "original_level": 10,
      "optimized_level": 10,
      "strategy": "diplomatic_violation_const"
    }
  ],
  "error_federation": {
    "cases": [
      {
        "case": "mod by zero",
        "trace_equal": true,
        "error_equal": true,
        "surface_diff": true,
        "step_left": 12,
        "step_right": 12,
        "left_error": {
          "step": 11,
          "control_kind": "ReturnValue",
          "expr_kind": "💩₀",
          "kont_kind": "ModRightK",
          "kont_depth": 2,
          "env_keys": [],
          "observed_count": 0,
          "frontend": "💩ScatLang",
          "error_type": "ScatError",
          "error_message": "mod by zero Uho"
        },
        "right_error": {
          "step": 11,
          "control_kind": "ReturnValue",
          "expr_kind": "💩₀",
          "kont_kind": "ModRightK",
          "kont_depth": 2,
          "env_keys": [],
          "observed_count": 0,
          "frontend": "🌊SeaIR",
          "error_type": "ScatError",
          "error_message": "mod by zero Uho"
        },
        "passed": true
      },
      {
        "case": "unbound variable",
        "trace_equal": true,
        "error_equal": true,
        "surface_diff": true,
        "step_left": 2,
        "step_right": 2,
        "left_error": {
          "step": 1,
          "control_kind": "EvalExpr",
          "expr_kind": "Var",
          "kont_kind": "FlushK",
          "kont_depth": 1,
          "env_keys": [],
          "observed_count": 0,
          "frontend": "💩ScatLang",
          "error_type": "ScatError",
          "error_message": "unbound variable: missing"
        },
        "right_error": {
          "step": 1,
          "control_kind": "EvalExpr",
          "expr_kind": "Var",
          "kont_kind": "FlushK",
          "kont_depth": 1,
          "env_keys": [],
          "observed_count": 0,
          "frontend": "🌊SeaIR",
          "error_type": "ScatError",
          "error_message": "unbound variable: missing"
        },
        "passed": true
      },
      {
        "case": "step limit / constipation",
        "trace_equal": true,
        "error_equal": true,
        "surface_diff": true,
        "step_left": 40,
        "step_right": 40,
        "left_error": {
          "step": 40,
          "control_kind": "EvalExpr",
          "expr_kind": "PoopSuccExpr",
          "kont_kind": "NeqRightK",
          "kont_depth": 2,
          "env_keys": [
            "x"
          ],
          "observed_count": 0,
          "frontend": "💩ScatLang",
          "error_type": "StepLimitError",
          "error_message": "step limit exceeded: 40"
        },
        "right_error": {
          "step": 40,
          "control_kind": "EvalExpr",
          "expr_kind": "PoopSuccExpr",
          "kont_kind": "NeqRightK",
          "kont_depth": 2,
          "env_keys": [
            "x"
          ],
          "observed_count": 0,
          "frontend": "🌊SeaIR",
          "error_type": "StepLimitError",
          "error_message": "step limit exceeded: 40"
        },
        "passed": true
      },
      {
        "case": "PhilosophyGorillaException (DungLang vs YakiimoIR)",
        "trace_equal": true,
        "error_equal": true,
        "surface_diff": true,
        "step_left": 2,
        "step_right": 2,
        "left_error": {
          "step": 1,
          "control_kind": "EvalExpr",
          "expr_kind": "PhilosophyExpr",
          "kont_kind": "AssignK",
          "kont_depth": 1,
          "env_keys": [],
          "observed_count": 0,
          "frontend": "🦍DungLang",
          "error_type": "PhilosophyGorillaException",
          "error_message": "To whom does a fart belong? Uho."
        },
        "right_error": {
          "step": 1,
          "control_kind": "EvalExpr",
          "expr_kind": "PhilosophyExpr",
          "kont_kind": "AssignK",
          "kont_depth": 1,
          "env_keys": [],
          "observed_count": 0,
          "frontend": "🍠YakiimoIR",
          "error_type": "PhilosophyGorillaException",
          "error_message": "To whom does a fart belong? Uho."
        },
        "passed": true
      }
    ],
    "all_passed": true
  },
  "civilization": {
    "constitution": {
      "articles": [
        {
          "article_no": 1,
          "title": "Witness Eligibility",
          "rule": "The PhilosophyGorilla may not serve as a witness"
        },
        {
          "article_no": 2,
          "title": "GhostOdor Presumption of Innocence",
          "rule": "GhostOdor shall not be directly presumed guilty"
        },
        {
          "article_no": 3,
          "title": "Banana History Rewrite Right",
          "rule": "A history rewrite may be filed with 3 or more bananas"
        },
        {
          "article_no": 4,
          "title": "Cross-Border Odor Diplomacy",
          "rule": "Cross-border GhostOdor events are diplomatic matters"
        }
      ]
    },
    "election": {
      "step": 200,
      "term_no": 18,
      "winners": [
        {
          "name": "LegalGorilla",
          "party": "Stone Tablet Rule-of-Law Party",
          "policy": "Strict Penalism"
        },
        {
          "name": "RevolutionGorilla",
          "party": "Cave Revolution Front",
          "policy": "Revolutionary Acquittalism"
        },
        {
          "name": "BananaPartyGorilla",
          "party": "Banana Party",
          "policy": "Banana Welfarism"
        }
      ],
      "vote_share": {
        "ResearchGorilla": 0.134,
        "MeteorologicalGorilla": 0.118,
        "LegalGorilla": 0.276,
        "BananaPartyGorilla": 0.206,
        "RevolutionGorilla": 0.266
      }
    },
    "ghost_verdict": "GhostOdor → Not Guilty. Odor is the people's self-expression. Uho.",
    "history_rewrites": [
      {
        "step": 300,
        "kind": "history_rewrite",
        "detail": "🍌×3: Official history rewritten",
        "frontend": "BananaGC",
        "era": "meta",
        "erased_event": "💨 Lv7(Mammoth)",
        "rewritten_as": "Declared to have never existed from the beginning"
      },
      {
        "step": 300,
        "kind": "history_rewrite",
        "detail": "🍌×3: Official history rewritten",
        "frontend": "BananaGC",
        "era": "meta",
        "erased_event": "🌍 UhoTribe→BananaTribe Concentration:7 Bananas:14",
        "rewritten_as": "Declared to have never existed from the beginning"
      }
    ],
    "metrics": {
      "stability": 68.5,
      "diplomatic_tension": 50,
      "philosophy_pollution": 36,
      "history_rewrite_rate": 12.5,
      "ghost_odor_count": 1,
      "myth_pressure": 92
    },
    "events": [
      {
        "step": 6,
        "kind": "odor",
        "detail": "💨 Lv7(Mammoth)",
        "frontend": "🦍DungLang",
        "era": "official"
      },
      {
        "step": 42,
        "kind": "diplomatic",
        "detail": "🌍 UhoTribe→BananaTribe Concentration:7 Bananas:14",
        "frontend": "🦍DungLang",
        "era": "official"
      },
      {
        "step": 55,
        "kind": "ghost_odor",
        "detail": "👻 Ghost Odor Lv5: CaveA committed · CaveB rolled back",
        "frontend": "2PCIR",
        "era": "liminal",
        "cave_a": "🦣CaveA",
        "cave_b": "🦣CaveB",
        "odor_level": 5
      },
      {
        "step": 120,
        "kind": "constitution",
        "detail": "⚖️ DungLang Constitution enacted: GhostOdor Presumption of Innocence adopted",
        "frontend": "ConstitutionIR",
        "era": "legal"
      },
      {
        "step": 150,
        "kind": "constitution_violation",
        "detail": "⚖️ Article 2 violation: GhostOdor directly presumed guilty",
        "frontend": "ConstitutionIR",
        "era": "legal",
        "article_no": 2,
        "article_title": "GhostOdor Presumption of Innocence",
        "offender": "LegalGorilla",
        "severity": 4
      },
      {
        "step": 151,
        "kind": "constitution_violation",
        "detail": "⚖️ Article 1 violation: PhilosophyGorilla used as witness",
        "frontend": "ConstitutionIR",
        "era": "legal",
        "article_no": 1,
        "article_title": "Witness Eligibility",
        "offender": "PhilosophyGorilla",
        "severity": 5
      },
      {
        "step": 200,
        "kind": "election",
        "detail": "🗳️ CouncilTerm #18: LegalGorilla, RevolutionGorilla, BananaPartyGorilla elected",
        "frontend": "ElectionIR",
        "era": "political"
      },
      {
        "step": 210,
        "kind": "council_verdict",
        "detail": "Council Verdict: GhostOdor → Not Guilty. Odor is the people's self-expression. Uho.",
        "frontend": "CouncilIR",
        "era": "political"
      },
      {
        "step": 300,
        "kind": "history_rewrite",
        "detail": "🍌×3: Official history rewritten",
        "frontend": "BananaGC",
        "era": "meta",
        "erased_event": "💨 Lv7(Mammoth)",
        "rewritten_as": "Declared to have never existed from the beginning"
      },
      {
        "step": 300,
        "kind": "artifact",
        "detail": "🪨 Cave painting trace: 💨 Lv7(Mammoth)",
        "frontend": "ArchaeologyIR",
        "era": "archaeological",
        "artifact_id": "ART-300-1",
        "source_event": "💨 Lv7(Mammoth)",
        "confidence": 0.5
      },
      {
        "step": 300,
        "kind": "history_rewrite",
        "detail": "🍌×3: Official history rewritten",
        "frontend": "BananaGC",
        "era": "meta",
        "erased_event": "🌍 UhoTribe→BananaTribe Concentration:7 Bananas:14",
        "rewritten_as": "Declared to have never existed from the beginning"
      },
      {
        "step": 300,
        "kind": "artifact",
        "detail": "🪨 Cave painting trace: 🌍 UhoTribe→BananaTribe Concentration:7 Bananas:14",
        "frontend": "ArchaeologyIR",
        "era": "archaeological",
        "artifact_id": "ART-300-2",
        "source_event": "🌍 UhoTribe→BananaTribe Concentration:7 Bananas:14",
        "confidence": 0.5
      },
      {
        "step": 300,
        "kind": "banana_gc",
        "detail": "🍌×3: 2 entries erased from official history",
        "frontend": "BananaGC",
        "era": "meta"
      },
      {
        "step": 450,
        "kind": "legend",
        "detail": "📜 Legend: Once an invisible odor passed from cave to cave. No one took responsibility, and only the stone tablets trembled.",
        "frontend": "MythIR",
        "era": "legendary",
        "source_events": [
          "💨 Lv7(Mammoth)",
          "🌍 UhoTribe→BananaTribe Concentration:7 Bananas:14",
          "👻 Ghost Odor Lv5: CaveA committed · CaveB rolled back"
        ]
      },
      {
        "step": 900,
        "kind": "myth",
        "detail": "✨ Myth: When three bananas were offered, the incident was erased from history. But the cave paintings did not stay silent, and GhostOdor returns as the wind of the night.",
        "frontend": "MythIR",
        "era": "mythic",
        "myth_id": "MYTH-GHOST-ODOR-001",
        "doctrine": "The odor does not vanish. Only the record does.",
        "source_events": [
          "💨 Lv7(Mammoth)",
          "🌍 UhoTribe→BananaTribe Concentration:7 Bananas:14",
          "👻 Ghost Odor Lv5: CaveA committed · CaveB rolled back"
        ]
      },
      {
        "step": 1050,
        "kind": "religion",
        "detail": "⛪ Church of GhostOdor Founded: Doctrine — \"The odor does not vanish; only the record does.\"",
        "frontend": "MythIR",
        "era": "religious"
      }
    ],
    "official_history": [
      {
        "step": 120,
        "kind": "constitution",
        "detail": "⚖️ DungLang Constitution enacted: GhostOdor Presumption of Innocence adopted",
        "frontend": "ConstitutionIR",
        "era": "legal"
      },
      {
        "step": 200,
        "kind": "election",
        "detail": "🗳️ CouncilTerm #18: LegalGorilla, RevolutionGorilla, BananaPartyGorilla elected",
        "frontend": "ElectionIR",
        "era": "political"
      },
      {
        "step": 210,
        "kind": "council_verdict",
        "detail": "Council Verdict: GhostOdor → Not Guilty. Odor is the people's self-expression. Uho.",
        "frontend": "CouncilIR",
        "era": "political"
      }
    ],
    "archaeology": [
      {
        "step": 300,
        "kind": "artifact",
        "detail": "🪨 Cave painting trace: 💨 Lv7(Mammoth)",
        "frontend": "ArchaeologyIR",
        "era": "archaeological",
        "artifact_id": "ART-300-1",
        "source_event": "💨 Lv7(Mammoth)",
        "confidence": 0.5
      },
      {
        "step": 300,
        "kind": "artifact",
        "detail": "🪨 Cave painting trace: 🌍 UhoTribe→BananaTribe Concentration:7 Bananas:14",
        "frontend": "ArchaeologyIR",
        "era": "archaeological",
        "artifact_id": "ART-300-2",
        "source_event": "🌍 UhoTribe→BananaTribe Concentration:7 Bananas:14",
        "confidence": 0.5
      }
    ],
    "myths": [
      {
        "step": 450,
        "kind": "legend",
        "detail": "📜 Legend: Once an invisible odor passed from cave to cave. No one took responsibility, and only the stone tablets trembled.",
        "frontend": "MythIR",
        "era": "legendary",
        "source_events": [
          "💨 Lv7(Mammoth)",
          "🌍 UhoTribe→BananaTribe Concentration:7 Bananas:14",
          "👻 Ghost Odor Lv5: CaveA committed · CaveB rolled back"
        ]
      },
      {
        "step": 900,
        "kind": "myth",
        "detail": "✨ Myth: When three bananas were offered, the incident was erased from history. But the cave paintings did not stay silent, and GhostOdor returns as the wind of the night.",
        "frontend": "MythIR",
        "era": "mythic",
        "myth_id": "MYTH-GHOST-ODOR-001",
        "doctrine": "The odor does not vanish. Only the record does.",
        "source_events": [
          "💨 Lv7(Mammoth)",
          "🌍 UhoTribe→BananaTribe Concentration:7 Bananas:14",
          "👻 Ghost Odor Lv5: CaveA committed · CaveB rolled back"
        ]
      },
      {
        "step": 1050,
        "kind": "religion",
        "detail": "⛪ Church of GhostOdor Founded: Doctrine — \"The odor does not vanish; only the record does.\"",
        "frontend": "MythIR",
        "era": "religious"
      }
    ],
    "replay": [
      "📜 Replay Federation 4.0",
      "  step    6 | 💨 [official] 💨 Lv7(Mammoth)",
      "  step   42 | 🌍 [official] 🌍 UhoTribe→BananaTribe Concentration:7 Bananas:14",
      "  step   55 | 👻 [liminal] 👻 Ghost Odor Lv5: CaveA committed · CaveB rolled back",
      "  step  120 | ⚖️ [legal] ⚖️ DungLang Constitution enacted: GhostOdor Presumption of Innocence adopted",
      "  step  150 | 🚨 [legal] ⚖️ Article 2 violation: GhostOdor directly presumed guilty",
      "  step  151 | 🚨 [legal] ⚖️ Article 1 violation: PhilosophyGorilla used as witness",
      "  step  200 | 🗳️ [political] 🗳️ CouncilTerm #18: LegalGorilla, RevolutionGorilla, BananaPartyGorilla elected",
      "  step  210 | 🏛️ [political] Council Verdict: GhostOdor → Not Guilty. Odor is the people's self-expression. Uho.",
      "  step  300 | 🪨 [archaeological] 🪨 Cave painting trace: 🌍 UhoTribe→BananaTribe Concentration:7 Bananas:14",
      "  step  300 | 🪨 [archaeological] 🪨 Cave painting trace: 💨 Lv7(Mammoth)",
      "  step  300 | 🍌 [meta] 🍌×3: 2 entries erased from official history",
      "  step  300 | 📜🔥 [meta] 🍌×3: Official history rewritten",
      "  step  300 | 📜🔥 [meta] 🍌×3: Official history rewritten",
      "  step  450 | 📜 [legendary] 📜 Legend: Once an invisible odor passed from cave to cave. No one took responsibility, and only the stone tablets trembled.",
      "  step  900 | ✨ [mythic] ✨ Myth: When three bananas were offered, the incident was erased from history. But the cave paintings did not stay silent, and GhostOdor returns as the wind of the night.",
      "  step 1050 | ⛪ [religious] ⛪ Church of GhostOdor Founded: Doctrine — \"The odor does not vanish; only the record does.\""
    ]
  }
}
