Elm Exactly

Theorema92_dec_bytes

StandardElmMech/Eff/Properties.lean:173, A92 · tactic proof

A92: only a byte sequence decodes at Bytes, as bin# of its bytes.

Statement

theorem a92_dec_bytes {j : BVal} {v : Val} : Dec .bytes j v ↔
    ∃ os, j = .bytes os ∧ (∀ o ∈ os, o < 256) ∧ v = binVal os

Proof

by
  constructor
  · intro h
    rw [dec_iff] at h
    cases j <;> simp [dec] at h
    rename_i os
    obtain ⟨hall, rfl⟩ := h
    exact ⟨os, rfl, hall, rfl⟩
  · rintro ⟨os, rfl, hos, rfl⟩; exact .r_e_dec_bytes os hos

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

Rules of the book it uses

Theorems it uses

About ruling A92 of the book, where the implementations disagreed or were silent and the definition decides.

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.