Fixed Reporting Codes and Closed Boundary Screening — Definitions
DefinitionAPFPaper1_StableReportingFor real delta, let N(delta)=Nat.ceil(1/delta). Let q(delta,x)=min(max(1,Nat.ceil(x/delta)),N(delta)). Natural-number ceiling is clipped at zero for negative inputs; on normalized inputs this agrees with the source's integer ceiling after its lower clipping. For delta>0 the zero-based bin code b(delta,x) is q(delta,x)-1 as an element of Fin N(delta). The definition proves its index bound internally and imports no theorem target.
For arbitrary types W and A and rho:W→A→R, the profile code of a is the function w↦b(delta,rho(w,a)). Cells is the range of this map, counting equal functions once. It is a set of profiles, not a set of raw parameters or a quotient by exact contextual equivalence.
An internal boundary is a natural number k with 1<=k<N(delta). Given rho:W→Theta→R and a real margin r, the screening set contains exactly those theta for which r<=|rho(w,theta)-k delta| for every w and every internal k. The definition does not assume delta>0, r>0, normalization, finiteness, continuity or nonemptiness. These hypotheses occur separately where needed. If there are no internal boundaries, the condition is vacuous. These are all seven new declarations.
import Mathlib
set_option autoImplicit false
noncomputable section
namespace APFPaper1.FiniteResolution
noncomputable def binCount (delta : ℝ) : ℕ := Nat.ceil (1/delta)
noncomputable def binLabel (delta x : ℝ) : ℕ :=
min (max 1 (Nat.ceil (x/delta))) (binCount delta)
noncomputable def binCode (delta : ℝ) (hd : 0<delta) (x : ℝ) : Fin (binCount delta) :=
⟨binLabel delta x-1, by have h : 1≤binLabel delta x ∧ binLabel delta x≤binCount delta :=
⟨le_min (le_max_left _ _) (Nat.one_le_ceil_iff.mpr (one_div_pos.mpr hd)),
min_le_right _ _⟩; omega⟩
noncomputable def profileCode {W A : Type} (delta : ℝ) (hd : 0<delta)
(rho : W → A → ℝ) (a : A) : W → Fin (binCount delta) :=
fun w => binCode delta hd (rho w a)
def Cells {W A : Type} (delta : ℝ) (hd : 0<delta) (rho : W → A → ℝ) :=
Set.range (profileCode delta hd rho)
end APFPaper1.FiniteResolution
namespace APFPaper1.CompactScreening
open APFPaper1.FiniteResolution
def InternalBoundary (delta : ℝ) := {k : ℕ // 1≤k ∧ k<binCount delta}
def screeningSet {Theta W : Type} (rho : W → Theta → ℝ) (delta radius : ℝ) : Set Theta :=
{theta | ∀ w (k : InternalBoundary delta), radius≤|rho w theta-(k.val:ℝ)*delta|}
end APFPaper1.CompactScreening
Read-back
What the Lean code literally says, in plain math · GPT-6
Blind read-back of declaration.lean
Auditor model: Codex, based on GPT-6. A more specific model variant is not exposed in this auditor's context.
binCount. For every real number , this defines the natural number , where is the least nonnegative integer greater than or equal to the real number (so it is zero when ). There is no positivity hypothesis on . Real division is total, with , so for ; for , , and for , .
binLabel. For every pair of real numbers , this defines the natural number , where the natural-number ceiling is the least nonnegative integer greater than or equal to its real argument, and division by zero returns zero. No restriction is imposed on either real argument. In particular, for every when . When , its values lie between and inclusive: every receives label , and every receives the largest label. For each natural number satisfying , the point receives label ; the boundary itself is thus assigned to that label. The input need not belong to .
binCode. For every real together with a proof of , and every real , this defines an element of the finite type of natural numbers strictly less than , with underlying value . Here the natural-number ceiling is the least nonnegative integer at least its argument, and subtraction is natural-number subtraction, truncated at zero. The positivity hypothesis ensures and that the expression before subtraction belongs to , so the resulting value belongs to . There is no restriction on ; in particular all have code zero, and all have code . At an internal boundary , where is a natural number with , the code is . When , every real input has code zero. This declaration requires the positive- proof and therefore supplies no code for .
profileCode. For arbitrary types and , a real together with a proof of , an arbitrary function , and an element , this defines the function on whose value at every is the natural number , regarded as an element of , where and the natural-number ceiling is the least nonnegative integer at least its real argument. The subtraction is natural-number subtraction; positivity of ensures that the quantity being reduced by one is at least one. Neither type is assumed finite or nonempty, and no bounds or other properties are assumed for . If is empty, the result is the unique function on the empty domain; if is empty, there is no element at which to evaluate this definition. If , the result is the constant zero function on .
Cells. For arbitrary types , a real together with a proof of , and an arbitrary function , this defines a set of functions from to , where : a function belongs to the set exactly when there exists an element such that, for every , the underlying natural-number value of equals . The natural-number ceiling is the least nonnegative integer at least its real argument, subtraction is natural-number subtraction, and the positivity hypothesis ensures that these are valid values below . Membership requires existence of such an , without uniqueness. The set consists of the functions attained by these choices of ; no finiteness, nonemptiness, or bounds on are assumed. It is empty if is empty. If is empty and is nonempty, it is the singleton containing the empty-domain function. If and is nonempty, it is the singleton containing the constant zero function.
InternalBoundary. For every real , this defines the type of natural numbers equipped with proofs of both and , where the natural-number ceiling is the least nonnegative integer at least its real argument and division by zero returns zero. Its possible numerical values are exactly the integers from through , with the upper condition strictly less than the ceiling. There is no hypothesis that is positive. The type is empty whenever that ceiling is zero or one, including every and every . Its elements carry the index ; the definition does not itself return the real number .
screeningSet. For arbitrary types , an arbitrary function , and arbitrary real numbers , this defines the subset of consisting exactly of those such that, for every and every natural number satisfying , one has , with interpreted as a real number in the product. The natural-number ceiling is the least nonnegative integer at least its real argument, and division by zero returns zero. The comparison is non-strict, so equality with is permitted. No positivity assumption is imposed on or ; neither type is assumed finite, nonempty, or equipped with topology, and has no assumed bounds or regularity. Only the indices satisfying the displayed strict upper bound are tested. If is empty, or if the ceiling is zero or one, the universal condition is vacuous and the set is all of ; the latter includes and . For the inequality always holds, so the set is likewise all of . For other parameters, the definition asserts no existence of a qualifying ; if is empty, the defined set is empty.