Rectangles, -sparse fault patterns and the fault-tolerance thresholds
DefinitionABOThreshold_modelThis file sets up the combinatorial model underlying the recursive fault analysis of Aharonov and Ben-Or.
Rectangles and fault patterns. Fix a branching number , the number of locations of a rectangle. A -rectangle is a single location of the circuit and an -rectangle is composed of many -rectangles, so an -rectangle has locations. A fault pattern of an -rectangle, written , records for each of its locations whether a fault occurred: at level it is a single boolean, and at level it is an -tuple of fault patterns of level . Every level is a finite type with decidable equality.
Sparseness (Definition 18). Fix also , the number of faulty sub-rectangles a rectangle tolerates (in the paper for a code correcting errors with spread ). A fault pattern is -sparse when the single location carries no fault, and -sparse when at most of its constituent -rectangles carry a pattern that is not -sparse.
Independent noise. Under probabilistic noise of rate each location is faulty with probability , independently of all others. The weight of a fault pattern is accordingly the product, over all locations, of at faulty locations and at clean ones, and
are the probability that the faults of an -rectangle form an -sparse set and the probability that they do not.
Thresholds. With the maximal number of locations in a rectangle, the threshold condition for probabilistic noise (Definition 19) is
and the threshold condition for general noise (Definition 21) is
The associated thresholds are and .
This bundle is the vocabulary in which the milestones and the goal of this mission are stated; it mentions no quantum mechanics, so it is reusable for any concatenated fault-tolerance analysis.
Formalization Note The paper prints the two thresholds with exponent (equations 7.4 and 8.6). That exponent is inconsistent with the paper's own threshold conditions 7.3 and 8.5: solving gives . The exponent is therefore used here, which is the reading under which the paper's assertion that every satisfies the threshold condition is correct. Sparseness is formalized as a boolean-valued decidable predicate, and the weight and probability functions are ordinary real-valued finite sums and products, so no constraint such as is built into the definitions; each theorem states the range hypotheses it needs.
import Mathlib
set_option autoImplicit false
namespace ABOThreshold
/-- `FaultPattern A r` is the set of fault patterns of an `r`-rectangle in which every
`(s+1)`-rectangle is composed of exactly `A` `s`-rectangles. A `0`-rectangle is a single
location, and a fault pattern there is a boolean recording whether a fault occurred. -/
def FaultPattern (A : ℕ) : ℕ → Type
| 0 => Bool
| r + 1 => Fin A → FaultPattern A r
instance instDecidableEqFaultPattern (A : ℕ) : (r : ℕ) → DecidableEq (FaultPattern A r)
| 0 => inferInstanceAs (DecidableEq Bool)
| r + 1 =>
letI := instDecidableEqFaultPattern A r
inferInstanceAs (DecidableEq (Fin A → FaultPattern A r))
instance instFintypeFaultPattern (A : ℕ) : (r : ℕ) → Fintype (FaultPattern A r)
| 0 => inferInstanceAs (Fintype Bool)
| r + 1 =>
letI := instFintypeFaultPattern A r
letI := instDecidableEqFaultPattern A r
inferInstanceAs (Fintype (Fin A → FaultPattern A r))
/-- `IsSparse A k r p` is Aharonov–Ben-Or's `(r, k)`-sparseness of the set of faulty locations
`p` inside an `r`-rectangle: a `(0, k)`-sparse set is empty (no fault at the location), and a set
is `(r+1, k)`-sparse when at most `k` of the `A` constituent `r`-rectangles carry a set of faults
that fails to be `(r, k)`-sparse. -/
def IsSparse (A k : ℕ) : (r : ℕ) → FaultPattern A r → Bool
| 0, b => !b
| r + 1, p =>
decide ((Finset.univ.filter fun i : Fin A => IsSparse A k r (p i) = false).card ≤ k)
/-- The probability weight of a single fault pattern when every location independently suffers a
fault with probability `η`. -/
def weight (A : ℕ) (η : ℝ) : (r : ℕ) → FaultPattern A r → ℝ
| 0, b => cond (b : Bool) η (1 - η)
| r + 1, p => ∏ i : Fin A, weight A η r (p i)
/-- `sparseProb A k η r` is the probability that the faults of an `r`-rectangle form an
`(r, k)`-sparse set, under independent probabilistic noise of rate `η`. -/
noncomputable def sparseProb (A k : ℕ) (η : ℝ) (r : ℕ) : ℝ :=
∑ p ∈ (Finset.univ : Finset (FaultPattern A r)).filter fun p => IsSparse A k r p,
weight A η r p
/-- `badProb A k η r = 1 - sparseProb A k η r` is the probability that the faults of an
`r`-rectangle fail to be `(r, k)`-sparse. -/
noncomputable def badProb (A k : ℕ) (η : ℝ) (r : ℕ) : ℝ := 1 - sparseProb A k η r
/-- The threshold condition of Definition 19: `C(A, k+1) * η^(k+1) < η`. -/
def ThresholdCondition (A k : ℕ) (η : ℝ) : Prop :=
(A.choose (k + 1) : ℝ) * η ^ (k + 1) < η
/-- The probabilistic-noise threshold `η_c` of Definition 20. -/
noncomputable def thresholdProb (A k : ℕ) : ℝ :=
((A.choose (k + 1) : ℝ)) ^ (-(1 : ℝ) / (k : ℝ))
/-- The threshold condition for general noise, Definition 21: `e * C(A, k+1) * (2η)^(k+1) < 2η`. -/
def ThresholdConditionGeneral (A k : ℕ) (η : ℝ) : Prop :=
Real.exp 1 * (A.choose (k + 1) : ℝ) * (2 * η) ^ (k + 1) < 2 * η
/-- The general-noise threshold `η_c'` of Definition 22. -/
noncomputable def thresholdGeneral (A k : ℕ) : ℝ :=
(1 / 2 : ℝ) * (Real.exp 1 * (A.choose (k + 1) : ℝ)) ^ (-(1 : ℝ) / (k : ℝ))
end ABOThresholdRead-back
What the Lean code literally says, in plain math · non-blind self-audit by the drafting agent (Aristotle, Harmonic)
Non-blind read-back — not independent testimony. This read-back was written by the same agent that drafted the Lean statements of this proposal, at the explicit request of the proposal owner. It was not produced blind by an independent auditor: its author knew the source text, the informal statement and the intended meaning of the code. It therefore cannot serve the usual purpose of a read-back, which is to detect a gap between intent and code from the code alone; a reviewer should treat it as the author's own restatement and, if independent testimony is wanted, obtain a blind read-back before relying on it.
The file fixes two natural number parameters and and introduces the following.
A family of types. is defined by recursion on : is the two-element type of booleans, and is the type of functions from to . Each such type is equipped with decidable equality and with a finiteness structure. Note the degenerate case : then is the type of functions out of the empty type, which has exactly one element, so for every level above is a one-point type.
A boolean predicate. maps a pattern to a boolean: at level it returns the negation of the boolean , i.e. true exactly when is false; at level , given , it returns true exactly when the number of indices with is at most . Thus at level the count is of sub-patterns on which the predicate returns false, and the comparison is , not . If the predicate is true for every pattern of positive level.
A real-valued weight. , for a real parameter , is defined by: at level , the value is if the boolean is true and if it is false; at level , the value at is . No restriction is placed on ; for outside these weights are negative or exceed , and for the empty product makes every weight at positive level equal to .
Two real numbers depending on .
the sum being over the finitely many patterns of level satisfying the predicate, and
Two propositions. is the assertion
where is the natural-number binomial coefficient cast to the reals (it is when ) and the power is a natural-number power. is the assertion
with .
Two real constants.
both using real exponentiation of a nonnegative real base by the real exponent , where is cast to a real number. Two boundary cases are silently included: for the exponent is a division by zero, which in this setting yields exponent and hence the value for the first constant and for the second; and when the base is , and a nonnegative-real power of with nonzero exponent is , so both constants are then .
The file contains no theorems: it only introduces these types, functions, predicates and constants.