Theory Wasm_Ast
section ‹WebAssembly Core AST›
theory Wasm_Ast
imports
Main
"Native_Word.Uint8"
"Word_Lib.Reversed_Bit_Lists"
begin
type_synonym
i = nat
type_synonym
off = nat
type_synonym
a = nat
typedecl i32
typedecl i64
typedecl f32
typedecl f64
type_synonym byte = uint8
typedef bytes = "UNIV :: (byte list) set" ..
setup_lifting type_definition_bytes
declare Quotient_bytes[transfer_rule]
lift_definition bytes_takefill :: "byte ⇒ nat ⇒ bytes ⇒ bytes" is "(λa n as. takefill (Abs_uint8 a) n as)" .
lift_definition bytes_replicate :: "nat ⇒ byte ⇒ bytes" is "(λn b. replicate n (Abs_uint8 b))" .
definition msbyte :: "bytes ⇒ byte" where
"msbyte bs = last (Rep_bytes bs)"
typedef mem = "UNIV :: (byte list) set" ..
setup_lifting type_definition_mem
declare Quotient_mem[transfer_rule]
lift_definition read_bytes :: "mem ⇒ nat ⇒ nat ⇒ bytes" is "(λm n l. take l (drop n m))" .
lift_definition write_bytes :: "mem ⇒ nat ⇒ bytes ⇒ mem" is "(λm n bs. (take n m) @ bs @ (drop (n + length bs) m))" .
lift_definition mem_append :: "mem ⇒ bytes ⇒ mem" is append .
typedecl host
typedecl host_state