P826_T1_PowerGridAlignment

Lean checked

Statement

This explanation was written alongside the formalization to describe the statement and its reasoning.

Lemma · Dyadic threshold alignment on a 768-cell decimal grid

Let r,p\in\mathbb Z. If p\leq768 and 0\leq r+768-p, then 2^r is a natural-number multiple of the decimal grid unit 10^{p-768}: there is b\in\mathbb N such that
2^r=b10^{p-768}.

Lean statement

Trellis authored these statements and proofs. Lean checks the formal proofs; the assumptions used by each proof are listed below.

import Tablet.P798_T1_GridAlignment

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: P826_T1_PowerGridAlignment]
theorem P826_T1_PowerGridAlignment (r p : Int)
    (hp : p <= 768) (hcap : 0 <= r + 768 - p) :
    exists b : Nat,
      (2 : Real) ^ r = (b : Real) * (10 : Real) ^ (p - 768) := by
Proof

Natural-language proof

The status above describes the Lean proof. Its explanatory prose may remain a sketch after that proof closes.

Explanatory prose status

Prose retained as authored. The explanatory prose is preserved as it stood when captured.

Proof

Put n=768-p\geq0 and m=r+768-p=r+n\geq0, and choose b=2^m5^n\in\mathbb N. Since 10=2\cdot5 and all bases are nonzero, the integer-power laws give
b10^{p-768} =2^m5^n10^{-n} =2^m5^n(2^n5^n)^{-1} =2^{m-n}=2^r.
Thus the exponent-capacity inequality is exactly what makes the normalized dyadic threshold an integer boundary of the same 768-cell grid on which GridAlignment places the retained decimal value.

Lean proof


  let n : Nat := (768 - p).toNat
  let m : Nat := (r + 768 - p).toNat
  have hn : (n : Int) = 768 - p := by
    dsimp only [n]
    rw [Int.toNat_of_nonneg (by omega)]
  have hm : (m : Int) = r + 768 - p := by
    simp only [m, Int.toNat_of_nonneg hcap]
  refine ⟨2 ^ m * 5 ^ n, ?_⟩
  push_cast
  rw [mul_assoc]
  have hten : (10 : Real) ^ (p - 768) =
      ((10 : Real) ^ n)⁻¹ := by
    rw [show p - 768 = -(n : Int) by omega, zpow_neg]
    norm_num only [zpow_natCast]
  rw [hten, show (10 : Real) ^ n = (2 : Real) ^ n * (5 : Real) ^ n by
    rw [← mul_pow]; norm_num]
  have h5ne : (5 : Real) ^ n ≠ 0 := pow_ne_zero _ (by norm_num)
  rw [mul_inv]
  have hcancel : (5 : Real) ^ n * ((2 : Real) ^ n)⁻¹ *
      ((5 : Real) ^ n)⁻¹ = ((2 : Real) ^ n)⁻¹ := by
    calc
      (5 : Real) ^ n * ((2 : Real) ^ n)⁻¹ * ((5 : Real) ^ n)⁻¹ =
          ((2 : Real) ^ n)⁻¹ * ((5 : Real) ^ n * ((5 : Real) ^ n)⁻¹) := by
            ring
      _ = ((2 : Real) ^ n)⁻¹ := by rw [mul_inv_cancel₀ h5ne, mul_one]
  rw [show (5 : Real) ^ n * (((2 : Real) ^ n)⁻¹ * ((5 : Real) ^ n)⁻¹) =
      ((2 : Real) ^ n)⁻¹ by rw [← mul_assoc]; exact hcancel]
  rw [← div_eq_mul_inv, ← zpow_natCast, ← zpow_natCast]
  rw [← zpow_sub₀ (by norm_num : (2 : Real) ≠ 0)]
  congr 1
  omega

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.P798_T1_GridAlignment

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: P826_T1_PowerGridAlignment]
theorem P826_T1_PowerGridAlignment (r p : Int)
    (hp : p <= 768) (hcap : 0 <= r + 768 - p) :
    exists b : Nat,
      (2 : Real) ^ r = (b : Real) * (10 : Real) ^ (p - 768) := by
-- BODY
  let n : Nat := (768 - p).toNat
  let m : Nat := (r + 768 - p).toNat
  have hn : (n : Int) = 768 - p := by
    dsimp only [n]
    rw [Int.toNat_of_nonneg (by omega)]
  have hm : (m : Int) = r + 768 - p := by
    simp only [m, Int.toNat_of_nonneg hcap]
  refine ⟨2 ^ m * 5 ^ n, ?_⟩
  push_cast
  rw [mul_assoc]
  have hten : (10 : Real) ^ (p - 768) =
      ((10 : Real) ^ n)⁻¹ := by
    rw [show p - 768 = -(n : Int) by omega, zpow_neg]
    norm_num only [zpow_natCast]
  rw [hten, show (10 : Real) ^ n = (2 : Real) ^ n * (5 : Real) ^ n by
    rw [← mul_pow]; norm_num]
  have h5ne : (5 : Real) ^ n ≠ 0 := pow_ne_zero _ (by norm_num)
  rw [mul_inv]
  have hcancel : (5 : Real) ^ n * ((2 : Real) ^ n)⁻¹ *
      ((5 : Real) ^ n)⁻¹ = ((2 : Real) ^ n)⁻¹ := by
    calc
      (5 : Real) ^ n * ((2 : Real) ^ n)⁻¹ * ((5 : Real) ^ n)⁻¹ =
          ((2 : Real) ^ n)⁻¹ * ((5 : Real) ^ n * ((5 : Real) ^ n)⁻¹) := by
            ring
      _ = ((2 : Real) ^ n)⁻¹ := by rw [mul_inv_cancel₀ h5ne, mul_one]
  rw [show (5 : Real) ^ n * (((2 : Real) ^ n)⁻¹ * ((5 : Real) ^ n)⁻¹) =
      ((2 : Real) ^ n)⁻¹ by rw [← mul_assoc]; exact hcancel]
  rw [← div_eq_mul_inv, ← zpow_natCast, ← zpow_natCast]
  rw [← zpow_sub₀ (by norm_num : (2 : Real) ≠ 0)]
  congr 1
  omega

end dec2flt_model

Proof structure

Follow the declared dependencies to read the supporting statements and proofs.

Explore this dependency tree

Inspect related source (116)
More program dependencies (83)
Standard-library dependencies (30)

Related source and models come from the extraction records and declared dependencies.

Proof assumptions and review

Lean checks the formal proof. Trellis also reviews how the statement corresponds to the intended requirement.

Transitive assumptions

This list combines the assumptions recorded for this declaration and its dependencies. It may include assumptions used by auxiliary declarations in those modules.

Helper theorems included
Technical checking records
Local closure summary
{
  "node": "P826_T1_PowerGridAlignment",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "31e2121c4fa28899fc6e4b4cc2c7e06a3c1ebc6b4fae9641cefb9fd1392b3e06",
  "active_statement_hash": "151d0cd9436face2366c158bbe6c2a5086d09da0f7511e569463598d4f0954f1",
  "kernel_axioms": [
    "Classical.choice",
    "Quot.sound",
    "propext"
  ],
  "toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
  "lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
  "checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
  "approved_axioms_hash": "ab64d13f256386ee0e494a5abcc6a5db49512cf3d90bbdfcabd6327793a31f95",
  "axcheck_status": "Agreed",
  "accepted_at_snapshot_id": "revalidate-cycle-194",
  "boundary_theorems": {},
  "strict_theorem_deps": {},
  "strict_definition_deps": {}
}
Prose assessment
{
  "label": "Lean proof closed; predictive prose review no longer required",
  "assessment_status": null,
  "fingerprint_relation": "unknown",
  "assessment_fingerprint": null,
  "current_fingerprint": "sound-v2:fcc2cff081ecc2ff1ef7262aea3c679ac5d15a3aa740269a00b09a101b201e17",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}