mkWithSupport
defimported Lean
Given a finset $S \subseteq \mathrm{Fin}\,n$ and an assignment $f : S \to \mathrm{PauliNZ}$, constructs the Pauli string that equals $f(i).\mathrm{toBasis}$ on each $i \in S$ and equals $I$ elsewhere.
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 mkWithSupport {n : ℕ} (S : Finset (Fin n)) (f : S → PauliNZ) : PauliString n
- Defined in
- TCSlib, `mkWithSupport`
- 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.mkWithSupport← mkWithSupport (TCSlib/ErrorCorrectingCodes/QuantumHamming.lean:124): verbatim
- Verified
- 07 Oct 2026
- Axioms
- none listed
- Built on 4
- PauliNZ.toBasisEmbeds a non-identity Pauli ($X$, $Y$, or $Z$) from the three-element type $\mathrm{PauliNZ}$ into the full Pauli basis $\{I,X,Y,Z\}$.
- PauliNZA 3-element type for non-identity single-qubit Pauli operators, used in counting arguments.
- PauliStringA Pauli string of length $n$ is a function $p : \mathrm{Fin}\,n \to \mathrm{PauliBasis}$.
- PauliBasisThe four Pauli basis elements $\{I,X,Y,Z\}$, represented as an inductive type.
- Used by 2
- support_mkWithSupportSupport of a Pauli string built from prescribed data. Fix $n$, a finset $S \subseteq \mathrm{Fin}\,n$, and an assignment…
- card_pauliStringsExactSupportNumber of Pauli strings with a prescribed support. Let $n$ be a natural number and let $S \subseteq \mathrm{Fin}\,n$ be a set of…
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 /-- Constructs a Pauli string with support exactly `S` and non-identity assignments given by `f`. -/ noncomputable def mkWithSupport {n : ℕ} (S : Finset (Fin n)) (f : S → PauliNZ) : PauliString n := fun i => if h : i ∈ S then (f ⟨i, h⟩).toBasis else PauliBasis.I