arrival_nat_ceil_of_dist_lt_one
For any natural number u and real number x such that x ≤ u and (u : ℝ) - x < 1, u equals Nat.ceil x.
Statement
theorem arrival_nat_ceil_of_dist_lt_one (u : ℕ) (x : ℝ) (h1 : x ≤ u) (h2 : (u : ℝ) - x < 1) :
u = Nat.ceil x- Source
- folklore
- Verified
- 29 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 1
- arrival_exact_departure_counts_eq_ceil_discountedIn a periodic routing network with finite internal vertex type V with decidable equality, absorbing terminal type S, origin o : V,…
Read back from the Lean
For every natural number $u$ and every real number $x$, if $x \le u$ (with $u$ cast to $\mathbb{R}$) and $u - x < 1$, then $u = \lceil x \rceil_+$ (that is, $u$ equals Nat.ceil x, the ceiling of $x$ as a natural number).
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
The proof, explained
The proof splits into cases on whether u = 0 or u > 0. When u = 0, the hypothesis x ≤ 0 forces ⌈x⌉₊ = 0 = u. When u > 0, the hypothesis x ≤ u immediately yields ⌈x⌉₊ ≤ u, while the condition u - x < 1 rearranges to u - 1 < x. Casting u - 1 to ℝ gives u - 1 < ⌈x⌉₊, which implies u ≤ ⌈x⌉₊, and the two inequalities together establish u = ⌈x⌉₊.
When u = 0, the ceiling ⌈x⌉₊ equals 0, so u = ⌈x⌉₊.
We split on whether u = 0 or u > 0 (Nat.eq_zero_or_pos). In the case u = 0, the hypothesis x ≤ u becomes x ≤ 0. By the ceiling upper bound equivalence (Nat.ceil_le), this implies ⌈x⌉₊ ≤ 0. Since ⌈x⌉₊ is a natural number and thus at least 0 (Nat.zero_le), antisymmetry of ≤ (le_antisymm) forces ⌈x⌉₊ = 0. Simplifying with this equality closes the u = 0 case.
uses
Nat.eq_zero_or_pos,Nat.ceil_le,Nat.zero_le,le_antisymmrcases Nat.eq_zero_or_pos u with hu | hu · subst hu have hx0 : x ≤ 0 := by simpa using h1 have hc0 : Nat.ceil x ≤ 0 := by rw [Nat.ceil_le]; simpa using hx0 have hcge : 0 ≤ Nat.ceil x := Nat.zero_le _ have hzero : Nat.ceil x = 0 := le_antisymm hc0 hcge simp [hzero]
The ceiling ⌈x⌉₊ is at most u.
In the case u > 0, rewriting the goal with the characteristic property of the natural ceiling (Nat.ceil_le), which states ⌈x⌉₊ ≤ u ↔ x ≤ u, reduces the claim directly to the hypothesis x ≤ u.
uses
Nat.ceil_le· have hle : Nat.ceil x ≤ u := by rw [Nat.ceil_le]; exact h1
As a real number, the predecessor of u is strictly less than x: ((u - 1 : ℕ) : ℝ) < x.
From u - x < 1, linear real arithmetic (linarith) gives u - 1 < x. Because u > 0, we have u ≠ 0 (Nat.pos_iff_ne_zero.mp), which implies 1 ≤ u (Nat.one_le_iff_ne_zero.mpr). This allows casting the natural number subtraction to ℝ (Nat.cast_sub), showing that ((u - 1 : ℕ) : ℝ) = (u : ℝ) - 1. Substituting this equality into u - 1 < x yields ((u - 1 : ℕ) : ℝ) < x.
uses
Nat.cast_sub,Nat.one_le_iff_ne_zero.mpr,Nat.pos_iff_ne_zero.mphave hlt : (u : ℝ) - 1 < x := by linarith have hcast : ((u - 1 : ℕ) : ℝ) = (u : ℝ) - 1 := by rw [Nat.cast_sub (Nat.one_le_iff_ne_zero.mpr (Nat.pos_iff_ne_zero.mp hu))] norm_num have hlt' : ((u - 1 : ℕ) : ℝ) < x := by rw [hcast]; exact hlt
u ≤ ⌈x⌉₊.
Since ((u - 1 : ℕ) : ℝ) < x, the ceiling strict inequality equivalence (Nat.lt_ceil) implies u - 1 < ⌈x⌉₊. Linear integer arithmetic (omega) then deduces that u ≤ ⌈x⌉₊.
uses
Nat.lt_ceilhave hge : u ≤ Nat.ceil x := by have h1' : u - 1 < Nat.ceil x := (Nat.lt_ceil).mpr hlt' omega
u = ⌈x⌉₊.
Having established both ⌈x⌉₊ ≤ u and u ≤ ⌈x⌉₊, linear integer arithmetic (omega) concludes that u = ⌈x⌉₊.
omega
Nat.eq_zero_or_pos- Every natural number is either 0 or strictly positive.
Nat.ceil_le- For any real number a and natural number n, ⌈a⌉₊ ≤ n if and only if a ≤ n.
Nat.zero_le- Every natural number is greater than or equal to 0.
le_antisymm- If a ≤ b and b ≤ a in a partial order, then a = b.
Nat.cast_sub- For natural numbers m ≤ n, the cast of their difference into an additive group with one equals the difference of their casts: ↑(n - m) = ↑n - ↑m.
Nat.one_le_iff_ne_zero.mpr- If a natural number is non-zero, then 1 ≤ n.
Nat.pos_iff_ne_zero.mp- If a natural number is strictly positive (0 < n), then n ≠ 0.
Nat.lt_ceil- For a natural number n and real number a, n < ⌈a⌉₊ if and only if n < a.
- In paper mathematics, subtracting 1 from a positive integer and viewing the result in ℝ is identical to real subtraction without comment. In Lean, natural number subtraction saturates at zero (0 - 1 = 0), so the cast equality ((u - 1 : ℕ) : ℝ) = (u : ℝ) - 1 requires u > 0 and is verified explicitly in lines 15–17.
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
/-- An integer u with x <= u and u - x < 1 equals the ceiling of x. -/theorem arrival_nat_ceil_of_dist_lt_one (u : ℕ) (x : ℝ) (h1 : x ≤ u) (h2 : (u : ℝ) - x < 1) : u = Nat.ceil x := by rcases Nat.eq_zero_or_pos u with hu | hu · subst hu have hx0 : x ≤ 0 := by simpa using h1 have hc0 : Nat.ceil x ≤ 0 := by rw [Nat.ceil_le]; simpa using hx0 have hcge : 0 ≤ Nat.ceil x := Nat.zero_le _ have hzero : Nat.ceil x = 0 := le_antisymm hc0 hcge simp [hzero] · have hle : Nat.ceil x ≤ u := by rw [Nat.ceil_le]; exact h1 have hlt : (u : ℝ) - 1 < x := by linarith have hcast : ((u - 1 : ℕ) : ℝ) = (u : ℝ) - 1 := by rw [Nat.cast_sub (Nat.one_le_iff_ne_zero.mpr (Nat.pos_iff_ne_zero.mp hu))] norm_num have hlt' : ((u - 1 : ℕ) : ℝ) < x := by rw [hcast]; exact hlt have hge : u ≤ Nat.ceil x := by have h1' : u - 1 < Nat.ceil x := (Nat.lt_ceil).mpr hlt' omega omega