Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Definitions for Routing entanglement in the quantum internet

Definition
QAlgorithms_Papers_Independent_Intakethird100_P45

by Gohan · Nov 1, 2026 · Mathlib 0df444a (Lean v4.33.1)

prove2quantum

The objects the formalized statements of Routing entanglement in the quantum internet (arXiv:1708.07142) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • iidMass: PDF p.4: joint mass of independent homogeneous success flags. Each index is one attempt. For 0 ≤ p ≤ 1 this is a probability mass function.
  • bernoulliFlagEvent: PDF p.4: event probability computed from independent physical attempts.
  • retainedLinkProbability: PDF p.4: at most one ebit is retained, iff some parallel attempt succeeds.
  • chainProbability: PDF p.4: unconditional success of a fixed chain, requiring all k external links and all k-1 prescribed BSMs. Pairings precede outcomes.
  • latticeDistance: PDF pp.4–5: Manhattan adjacency for physical grid edges. This is not the local protocol's Euclidean distance used in choosing neighbors.
  • GridNetwork: PDF pp.4–5: distinct sites of a finite square-grid network. Physical edges are all nearest-neighbor pairs; successful subgraphs can delete edges.
  • Edge: PDF p.4: an edge label, canonically ordered to avoid double counting.
  • edgeKey: PDF p.4: one undirected physical-edge label, in either orientation.
  • physicalEdges: PDF pp.4–5: the network's physical edges, each with at most one usable pair.
  • endpointDegree: PDF p.4: the physical degree of a terminal.
  • PortTrailEncoding: PDF pp.4–5: finite candidate trail encoding. r.1.val counts its BSMs, and r.1.val+1 counts its external edges. An edge-simple trail has at most N*N edges, so the bound loses none. Validity is imposed separately.
  • routeLength: PDF p.4: the number of external edges in a candidate trail.
  • routeEdge: PDF p.4: the undirected physical edge traversed at a trail step.
  • routeEdges: PDF pp.4–5: physical memories consumed by the trail, as edge labels.
  • ValidRoute: PDF pp.4–5: trail in a successful external graph. Distinct edges impose one use per memory, while permitting repeated repeater vertices on different ports. Neither terminal may be an internal repeater of its own flow.
  • candidateRoutes: PDF p.5: admissible trails computed from the successful external graph.
  • FeasibleFamily: PDF p.5: a simultaneous one-slot BSM schedule for the designated flow. Shared repeater vertices are allowed; shared physical memories are not. The schedule is selected from external flags before BSM outcomes.
  • InternalFlags: PDF p.4: BSM flags indexed by each selected trail's internal positions. Unselected coordinates are ignored. In a feasible family selected coordinates are distinct physical BSMs because they consume distinct incident memories.
  • deliveredCount: PDF p.4: the actual integer number of delivered ebits in one slot. Feasibility requires the selected external links to have succeeded already.
  • conditionalYield: PDF p.5: conditional expected yield, after external flags and before BSM flags. Each selected trail contributes q^(length-1); the sum uses linearity of expectation, rather than multiplying path-success probabilities.
  • feasibleFamilies: PDF p.5: finite set of all feasible schedules, including the empty one.
  • shortestRoute: PDF p.5: select a shortest surviving route, with a minimizing tie choice fixed independently of future BSM outcomes. A shortest trail is a simple path.
  • greedySteps: PDF p.5: shortest-path greedy, deleting physical edges after every choice. An initial physical-edge count of fuel suffices because every route consumes at least one remaining edge. No schedule depends on future BSM flags.
  • greedyFamily: PDF p.5: the complete prescribed greedy schedule in a successful graph.
  • conditionalOptimum: PDF p.5: the actual finite optimum over one-slot BSM schedules, computed from the successful graph. This is not a free function constrained by the desired bound. Randomizing schedules cannot improve a finite maximum.
  • externalMass: PDF pp.4–5: probability of exactly a given external outcome H. Callers sum over subsets, so subtraction counts failures without truncation. Zero exponents express empty products, including at p=0,1.
  • greedyRate: PDF p.5: greedy expected ebits per slot, averaging the actual protocol path-sum yield over independent external-success subsets.
  • optimalGlobalRate: PDF p.5: globally optimal one-slot pairwise-swap expected yield. Only external flags are observed before selecting the optimal schedule.
Definition code
import Mathlib

/-!
# Routing entanglement in the quantum internet: finite one-slot results

Pant et al., arXiv:1708.07142v2, PDF pp.4–5. Only heralded loss is
represented: successful external links are perfect EPR pairs, and successful
BSMs join pairs. External attempts precede simultaneous internal attempts.
Memories last one slot and are used in at most one BSM; terminals retain their
halves. No purification, inter-slot storage, or general quantum processing is
included. Rates are expected delivered ebits per slot, not channel capacities.

A port-disjoint BSM schedule decomposes into terminal trails, other trails,
and cycles. Only trails joining the designated pair contribute. Conversely,
an edge-disjoint family below prescribes those BSMs, leaving other memories
idle. Trails may revisit a repeater on different ports, but may not reuse a
physical edge or pass internally through either terminal. Thus optimization
allows two BSMs per degree-four repeater and is not vertex-disjoint routing.
The finite maximum is computed before any future BSM flags are revealed.

Local-rule lattice claims and empirical claims are deferred in HARD.md.
-/

namespace QAlgorithms.Papers.Independent.Intakethird100.P45

open scoped BigOperators

noncomputable section

/-- PDF p.4: joint mass of independent homogeneous success flags. Each index
is one attempt. For `0 ≤ p ≤ 1` this is a probability mass function. -/
def iidMass {I : Type*} [Fintype I] (p : ℝ) (flags : I → Bool) : ℝ :=
  ∏ i, if flags i then p else 1 - p

/-- PDF p.4: event probability computed from independent physical attempts. -/
def bernoulliFlagEvent {I : Type*} [Fintype I] (p : ℝ) (event : (I → Bool) → Prop) : ℝ := by
  classical
  exact ∑ flags : I → Bool, if event flags then iidMass p flags else 0

/-- PDF p.4: at most one ebit is retained, iff some parallel attempt succeeds. -/
def retainedLinkProbability (S : ℕ) (p0 : ℝ) : ℝ :=
  bernoulliFlagEvent (I := Fin S) p0 (fun flags => ∃ i, flags i = true)

/-- PDF p.4: unconditional success of a fixed chain, requiring all `k`
external links and all `k-1` prescribed BSMs. Pairings precede outcomes. -/
def chainProbability (k : ℕ) (p q : ℝ) : ℝ := by
  classical
  exact ∑ external : Fin k → Bool, ∑ internal : Fin (k - 1) → Bool,
    if (∀ i, external i = true) ∧ (∀ j, internal j = true) then
      iidMass p external * iidMass q internal else 0

/-- PDF pp.4–5: Manhattan adjacency for physical grid edges. This is not
the local protocol's Euclidean distance used in choosing neighbors. -/
def latticeDistance (a b : ℤ × ℤ) : ℕ :=
  (a.1 - b.1).natAbs + (a.2 - b.2).natAbs

/-- PDF pp.4–5: distinct sites of a finite square-grid network. Physical
edges are all nearest-neighbor pairs; successful subgraphs can delete edges. -/
structure GridNetwork (N : ℕ) where
  position : Fin N → ℤ × ℤ
  injective_position : Function.Injective position

/-- PDF p.4: an edge label, canonically ordered to avoid double counting. -/
abbrev Edge (N : ℕ) := Fin N × Fin N

/-- PDF p.4: one undirected physical-edge label, in either orientation. -/
def edgeKey {N : ℕ} (a b : Fin N) : Edge N :=
  (min a b, max a b)

/-- PDF pp.4–5: the network's physical edges, each with at most one usable pair. -/
def physicalEdges {N : ℕ} (G : GridNetwork N) : Finset (Edge N) := by
  classical
  exact Finset.univ.filter (fun e => e.1 < e.2 ∧
    latticeDistance (G.position e.1) (G.position e.2) = 1)

/-- PDF p.4: the physical degree of a terminal. -/
def endpointDegree {N : ℕ} (G : GridNetwork N) (a : Fin N) : ℕ := by
  classical
  exact ((physicalEdges G).filter (fun e => e.1 = a ∨ e.2 = a)).card

/-- PDF pp.4–5: finite candidate trail encoding. `r.1.val` counts its BSMs,
and `r.1.val+1` counts its external edges. An edge-simple trail has at most
`N*N` edges, so the bound loses none. Validity is imposed separately. -/
abbrev PortTrailEncoding (N : ℕ) := Σ k : Fin (N * N), Fin (k.val + 2) → Fin N

/-- PDF p.4: the number of external edges in a candidate trail. -/
def routeLength {N : ℕ} (r : PortTrailEncoding N) : ℕ := r.1.val + 1

/-- PDF p.4: the undirected physical edge traversed at a trail step. -/
def routeEdge {N : ℕ} (r : PortTrailEncoding N) (i : Fin (r.1.val + 1)) : Edge N :=
  edgeKey (r.2 ⟨i.val, by omega⟩) (r.2 ⟨i.val + 1, by omega⟩)

/-- PDF pp.4–5: physical memories consumed by the trail, as edge labels. -/
def routeEdges {N : ℕ} (r : PortTrailEncoding N) : Finset (Edge N) := by
  classical
  exact Finset.univ.image (routeEdge r)

/-- PDF pp.4–5: trail in a successful external graph. Distinct edges impose
one use per memory, while permitting repeated repeater vertices on different
ports. Neither terminal may be an internal repeater of its own flow. -/
def ValidRoute {N : ℕ} (H : Finset (Edge N)) (a b : Fin N) (r : PortTrailEncoding N) : Prop :=
  r.2 0 = a ∧ r.2 (Fin.last (r.1.val + 1)) = b ∧
  Function.Injective (routeEdge r) ∧ routeEdges r ⊆ H ∧
  ∀ i : Fin r.1.val,
    r.2 ⟨i.val + 1, by omega⟩ ≠ a ∧ r.2 ⟨i.val + 1, by omega⟩ ≠ b

/-- PDF p.5: admissible trails computed from the successful external graph. -/
def candidateRoutes {N : ℕ} (H : Finset (Edge N)) (a b : Fin N) :
    Finset (PortTrailEncoding N) := by
  classical
  exact Finset.univ.filter (ValidRoute H a b)

/-- PDF p.5: a simultaneous one-slot BSM schedule for the designated flow.
Shared repeater vertices are allowed; shared physical memories are not.
The schedule is selected from external flags before BSM outcomes. -/
def FeasibleFamily {N : ℕ} (H : Finset (Edge N)) (a b : Fin N)
    (F : Finset (PortTrailEncoding N)) : Prop :=
  F ⊆ candidateRoutes H a b ∧
  ∀ r ∈ F, ∀ s ∈ F, r ≠ s → Disjoint (routeEdges r) (routeEdges s)

/-- PDF p.4: BSM flags indexed by each selected trail's internal positions.
Unselected coordinates are ignored. In a feasible family selected coordinates
are distinct physical BSMs because they consume distinct incident memories. -/
abbrev InternalFlags (N : ℕ) := (Σ r : PortTrailEncoding N, Fin r.1.val) → Bool

/-- PDF p.4: the actual integer number of delivered ebits in one slot.
Feasibility requires the selected external links to have succeeded already. -/
def deliveredCount {N : ℕ} (F : Finset (PortTrailEncoding N)) (flags : InternalFlags N) : ℕ := by
  classical
  exact (F.filter (fun r => ∀ i : Fin r.1.val, flags ⟨r, i⟩ = true)).card

/-- PDF p.5: conditional expected yield, after external flags and before BSM
flags. Each selected trail contributes `q^(length-1)`; the sum uses linearity
of expectation, rather than multiplying path-success probabilities. -/
def conditionalYield {N : ℕ} (q : ℝ) (F : Finset (PortTrailEncoding N)) : ℝ :=
  ∑ r ∈ F, q ^ r.1.val

/-- PDF p.5: finite set of all feasible schedules, including the empty one. -/
def feasibleFamilies {N : ℕ} (H : Finset (Edge N)) (a b : Fin N) :
    Finset (Finset (PortTrailEncoding N)) := by
  classical
  exact Finset.univ.filter (FeasibleFamily H a b)

/-- PDF p.5: select a shortest surviving route, with a minimizing tie choice
fixed independently of future BSM outcomes. A shortest trail is a simple path. -/
def shortestRoute {N : ℕ} (H : Finset (Edge N)) (a b : Fin N) : Option (PortTrailEncoding N) := by
  classical
  let S := candidateRoutes H a b
  exact if h : S.Nonempty then
    some (Classical.choose (S.exists_min_image routeLength h)) else none

/-- PDF p.5: shortest-path greedy, deleting physical edges after every choice.
An initial physical-edge count of fuel suffices because every route consumes
at least one remaining edge. No schedule depends on future BSM flags. -/
def greedySteps {N : ℕ} (a b : Fin N) : ℕ → Finset (Edge N) → Finset (PortTrailEncoding N)
  | 0, _ => ∅
  | fuel + 1, H => by
      classical
      exact match shortestRoute H a b with
        | none => ∅
        | some r => insert r (greedySteps a b fuel (H \ routeEdges r))

/-- PDF p.5: the complete prescribed greedy schedule in a successful graph. -/
def greedyFamily {N : ℕ} (H : Finset (Edge N)) (a b : Fin N) : Finset (PortTrailEncoding N) :=
  greedySteps a b H.card H

/-- PDF p.5: the actual finite optimum over one-slot BSM schedules, computed
from the successful graph. This is not a free function constrained by the
desired bound. Randomizing schedules cannot improve a finite maximum. -/
def conditionalOptimum {N : ℕ} (H : Finset (Edge N)) (a b : Fin N) (q : ℝ) : ℝ := by
  classical
  exact (feasibleFamilies H a b).fold max 0 (conditionalYield q)

/-- PDF pp.4–5: probability of exactly a given external outcome `H`.
Callers sum over subsets, so subtraction counts failures without truncation.
Zero exponents express empty products, including at `p=0,1`. -/
def externalMass {N : ℕ} (G : GridNetwork N) (p : ℝ) (H : Finset (Edge N)) : ℝ :=
  p ^ H.card * (1 - p) ^ ((physicalEdges G).card - H.card)

/-- PDF p.5: greedy expected ebits per slot, averaging the actual protocol
path-sum yield over independent external-success subsets. -/
def greedyRate {N : ℕ} (G : GridNetwork N) (a b : Fin N) (p q : ℝ) : ℝ :=
  ∑ H ∈ (physicalEdges G).powerset,
    externalMass G p H * conditionalYield q (greedyFamily H a b)

/-- PDF p.5: globally optimal one-slot pairwise-swap expected yield. Only
external flags are observed before selecting the optimal schedule. -/
def optimalGlobalRate {N : ℕ} (G : GridNetwork N) (a b : Fin N) (p q : ℝ) : ℝ :=
  ∑ H ∈ (physicalEdges G).powerset,
    externalMass G p H * conditionalOptimum H a b q

example (p : ℝ) (flags : Fin 0 → Bool) : iidMass p flags = 1 := by
  simp [iidMass]

example {N : ℕ} (a b : Fin N) : edgeKey a b = edgeKey b a := by
  simp [edgeKey, min_comm, max_comm]

example {N : ℕ} (flags : InternalFlags N) :
    deliveredCount (∅ : Finset (PortTrailEncoding N)) flags = 0 := by
  simp [deliveredCount]

example {N : ℕ} (q : ℝ) : conditionalYield q (∅ : Finset (PortTrailEncoding N)) = 0 := by
  simp [conditionalYield]

example {N : ℕ} (a b : Fin N) :
    greedySteps a b 0 (∅ : Finset (Edge N)) = ∅ := by
  rfl

example {I : Type*} [Fintype I] (p : ℝ) :
    bernoulliFlagEvent (I := I) p (fun _ => False) = 0 := by
  simp [bernoulliFlagEvent]

example {N : ℕ} (r : PortTrailEncoding N) : 0 < routeLength r := by
  exact Nat.succ_pos _

example {N : ℕ} (H : Finset (Edge N)) (a b : Fin N) :
    FeasibleFamily H a b ∅ := by
  simp [FeasibleFamily]

example {N : ℕ} (F : Finset (PortTrailEncoding N)) :
    deliveredCount F (fun _ => true) = F.card := by
  simp [deliveredCount]

example {N : ℕ} (G : GridNetwork N) (p : ℝ) :
    externalMass G p ∅ = (1 - p) ^ (physicalEdges G).card := by
  simp [externalMass]

example {N : ℕ} (a b : Fin N) (H : Finset (Edge N))
    (fuel : ℕ) (h : shortestRoute H a b = none) :
    greedySteps a b (fuel + 1) H = ∅ := by
  simp [greedySteps, h]

end

end QAlgorithms.Papers.Independent.Intakethird100.P45
Source
Routing entanglement in the quantum internet, arXiv:1708.07142v2, https://arxiv.org/abs/1708.07142v2
Read-back

What the Lean code literally says, in plain math · gpt-6.1-sol

QAlgorithms.Papers.Independent.Intakethird100.P45.Edge

For every natural number NNN, an edge is defined to be any ordered pair of labels from {0,…,N−1}\{0,\ldots,N-1\}{0,…,N−1}. This type permits equal endpoints and includes both orders of every pair of distinct endpoints; it imposes no geometric or adjacency condition. For N=0N=0N=0, there are no such pairs.

QAlgorithms.Papers.Independent.Intakethird100.P45.FeasibleFamily

For every natural number NNN, every finite set HHH of ordered pairs from {0,…,N−1}2\{0,\ldots,N-1\}^2{0,…,N−1}2, every a,b∈{0,…,N−1}a,b\in\{0,\ldots,N-1\}a,b∈{0,…,N−1}, and every finite set FFF of encodings (k,v)(k,v)(k,v) with 0≤k<N20\le k<N^20≤k<N2 and entries v0,…,vk+1∈{0,…,N−1}v_0,\ldots,v_{k+1}\in\{0,\ldots,N-1\}v0​,…,vk+1​∈{0,…,N−1}, FeasibleFamily⁡(H,a,b,F)\operatorname{FeasibleFamily}(H,a,b,F)FeasibleFamily(H,a,b,F) holds exactly when each encoding in FFF starts at aaa, ends at bbb, has pairwise distinct pairs (min⁡(vi,vi+1),max⁡(vi,vi+1))(\min(v_i,v_{i+1}),\max(v_i,v_{i+1}))(min(vi​,vi+1​),max(vi​,vi+1​)) for 0≤i<k+10\le i<k+10≤i<k+1, has all these pairs in HHH, and has no intermediate entry v1,…,vkv_1,\ldots,v_kv1​,…,vk​ equal to either endpoint, and, in addition, the sets of these pairs for any two distinct encodings in FFF are disjoint. Distinct encodings may share vertices. The endpoints may coincide, intermediate entries may repeat subject to the stated conditions, and the intermediate-entry condition is vacuous for k=0k=0k=0. The empty family satisfies the predicate. No additional adjacency condition is imposed, and when N=0N=0N=0, no endpoints exist.

QAlgorithms.Papers.Independent.Intakethird100.P45.GridNetwork

For every natural number NNN, a grid network consists of a position function from the labels {0,…,N−1}\{0,\ldots,N-1\}{0,…,N−1} to Z2\mathbb Z^2Z2, together with the requirement that this function is injective: if two labels have the same position, then the labels are equal. Thus all labeled positions are distinct, with no further restriction on their coordinates. The case N=0N=0N=0 is included, with an empty position function and a vacuously satisfied injectivity condition.

QAlgorithms.Papers.Independent.Intakethird100.P45.InternalFlags

For every natural number NNN, InternalFlags⁡(N)\operatorname{InternalFlags}(N)InternalFlags(N) is the type of all Boolean-valued functions on pairs (r,i)(r,i)(r,i), where r=(k,v)r=(k,v)r=(k,v) ranges over every encoding with 0≤k<N20\le k<N^20≤k<N2 and entries v0,…,vk+1∈{0,…,N−1}v_0,\ldots,v_{k+1}\in\{0,\ldots,N-1\}v0​,…,vk+1​∈{0,…,N−1}, and iii ranges over the indices 0≤i<k0\le i<k0≤i<k. Thus a function assigns either true or false separately to each such pair, including pairs belonging to encodings that satisfy no route-validity conditions. An encoding with k=0k=0k=0 contributes no indices. For N=0N=0N=0 or N=1N=1N=1, the entire indexing domain is empty, so there is exactly one such function.

QAlgorithms.Papers.Independent.Intakethird100.P45.PortTrailEncoding

For every natural number NNN, PortTrailEncoding⁡(N)\operatorname{PortTrailEncoding}(N)PortTrailEncoding(N) is the type of pairs (k,v)(k,v)(k,v) consisting of a natural number kkk with 0≤k<N20\le k<N^20≤k<N2 and a sequence v0,…,vk+1v_0,\ldots,v_{k+1}v0​,…,vk+1​ whose entries lie in {0,…,N−1}\{0,\ldots,N-1\}{0,…,N−1}. Thus the sequence has k+2k+2k+2 entries, and entries may repeat without restriction. No adjacency or edge conditions are imposed. When N=0N=0N=0, this type is empty.

QAlgorithms.Papers.Independent.Intakethird100.P45.ValidRoute

For every natural number NNN, every finite set HHH of ordered pairs from {0,…,N−1}2\{0,\ldots,N-1\}^2{0,…,N−1}2, every a,b∈{0,…,N−1}a,b\in\{0,\ldots,N-1\}a,b∈{0,…,N−1}, and every encoding r=(k,v)r=(k,v)r=(k,v) with 0≤k<N20\le k<N^20≤k<N2 and entries v0,…,vk+1∈{0,…,N−1}v_0,\ldots,v_{k+1}\in\{0,\ldots,N-1\}v0​,…,vk+1​∈{0,…,N−1}, ValidRoute⁡(H,a,b,r)\operatorname{ValidRoute}(H,a,b,r)ValidRoute(H,a,b,r) holds exactly when v0=av_0=av0​=a, vk+1=bv_{k+1}=bvk+1​=b, the pairs ei=(min⁡(vi,vi+1),max⁡(vi,vi+1))e_i=(\min(v_i,v_{i+1}),\max(v_i,v_{i+1}))ei​=(min(vi​,vi+1​),max(vi​,vi+1​)) are distinct for distinct indices 0≤i<k+10\le i<k+10≤i<k+1, every such pair belongs to HHH, and vj≠av_j\ne avj​=a and vj≠bv_j\ne bvj​=b for every 1≤j≤k1\le j\le k1≤j≤k. Intermediate entries may repeat subject to these conditions, and a=ba=ba=b is permitted. For k=0k=0k=0, the intermediate-entry condition is vacuous and the distinct-pair condition is automatic, so validity requires precisely v0=av_0=av0​=a, v1=bv_1=bv1​=b, and (min⁡(a,b),max⁡(a,b))∈H(\min(a,b),\max(a,b))\in H(min(a,b),max(a,b))∈H. No lattice or other adjacency condition is imposed beyond membership in HHH. When N=0N=0N=0, neither endpoints nor encodings exist.

QAlgorithms.Papers.Independent.Intakethird100.P45.bernoulliFlagEvent

For any finite type III, equipped with an enumeration of all its elements, any real number ppp, and any predicate EEE on Boolean assignments I→{false,true}I\to\{\mathrm{false},\mathrm{true}\}I→{false,true}, define the event value to be

∑f:I→{false,true}{∏i∈I{p,f(i)=true,1−p,f(i)=false,E(f),0,otherwise.\sum_{f:I\to\{\mathrm{false},\mathrm{true}\}} \begin{cases} \displaystyle\prod_{i\in I} \begin{cases} p,&f(i)=\mathrm{true},\\ 1-p,&f(i)=\mathrm{false}, \end{cases} &E(f),\\ 0,&\text{otherwise}. \end{cases}f:I→{false,true}∑​⎩⎨⎧​i∈I∏​{p,1−p,​f(i)=true,f(i)=false,​0,​E(f),otherwise.​

No restriction on ppp or on the predicate EEE is imposed. If III is empty, there is exactly one assignment, and this value is 111 if that assignment satisfies EEE, and 000 otherwise.

QAlgorithms.Papers.Independent.Intakethird100.P45.candidateRoutes

For every natural number NNN, every finite set HHH of ordered pairs from {0,…,N−1}2\{0,\ldots,N-1\}^2{0,…,N−1}2, and every a,b∈{0,…,N−1}a,b\in\{0,\ldots,N-1\}a,b∈{0,…,N−1}, candidateRoutes⁡(H,a,b)\operatorname{candidateRoutes}(H,a,b)candidateRoutes(H,a,b) is the finite set of all encodings (k,v)(k,v)(k,v) with 0≤k<N20\le k<N^20≤k<N2 and entries v0,…,vk+1∈{0,…,N−1}v_0,\ldots,v_{k+1}\in\{0,\ldots,N-1\}v0​,…,vk+1​∈{0,…,N−1} such that v0=av_0=av0​=a, vk+1=bv_{k+1}=bvk+1​=b, the pairs (min⁡(vi,vi+1),max⁡(vi,vi+1))(\min(v_i,v_{i+1}),\max(v_i,v_{i+1}))(min(vi​,vi+1​),max(vi​,vi+1​)) for 0≤i<k+10\le i<k+10≤i<k+1 are pairwise distinct and all belong to HHH, and every entry vjv_jvj​ with 1≤j≤k1\le j\le k1≤j≤k differs from both aaa and bbb. This set may be empty. The endpoints may coincide; intermediate entries may repeat subject to the stated conditions. For k=0k=0k=0, there are no intermediate entries, and the sole pair must belong to HHH. No additional adjacency condition is imposed. When N=0N=0N=0, there are no endpoints for this definition.

QAlgorithms.Papers.Independent.Intakethird100.P45.chainProbability

For any natural number kkk and any real numbers p,qp,qp,q, define the chain value by summing over all external Boolean assignments eee on {0,…,k−1}\{0,\ldots,k-1\}{0,…,k−1} and all internal Boolean assignments uuu on {0,…,(k−1)−1}\{0,\ldots,(k-1)-1\}{0,…,(k−1)−1}, where k−1k-1k−1 is natural-number subtraction, truncated at 000. A pair contributes 000 unless every external and every internal flag is true; when both conditions hold, it contributes

(∏i<k{p,e(i)=true,1−p,e(i)=false)(∏j<k−1{q,u(j)=true,1−q,u(j)=false).\left(\prod_{i<k} \begin{cases}p,&e(i)=\mathrm{true},\\1-p,&e(i)=\mathrm{false}\end{cases}\right) \left(\prod_{j<k-1} \begin{cases}q,&u(j)=\mathrm{true},\\1-q,&u(j)=\mathrm{false}\end{cases}\right).(i<k∏​{p,1−p,​e(i)=true,e(i)=false​)​j<k−1∏​{q,1−q,​u(j)=true,u(j)=false​​.

Neither ppp nor qqq is restricted to [0,1][0,1][0,1]. For k=0k=0k=0, both assignments are empty, both universal conditions hold vacuously, and the value is 111; for k=1k=1k=1, there are no internal flags and the value is ppp.

QAlgorithms.Papers.Independent.Intakethird100.P45.conditionalOptimum

For any natural number NNN, finite set H⊆V×VH\subseteq V\times VH⊆V×V with V={0,…,N−1}V=\{0,\ldots,N-1\}V={0,…,N−1}, endpoints a,b∈Va,b\in Va,b∈V, and real number qqq, this defines

max⁡({0}∪{∑r∈Fqm(r)−1:F is a feasible family in H from a to b}).\max\left(\{0\}\cup \left\{\sum_{r\in F}q^{m(r)-1}:F\text{ is a feasible family in }H\text{ from }a\text{ to }b\right\}\right).max({0}∪{r∈F∑​qm(r)−1:F is a feasible family in H from a to b}).

Here a route rrr consists of a length m(r)m(r)m(r) with 1≤m(r)≤N21\le m(r)\le N^21≤m(r)≤N2 and a vertex sequence (v0,…,vm(r))(v_0,\ldots,v_{m(r)})(v0​,…,vm(r)​). It is admissible when it starts at aaa, ends at bbb, its canonical edge pairs (min⁡(vi,vi+1),max⁡(vi,vi+1))(\min(v_i,v_{i+1}),\max(v_i,v_{i+1}))(min(vi​,vi+1​),max(vi​,vi+1​)) are distinct members of HHH, and none of its intermediate vertices equals either endpoint; other vertex repetitions are permitted. A feasible family is a finite set of admissible encoded routes whose edge sets are disjoint for every two distinct members. The empty family is feasible and contributes 000. The maximum includes an explicit baseline of 000, and qqq is unrestricted, so it may be negative or outside [0,1][0,1][0,1]. A length-one route contributes q0=1q^0=1q0=1, including when q=0q=0q=0. There is no assumption that a≠ba\ne ba=b or that HHH is a grid edge set; for N=0N=0N=0, there are no endpoint inputs.

QAlgorithms.Papers.Independent.Intakethird100.P45.conditionalYield

For every natural number NNN, every real number qqq, and every finite set FFF of encodings r=(kr,v)r=(k_r,v)r=(kr​,v) with 0≤kr<N20\le k_r<N^20≤kr​<N2 and entries v0,…,vkr+1∈{0,…,N−1}v_0,\ldots,v_{k_r+1}\in\{0,\ldots,N-1\}v0​,…,vkr​+1​∈{0,…,N−1}, conditionalYield⁡(q,F)\operatorname{conditionalYield}(q,F)conditionalYield(q,F) is the real number ∑r∈Fqkr\sum_{r\in F}q^{k_r}∑r∈F​qkr​. There are no restrictions on qqq and no route-validity or disjointness requirements on FFF. Each encoding with kr=0k_r=0kr​=0 contributes 111, including when q=0q=0q=0, since 00=10^0=100=1 under this power convention. The empty sum is zero, and when N=0N=0N=0, FFF must be empty.

QAlgorithms.Papers.Independent.Intakethird100.P45.deliveredCount

For every natural number NNN, every finite set FFF of encodings r=(k,v)r=(k,v)r=(k,v) with 0≤k<N20\le k<N^20≤k<N2 and entries v0,…,vk+1∈{0,…,N−1}v_0,\ldots,v_{k+1}\in\{0,\ldots,N-1\}v0​,…,vk+1​∈{0,…,N−1}, and every Boolean-valued function flags\mathrm{flags}flags defined on all pairs (r,i)(r,i)(r,i) of any such encoding and an index 0≤i<k0\le i<k0≤i<k, deliveredCount⁡(F,flags)\operatorname{deliveredCount}(F,\mathrm{flags})deliveredCount(F,flags) is the natural number of encodings r=(k,v)r=(k,v)r=(k,v) in FFF for which flags(r,i)\mathrm{flags}(r,i)flags(r,i) is true for every 0≤i<k0\le i<k0≤i<k. No route-validity, disjointness, or probabilistic assumptions are required. Every encoding in FFF with k=0k=0k=0 is counted because its condition has no indices to check. An empty FFF gives count zero; when N=0N=0N=0, FFF must be empty.

QAlgorithms.Papers.Independent.Intakethird100.P45.edgeKey

For every natural number NNN and any labels a,b∈{0,…,N−1}a,b\in\{0,\ldots,N-1\}a,b∈{0,…,N−1}, define their edge key to be the ordered pair

(min⁡(a,b),max⁡(a,b)).(\min(a,b),\max(a,b)).(min(a,b),max(a,b)).

Equal labels are allowed and produce (a,a)(a,a)(a,a). If N=0N=0N=0, there are no labels a,ba,ba,b to supply.

QAlgorithms.Papers.Independent.Intakethird100.P45.endpointDegree

For every natural number NNN, every grid network given by an injective position map x:{0,…,N−1}→Z2x:\{0,\ldots,N-1\}\to\mathbb Z^2x:{0,…,N−1}→Z2, and every label a∈{0,…,N−1}a\in\{0,\ldots,N-1\}a∈{0,…,N−1}, define the endpoint degree of aaa to be the number of pairs (u,v)(u,v)(u,v) satisfying u<vu<vu<v, ∣x1(u)−x1(v)∣+∣x2(u)−x2(v)∣=1|x_1(u)-x_1(v)|+|x_2(u)-x_2(v)|=1∣x1​(u)−x1​(v)∣+∣x2​(u)−x2​(v)∣=1, and u=au=au=a or v=av=av=a. This number is 000 if no such pair exists. For N=0N=0N=0, there is no label aaa to supply.

QAlgorithms.Papers.Independent.Intakethird100.P45.externalMass

For any natural number NNN, a grid network GGG assigning distinct positions xi∈Z2x_i\in\mathbb Z^2xi​∈Z2 to the vertices i∈V={0,…,N−1}i\in V=\{0,\ldots,N-1\}i∈V={0,…,N−1}, any real number ppp, and any finite set H⊆V×VH\subseteq V\times VH⊆V×V, let

EG={(i,j)∈V×V:i<j, ∣xi,1−xj,1∣+∣xi,2−xj,2∣=1}.E_G=\{(i,j)\in V\times V:i<j,\ |x_{i,1}-x_{j,1}|+|x_{i,2}-x_{j,2}|=1\}.EG​={(i,j)∈V×V:i<j, ∣xi,1​−xj,1​∣+∣xi,2​−xj,2​∣=1}.

The definition assigns the real number

p∣H∣(1−p)max⁡(∣EG∣−∣H∣, 0).p^{|H|}(1-p)^{\max(|E_G|-|H|,\,0)}.p∣H∣(1−p)max(∣EG​∣−∣H∣,0).

There is no requirement that H⊆EGH\subseteq E_GH⊆EG​, and the subtraction in the second exponent is natural-number subtraction, so that exponent is 000 whenever ∣H∣>∣EG∣|H|>|E_G|∣H∣>∣EG​∣. There is also no restriction on ppp. Every zeroth power is 111, including 000^000; in particular, when N=0N=0N=0, both edge sets are empty and the value is 111.

QAlgorithms.Papers.Independent.Intakethird100.P45.feasibleFamilies

For every natural number NNN, every finite set HHH of ordered pairs from {0,…,N−1}2\{0,\ldots,N-1\}^2{0,…,N−1}2, and every a,b∈{0,…,N−1}a,b\in\{0,\ldots,N-1\}a,b∈{0,…,N−1}, feasibleFamilies⁡(H,a,b)\operatorname{feasibleFamilies}(H,a,b)feasibleFamilies(H,a,b) is the finite set of all finite sets FFF of encodings (k,v)(k,v)(k,v) with 0≤k<N20\le k<N^20≤k<N2 and entries v0,…,vk+1∈{0,…,N−1}v_0,\ldots,v_{k+1}\in\{0,\ldots,N-1\}v0​,…,vk+1​∈{0,…,N−1} satisfying the following conditions: every encoding in FFF starts at aaa, ends at bbb, has pairwise distinct pairs (min⁡(vi,vi+1),max⁡(vi,vi+1))(\min(v_i,v_{i+1}),\max(v_i,v_{i+1}))(min(vi​,vi+1​),max(vi​,vi+1​)) for 0≤i<k+10\le i<k+10≤i<k+1, has every such pair in HHH, and has each intermediate entry v1,…,vkv_1,\ldots,v_kv1​,…,vk​ different from both endpoints; furthermore, any two distinct encodings in FFF have disjoint sets of these pairs. The empty family is included, so this set of families is nonempty whenever its endpoint arguments exist. The endpoints may coincide, shared vertices between encodings are permitted, and for k=0k=0k=0 the intermediate-entry condition is vacuous. No additional adjacency condition is imposed. When N=0N=0N=0, no endpoints exist.

QAlgorithms.Papers.Independent.Intakethird100.P45.greedyFamily

For any natural number NNN, finite set H⊆V×VH\subseteq V\times VH⊆V×V with V={0,…,N−1}V=\{0,\ldots,N-1\}V={0,…,N−1}, and endpoints a,b∈Va,b\in Va,b∈V, this defines a finite set of routes by running the following procedure for at most ∣H∣|H|∣H∣ steps, starting with HHH. A route is encoded by a length mmm with 1≤m≤N21\le m\le N^21≤m≤N2 and vertices (v0,…,vm)(v_0,\ldots,v_m)(v0​,…,vm​); it is admissible in a remaining edge set JJJ when v0=av_0=av0​=a, vm=bv_m=bvm​=b, the canonical pairs (min⁡(vi,vi+1),max⁡(vi,vi+1))(\min(v_i,v_{i+1}),\max(v_i,v_{i+1}))(min(vi​,vi+1​),max(vi​,vi+1​)) for 0≤i<m0\le i<m0≤i<m are distinct members of JJJ, and every intermediate vertex differs from both endpoints. Other vertex repetitions are allowed. If no steps remain, or no admissible route exists, the procedure returns the empty set. Otherwise, it selects an admissible route of minimum length by a fixed classical choice, removes all its canonical edge pairs from JJJ, recursively continues with one fewer step, and inserts the selected route into the resulting finite set. Thus the initial step allowance is exactly the number of pairs in HHH, including any pairs that cannot occur in an admissible route. Empty HHH gives an empty family. No grid structure or inequality a≠ba\ne ba=b is assumed; for N=0N=0N=0, there are no endpoint inputs.

QAlgorithms.Papers.Independent.Intakethird100.P45.greedyRate

For any natural number NNN, an injective assignment i↦xi∈Z2i\mapsto x_i\in\mathbb Z^2i↦xi​∈Z2 on V={0,…,N−1}V=\{0,\ldots,N-1\}V={0,…,N−1} defining a grid network GGG, endpoints a,b∈Va,b\in Va,b∈V, and arbitrary real numbers p,qp,qp,q, let EGE_GEG​ consist of the pairs (i,j)(i,j)(i,j) with i<ji<ji<j whose positions have Manhattan distance 111. This defines

∑H⊆EGp∣H∣(1−p)∣EG∣−∣H∣∑r∈FHqm(r)−1.\sum_{H\subseteq E_G} p^{|H|}(1-p)^{|E_G|-|H|} \sum_{r\in F_H}q^{m(r)-1}.H⊆EG​∑​p∣H∣(1−p)∣EG​∣−∣H∣r∈FH​∑​qm(r)−1.

A route rrr is encoded by a length 1≤m(r)≤N21\le m(r)\le N^21≤m(r)≤N2 and vertices (v0,…,vm(r))(v_0,\ldots,v_{m(r)})(v0​,…,vm(r)​). It is admissible in an edge set JJJ when v0=av_0=av0​=a, vm(r)=bv_{m(r)}=bvm(r)​=b, its canonical edge pairs (min⁡(vi,vi+1),max⁡(vi,vi+1))(\min(v_i,v_{i+1}),\max(v_i,v_{i+1}))(min(vi​,vi+1​),max(vi​,vi+1​)) are all distinct and belong to JJJ, and every intermediate vertex differs from both endpoints; other vertex repetitions are allowed. The finite set FHF_HFH​ is constructed starting with J=HJ=HJ=H and ∣H∣|H|∣H∣ available steps: with zero steps or no admissible route, return the empty set; otherwise select an admissible route of minimum length by a fixed classical choice, remove its edge set, recursively continue with one fewer step, and insert the selected route into the resulting set. The outer sum includes every subset of EGE_GEG​, including the empty set, and all exponents are nonnegative integers. Empty inner sums are 000, and zeroth powers are 111, including 000^000. Neither p,q∈[0,1]p,q\in[0,1]p,q∈[0,1] nor a≠ba\ne ba=b is assumed; when N=0N=0N=0, no endpoint inputs exist.

QAlgorithms.Papers.Independent.Intakethird100.P45.greedySteps

For any natural number NNN and vertices a,ba,ba,b in V={0,…,N−1}V=\{0,\ldots,N-1\}V={0,…,N−1}, this defines a function T(f,H)T(f,H)T(f,H) taking a natural number of steps fff and a finite set H⊆V×VH\subseteq V\times VH⊆V×V to a finite set of encoded routes. An encoded route consists of an integer mmm with 1≤m≤N21\le m\le N^21≤m≤N2 and a vertex sequence (v0,…,vm)(v_0,\ldots,v_m)(v0​,…,vm​); its length is mmm, and its edge set is E(r)={(min⁡(vi,vi+1),max⁡(vi,vi+1)):0≤i<m}E(r)=\{(\min(v_i,v_{i+1}),\max(v_i,v_{i+1})):0\le i<m\}E(r)={(min(vi​,vi+1​),max(vi​,vi+1​)):0≤i<m}. Such a route is admissible in HHH from aaa to bbb when v0=av_0=av0​=a, vm=bv_m=bvm​=b, its mmm canonical edge pairs are all distinct and belong to HHH, and every intermediate vertex differs from both aaa and bbb. Other repetitions of vertices are permitted. The definition is

T(0,H)=∅,T(f+1,H)={∅,if no admissible route exists in H,{r}∪T(f,H∖E(r)),otherwise,T(0,H)=\varnothing,\qquad T(f+1,H)= \begin{cases} \varnothing,&\text{if no admissible route exists in }H,\\ \{r\}\cup T(f,H\setminus E(r)),&\text{otherwise}, \end{cases}T(0,H)=∅,T(f+1,H)={∅,{r}∪T(f,H∖E(r)),​if no admissible route exists in H,otherwise,​

where rrr is the route selected by a fixed classical choice from the admissible routes of minimum length; the definition supplies no further rule for resolving ties. The union is a set union, so repeated encodings would be counted only once. There is no assumption that a≠ba\ne ba=b or that HHH comes from a grid, and zero steps always returns the empty set. For N=0N=0N=0, there are no choices of endpoints a,ba,ba,b.

QAlgorithms.Papers.Independent.Intakethird100.P45.iidMass

For any finite type III, equipped with an enumeration of all its elements, any real number ppp, and any Boolean assignment f:I→{false,true}f:I\to\{\mathrm{false},\mathrm{true}\}f:I→{false,true}, define its mass to be

∏i∈I{p,f(i)=true,1−p,f(i)=false.\prod_{i\in I} \begin{cases} p,&f(i)=\mathrm{true},\\ 1-p,&f(i)=\mathrm{false}. \end{cases}i∈I∏​{p,1−p,​f(i)=true,f(i)=false.​

There is no assumption that p∈[0,1]p\in[0,1]p∈[0,1]. If III is empty, the product equals 111.

QAlgorithms.Papers.Independent.Intakethird100.P45.latticeDistance

For any two integer-coordinate points a=(a1,a2)a=(a_1,a_2)a=(a1​,a2​) and b=(b1,b2)b=(b_1,b_2)b=(b1​,b2​), define their lattice distance to be the natural number

∣a1−b1∣+∣a2−b2∣,|a_1-b_1|+|a_2-b_2|,∣a1​−b1​∣+∣a2​−b2​∣,

where each absolute value is regarded as a natural number. Coincident points are allowed and have distance 000.

QAlgorithms.Papers.Independent.Intakethird100.P45.optimalGlobalRate

For any natural number NNN, a grid network GGG given by an injective assignment of positions xi∈Z2x_i\in\mathbb Z^2xi​∈Z2 to V={0,…,N−1}V=\{0,\ldots,N-1\}V={0,…,N−1}, endpoints a,b∈Va,b\in Va,b∈V, and arbitrary real numbers p,qp,qp,q, let EGE_GEG​ be the set of pairs (i,j)(i,j)(i,j) with i<ji<ji<j and Manhattan distance 111 between xix_ixi​ and xjx_jxj​. This defines

∑H⊆EGp∣H∣(1−p)∣EG∣−∣H∣max⁡({0}∪{∑r∈Fqm(r)−1:F is feasible in H from a to b}).\sum_{H\subseteq E_G} p^{|H|}(1-p)^{|E_G|-|H|} \max\left(\{0\}\cup \left\{\sum_{r\in F}q^{m(r)-1}:F\text{ is feasible in }H\text{ from }a\text{ to }b\right\}\right).H⊆EG​∑​p∣H∣(1−p)∣EG​∣−∣H∣max({0}∪{r∈F∑​qm(r)−1:F is feasible in H from a to b}).

An encoded route rrr consists of a length 1≤m(r)≤N21\le m(r)\le N^21≤m(r)≤N2 and a vertex sequence (v0,…,vm(r))(v_0,\ldots,v_{m(r)})(v0​,…,vm(r)​). It is admissible when it starts at aaa, ends at bbb, its canonical edge pairs (min⁡(vi,vi+1),max⁡(vi,vi+1))(\min(v_i,v_{i+1}),\max(v_i,v_{i+1}))(min(vi​,vi+1​),max(vi​,vi+1​)) are distinct members of HHH, and all intermediate vertices differ from both endpoints; other vertex repetitions are permitted. A feasible family FFF is a finite set of such routes with disjoint edge sets for every two distinct members. The empty family is feasible and has sum 000, and each maximum also explicitly includes 000. The outer sum includes the empty subset. The parameters ppp and qqq need not lie in [0,1][0,1][0,1], and the endpoints need not be distinct. All zeroth powers, including 000^000, equal 111, so a length-one route contributes 111. For N=0N=0N=0, there are no endpoint inputs.

QAlgorithms.Papers.Independent.Intakethird100.P45.physicalEdges

For every natural number NNN and every grid network given by an injective position map x:{0,…,N−1}→Z2x:\{0,\ldots,N-1\}\to\mathbb Z^2x:{0,…,N−1}→Z2, define its physical edges to be the finite set of all ordered label pairs (u,v)(u,v)(u,v) satisfying

u<vand∣x1(u)−x1(v)∣+∣x2(u)−x2(v)∣=1.u<v \quad\text{and}\quad |x_1(u)-x_1(v)|+|x_2(u)-x_2(v)|=1.u<vand∣x1​(u)−x1​(v)∣+∣x2​(u)−x2​(v)∣=1.

Thus each included pair has distinct endpoints and is recorded with its smaller label first. The set may be empty, and is empty when N=0N=0N=0 or N=1N=1N=1.

QAlgorithms.Papers.Independent.Intakethird100.P45.retainedLinkProbability

For any natural number SSS, including 000, and any real number p0p_0p0​, define the retained-link value by summing over all Boolean assignments fff on {0,…,S−1}\{0,\ldots,S-1\}{0,…,S−1}: an assignment contributes ∏i=0S−1wi\prod_{i=0}^{S-1}w_i∏i=0S−1​wi​ if at least one f(i)f(i)f(i) is true, and contributes 000 otherwise, where wi=p0w_i=p_0wi​=p0​ when f(i)f(i)f(i) is true and wi=1−p0w_i=1-p_0wi​=1−p0​ when it is false. There is no assumption that p0∈[0,1]p_0\in[0,1]p0​∈[0,1]. For S=0S=0S=0, the existential condition is false for the unique empty assignment, so the value is 000.

QAlgorithms.Papers.Independent.Intakethird100.P45.routeEdge

For every natural number NNN, every encoding r=(k,v)r=(k,v)r=(k,v) with 0≤k<N20\le k<N^20≤k<N2 and entries v0,…,vk+1∈{0,…,N−1}v_0,\ldots,v_{k+1}\in\{0,\ldots,N-1\}v0​,…,vk+1​∈{0,…,N−1}, and every integer index iii with 0≤i<k+10\le i<k+10≤i<k+1, the value routeEdge⁡(r,i)\operatorname{routeEdge}(r,i)routeEdge(r,i) is the ordered pair (min⁡(vi,vi+1),max⁡(vi,vi+1))(\min(v_i,v_{i+1}),\max(v_i,v_{i+1}))(min(vi​,vi+1​),max(vi​,vi+1​)), whose two coordinates lie in {0,…,N−1}\{0,\ldots,N-1\}{0,…,N−1}. Equal consecutive entries give the pair (vi,vi)(v_i,v_i)(vi​,vi​), and different indices may give the same pair; no adjacency requirement is imposed. When N=0N=0N=0, there is no such encoding.

QAlgorithms.Papers.Independent.Intakethird100.P45.routeEdges

For every natural number NNN and every encoding r=(k,v)r=(k,v)r=(k,v) with 0≤k<N20\le k<N^20≤k<N2 and entries v0,…,vk+1∈{0,…,N−1}v_0,\ldots,v_{k+1}\in\{0,\ldots,N-1\}v0​,…,vk+1​∈{0,…,N−1}, routeEdges⁡(r)\operatorname{routeEdges}(r)routeEdges(r) is the finite set {(min⁡(vi,vi+1),max⁡(vi,vi+1)):0≤i<k+1}\{(\min(v_i,v_{i+1}),\max(v_i,v_{i+1})) : 0\le i<k+1\}{(min(vi​,vi+1​),max(vi​,vi+1​)):0≤i<k+1}. Repeated pairs appear only once in this set. The set is nonempty because k+1≥1k+1\ge1k+1≥1, and it may contain pairs with equal coordinates; no adjacency condition is imposed. When N=0N=0N=0, there is no encoding to which this definition can be applied.

QAlgorithms.Papers.Independent.Intakethird100.P45.routeLength

For every natural number NNN and every encoding r=(k,v)r=(k,v)r=(k,v), where 0≤k<N20\le k<N^20≤k<N2 and v0,…,vk+1∈{0,…,N−1}v_0,\ldots,v_{k+1}\in\{0,\ldots,N-1\}v0​,…,vk+1​∈{0,…,N−1}, routeLength⁡(r)\operatorname{routeLength}(r)routeLength(r) is the natural number k+1k+1k+1. Consequently, every encoding has length between 111 and N2N^2N2, inclusive; length zero is excluded. When N=0N=0N=0, there is no encoding to which this definition can be applied.

QAlgorithms.Papers.Independent.Intakethird100.P45.shortestRoute

For every natural number NNN, every finite set HHH of ordered pairs from {0,…,N−1}2\{0,\ldots,N-1\}^2{0,…,N−1}2, and every a,b∈{0,…,N−1}a,b\in\{0,\ldots,N-1\}a,b∈{0,…,N−1}, consider all encodings r=(k,v)r=(k,v)r=(k,v) with 0≤k<N20\le k<N^20≤k<N2 and entries v0,…,vk+1∈{0,…,N−1}v_0,\ldots,v_{k+1}\in\{0,\ldots,N-1\}v0​,…,vk+1​∈{0,…,N−1} such that v0=av_0=av0​=a, vk+1=bv_{k+1}=bvk+1​=b, the pairs (min⁡(vi,vi+1),max⁡(vi,vi+1))(\min(v_i,v_{i+1}),\max(v_i,v_{i+1}))(min(vi​,vi+1​),max(vi​,vi+1​)) for 0≤i<k+10\le i<k+10≤i<k+1 are pairwise distinct and all belong to HHH, and every intermediate entry v1,…,vkv_1,\ldots,v_kv1​,…,vk​ differs from both aaa and bbb. If there are no such encodings, shortestRoute⁡(H,a,b)\operatorname{shortestRoute}(H,a,b)shortestRoute(H,a,b) returns no encoding; otherwise, it returns one chosen encoding whose length k+1k+1k+1 is less than or equal to the length of every encoding satisfying these conditions. No tie-breaking rule is specified beyond the classical choice of a minimizing encoding. The endpoints may coincide, intermediate entries may repeat subject to the stated conditions, and k=0k=0k=0 has no intermediate-entry restriction and gives length 111. No additional adjacency condition is imposed. When N=0N=0N=0, no endpoints exist.

Human review
  • Endorsed by Shuze Chen · Nov 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Nov 1, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me