Repository navigation
Expand file tree
/
Copy pathPrintFloatFile.lean
More file actions
35 lines (29 loc) · 1.56 KB
/
Copy pathPrintFloatFile.lean
File metadata and controls
35 lines (29 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import Library.Numerics.Decimal.PrintFloat.PrintFloatBytes
import LeanExe.Pipeline.FileBytes
/-! Checked after `build/verified/printfloat.wasm` is written by `tools/Emit.lean`, with
`tools/leanrun --timeout 10m lake env lean Library/Numerics/Decimal/PrintFloat/PrintFloatFile.lean`: the file holds
`encode PrintFloat.compiled.module`, so it decodes to the module of the four byte theorems of
`PrintFloatBytes`. -/
namespace Library.Numerics.Decimal.PrintFloat.PrintFloatFile
set_option maxRecDepth 100000 in
/-- `build/verified/printfloat.wasm` holds `encode PrintFloat.compiled.module`. -/
theorem print_file :
Wasm.Encoding.encode PrintFloat.compiled.module =
.ok (binary_file% "../../../../build/verified/printfloat.wasm") :=
LeanExe.Pipeline.encode_eq_of_toList (by decide +kernel)
set_option maxRecDepth 100000 in
/-- `build/verified/printfloat.wasm` decodes to the module of the printers' byte theorems. -/
theorem print_file_decode :
Wasm.Encoding.decode (binary_file% "../../../../build/verified/printfloat.wasm") =
.ok PrintFloat.compiled.module := by
obtain ⟨bytes, henc, hdec, _⟩ := PrintFloatBytes.print64_bytes_accuracy
have _h64e := PrintFloatBytes.print64Ecma_bytes_accuracy
have _h32 := PrintFloatBytes.print32_bytes_accuracy
have _h32e := PrintFloatBytes.print32Ecma_bytes_accuracy
have h : binary_file% "../../../../build/verified/printfloat.wasm" = bytes :=
Except.ok.inj (print_file.symm.trans henc)
rw [h]
exact hdec
#print axioms print_file
#print axioms print_file_decode
end Library.Numerics.Decimal.PrintFloat.PrintFloatFile