Repository navigation
Expand file tree
/
Copy pathFile.lean
More file actions
33 lines (27 loc) · 1.42 KB
/
Copy pathFile.lean
File metadata and controls
33 lines (27 loc) · 1.42 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
import Library.Hashing.XxHash64.Bytes
import LeanExe.Pipeline.FileBytes
/-! Checked after `tests/verified/run.sh` writes `build/verified/xxhash64.wasm`, with
`tools/leanrun --timeout 10m lake env lean Library/Hashing/XxHash64/File.lean`: the file holds
`encode compiled.module`, which `compiled.encoded` states as literal bytes, so it decodes to the
module of the call theorems of `Library.Hashing.XxHash64.Bytes`. The file's bytes are a term
nested as deep as the file is long, which the kernel checks under a raised `maxRecDepth`. -/
namespace Library.Hashing.XxHash64.File
set_option maxRecDepth 100000 in
/-- `build/verified/xxhash64.wasm` holds `encode compiled.module`. -/
theorem xxhash64_file :
Wasm.Encoding.encode compiled.module =
.ok (binary_file% "../../../build/verified/xxhash64.wasm") :=
LeanExe.Pipeline.encode_eq_of_encoding compiled.encoded.1 (by decide +kernel)
set_option maxRecDepth 100000 in
/-- `build/verified/xxhash64.wasm` decodes to the module of the call theorems. -/
theorem xxhash64_file_decode :
Wasm.Encoding.decode (binary_file% "../../../build/verified/xxhash64.wasm") =
.ok compiled.module := by
obtain ⟨bytes, henc, hdec, _⟩ := compiled.bytes
have h : binary_file% "../../../build/verified/xxhash64.wasm" = bytes :=
Except.ok.inj (xxhash64_file.symm.trans henc)
rw [h]
exact hdec
#print axioms xxhash64_file
#print axioms xxhash64_file_decode
end Library.Hashing.XxHash64.File