{
  "id": "7245",
  "ident": "NS.07245",
  "slug": "papers-branchingvas--reachable-example",
  "title": "Decidability of reachability for branching vector addition systems · reachable_example",
  "status": "test",
  "statement_status": "reviewed",
  "statement_md": "The vector [0, 0, 12] is reachable in the first example BVAS.",
  "subjects": [
    "math.LO",
    "math.CO",
    "msc:03",
    "msc:68"
  ],
  "tags": [],
  "collection": "papers",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "BranchingVAS.reachable_example",
  "statement_lean": "theorem reachable_example : exampleBvas.Reachable ![0,0,12]",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Decidability of reachability for branching vector addition systems\n\nA *branching vector addition system* (BVAS) of dimension `d` is given by a finite\nlist of *axioms*, a finite list of *unary rules*, and a finite list of *binary\nrules*, each of which is a vector in `ℤ^d`. A *configuration* is a vector in `ℕ^d`,\nwhich here is represented as a vector `v ∈ ℤ^d` subject to `0 ≤ v`. The set of\n*reachable* configurations is defined inductively:\n\n* every axiom that is a valid configuration (i.e. lies in `ℕ^d`) is reachable;\n* if `v` is a reachable configuration, `r` is a unary rule and `v + r ∈ ℕ^d`, then\n  `v + r` is reachable;\n* if `v₁, v₂` are both reachable configurations, `r` is a binary rule and\n  `v₁ + v₂ + r ∈ ℕ^d`, then `v₁ + v₂ + r` is reachable.\n\nModelling axioms as vectors in `ℤ^d` and only counting the non-negative ones as\nreachable yields the same set of reachable configurations as the usual definition\nin which axioms are required to lie in `ℕ^d`.\n\nBranching vector addition systems are distinguished from ordinary vector addition systems (VAS) by allowing binary rules. VAS reachability is known to be decidable.\n\n*References:*\n- [The covering and boundedness problems for branching vector addition systems](https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.FSTTCS.2009.2317)\n  (*Stéphane Demri, Marcin Jurdziński, Oded Lachish, Ranko Lazić*, FSTTCS 2009)\n  Gives a similar definition of BVAS, and compares it to related equivalent definitions.\n- [On the Reachability Problem for Two-Dimensional Branching VASS](https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.MFCS.2025.22)\n  by *Clotilde Bizière, Thibault Hilaire, Jérôme Leroux, Grégoire Sutre*, MFCS 2025, which\n  settles the two-dimensional case and states that \"the decidability status of the reachability\n  problem for BVASS remains open in higher dimensions\".\n- [The General Vector Addition System Reachability Problem by Presburger Inductive\n  Invariants](https://arxiv.org/abs/1009.1076) by *Jérôme Leroux* (2010), for the decidability\n  of reachability for ordinary VAS.\n- [Solving the Reachability Problem for Branching Vector Addition Systems via Semilinear\n  Inductive Invariants](https://arxiv.org/abs/2607.09558) by *Clotilde Bizière, Jérôme Leroux,\n  Grégoire Sutre* (2026), a recent preprint claiming a positive resolution to the conjecture:\n  reachability for branching vector addition systems is decidable.\n-/\n\n@[expose] public section\n\nnamespace BranchingVAS\n\n/--\nA branching vector addition system of dimension `d`.\n-/\nstructure Bvas (d : ℕ) where\n  axioms : List (Fin d → ℤ)\n  unaryRules : List (Fin d → ℤ)\n  binaryRules : List (Fin d → ℤ)\n\n/-- The reachable configurations of a branching vector addition system. -/\ninductive Bvas.Reachable {d : ℕ} (b : Bvas d) : (Fin d → ℤ) → Prop\n  | base {v : Fin d → ℤ} (hmem : v ∈ b.axioms) (hcfg : 0 ≤ v) : b.Reachable v\n  | unary {v r w : Fin d → ℤ} (hv : b.Reachable v) (hr : r ∈ b.unaryRules)\n      (hcfg : 0 ≤ w) (hw : w = v + r) : b.Reachable w\n  | binary {v₁ v₂ r w : Fin d → ℤ} (hv₁ : b.Reachable v₁) (hv₂ : b.Reachable v₂)\n      (hr : r ∈ b.binaryRules) (hcfg : 0 ≤ w) (hw : w = v₁ + v₂ + r) : b.Reachable w\n\n/--\nThe vector in `ℤ^d` whose `i`-th coordinate is the `i`-th entry of the list `l`, or `0` if `l`\nhas fewer than `i + 1` entries. Used to encode the inputs of the reachability problem.\n-/\ndef vecOfList (d : ℕ) (l : List ℤ) : Fin d → ℤ := fun i => l.getD i 0\n\n@[category API, AMS 3 68]\ntheorem vecOfList_ofFn {d : ℕ} (v : Fin d → ℤ) : vecOfList d (List.ofFn v) = v := by\n  funext i\n  simp [vecOfList, List.getD_eq_getElem?_getD]\n\n@[category API, AMS 3 68]\ntheorem ofFn_vecOfList (d : ℕ) (l : List ℤ) :\n    List.ofFn (vecOfList d l) = (List.range d).map fun i => l.getD i 0 := by\n  rw [List.ofFn_eq_map, ← List.map_coe_finRange_eq_range, List.map_map]\n  rfl\n\n@[category API, AMS 3 68]\ntheorem primrec_ofFn_vecOfList : Primrec₂ fun d l => List.ofFn (vecOfList d l) :=\n  (Primrec.list_map (Primrec.list_range.comp Primrec.fst)\n    ((Primrec.list_getD 0).comp₂ (Primrec.snd.comp₂ Primrec₂.left) Primrec₂.right)).of_eq\n      fun ⟨d, l⟩ => (ofFn_vecOfList d l).symm\n\n/--\nAn input of the reachability problem, that is, a dimension `d`, a branching vector addition\nsystem of dimension `d` and a target vector in `ℤ^d`, is encoded by `d` together with the lists\nof entries of the axioms, of the rules and of the target.\n-/\ninstance : Primcodable (Σ d : ℕ, Bvas d × (Fin d → ℤ)) :=\n  Primcodable.ofLeftInverse\n    (fun p => (p.1, p.2.1.axioms.map List.ofFn, p.2.1.unaryRules.map List.ofFn,\n      p.2.1.binaryRules.map List.ofFn, List.ofFn p.2.2))\n    (fun q => ⟨q.1, ⟨q.2.1.map (vecOfList q.1), q.2.2.1.map (vecOfList q.1),\n      q.2.2.2.1.map (vecOfList q.1)⟩, vecOfList q.1 q.2.2.2.2⟩)\n    (fun p => by simp [List.map_map, Function.comp_def, vecOfList_ofFn])\n    (by\n      have h : Primrec fun q : ℕ × List (List ℤ) × List (List ℤ) × List (List ℤ) × List ℤ =>\n          (q.1, q.2.1.map fun l => List.ofFn (vecOfList q.1 l),\n            q.2.2.1.map fun l => List.ofFn (vecOfList q.1 l),\n            q.2.2.2.1.map fun l => List.ofFn (vecOfList q.1 l),\n            List.ofFn (vecOfList q.1 q.2.2.2.2)) :=\n        Primrec.pair Primrec.fst <| Primrec.pair (Primrec.list_map (Primrec.fst.comp Primrec.snd)\n            (primrec_ofFn_vecOfList.comp₂ (Primrec.fst.comp₂ Primrec₂.left) Primrec₂.right)) <|\n          Primrec.pair (Primrec.list_map (Primrec.fst.comp <| Primrec.snd.comp Primrec.snd)\n            (primrec_ofFn_vecOfList.comp₂ (Primrec.fst.comp₂ Primrec₂.left) Primrec₂.right)) <|\n          Primrec.pair\n            (Primrec.list_map\n              (Primrec.fst.comp <| Primrec.snd.comp <| Primrec.snd.comp Primrec.snd)\n              (primrec_ofFn_vecOfList.comp₂ (Primrec.fst.comp₂ Primrec₂.left) Primrec₂.right))\n            (primrec_ofFn_vecOfList.comp Primrec.fst\n              (Primrec.snd.comp <| Primrec.snd.comp <| Primrec.snd.comp Primrec.snd))\n      exact h.of_eq fun q => by simp [List.map_map, Function.comp_def])\n\n/--\nThe reachability problem for branching vector addition systems is decidable.\n\nThat is, the predicate taking a dimension `d`, a branching vector addition system `b` of\ndimension `d` and a target vector `t ∈ ℤ^d`, and returning whether `t` is reachable in `b`, is\na computable predicate. Note that the dimension is part of the input: a single algorithm must\nwork for all dimensions.\n\nAs of August 2026, the solution is quite recently announced and is not\nyet peer-reviewed.\n-/\n@[category research solved, AMS 3 68]\ntheorem reachability_decidable :\n    ComputablePred fun p : Σ d : ℕ, Bvas d × (Fin d → ℤ) => p.2.1.Reachable p.2.2 := by\n  sorry\n\n/-- Every axiom that is non-negative is reachable. -/\n@[category test, AMS 3 68]\ntheorem reachable_of_mem_axioms {d : ℕ} (b : Bvas d) {v : Fin d → ℤ}\n    (hmem : v ∈ b.axioms) (hcfg : 0 ≤ v) : b.Reachable v :=\n  .base hmem hcfg\n\n/-- Reachable vectors are always non-negative. -/\n@[category test, AMS 3 68]\ntheorem reachable_imp_pos {d : ℕ} (v : Fin d → ℤ) (b : Bvas d) :\n    b.Reachable v → 0 ≤ v := by\n  intro h; cases h; all_goals assumption\n\n/-- A small BVAS of dimension 3 used for a test below. -/\ndef exampleBvas : Bvas 3 := {\n  axioms := [![3,1,0], ![0,0,0]],\n  unaryRules := [![1,-10,-10], ![-1,0,1]],\n  binaryRules := [![-1,-1,10]],\n}\n\n/--\nA small (indeed, degenerate, since it contains no binary rules) BVAS of\ndimension 2 used for a test below.\n-/\ndef exampleBvas2 : Bvas 2 := {\n  axioms := [![10,0]],\n  unaryRules := [![-1, 1]],\n  binaryRules := [],\n}\n\n/--\nThe vector [0, 0, 12] is reachable in the first example BVAS.\n-/\n@[category test, AMS 3 68]\ntheorem reachable_example : exampleBvas.Reachable ![0,0,12] :=\n  have h1 : exampleBvas.Reachable ![3,1,0] := .base\n    (by decide)\n    (by intro i; fin_cases i <;> simp)\n  have h2 : exampleBvas.Reachable ![0,0,0] := .base\n    (by decide)\n    (by intro i; fin_cases i <;> simp)\n  have h3 : exampleBvas.Reachable ![2,0,10] := by\n    refine .binary (r := ![-1, -1, 10]) h1 h2 (by decide) ?_ (by decide)\n    intro i; fin_cases i <;> simp\n  have h4 : exampleBvas.Reachable ![1,0,11] := by\n    refine .unary  (r := ![-1, 0, 1]) h3 (by decide) ?_ (by decide)\n    intro i; fin_cases i <;> simp\n  have h5 : exampleBvas.Reachable ![0,0,12] := by\n    refine .unary (r := ![-1, 0, 1]) h4 (by decide) ?_ (by decide)\n    intro i; fin_cases i <;> simp\n  h5\n\n/--\nThe vector [0, 0] is not reachable in the second example BVAS.\n-/\n@[category test, AMS 3 68]\ntheorem not_reachable_example : ¬ exampleBvas2.Reachable ![0,0] := by\n  let rec invariant (v : Fin 2 → ℤ) :\n      (hv : exampleBvas2.Reachable v) → v 0 + v 1 = 10\n    | .base hmem hcfg => by fin_cases hmem; simp\n    | .unary hv hr hcfg hw => by\n        fin_cases hr;\n        · rw [hw]\n          simp only [Pi.add_apply, Matrix.cons_val_zero, Matrix.cons_val_one]\n          ring_nf\n          exact invariant _ hv\n    | .binary _ _ hr _ _ => by fin_cases hr\n  intro h\n  simpa using invariant _ h\n\nend BranchingVAS\n",
  "statement_hash": "ae2be1f3a9635caa2b97465ad18868c43d6a88f6db5f0cdf9095202c4aa60a05",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}