An exact rational tolerance filter on finite candidates
DefinitionCouret_RecohNoisyUniqueness_7e21ca0c53e8couret-programmecouret-unification-20261108
Let have decidable equality, be any finite coordinate type, and be a supplied finite candidate set. Let give predicted complex coordinates and observed coordinates. For rational radius , the decoder is
where squared distance is the sum of the two rational coordinate-difference squares. It performs only rational comparisons. Negative radii reject all candidates; for an empty coordinate type, a nonnegative radius accepts every supplied candidate. Accuracy, separation, true-candidate membership and error budgets are hypotheses of separate correctness results, not assumptions or consequences of this definition alone.
Definition code
import Aesop
import Lean.Elab.Tactic.Omega
import Mathlib.Algebra.BigOperators.Group.Finset.Basic
import Mathlib.Algebra.Field.ZMod
import Mathlib.Algebra.Group.AddChar
import Mathlib.Algebra.Module.ZMod
import Mathlib.Analysis.Complex.Basic
import Mathlib.Analysis.Complex.Norm
import Mathlib.Analysis.SpecialFunctions.Complex.CircleAddChar
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Finite.Card
import Mathlib.Data.Finset.Card
import Mathlib.Data.Finset.Powerset
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Fintype.Card
import Mathlib.Data.Nat.Factorization.Basic
import Mathlib.Data.ZMod.Basic
import Mathlib.FieldTheory.Finiteness
import Mathlib.GroupTheory.FiniteAbelian.Duality
import Mathlib.LinearAlgebra.Dimension.Constructions
import Mathlib.LinearAlgebra.Dimension.Finite
import Mathlib.LinearAlgebra.Dual.Lemmas
import Mathlib.LinearAlgebra.LinearIndependent.Lemmas
import Mathlib.Tactic.Abel
import Mathlib.Tactic.Choose
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.LinearCombination
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.Ring
import Mathlib.Tactic.Tauto
import Definitions.Def_Couret_RecohProbeStability_e389a2280f15
import Definitions.Def_Couret_RecohRationalComplex_e4146c64164f
import Mathlib.Tactic.Positivity
set_option autoImplicit false
/-!
Noise tolerance with explicit prediction error. The executable decoder
below compares rational squared distances. Its correctness theorem relates
those comparisons to the complex readings, accounting separately for the
measurement error, the prediction error, and the acceptance radius.
The candidate set is supplied explicitly. Completeness requires the true
support to occur in that set; this module makes no ambient enumeration claim.
-/
namespace Couret.STROBO2TORS
/-- A finite, executable decoder. Negative radii reject every candidate.
No equality or order comparison of real or complex numbers is performed. -/
def recohRationalNoisyDecoder {X I : Type*} [DecidableEq X] [Fintype I]
(candidates : Finset X) (predicted : X → I → RecohRationalComplex)
(observed : I → RecohRationalComplex) (radius : ℚ) : Finset X :=
candidates.filter fun S => 0 ≤ radius ∧
∀ i, recohRationalSquaredDistance (observed i) (predicted S i) ≤ radius ^ 2
end Couret.STROBO2TORS
Source
Alexandre Couret, https://github.com/alexcour/couret-finite-verifications/blob/eb7323762a9fa64f54f95ea7aa2981dee0ba54af/research/strobo-2tors-2026-10-12/lean/RecohNoisyUniqueness.lean; source file SHA-256 6052faa2e2efbc2d3e68381058002e13b4872e2433fd587269e83b1de0f67f8c