🏛️ Atlas✒️Formalizations.Logic.SynapseGate view on GitHub ↗12 theorems
/-Copyright (c) 2026 Carles Marín. All rights reserved.Released under Apache 2.0 license as described in the file LICENSE.Authors: Carles Marín-/module public import Mathlib.Data.List.Forall2 /-!# Decision rule of the SYNAPSE profile receipt A three-valued decision rule on lists of obligation statuses (`pasa`, `falla`, `noAplica`, `indet`)with a priority flag: any failure rejects; all passes without the priority flag accepts; otherwisethe verdict is inconclusive. We prove the elementary guarantees of the rule, not of the truth of theclaims: characterisations of acceptance and rejection, monotonicity under pointwise improvement ofstatuses (ablation), and a bounded impossibility for indistinguishable views. The rule coincideswith the author's implementation on all 680 combinations of 1 to 4 obligations. ## Main results * `SynapseGate.decidir_aceptada_iff`: accepted iff no priority flag and every obligation passes* `SynapseGate.decidir_rechazada_iff`: rejected iff some obligation fails* `SynapseGate.declarado_no_acepta`: a declared non-passing obligation blocks acceptance* `SynapseGate.monotonia`: improving statuses pointwise preserves acceptance; worsening preserves rejection* `SynapseGate.indistinguibles_no_aceptan`: a sound gate never accepts a view indistinguishable from a false one ## References * C. Marín, *SYNAPSE v2: Evidence Receipts and Verification Limits for AI Agents in Mathematical Research*, working draft (29 November 2026).-/ @[expose] public section namespace SynapseGate /-- Status of one obligation of the receipt: passed, failed, not applicable, undecided. -/inductive Estado | pasa | falla | noAplica | indet  deriving DecidableEq, Repr /-- Verdict of the receipt: accepted, rejected, inconclusive. -/inductive Decision | aceptada | rechazada | inconclusa  deriving DecidableEq, Repr /-- Same rule as the Python: any `falla` ⇒ rechazada; all `pasa` and not priority ⇒ aceptada;otherwise inconclusa. -/def decidir (obl : List Estado) (esPrioridad : Bool) : Decision :=  if .falla ∈ obl then .rechazada  else if (∀ e ∈ obl, e = .pasa) ∧ esPrioridad = false then .aceptada  else .inconclusa private theorem d_rech {obl : List Estado} {p : Bool} (h : Estado.falla ∈ obl) :    decidir obl p = .rechazada := by  simp [decidir, h] private theorem d_acc {obl : List Estado} {p : Bool} (h1 : ¬ Estado.falla ∈ obl)    (H : (∀ e ∈ obl, e = Estado.pasa) ∧ p = false) : decidir obl p = .aceptada := by  simp [decidir, h1, H.2]  exact H.1 private theorem d_inc {obl : List Estado} {p : Bool} (h1 : ¬ Estado.falla ∈ obl)    (H : ¬ ((∀ e ∈ obl, e = Estado.pasa) ∧ p = false)) : decidir obl p = .inconclusa := by  simp only [decidir, h1, H, ↓reduceIte] /-- Acceptance holds exactly when the claim is not a priority one and every obligation passed. -/theorem decidir_aceptada_iff (obl : List Estado) (p : Bool) :    decidir obl p = .aceptada ↔ (p = false ∧ ∀ e ∈ obl, e = .pasa) := by  constructor  · intro h    by_cases h1 : Estado.falla ∈ obl    · rw [d_rech h1] at h; cases h    · by_cases H : (∀ e ∈ obl, e = Estado.pasa) ∧ p = false      · exact ⟨H.2, H.1⟩      · rw [d_inc h1 H] at h; cases h  · rintro ⟨hp, hall⟩    have h1 : ¬ Estado.falla ∈ obl := fun hf => by      have := hall _ hf; cases this    exact d_acc h1 ⟨hall, hp⟩ /-- Rejection holds exactly when some obligation failed. -/theorem decidir_rechazada_iff (obl : List Estado) (p : Bool) :    decidir obl p = .rechazada ↔ .falla ∈ obl := by  constructor  · intro h    by_contra h1    by_cases H : (∀ e ∈ obl, e = Estado.pasa) ∧ p = false    · rw [d_acc h1 H] at h; cases h    · rw [d_inc h1 H] at h; cases h  · exact d_rech /-- A declared obligation that does not pass blocks acceptance. -/theorem declarado_no_acepta (obl : List Estado) (p : Bool)    (h : ∃ e ∈ obl, e ≠ .pasa) : decidir obl p ≠ .aceptada := by  intro hd  obtain ⟨e, he, hne⟩ := h  exact hne (((decidir_aceptada_iff obl p).1 hd).2 e he) /-- Information order on statuses: `falla < noAplica, indet < pasa`. -/def rango : Estado → Nat  | .falla => 0  | .noAplica => 1  | .indet => 1  | .pasa => 2 private theorem pasa_of_rango {a b : Estado} (h : rango a ≤ rango b) (ha : a = .pasa) :    b = .pasa := by  subst ha; cases b <;> simp [rango] at h ⊢ private theorem falla_of_rango {a b : Estado} (h : rango a ≤ rango b) (hb : b = .falla) :    a = .falla := by  subst hb; cases a <;> simp [rango] at h ⊢ private theorem mem_pre {R : Estado → Estado → Prop} {l l' : List Estado}    (h : List.Forall₂ R l l') : ∀ e', e' ∈ l' → ∃ e ∈ l, R e e' := by  induction h with  | nil => intro e' he'; cases he'  | @cons a b _ _ hab _ ih =>    intro e' he'    rcases List.mem_cons.mp he' with rfl | hm    · exact ⟨a, List.mem_cons_self, hab⟩    · obtain ⟨x, hx, hxr⟩ := ih e' hm      exact ⟨x, List.mem_cons_of_mem _ hx, hxr⟩ private theorem mem_post {R : Estado → Estado → Prop} {l l' : List Estado}    (h : List.Forall₂ R l l') : ∀ e, e ∈ l → ∃ e' ∈ l', R e e' := by  induction h with  | nil => intro e he; cases he  | @cons a b _ _ hab _ ih =>    intro e he    rcases List.mem_cons.mp he with rfl | hm    · exact ⟨b, List.mem_cons_self, hab⟩    · obtain ⟨x, hx, hxr⟩ := ih e hm      exact ⟨x, List.mem_cons_of_mem _ hx, hxr⟩ /-- Monotonicity (ablation): improving statuses pointwise keeps acceptance; worsening keeps rejection. -/theorem monotonia (obl obl' : List Estado) (p : Bool)    (h : List.Forall₂ (fun a b => rango a ≤ rango b) obl obl') :    (decidir obl p = .aceptada → decidir obl' p = .aceptada) ∧    (decidir obl' p = .rechazada → decidir obl p = .rechazada) := by  constructor  · intro hd    rw [decidir_aceptada_iff] at hd ⊢    refine ⟨hd.1, fun e' he' => ?_⟩    obtain ⟨e, he, hr⟩ := mem_pre h e' he'    exact pasa_of_rango hr (hd.2 e he)  · intro hd    rw [decidir_rechazada_iff] at hd ⊢    obtain ⟨e, he, hr⟩ := mem_pre h _ hd    have := falla_of_rango hr rfl    rw [this] at he    exact he /-- Bounded impossibility: if a gate cannot tell `m₁` from a false `m₂` (same view) and is sound, itdoes not accept `m₁`. -/theorem indistinguibles_no_aceptan {M V : Type} (vista : M → V) (G : M → Bool)    (hG : ∀ m₁ m₂, vista m₁ = vista m₂ → G m₁ = G m₂)    (verdad : M → Prop) (hsol : ∀ m, G m = true → verdad m)    (m₁ m₂ : M) (hv : vista m₁ = vista m₂) (hn : ¬ verdad m₂) : G m₁ = false := by  cases h : G m₁ with  | false => rfl  | true => exact absurd (hsol m₂ (by rw [← hG m₁ m₂ hv]; exact h)) hn end SynapseGate