interplane.Get Omega
Read in your language

hive-view

aien-dev/hive-view

Brought by drakestapleton

branch main Branches Tags History

hive-view / evidence / cpu-shares.lean

24 lines · 1430 bytes Raw Blame History
1import Mathlib
2
3/-! hive-view CPU shares, as reported in README.md and evidence/2026-11-07-v1.md.
4
5`gate cpu PID 60` counts CPU ticks at USER_HZ = 100 over 60 s, so one core supplies 60*100 ticks
6and the 20-core Spark 60*100*20. The measured tick counts (182, 76, 171) are MEASURED inputs; this
7file proves only the arithmetic from them to the percentages shown, and the rounding.
8
9Checked with Lean 4 v4.35.0 and Mathlib 56a005855ea17e0b0958f73ec801ae140b0a1679:
10`lake env lean evidence/cpu-shares.lean` in a project with that toolchain and Mathlib. -/
11
12theorem run1_core : (182:ℚ) / (60*100) * 100 = 91/30 := by norm_num
13theorem run2_core : (76:ℚ) / (60*100) * 100 = 19/15 := by norm_num
14theorem run3_core : (171:ℚ) / (60*100) * 100 = 57/20 := by norm_num
15theorem run1_machine : (182:ℚ) / (60*100*20) * 100 = 91/600 := by norm_num
16theorem run2_machine : (76:ℚ) / (60*100*20) * 100 = 19/300 := by norm_num
17theorem run3_machine : (171:ℚ) / (60*100*20) * 100 = 57/400 := by norm_num
18
19/-- The shown values 3.03, 1.27, 2.85 (% of one core) and 0.15, 0.063, 0.1425 (% of the machine)
20are each within half a unit of their last shown digit of the exact value. -/
21theorem shown_values_round :
22 |(91/30:ℚ) - 303/100| < 1/200 ∧ |(19/15:ℚ) - 127/100| < 1/200 ∧ (57/20:ℚ) = 285/100 ∧
23 |(91/600:ℚ) - 15/100| < 1/200 ∧ |(19/300:ℚ) - 63/1000| < 1/2000 ∧ (57/400:ℚ) = 1425/10000 := by
24 norm_num [abs_lt]