AFTD Auto-Formalizing Theoretical Domains

weight

defimported Lean

The support $\mathrm{supp}(p) \subseteq \mathrm{Fin}\,n$ consists of coordinates where $p(i) \neq I$; the weight is $\mathrm{wt}(p) = |\mathrm{supp}(p)|$.

Statement

set_option linter.mathlibStandardSet false in
open scoped BigOperators in
open scoped Real in
open scoped Nat in
open scoped Classical in
open scoped Pointwise in
set_option maxRecDepth 4000 in
set_option synthInstance.maxHeartbeats 20000 in
set_option synthInstance.maxSize 128 in
set_option relaxedAutoImplicit false in
set_option autoImplicit false in
open Complex Matrix in
noncomputable def weight {n : ℕ} (p : PauliString n) : ℕ
Defined in
TCSlib, `weight`
Lean proof
By Allan Li, Hydroxyi (from the file's git history), from github.com/Shilun-Allan-Li/tcslib at c8a02591b1e5 (Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.25.0.
Verified
07 Oct 2026
Axioms
none listed
Built on 2
  • supportThe support $\mathrm{supp}(p) \subseteq \mathrm{Fin}\,n$ consists of coordinates where $p(i) \neq I$; the weight is…
  • PauliStringA Pauli string of length $n$ is a function $p : \mathrm{Fin}\,n \to \mathrm{PauliBasis}$.
Used by 18
  • op_98_eight_approximationPartition the packing O into blocks of at most 4 sets; the factor-2 exchange inequality gives weight(block) ≤ 2·weight(N(A, block)) for…
  • kst_code_linear_construction_finite_fieldLet n, s, t, r ≥ 1 be integers, and let w_1, ..., w_n in (ZMod 2)^r be vectors such that the sum of w_i over S is nonzero for every subset…
  • condorcet_cubic_subset_potential_residue_barrierFor candidates indexed modulo19, orient a to b when b-a is one of the nine nonzero quadratic residues. Consider any finite family of…
  • petersen_hard_core_var_per_vertex_eq_polyFor every real activity x, the per-vertex hard-core variance of the Petersen graph hardCoreVarSize petersen_graph (fun _ => x) / 10 equals…
  • hilton_strong_incomparability_matrixFor every natural number n there are a field K, a matrix L over K with rows indexed by the subsets of Fin n and 2^(n-1) columns, and a…
  • symmetric_counterexample_support_weight_iffFor any n = 2^k ≥ 8 and any input v : Fin n → ZMod 2, the symmetric Boolean function symmetric_counterexample_func n evaluates to 1 on v…
  • PauliErrorsLeThe set of all Pauli strings of weight at most $t$:…
  • IsNondegenerateA code is non-degenerate if it satisfies the Knill--Laflamme condition and additionally $P_C E^\dagger F P_C = 0$ whenever…
  • abel_summation_by_partsFor any positive dimension n, vector a, permutation π of Fin n, and vector z summing to 1, the inner product ∑ i, a i * z i equals a(π(0))…
  • KnillLaflammeA subspace $C \le \mathcal{H}_n$ satisfies the Knill--Laflamme condition for $t$-error correction if for all Pauli strings $E,F$…
  • zero_sum_w_three_threew_3(3) = 13: every admissible sequence (no term ≡ 0 mod 3) of 13 vectors in ℤ^3 has a nonempty subsequence whose sum is ≡ 0 (mod 3) but ≢…
  • gen_k_server_uniform_log_competitiveFor every k ≥ 1, every m and every start configuration a : Fin k → Fin m of generalized k-server on k uniform metrics with m points each…
  • ejr_chain_singleton_ballotsIf every voter approves at most one candidate, then there is an ordering of the candidates every prefix of which is an EJR committee of…
  • card_pauliErrorsLeCardinality of the bounded-weight Pauli error set. For natural numbers $n$ and $t$, the number of Pauli strings of length $n$ whose weight…
  • dyadic_spectral_series_boundLet a ≥ 0, and let mu : ℕ+ → ℝ be a non-negative sequence satisfying ∑' j, mu j ≤ 1 and tail bounds ∑_{k > j} mu k ≤ (1/2)^j for all j ≥…
  • error_subspaces_orthogonalOrthogonality of distinct error subspaces. Let $C \le \mathcal{H}_n$ be a code that is non-degenerate for $t$-error correction, and let…
  • error_sphere_dimensionDimension of the error sphere of a non-degenerate code. Let $C \le \mathcal{H}_n$ be a code on $n$ qubits that is non-degenerate for $t$…
  • graph_defect_le_oneFor every graph G on at least one vertex and every integer t ≥ 2, the defect def_t(G) satisfies def_t(G) ≤ 1. That is, the least…

Lean source view module on GitHub

set_option linter.mathlibStandardSet false in
open scoped BigOperators in
open scoped Real in
open scoped Nat in
open scoped Classical in
open scoped Pointwise in
set_option maxRecDepth 4000 in
set_option synthInstance.maxHeartbeats 20000 in
set_option synthInstance.maxSize 128 in
set_option relaxedAutoImplicit false in
set_option autoImplicit false in
open Complex Matrix in
/-- The weight of a Pauli string: the number of non-identity tensor factors. -/
noncomputable def weight {n : ℕ} (p : PauliString n) : ℕ :=
  (support p).card
See it in the graphDiscuss this resultChallenge it