Elm Exactly

TheoremstripFactor_pow2

StandardElmMech/Eff/Properties.lean:240, Numbers: a float's exact value is decimal · tactic proof

Statement

theorem stripFactor_pow2 : ∀ (j fuel : Nat), j ≤ fuel → stripFactor 2 fuel (2 ^ j) = 1
  | 0, 0, _ => rfl
  | 0, _ + 1, _ => by simp [stripFactor]
  | j + 1, fuel + 1, h => by
    simp only [stripFactor]
    have h2 : (2 : Nat) ^ (j + 1) % 2 = 0

Proof

by rw [Nat.pow_succ]; simp
    have hne : (2 : Nat) ^ (j + 1) ≠ 0 := Nat.ne_of_gt (Nat.two_pow_pos _)
    have hc : (2 ≥ 2 ∧ (2 : Nat) ^ (j + 1) ≠ 0 ∧ (2 : Nat) ^ (j + 1) % 2 = 0) := ⟨by decide, hne, h2⟩
    split
    · rw [Nat.pow_succ, Nat.mul_div_cancel _ (by decide)]
      exact stripFactor_pow2 j fuel (by omega)
    · exact absurd hc ‹_›

Proved with tactics, which Lean expands into a proof term that its kernel checks.

Used by

In StandardElmMech/Eff/Properties.lean: APPLY of the effect values has one member; the rulings A74, A76, A88 and A92; canonical payload types, the decimality of a float's exact value, and that every value of a payload type has a canonical encoding (enc_total).

A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.