diff --git a/document/core/Makefile b/document/core/Makefile index 699c2b5c2e..e11e7894ec 100644 --- a/document/core/Makefile +++ b/document/core/Makefile @@ -352,7 +352,7 @@ latex: latexpdf: $(GENERATED) $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex LATEXMKOPTS=" $(BUILDDIR)/latex/LOG 2>&1 || cat $(BUILDDIR)/latex/LOG + $(MAKE) -C $(BUILDDIR)/latex LATEXMKOPTS=" -file-line-error -halt-on-error" all-pdf >$(BUILDDIR)/latex/LOG 2>&1 || cat $(BUILDDIR)/latex/LOG @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." .PHONY: latexpdfja diff --git a/specification/wasm-3.0/2.1-validation.types.spectec b/specification/wasm-3.0/2.1-validation.types.spectec index eac31a1408..692f986dea 100644 --- a/specification/wasm-3.0/2.1-validation.types.spectec +++ b/specification/wasm-3.0/2.1-validation.types.spectec @@ -24,6 +24,9 @@ rule Heaptype_ok/typeuse: C |- typeuse : OK -- Typeuse_ok: C |- typeuse : OK +rule Heaptype_ok/bot: + C |- BOT : OK + rule Reftype_ok: C |- REF NULL? heaptype : OK -- Heaptype_ok: C |- heaptype : OK diff --git a/specification/wasm-3.0/2.3-validation.instructions.spectec b/specification/wasm-3.0/2.3-validation.instructions.spectec index a893c85c13..9990490585 100644 --- a/specification/wasm-3.0/2.3-validation.instructions.spectec +++ b/specification/wasm-3.0/2.3-validation.instructions.spectec @@ -637,7 +637,7 @@ rule Instrs_ok/frame: rule Expr_ok: C |- instr* : t* - -- Instrs_ok: C |- instr* : eps ->_(eps) t* + -- Instrs_ok: C |- instr* : eps -> t* ;; Constant expressions diff --git a/specification/wasm-3.0/4.1-execution.values.spectec b/specification/wasm-3.0/4.1-execution.values.spectec index b6951b99ee..6237c93ac0 100644 --- a/specification/wasm-3.0/4.1-execution.values.spectec +++ b/specification/wasm-3.0/4.1-execution.values.spectec @@ -81,6 +81,23 @@ rule Val_ok/ref: -- Ref_ok: s |- ref : rt +;; Field values + +relation Packval_ok: store |- packval : packtype +relation Fieldval_ok: store |- fieldval : storagetype + +rule Packval_ok: + s |- PACK pt c : pt + +rule Fieldval_ok/val: + s |- val : t + -- Val_ok: s |- val : t + +rule Fieldval_ok/packval: + s |- packval : pt + -- Packval_ok: s |- packval : pt + + ;; External addresses relation Externaddr_ok: store |- externaddr : externtype hint(macro "%externaddr") diff --git a/specification/wasm-3.0/7.1-soundness.configurations.spectec b/specification/wasm-3.0/7.1-soundness.configurations.spectec new file mode 100644 index 0000000000..37ba3f4d39 --- /dev/null +++ b/specification/wasm-3.0/7.1-soundness.configurations.spectec @@ -0,0 +1,339 @@ +;; Administrative instructions + +relation Instr_ok2: store; context |- instr : instrtype +relation Instrs_ok2: store; context |- instr* : instrtype +relation Expr_ok2: store; context |- expr : resulttype + +rule Instr_ok2/plain: + s; C |- instr : t_1* ->_(x*) t_2* + -- Instr_ok: C |- instr : t_1* ->_(x*) t_2* + +rule Instr_ok2/ref: + s; C |- ref : eps -> rt + -- Ref_ok: s |- ref : rt + +rule Instr_ok2/label: + s; C |- LABEL_ n `{instr'*} instr* : eps -> t* + -- Instrs_ok2: s; C |- instr'* : t'^n ->_(x'*) t* + -- Instrs_ok2: s; {LABELS (t')^n} ++ C |- instr* : eps ->_(x*) t* + +rule Instr_ok2/frame: + s; C |- FRAME_ n `{f} instr* : eps -> t^n + -- Frame_ok: s |- f : C' + -- Expr_ok2: s; C' |- instr* : t^n + +rule Instr_ok2/handler: + s; C |- HANDLER_ n `{catch*} instr* : t_1* -> t_2* + -- (Catch_ok: C |- catch : OK)* + -- Instrs_ok2: s; C |- instr* : t_1* ->_(x*) t_2* + +rule Instr_ok2/trap: + s; C |- TRAP : t_1* -> t_2* + -- Instrtype_ok: C |- t_1* -> t_2* : OK + + +rule Instrs_ok2/empty: + s; C |- eps : eps -> eps + +rule Instrs_ok2/seq: + s; C |- instr_1 instr_2* : t_1* ->_(x_1* x_2*) t_3* + -- Instr_ok2: s; C |- instr_1 : t_1* ->_(x_1*) t_2* + -- (if C.LOCALS[x_1] = init t)* + -- Instrs_ok2: s; $with_locals(C, x_1*, (SET t)*) |- instr_2* : t_2* ->_(x_2*) t_3* + +rule Instrs_ok2/sub: + s; C |- instr* : it' + -- Instrs_ok2: s; C |- instr* : it + -- Instrtype_sub: C |- it <: it' + -- Instrtype_ok: C |- it' : OK + +;; TODO(3, rossberg): allow omitting parens +rule Instrs_ok2/frame: + s; C |- instr* : (t* t_1*) ->_(x*) (t* t_2*) + -- Instrs_ok2: s; C |- instr* : t_1* ->_(x*) t_2* + -- Resulttype_ok: C |- t* : OK + + +rule Expr_ok2: + s; C |- instr* : t* + -- Instrs_ok2: s; C |- instr* : eps -> t* + + +;; Instances + +relation Taginst_ok: store |- taginst : tagtype +relation Globalinst_ok: store |- globalinst : globaltype +relation Meminst_ok: store |- meminst : memtype +relation Tableinst_ok: store |- tableinst : tabletype +relation Funcinst_ok: store |- funcinst : deftype +relation Datainst_ok: store |- datainst : datatype +relation Eleminst_ok: store |- eleminst : elemtype +relation Exportinst_ok: store |- exportinst : OK +relation Structinst_ok: store |- structinst : OK +relation Arrayinst_ok: store |- arrayinst : OK +relation Exninst_ok: store |- exninst : OK + +rule Taginst_ok: + s |- {TYPE jt} : jt + -- Tagtype_ok: {} |- jt : OK + +rule Globalinst_ok: + s |- {TYPE mut? t, VALUE val} : mut? t + -- Globaltype_ok: {} |- mut? t : OK + -- Val_ok: s |- val : t + +rule Meminst_ok: + s |- {TYPE at `[n..m] PAGE, BYTES b*} : at `[n..m] PAGE + -- Memtype_ok: {} |- at `[n..m] PAGE : OK + -- if |b*| = $(n * $($(64 * $Ki))) + +rule Tableinst_ok: + s |- {TYPE at `[n..m] rt, REFS ref*} : at `[n..m] rt + -- Tabletype_ok: {} |- at `[n..m] rt : OK + -- if |ref*| = n + -- (Ref_ok: s |- ref : rt)* + +rule Funcinst_ok: + s |- {TYPE dt, MODULE moduleinst, CODE func} : dt + -- Deftype_ok: {} |- dt : OK + -- Moduleinst_ok: s |- moduleinst : C + ---- + -- Func_ok: C |- func : dt' + -- Deftype_sub: C |- dt' <: dt + +rule Datainst_ok: + s |- {BYTES b*} : OK + +rule Eleminst_ok: + s |- {TYPE rt, REFS ref*} : rt + -- Reftype_ok: {} |- rt : OK + -- (Ref_ok: s |- ref : rt)* + +rule Exportinst_ok: + s |- {NAME nm, ADDR xa} : OK + -- Externaddr_ok: s |- xa : xt + + +rule Structinst_ok: + s |- {TYPE dt, FIELDS fv*} : OK + -- Expand: dt ~~ STRUCT (mut? zt)* + -- (Fieldval_ok: s |- fv : zt)* + +rule Arrayinst_ok: + s |- {TYPE dt, FIELDS fv*} : OK + -- Expand: dt ~~ ARRAY (mut? zt) + -- (Fieldval_ok: s |- fv : zt)* + +rule Exninst_ok: + s |- {TAG ta, FIELDS val*} : OK + -- if dt = s.TAGS[ta].TYPE + -- Expand: dt ~~ FUNC t* -> eps + -- (Val_ok: s |- val : t)* + + +;; Modules + +relation Moduleinst_ok: store |- moduleinst : context + +rule Moduleinst_ok: + s |- { TYPES deftype*, + TAGS tagaddr*, + GLOBALS globaladdr*, + MEMS memaddr*, + TABLES tableaddr*, + FUNCS funcaddr*, + DATAS dataaddr*, + ELEMS elemaddr*, + EXPORTS exportinst* } : + { TYPES deftype*, + RECS subtype*, + TAGS tagtype*, + GLOBALS globaltype*, + MEMS memtype*, + TABLES tabletype*, + FUNCS deftype_F*, + DATAS datatype*, + ELEMS elemtype*, + REFS (i)^(i<|funcaddr*|) + } + -- (Deftype_ok: {} |- deftype : OK)* + -- (Externaddr_ok: s |- TAG tagaddr : TAG tagtype)* + ---- + -- (Externaddr_ok: s |- GLOBAL globaladdr : GLOBAL globaltype)* + -- (Externaddr_ok: s |- FUNC funcaddr : FUNC deftype_F)* + ---- + -- (Externaddr_ok: s |- MEM memaddr : MEM memtype)* + -- (Externaddr_ok: s |- TABLE tableaddr : TABLE tabletype)* + ---- + -- (Datainst_ok: s |- s.DATAS[dataaddr] : datatype)* + -- (Eleminst_ok: s |- s.ELEMS[elemaddr] : elemtype)* + ---- + -- (Exportinst_ok: s |- exportinst : OK)* + -- if $disjoint_(name, (exportinst.NAME)*) + ---- + -- (if exportinst.ADDR <- (TAG tagaddr)* (GLOBAL globaladdr)* (MEM memaddr)* (TABLE tableaddr)* (FUNC funcaddr)*)* + + +;; Store + +relation Store_ok: |- store : OK + +rule Store_ok: + |- s : OK + -- (Taginst_ok: s |- taginst : tagtype)* + -- (Globalinst_ok: s |- globalinst : globaltype)* + ---- + -- (Meminst_ok: s |- meminst : memtype)* + -- (Tableinst_ok: s |- tableinst : tabletype)* + ---- + -- (Funcinst_ok: s |- funcinst : deftype)* + -- (Datainst_ok: s |- datainst : datatype)* + -- (Eleminst_ok: s |- eleminst : elemtype)* + ---- + -- (Structinst_ok: s |- structinst : OK)* + -- (Arrayinst_ok: s |- arrayinst : OK)* + -- (Exninst_ok: s |- exninst : OK)* + ---- + -- (NotImmReachable: `~ (REF.STRUCT_ADDR a) >>_s (REF.STRUCT_ADDR a))^(a<|structinst*|) + -- (NotImmReachable: `~ (REF.ARRAY_ADDR a) >>_s (REF.ARRAY_ADDR a))^(a<|arrayinst*|) + -- (NotImmReachable: `~ (REF.EXN_ADDR a) >>_s (REF.EXN_ADDR a))^(a<|exninst*|) + ---- + -- if s = {TAGS taginst*, GLOBALS globalinst*, MEMS meminst*, TABLES tableinst*, FUNCS funcinst*, + DATAS datainst*, ELEMS eleminst*, STRUCTS structinst*, ARRAYS arrayinst*, EXNS exninst*} + + +relation ImmReachable: fieldval >>_store fieldval +relation NotImmReachable: `~ fieldval >>_store fieldval + +;; HACK: emulate premise negation +;; TODO(rossberg): directly support negation in IL +def $NotImmReachable(fieldval, store, fieldval) : bool +def $NotImmReachable(fv_1, s, fv_2) = false -- ImmReachable: fv_1 >>_s fv_2 +def $NotImmReachable(fv_1, s, fv_2) = true -- otherwise + +rule NotImmReachable: `~ fv_1 >>_s fv_2 -- if $NotImmReachable(fv_1, s, fv_2) + + +rule ImmReachable/trans: + fv_1 >>_s fv_2 + -- ImmReachable: fv_1 >>_s fv' + -- ImmReachable: fv' >>_s fv_2 + +rule ImmReachable/ref.struct: + (REF.STRUCT_ADDR a) >>_s s.STRUCTS[a].FIELDS[i] + -- Expand: s.STRUCTS[a].TYPE ~~ STRUCT ft* + -- if ft*[i] = zt + +rule ImmReachable/ref.array: + (REF.ARRAY_ADDR a) >>_s s.ARRAYS[a].FIELDS[i] + -- Expand: s.ARRAYS[a].TYPE ~~ ARRAY zt + +rule ImmReachable/ref.exn: + (REF.EXN_ADDR a) >>_s s.EXNS[a].FIELDS[i] + +rule ImmReachable/ref.extern: + (REF.EXTERN ref) >>_s ref + + +;; Store extension + +relation Extend_taginst: taginst `<= taginst +relation Extend_globalinst: globalinst `<= globalinst +relation Extend_meminst: meminst `<= meminst +relation Extend_tableinst: tableinst `<= tableinst +relation Extend_funcinst: funcinst `<= funcinst +relation Extend_datainst: datainst `<= datainst +relation Extend_eleminst: eleminst `<= eleminst +relation Extend_structinst: structinst `<= structinst +relation Extend_arrayinst: arrayinst `<= arrayinst +relation Extend_exninst: exninst `<= exninst +relation Extend_store: store `<= store + +rule Extend_taginst: + {TYPE jt} `<= {TYPE jt} + +rule Extend_globalinst: + {TYPE mut? t, VALUE val} `<= {TYPE mut? t, VALUE val'} + -- if mut? = MUT \/ val = val' + +rule Extend_meminst: + {TYPE at `[n..m] PAGE, BYTES b*} `<= {TYPE at `[n'..m] PAGE, BYTES b'*} + -- if n <= n' + -- if |b*| <= |b'*| + +rule Extend_tableinst: + {TYPE at `[n..m] rt, REFS ref*} `<= {TYPE at `[n'..m] rt, REFS ref'*} + -- if n <= n' + -- if |ref*| <= |ref'*| + +rule Extend_funcinst: + {TYPE dt, MODULE mm, CODE fc} `<= {TYPE dt, MODULE mm, CODE fc} + +rule Extend_datainst: + {BYTES b*} `<= {BYTES b'*} + -- if b* = b'* \/ b'* = eps + +rule Extend_eleminst: + {TYPE rt, REFS ref*} `<= {TYPE rt, REFS ref'*} + -- if ref* = ref'* \/ ref'* = eps + +rule Extend_structinst: + {TYPE dt, FIELDS fv*} `<= {TYPE dt, FIELDS fv'*} + -- Expand: dt ~~ STRUCT (mut? zt)* + -- (if mut? = MUT \/ fv = fv')* + +rule Extend_arrayinst: + {TYPE dt, FIELDS fv*} `<= {TYPE dt, FIELDS fv'*} + -- Expand: dt ~~ ARRAY (mut? zt) + -- (if mut? = MUT \/ fv = fv')* + +rule Extend_exninst: + {TAG ta, FIELDS val*} `<= {TAG ta, FIELDS val*} + + +rule Extend_store: + s `<= s' + -- (Extend_taginst: s.TAGS[a] `<= s'.TAGS[a] )^(a<|s.TAGS|) + -- (Extend_globalinst: s.GLOBALS[a] `<= s'.GLOBALS[a] )^(a<|s.GLOBALS|) + ---- + -- (Extend_meminst: s.MEMS[a] `<= s'.MEMS[a] )^(a<|s.MEMS|) + -- (Extend_tableinst: s.TABLES[a] `<= s'.TABLES[a] )^(a<|s.TABLES|) + ---- + -- (Extend_funcinst: s.FUNCS[a] `<= s'.FUNCS[a] )^(a<|s.FUNCS|) + -- (Extend_datainst: s.DATAS[a] `<= s'.DATAS[a] )^(a<|s.DATAS|) + ---- + -- (Extend_eleminst: s.ELEMS[a] `<= s'.ELEMS[a] )^(a<|s.ELEMS|) + -- (Extend_structinst: s.STRUCTS[a] `<= s'.STRUCTS[a] )^(a<|s.STRUCTS|) + ---- + -- (Extend_arrayinst: s.ARRAYS[a] `<= s'.ARRAYS[a] )^(a<|s.ARRAYS|) + -- (Extend_exninst: s.EXNS[a] `<= s'.EXNS[a] )^(a<|s.EXNS|) + + +;; Configurations + +relation Localval_ok: store |- val? : localtype +relation Frame_ok: store |- frame : context +relation State_ok: |- state : context +relation Config_ok: |- config : OK + +rule Localval_ok/set: + s |- val : SET t + -- Val_ok: s |- val : t + +rule Localval_ok/unset: + s |- eps : UNSET BOT + +rule Frame_ok: + s |- {LOCALS (val?)*, MODULE moduleinst} : C ++ {LOCALS lct*} + -- Moduleinst_ok: s |- moduleinst : C + -- (Localval_ok: s |- val? : lct)* + +rule State_ok: + |- s; f : C + -- Store_ok: |- s : OK + -- Frame_ok: s |- f : C + +rule Config_ok: + |- z; instr* : OK + -- State_ok: |- z : C + -- Expr_ok: C |- instr* : t* diff --git a/specification/wasm-latest/2.1-validation.types.spectec b/specification/wasm-latest/2.1-validation.types.spectec index eac31a1408..692f986dea 100644 --- a/specification/wasm-latest/2.1-validation.types.spectec +++ b/specification/wasm-latest/2.1-validation.types.spectec @@ -24,6 +24,9 @@ rule Heaptype_ok/typeuse: C |- typeuse : OK -- Typeuse_ok: C |- typeuse : OK +rule Heaptype_ok/bot: + C |- BOT : OK + rule Reftype_ok: C |- REF NULL? heaptype : OK -- Heaptype_ok: C |- heaptype : OK diff --git a/specification/wasm-latest/2.3-validation.instructions.spectec b/specification/wasm-latest/2.3-validation.instructions.spectec index a893c85c13..9990490585 100644 --- a/specification/wasm-latest/2.3-validation.instructions.spectec +++ b/specification/wasm-latest/2.3-validation.instructions.spectec @@ -637,7 +637,7 @@ rule Instrs_ok/frame: rule Expr_ok: C |- instr* : t* - -- Instrs_ok: C |- instr* : eps ->_(eps) t* + -- Instrs_ok: C |- instr* : eps -> t* ;; Constant expressions diff --git a/specification/wasm-latest/4.1-execution.values.spectec b/specification/wasm-latest/4.1-execution.values.spectec index b6951b99ee..6237c93ac0 100644 --- a/specification/wasm-latest/4.1-execution.values.spectec +++ b/specification/wasm-latest/4.1-execution.values.spectec @@ -81,6 +81,23 @@ rule Val_ok/ref: -- Ref_ok: s |- ref : rt +;; Field values + +relation Packval_ok: store |- packval : packtype +relation Fieldval_ok: store |- fieldval : storagetype + +rule Packval_ok: + s |- PACK pt c : pt + +rule Fieldval_ok/val: + s |- val : t + -- Val_ok: s |- val : t + +rule Fieldval_ok/packval: + s |- packval : pt + -- Packval_ok: s |- packval : pt + + ;; External addresses relation Externaddr_ok: store |- externaddr : externtype hint(macro "%externaddr") diff --git a/specification/wasm-latest/7.1-soundness.configurations.spectec b/specification/wasm-latest/7.1-soundness.configurations.spectec new file mode 100644 index 0000000000..37ba3f4d39 --- /dev/null +++ b/specification/wasm-latest/7.1-soundness.configurations.spectec @@ -0,0 +1,339 @@ +;; Administrative instructions + +relation Instr_ok2: store; context |- instr : instrtype +relation Instrs_ok2: store; context |- instr* : instrtype +relation Expr_ok2: store; context |- expr : resulttype + +rule Instr_ok2/plain: + s; C |- instr : t_1* ->_(x*) t_2* + -- Instr_ok: C |- instr : t_1* ->_(x*) t_2* + +rule Instr_ok2/ref: + s; C |- ref : eps -> rt + -- Ref_ok: s |- ref : rt + +rule Instr_ok2/label: + s; C |- LABEL_ n `{instr'*} instr* : eps -> t* + -- Instrs_ok2: s; C |- instr'* : t'^n ->_(x'*) t* + -- Instrs_ok2: s; {LABELS (t')^n} ++ C |- instr* : eps ->_(x*) t* + +rule Instr_ok2/frame: + s; C |- FRAME_ n `{f} instr* : eps -> t^n + -- Frame_ok: s |- f : C' + -- Expr_ok2: s; C' |- instr* : t^n + +rule Instr_ok2/handler: + s; C |- HANDLER_ n `{catch*} instr* : t_1* -> t_2* + -- (Catch_ok: C |- catch : OK)* + -- Instrs_ok2: s; C |- instr* : t_1* ->_(x*) t_2* + +rule Instr_ok2/trap: + s; C |- TRAP : t_1* -> t_2* + -- Instrtype_ok: C |- t_1* -> t_2* : OK + + +rule Instrs_ok2/empty: + s; C |- eps : eps -> eps + +rule Instrs_ok2/seq: + s; C |- instr_1 instr_2* : t_1* ->_(x_1* x_2*) t_3* + -- Instr_ok2: s; C |- instr_1 : t_1* ->_(x_1*) t_2* + -- (if C.LOCALS[x_1] = init t)* + -- Instrs_ok2: s; $with_locals(C, x_1*, (SET t)*) |- instr_2* : t_2* ->_(x_2*) t_3* + +rule Instrs_ok2/sub: + s; C |- instr* : it' + -- Instrs_ok2: s; C |- instr* : it + -- Instrtype_sub: C |- it <: it' + -- Instrtype_ok: C |- it' : OK + +;; TODO(3, rossberg): allow omitting parens +rule Instrs_ok2/frame: + s; C |- instr* : (t* t_1*) ->_(x*) (t* t_2*) + -- Instrs_ok2: s; C |- instr* : t_1* ->_(x*) t_2* + -- Resulttype_ok: C |- t* : OK + + +rule Expr_ok2: + s; C |- instr* : t* + -- Instrs_ok2: s; C |- instr* : eps -> t* + + +;; Instances + +relation Taginst_ok: store |- taginst : tagtype +relation Globalinst_ok: store |- globalinst : globaltype +relation Meminst_ok: store |- meminst : memtype +relation Tableinst_ok: store |- tableinst : tabletype +relation Funcinst_ok: store |- funcinst : deftype +relation Datainst_ok: store |- datainst : datatype +relation Eleminst_ok: store |- eleminst : elemtype +relation Exportinst_ok: store |- exportinst : OK +relation Structinst_ok: store |- structinst : OK +relation Arrayinst_ok: store |- arrayinst : OK +relation Exninst_ok: store |- exninst : OK + +rule Taginst_ok: + s |- {TYPE jt} : jt + -- Tagtype_ok: {} |- jt : OK + +rule Globalinst_ok: + s |- {TYPE mut? t, VALUE val} : mut? t + -- Globaltype_ok: {} |- mut? t : OK + -- Val_ok: s |- val : t + +rule Meminst_ok: + s |- {TYPE at `[n..m] PAGE, BYTES b*} : at `[n..m] PAGE + -- Memtype_ok: {} |- at `[n..m] PAGE : OK + -- if |b*| = $(n * $($(64 * $Ki))) + +rule Tableinst_ok: + s |- {TYPE at `[n..m] rt, REFS ref*} : at `[n..m] rt + -- Tabletype_ok: {} |- at `[n..m] rt : OK + -- if |ref*| = n + -- (Ref_ok: s |- ref : rt)* + +rule Funcinst_ok: + s |- {TYPE dt, MODULE moduleinst, CODE func} : dt + -- Deftype_ok: {} |- dt : OK + -- Moduleinst_ok: s |- moduleinst : C + ---- + -- Func_ok: C |- func : dt' + -- Deftype_sub: C |- dt' <: dt + +rule Datainst_ok: + s |- {BYTES b*} : OK + +rule Eleminst_ok: + s |- {TYPE rt, REFS ref*} : rt + -- Reftype_ok: {} |- rt : OK + -- (Ref_ok: s |- ref : rt)* + +rule Exportinst_ok: + s |- {NAME nm, ADDR xa} : OK + -- Externaddr_ok: s |- xa : xt + + +rule Structinst_ok: + s |- {TYPE dt, FIELDS fv*} : OK + -- Expand: dt ~~ STRUCT (mut? zt)* + -- (Fieldval_ok: s |- fv : zt)* + +rule Arrayinst_ok: + s |- {TYPE dt, FIELDS fv*} : OK + -- Expand: dt ~~ ARRAY (mut? zt) + -- (Fieldval_ok: s |- fv : zt)* + +rule Exninst_ok: + s |- {TAG ta, FIELDS val*} : OK + -- if dt = s.TAGS[ta].TYPE + -- Expand: dt ~~ FUNC t* -> eps + -- (Val_ok: s |- val : t)* + + +;; Modules + +relation Moduleinst_ok: store |- moduleinst : context + +rule Moduleinst_ok: + s |- { TYPES deftype*, + TAGS tagaddr*, + GLOBALS globaladdr*, + MEMS memaddr*, + TABLES tableaddr*, + FUNCS funcaddr*, + DATAS dataaddr*, + ELEMS elemaddr*, + EXPORTS exportinst* } : + { TYPES deftype*, + RECS subtype*, + TAGS tagtype*, + GLOBALS globaltype*, + MEMS memtype*, + TABLES tabletype*, + FUNCS deftype_F*, + DATAS datatype*, + ELEMS elemtype*, + REFS (i)^(i<|funcaddr*|) + } + -- (Deftype_ok: {} |- deftype : OK)* + -- (Externaddr_ok: s |- TAG tagaddr : TAG tagtype)* + ---- + -- (Externaddr_ok: s |- GLOBAL globaladdr : GLOBAL globaltype)* + -- (Externaddr_ok: s |- FUNC funcaddr : FUNC deftype_F)* + ---- + -- (Externaddr_ok: s |- MEM memaddr : MEM memtype)* + -- (Externaddr_ok: s |- TABLE tableaddr : TABLE tabletype)* + ---- + -- (Datainst_ok: s |- s.DATAS[dataaddr] : datatype)* + -- (Eleminst_ok: s |- s.ELEMS[elemaddr] : elemtype)* + ---- + -- (Exportinst_ok: s |- exportinst : OK)* + -- if $disjoint_(name, (exportinst.NAME)*) + ---- + -- (if exportinst.ADDR <- (TAG tagaddr)* (GLOBAL globaladdr)* (MEM memaddr)* (TABLE tableaddr)* (FUNC funcaddr)*)* + + +;; Store + +relation Store_ok: |- store : OK + +rule Store_ok: + |- s : OK + -- (Taginst_ok: s |- taginst : tagtype)* + -- (Globalinst_ok: s |- globalinst : globaltype)* + ---- + -- (Meminst_ok: s |- meminst : memtype)* + -- (Tableinst_ok: s |- tableinst : tabletype)* + ---- + -- (Funcinst_ok: s |- funcinst : deftype)* + -- (Datainst_ok: s |- datainst : datatype)* + -- (Eleminst_ok: s |- eleminst : elemtype)* + ---- + -- (Structinst_ok: s |- structinst : OK)* + -- (Arrayinst_ok: s |- arrayinst : OK)* + -- (Exninst_ok: s |- exninst : OK)* + ---- + -- (NotImmReachable: `~ (REF.STRUCT_ADDR a) >>_s (REF.STRUCT_ADDR a))^(a<|structinst*|) + -- (NotImmReachable: `~ (REF.ARRAY_ADDR a) >>_s (REF.ARRAY_ADDR a))^(a<|arrayinst*|) + -- (NotImmReachable: `~ (REF.EXN_ADDR a) >>_s (REF.EXN_ADDR a))^(a<|exninst*|) + ---- + -- if s = {TAGS taginst*, GLOBALS globalinst*, MEMS meminst*, TABLES tableinst*, FUNCS funcinst*, + DATAS datainst*, ELEMS eleminst*, STRUCTS structinst*, ARRAYS arrayinst*, EXNS exninst*} + + +relation ImmReachable: fieldval >>_store fieldval +relation NotImmReachable: `~ fieldval >>_store fieldval + +;; HACK: emulate premise negation +;; TODO(rossberg): directly support negation in IL +def $NotImmReachable(fieldval, store, fieldval) : bool +def $NotImmReachable(fv_1, s, fv_2) = false -- ImmReachable: fv_1 >>_s fv_2 +def $NotImmReachable(fv_1, s, fv_2) = true -- otherwise + +rule NotImmReachable: `~ fv_1 >>_s fv_2 -- if $NotImmReachable(fv_1, s, fv_2) + + +rule ImmReachable/trans: + fv_1 >>_s fv_2 + -- ImmReachable: fv_1 >>_s fv' + -- ImmReachable: fv' >>_s fv_2 + +rule ImmReachable/ref.struct: + (REF.STRUCT_ADDR a) >>_s s.STRUCTS[a].FIELDS[i] + -- Expand: s.STRUCTS[a].TYPE ~~ STRUCT ft* + -- if ft*[i] = zt + +rule ImmReachable/ref.array: + (REF.ARRAY_ADDR a) >>_s s.ARRAYS[a].FIELDS[i] + -- Expand: s.ARRAYS[a].TYPE ~~ ARRAY zt + +rule ImmReachable/ref.exn: + (REF.EXN_ADDR a) >>_s s.EXNS[a].FIELDS[i] + +rule ImmReachable/ref.extern: + (REF.EXTERN ref) >>_s ref + + +;; Store extension + +relation Extend_taginst: taginst `<= taginst +relation Extend_globalinst: globalinst `<= globalinst +relation Extend_meminst: meminst `<= meminst +relation Extend_tableinst: tableinst `<= tableinst +relation Extend_funcinst: funcinst `<= funcinst +relation Extend_datainst: datainst `<= datainst +relation Extend_eleminst: eleminst `<= eleminst +relation Extend_structinst: structinst `<= structinst +relation Extend_arrayinst: arrayinst `<= arrayinst +relation Extend_exninst: exninst `<= exninst +relation Extend_store: store `<= store + +rule Extend_taginst: + {TYPE jt} `<= {TYPE jt} + +rule Extend_globalinst: + {TYPE mut? t, VALUE val} `<= {TYPE mut? t, VALUE val'} + -- if mut? = MUT \/ val = val' + +rule Extend_meminst: + {TYPE at `[n..m] PAGE, BYTES b*} `<= {TYPE at `[n'..m] PAGE, BYTES b'*} + -- if n <= n' + -- if |b*| <= |b'*| + +rule Extend_tableinst: + {TYPE at `[n..m] rt, REFS ref*} `<= {TYPE at `[n'..m] rt, REFS ref'*} + -- if n <= n' + -- if |ref*| <= |ref'*| + +rule Extend_funcinst: + {TYPE dt, MODULE mm, CODE fc} `<= {TYPE dt, MODULE mm, CODE fc} + +rule Extend_datainst: + {BYTES b*} `<= {BYTES b'*} + -- if b* = b'* \/ b'* = eps + +rule Extend_eleminst: + {TYPE rt, REFS ref*} `<= {TYPE rt, REFS ref'*} + -- if ref* = ref'* \/ ref'* = eps + +rule Extend_structinst: + {TYPE dt, FIELDS fv*} `<= {TYPE dt, FIELDS fv'*} + -- Expand: dt ~~ STRUCT (mut? zt)* + -- (if mut? = MUT \/ fv = fv')* + +rule Extend_arrayinst: + {TYPE dt, FIELDS fv*} `<= {TYPE dt, FIELDS fv'*} + -- Expand: dt ~~ ARRAY (mut? zt) + -- (if mut? = MUT \/ fv = fv')* + +rule Extend_exninst: + {TAG ta, FIELDS val*} `<= {TAG ta, FIELDS val*} + + +rule Extend_store: + s `<= s' + -- (Extend_taginst: s.TAGS[a] `<= s'.TAGS[a] )^(a<|s.TAGS|) + -- (Extend_globalinst: s.GLOBALS[a] `<= s'.GLOBALS[a] )^(a<|s.GLOBALS|) + ---- + -- (Extend_meminst: s.MEMS[a] `<= s'.MEMS[a] )^(a<|s.MEMS|) + -- (Extend_tableinst: s.TABLES[a] `<= s'.TABLES[a] )^(a<|s.TABLES|) + ---- + -- (Extend_funcinst: s.FUNCS[a] `<= s'.FUNCS[a] )^(a<|s.FUNCS|) + -- (Extend_datainst: s.DATAS[a] `<= s'.DATAS[a] )^(a<|s.DATAS|) + ---- + -- (Extend_eleminst: s.ELEMS[a] `<= s'.ELEMS[a] )^(a<|s.ELEMS|) + -- (Extend_structinst: s.STRUCTS[a] `<= s'.STRUCTS[a] )^(a<|s.STRUCTS|) + ---- + -- (Extend_arrayinst: s.ARRAYS[a] `<= s'.ARRAYS[a] )^(a<|s.ARRAYS|) + -- (Extend_exninst: s.EXNS[a] `<= s'.EXNS[a] )^(a<|s.EXNS|) + + +;; Configurations + +relation Localval_ok: store |- val? : localtype +relation Frame_ok: store |- frame : context +relation State_ok: |- state : context +relation Config_ok: |- config : OK + +rule Localval_ok/set: + s |- val : SET t + -- Val_ok: s |- val : t + +rule Localval_ok/unset: + s |- eps : UNSET BOT + +rule Frame_ok: + s |- {LOCALS (val?)*, MODULE moduleinst} : C ++ {LOCALS lct*} + -- Moduleinst_ok: s |- moduleinst : C + -- (Localval_ok: s |- val? : lct)* + +rule State_ok: + |- s; f : C + -- Store_ok: |- s : OK + -- Frame_ok: s |- f : C + +rule Config_ok: + |- z; instr* : OK + -- State_ok: |- z : C + -- Expr_ok: C |- instr* : t* diff --git a/spectec/src/backend-latex/render.ml b/spectec/src/backend-latex/render.ml index ff455dae04..72bd922499 100644 --- a/spectec/src/backend-latex/render.ml +++ b/spectec/src/backend-latex/render.ml @@ -1084,6 +1084,8 @@ Printf.eprintf "[render_atom %s @ %s] id=%s def=%s macros: %s (%s)\n%!" | Sup -> "\\geq" | SqArrow | SqArrowSub -> "\\hookrightarrow" | SqArrowStar | SqArrowStarSub -> "\\hookrightarrow^\\ast" + | Prec | PrecSub -> "\\prec" + | Succ | SuccSub -> "\\succ" | Cat -> "\\oplus" | Bar -> "\\mid" | BigAnd -> "\\bigwedge" diff --git a/spectec/src/il/valid.ml b/spectec/src/il/valid.ml index 7a0fe7eb65..d115058333 100644 --- a/spectec/src/il/valid.ml +++ b/spectec/src/il/valid.ml @@ -193,7 +193,7 @@ and valid_iterexp ?(side = `Rhs) env (it, xes) at : iter * Env.t = (fun (it', _) -> il_iter it') ) @@ fun _ -> let env' = valid_iter ~side env it in - if xes = [] && it <= List1 && side = `Rhs then error at "empty iteration"; + if xes = [] && it <= List1 && side = `Rhs then error at "vacuous iteration"; let it' = match it with Opt -> Opt | _ -> List in it', List.fold_left (fun env' (x, e) -> diff --git a/spectec/src/middlend/sideconditions.ml b/spectec/src/middlend/sideconditions.ml index 5000d56768..e0238a885c 100644 --- a/spectec/src/middlend/sideconditions.ml +++ b/spectec/src/middlend/sideconditions.ml @@ -161,7 +161,18 @@ let rec implies prem1 prem2 = Il.Eq.eq_prem prem1 prem2 || | IterPr (prem2', _) -> implies prem1 prem2' | _ -> false +(* Remove empty premise iterators *) +let rec flatten_empty_iter prem = + match prem.it with + | IterPr (prem', iterexp) -> + let prem'' = flatten_empty_iter prem' in + (match iterexp with + | ((Opt | List | List1), []) -> prem'' + | _ -> IterPr (prem'', iterexp) $ prem.at) + | _ -> prem + let reduce_prems prems = prems + |> List.map flatten_empty_iter |> Util.Lib.List.filter_not is_true |> Util.Lib.List.nub implies diff --git a/spectec/test-frontend/TEST.md b/spectec/test-frontend/TEST.md index 5aae8c8475..9f4e56f9b1 100644 --- a/spectec/test-frontend/TEST.md +++ b/spectec/test-frontend/TEST.md @@ -2792,98 +2792,102 @@ relation Heaptype_ok: `%|-%:OK`(context, heaptype) `%|-%:OK`(C, (typeuse : typeuse <: heaptype)) -- Typeuse_ok: `%|-%:OK`(C, typeuse) + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:27.1-28.16 + rule bot{C : context}: + `%|-%:OK`(C, BOT_heaptype) + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:10.1-10.91 relation Reftype_ok: `%|-%:OK`(context, reftype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:27.1-29.37 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:30.1-32.37 rule _{C : context, heaptype : heaptype}: `%|-%:OK`(C, REF_reftype(NULL_null?{}, heaptype)) -- Heaptype_ok: `%|-%:OK`(C, heaptype) ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:11.1-11.91 relation Valtype_ok: `%|-%:OK`(context, valtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:31.1-33.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:34.1-36.35 rule num{C : context, numtype : numtype}: `%|-%:OK`(C, (numtype : numtype <: valtype)) -- Numtype_ok: `%|-%:OK`(C, numtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:35.1-37.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:38.1-40.35 rule vec{C : context, vectype : vectype}: `%|-%:OK`(C, (vectype : vectype <: valtype)) -- Vectype_ok: `%|-%:OK`(C, vectype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:39.1-41.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:42.1-44.35 rule ref{C : context, reftype : reftype}: `%|-%:OK`(C, (reftype : reftype <: valtype)) -- Reftype_ok: `%|-%:OK`(C, reftype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:43.1-44.16 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:46.1-47.16 rule bot{C : context}: `%|-%:OK`(C, BOT_valtype) ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:12.1-12.94 relation Typeuse_ok: `%|-%:OK`(context, typeuse) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:99.1-101.30 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:102.1-104.30 rule typeidx{C : context, typeidx : typeidx, dt : deftype}: `%|-%:OK`(C, _IDX_typeuse(typeidx)) -- if (C.TYPES_context[typeidx!`%`_typeidx.0] = dt) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:103.1-105.23 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:106.1-108.23 rule rec{C : context, i : n, st : subtype}: `%|-%:OK`(C, REC_typeuse(i)) -- if (C.RECS_context[i] = st) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:107.1-109.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:110.1-112.35 rule deftype{C : context, deftype : deftype}: `%|-%:OK`(C, (deftype : deftype <: typeuse)) -- Deftype_ok: `%|-%:OK`(C, deftype) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:49.1-49.100 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:52.1-52.100 relation Resulttype_ok: `%|-%:OK`(context, resulttype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:52.1-54.32 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:55.1-57.32 rule _{C : context, `t*` : valtype*}: `%|-%:OK`(C, `%`_resulttype(t*{t <- `t*`})) -- (Valtype_ok: `%|-%:OK`(C, t))*{t <- `t*`} -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:85.1-85.104 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:88.1-88.104 relation Fieldtype_ok: `%|-%:OK`(context, fieldtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:123.1-125.43 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:126.1-128.43 rule _{C : context, storagetype : storagetype}: `%|-%:OK`(C, `%%`_fieldtype(MUT_mut?{}, storagetype)) -- Storagetype_ok: `%|-%:OK`(C, storagetype) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:86.1-86.106 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:89.1-89.106 relation Storagetype_ok: `%|-%:OK`(context, storagetype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:115.1-117.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:118.1-120.35 rule val{C : context, valtype : valtype}: `%|-%:OK`(C, (valtype : valtype <: storagetype)) -- Valtype_ok: `%|-%:OK`(C, valtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:119.1-121.37 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:122.1-124.37 rule pack{C : context, packtype : packtype}: `%|-%:OK`(C, (packtype : packtype <: storagetype)) -- Packtype_ok: `%|-%:OK`(C, packtype) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:87.1-87.103 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:90.1-90.103 relation Comptype_ok: `%|-%:OK`(context, comptype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:128.1-130.42 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:131.1-133.42 rule struct{C : context, `fieldtype*` : fieldtype*}: `%|-%:OK`(C, STRUCT_comptype(`%`_list(fieldtype*{fieldtype <- `fieldtype*`}))) -- (Fieldtype_ok: `%|-%:OK`(C, fieldtype))*{fieldtype <- `fieldtype*`} - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:132.1-134.39 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:135.1-137.39 rule array{C : context, fieldtype : fieldtype}: `%|-%:OK`(C, ARRAY_comptype(fieldtype)) -- Fieldtype_ok: `%|-%:OK`(C, fieldtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:136.1-139.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:139.1-142.35 rule func{C : context, `t_1*` : valtype*, `t_2*` : valtype*}: `%|-%:OK`(C, `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t_1*{t_1 <- `t_1*`})) -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t_2*{t_2 <- `t_2*`})) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:88.1-88.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:91.1-91.126 relation Subtype_ok: `%|-%:%`(context, subtype, oktypeidx) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:142.1-149.49 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:145.1-152.49 rule _{C : context, `x*` : idx*, comptype : comptype, x_0 : idx, `comptype'*` : comptype*, `x'**` : idx**}: `%|-%:%`(C, SUB_subtype(FINAL_final?{}, _IDX_typeuse(x)*{x <- `x*`}, comptype), OK_oktypeidx(x_0)) -- if (|x*{x <- `x*`}| <= 1) @@ -2892,26 +2896,26 @@ relation Subtype_ok: `%|-%:%`(context, subtype, oktypeidx) -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:89.1-89.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:92.1-92.126 relation Rectype_ok: `%|-%:%`(context, rectype, oktypeidx) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:171.1-172.23 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:174.1-175.23 rule empty{C : context, x : idx}: `%|-%:%`(C, REC_rectype(`%`_list([])), OK_oktypeidx(x)) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:174.1-177.48 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:177.1-180.48 rule cons{C : context, subtype_1 : subtype, `subtype*` : subtype*, x : idx}: `%|-%:%`(C, REC_rectype(`%`_list([subtype_1] ++ subtype*{subtype <- `subtype*`})), OK_oktypeidx(x)) -- Subtype_ok: `%|-%:%`(C, subtype_1, OK_oktypeidx(x)) -- Rectype_ok: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidx(`%`_typeidx((x!`%`_idx.0 + 1)))) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:179.1-181.60 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:182.1-184.60 rule _rec2{C : context, `subtype*` : subtype*, x : idx}: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidx(x)) -- Rectype_ok2: `%|-%:%`({TYPES [], RECS subtype*{subtype <- `subtype*`}, TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []} +++ C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(x, 0)) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:90.1-90.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:93.1-93.126 relation Subtype_ok2: `%|-%:%`(context, subtype, oktypeidxnat) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:161.1-168.49 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:164.1-171.49 rule _{C : context, `typeuse*` : typeuse*, compttype : comptype, x : idx, i : nat, `comptype'*` : comptype*, `typeuse'**` : typeuse**, comptype : comptype}: `%|-%:%`(C, SUB_subtype(FINAL_final?{}, typeuse*{typeuse <- `typeuse*`}, compttype), OK_oktypeidxnat(x, i)) -- if (|typeuse*{typeuse <- `typeuse*`}| <= 1) @@ -2920,28 +2924,28 @@ relation Subtype_ok2: `%|-%:%`(context, subtype, oktypeidxnat) -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:91.1-91.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:94.1-94.126 relation Rectype_ok2: `%|-%:%`(context, rectype, oktypeidxnat) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:183.1-184.24 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:186.1-187.24 rule empty{C : context, x : idx, i : nat}: `%|-%:%`(C, REC_rectype(`%`_list([])), OK_oktypeidxnat(x, i)) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:186.1-189.55 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:189.1-192.55 rule cons{C : context, subtype_1 : subtype, `subtype*` : subtype*, x : idx, i : nat}: `%|-%:%`(C, REC_rectype(`%`_list([subtype_1] ++ subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(x, i)) -- Subtype_ok2: `%|-%:%`(C, subtype_1, OK_oktypeidxnat(x, i)) -- Rectype_ok2: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(`%`_typeidx((x!`%`_idx.0 + 1)), (i + 1))) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:92.1-92.102 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:95.1-95.102 relation Deftype_ok: `%|-%:OK`(context, deftype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:192.1-196.14 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:195.1-199.14 rule _{C : context, rectype : rectype, i : n, x : idx, n : n, `subtype*` : subtype*}: `%|-%:OK`(C, _DEF_deftype(rectype, i)) -- Rectype_ok: `%|-%:%`(C, rectype, OK_oktypeidx(x)) -- if (rectype = REC_rectype(`%`_list(subtype^n{subtype <- `subtype*`}))) -- if (i < n) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:95.1-95.108 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:98.1-98.108 relation Comptype_sub: `%|-%<:%`(context, comptype, comptype) ;; ../../../../specification/wasm-latest/2.2-validation.subtyping.spectec:169.1-171.41 rule struct{C : context, `ft_1*` : fieldtype*, `ft'_1*` : fieldtype*, `ft_2*` : fieldtype*}: @@ -2959,7 +2963,7 @@ relation Comptype_sub: `%|-%<:%`(context, comptype, comptype) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t_21*{t_21 <- `t_21*`}), `%`_resulttype(t_11*{t_11 <- `t_11*`})) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t_12*{t_12 <- `t_12*`}), `%`_resulttype(t_22*{t_22 <- `t_22*`})) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:96.1-96.107 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:99.1-99.107 relation Deftype_sub: `%|-%<:%`(context, deftype, deftype) ;; ../../../../specification/wasm-latest/2.2-validation.subtyping.spectec:183.1-185.66 rule refl{C : context, deftype_1 : deftype, deftype_2 : deftype}: @@ -5915,37 +5919,55 @@ relation Val_ok: `%|-%:%`(store, val, valtype) `%|-%:%`(s, (ref : ref <: val), (rt : reftype <: valtype)) -- Ref_ok: `%|-%:%`(s, ref, rt) +;; ../../../../specification/wasm-latest/4.1-execution.values.spectec +relation Packval_ok: `%|-%:%`(store, packval, packtype) + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec + rule _{s : store, pt : packtype, c : iN($psizenn(pt))}: + `%|-%:%`(s, PACK_packval(pt, c), pt) + +;; ../../../../specification/wasm-latest/4.1-execution.values.spectec +relation Fieldval_ok: `%|-%:%`(store, fieldval, storagetype) + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec + rule val{s : store, val : val, t : valtype}: + `%|-%:%`(s, (val : val <: fieldval), (t : valtype <: storagetype)) + -- Val_ok: `%|-%:%`(s, val, t) + + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec + rule packval{s : store, packval : packval, pt : packtype}: + `%|-%:%`(s, (packval : packval <: fieldval), (pt : packtype <: storagetype)) + -- Packval_ok: `%|-%:%`(s, packval, pt) + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec rec { -;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:86.1-86.84 +;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:103.1-103.84 relation Externaddr_ok: `%|-%:%`(store, externaddr, externtype) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:88.1-90.28 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:105.1-107.28 rule tag{s : store, a : addr, taginst : taginst}: `%|-%:%`(s, TAG_externaddr(a), TAG_externtype(taginst.TYPE_taginst)) -- if (s.TAGS_store[a] = taginst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:92.1-94.34 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:109.1-111.34 rule global{s : store, a : addr, globalinst : globalinst}: `%|-%:%`(s, GLOBAL_externaddr(a), GLOBAL_externtype(globalinst.TYPE_globalinst)) -- if (s.GLOBALS_store[a] = globalinst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:96.1-98.28 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:113.1-115.28 rule mem{s : store, a : addr, meminst : meminst}: `%|-%:%`(s, MEM_externaddr(a), MEM_externtype(meminst.TYPE_meminst)) -- if (s.MEMS_store[a] = meminst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:100.1-102.32 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:117.1-119.32 rule table{s : store, a : addr, tableinst : tableinst}: `%|-%:%`(s, TABLE_externaddr(a), TABLE_externtype(tableinst.TYPE_tableinst)) -- if (s.TABLES_store[a] = tableinst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:104.1-106.30 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:121.1-123.30 rule func{s : store, a : addr, funcinst : funcinst}: `%|-%:%`(s, FUNC_externaddr(a), FUNC_externtype((funcinst.TYPE_funcinst : deftype <: typeuse))) -- if (s.FUNCS_store[a] = funcinst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:108.1-111.37 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:125.1-128.37 rule sub{s : store, externaddr : externaddr, xt : externtype, xt' : externtype}: `%|-%:%`(s, externaddr, xt) -- Externaddr_ok: `%|-%:%`(s, externaddr, xt') @@ -7633,6 +7655,372 @@ def $ordered(decl*) : bool ;; ../../../../specification/wasm-latest/6.4-text.modules.spectec def $ordered{`decl_1*` : decl*, import : import, `decl_2*` : decl*}(decl_1*{decl_1 <- `decl_1*`} ++ [(import : import <: decl)] ++ decl_2*{decl_2 <- `decl_2*`}) = (((((($importsd(decl_1*{decl_1 <- `decl_1*`}) = []) /\ ($tagsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($globalsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($memsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($tablesd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($funcsd(decl_1*{decl_1 <- `decl_1*`}) = [])) +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Localval_ok: `%|-%:%`(store, val?, localtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule set{s : store, val : val, t : valtype}: + `%|-%:%`(s, ?(val), `%%`_localtype(SET_init, t)) + -- Val_ok: `%|-%:%`(s, val, t) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule unset{s : store}: + `%|-%:%`(s, ?(), `%%`_localtype(UNSET_init, BOT_valtype)) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Datainst_ok: `%|-%:%`(store, datainst, datatype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `b*` : byte*}: + `%|-%:%`(s, {BYTES b*{b <- `b*`}}, OK_datatype) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Eleminst_ok: `%|-%:%`(store, eleminst, elemtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, rt : reftype, `ref*` : ref*}: + `%|-%:%`(s, {TYPE rt, REFS ref*{ref <- `ref*`}}, rt) + -- Reftype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rt) + -- (Ref_ok: `%|-%:%`(s, ref, rt))*{ref <- `ref*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Exportinst_ok: `%|-%:OK`(store, exportinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, nm : name, xa : externaddr, xt : externtype}: + `%|-%:OK`(s, {NAME nm, ADDR xa}) + -- Externaddr_ok: `%|-%:%`(s, xa, xt) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Moduleinst_ok: `%|-%:%`(store, moduleinst, context) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `deftype*` : deftype*, `tagaddr*` : tagaddr*, `globaladdr*` : globaladdr*, `memaddr*` : memaddr*, `tableaddr*` : tableaddr*, `funcaddr*` : funcaddr*, `dataaddr*` : dataaddr*, `elemaddr*` : elemaddr*, `exportinst*` : exportinst*, `subtype*` : subtype*, `tagtype*` : tagtype*, `globaltype*` : globaltype*, `memtype*` : memtype*, `tabletype*` : tabletype*, `deftype_F*` : deftype*, `datatype*` : datatype*, `elemtype*` : elemtype*}: + `%|-%:%`(s, {TYPES deftype*{deftype <- `deftype*`}, TAGS tagaddr*{tagaddr <- `tagaddr*`}, GLOBALS globaladdr*{globaladdr <- `globaladdr*`}, MEMS memaddr*{memaddr <- `memaddr*`}, TABLES tableaddr*{tableaddr <- `tableaddr*`}, FUNCS funcaddr*{funcaddr <- `funcaddr*`}, DATAS dataaddr*{dataaddr <- `dataaddr*`}, ELEMS elemaddr*{elemaddr <- `elemaddr*`}, EXPORTS exportinst*{exportinst <- `exportinst*`}}, {TYPES deftype*{deftype <- `deftype*`}, RECS subtype*{subtype <- `subtype*`}, TAGS tagtype*{tagtype <- `tagtype*`}, GLOBALS globaltype*{globaltype <- `globaltype*`}, MEMS memtype*{memtype <- `memtype*`}, TABLES tabletype*{tabletype <- `tabletype*`}, FUNCS deftype_F*{deftype_F <- `deftype_F*`}, DATAS datatype*{datatype <- `datatype*`}, ELEMS elemtype*{elemtype <- `elemtype*`}, LOCALS [], LABELS [], RETURN ?(), REFS `%`_funcidx(i)^(i<|funcaddr*{funcaddr <- `funcaddr*`}|){}}) + -- (Deftype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, deftype))*{deftype <- `deftype*`} + -- (Externaddr_ok: `%|-%:%`(s, TAG_externaddr(tagaddr), TAG_externtype(tagtype)))*{tagaddr <- `tagaddr*`, tagtype <- `tagtype*`} + -- (Externaddr_ok: `%|-%:%`(s, GLOBAL_externaddr(globaladdr), GLOBAL_externtype(globaltype)))*{globaladdr <- `globaladdr*`, globaltype <- `globaltype*`} + -- (Externaddr_ok: `%|-%:%`(s, FUNC_externaddr(funcaddr), FUNC_externtype((deftype_F : deftype <: typeuse))))*{deftype_F <- `deftype_F*`, funcaddr <- `funcaddr*`} + -- (Externaddr_ok: `%|-%:%`(s, MEM_externaddr(memaddr), MEM_externtype(memtype)))*{memaddr <- `memaddr*`, memtype <- `memtype*`} + -- (Externaddr_ok: `%|-%:%`(s, TABLE_externaddr(tableaddr), TABLE_externtype(tabletype)))*{tableaddr <- `tableaddr*`, tabletype <- `tabletype*`} + -- (Datainst_ok: `%|-%:%`(s, s.DATAS_store[dataaddr], datatype))*{dataaddr <- `dataaddr*`, datatype <- `datatype*`} + -- (Eleminst_ok: `%|-%:%`(s, s.ELEMS_store[elemaddr], elemtype))*{elemaddr <- `elemaddr*`, elemtype <- `elemtype*`} + -- (Exportinst_ok: `%|-%:OK`(s, exportinst))*{exportinst <- `exportinst*`} + -- if $disjoint_(syntax name, exportinst.NAME_exportinst*{exportinst <- `exportinst*`}) + -- (if (exportinst.ADDR_exportinst <- TAG_externaddr(tagaddr)*{tagaddr <- `tagaddr*`} ++ GLOBAL_externaddr(globaladdr)*{globaladdr <- `globaladdr*`} ++ MEM_externaddr(memaddr)*{memaddr <- `memaddr*`} ++ TABLE_externaddr(tableaddr)*{tableaddr <- `tableaddr*`} ++ FUNC_externaddr(funcaddr)*{funcaddr <- `funcaddr*`}))*{exportinst <- `exportinst*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Frame_ok: `%|-%:%`(store, frame, context) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `val?*` : val?*, moduleinst : moduleinst, C : context, `lct*` : localtype*}: + `%|-%:%`(s, {LOCALS val?{val <- `val?`}*{`val?` <- `val?*`}, MODULE moduleinst}, C +++ {TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS lct*{lct <- `lct*`}, LABELS [], RETURN ?(), REFS []}) + -- Moduleinst_ok: `%|-%:%`(s, moduleinst, C) + -- (Localval_ok: `%|-%:%`(s, val?{val <- `val?`}, lct))*{lct <- `lct*`, `val?` <- `val?*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +rec { + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:3.1-3.56 +relation Instr_ok2: `%;%|-%:%`(store, context, instr, instrtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:7.1-9.46 + rule plain{s : store, C : context, instr : instr, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*}: + `%;%|-%:%`(s, C, instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- Instr_ok: `%|-%:%`(C, instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:11.1-13.27 + rule ref{s : store, C : context, ref : ref, rt : reftype}: + `%;%|-%:%`(s, C, (ref : ref <: instr), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(rt : reftype <: valtype)]))) + -- Ref_ok: `%|-%:%`(s, ref, rt) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:15.1-18.68 + rule label{s : store, C : context, n : n, `instr'*` : instr*, `instr*` : instr*, `t*` : valtype*, `t'*` : valtype*, `x'*` : idx*, `x*` : idx*}: + `%;%|-%:%`(s, C, `LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(t*{t <- `t*`}))) + -- Instrs_ok2: `%;%|-%:%`(s, C, instr'*{instr' <- `instr'*`}, `%->_%%`_instrtype(`%`_resulttype(t'^n{t' <- `t'*`}), x'*{x' <- `x'*`}, `%`_resulttype(t*{t <- `t*`}))) + -- Instrs_ok2: `%;%|-%:%`(s, {TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [`%`_resulttype(t'^n{t' <- `t'*`})], RETURN ?(), REFS []} +++ C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype([]), x*{x <- `x*`}, `%`_resulttype(t*{t <- `t*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:20.1-23.37 + rule frame{s : store, C : context, n : n, f : frame, `instr*` : instr*, `t*` : valtype*, C' : context}: + `%;%|-%:%`(s, C, `FRAME_%{%}%`_instr(n, f, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(t^n{t <- `t*`}))) + -- Frame_ok: `%|-%:%`(s, f, C') + -- Expr_ok2: `%;%|-%:%`(s, C', instr*{instr <- `instr*`}, `%`_resulttype(t^n{t <- `t*`})) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:25.1-28.52 + rule handler{s : store, C : context, n : n, `catch*` : catch*, `instr*` : instr*, `t_1*` : valtype*, `t_2*` : valtype*, `x*` : idx*}: + `%;%|-%:%`(s, C, `HANDLER_%{%}%`_instr(n, catch*{catch <- `catch*`}, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- (Catch_ok: `%|-%:OK`(C, catch))*{catch <- `catch*`} + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:30.1-32.42 + rule trap{s : store, C : context, `t_1*` : valtype*, `t_2*` : valtype*}: + `%;%|-%:%`(s, C, TRAP_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:4.1-4.58 +relation Instrs_ok2: `%;%|-%:%`(store, context, instr*, instrtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:35.1-36.27 + rule empty{s : store, C : context}: + `%;%|-%:%`(s, C, [], `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:38.1-42.86 + rule seq{s : store, C : context, instr_1 : instr, `instr_2*` : instr*, `t_1*` : valtype*, `x_1*` : idx*, `x_2*` : idx*, `t_3*` : valtype*, `t_2*` : valtype*, `init*` : init*, `t*` : valtype*}: + `%;%|-%:%`(s, C, [instr_1] ++ instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`} ++ x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) + -- Instr_ok2: `%;%|-%:%`(s, C, instr_1, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- (if (C.LOCALS_context[x_1!`%`_idx.0] = `%%`_localtype(init, t)))*{init <- `init*`, t <- `t*`, x_1 <- `x_1*`} + -- Instrs_ok2: `%;%|-%:%`(s, $with_locals(C, x_1*{x_1 <- `x_1*`}, `%%`_localtype(SET_init, t)*{t <- `t*`}), instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_2*{t_2 <- `t_2*`}), x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:44.1-48.33 + rule sub{s : store, C : context, `instr*` : instr*, it' : instrtype, it : instrtype}: + `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, it') + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, it) + -- Instrtype_sub: `%|-%<:%`(C, it, it') + -- Instrtype_ok: `%|-%:OK`(C, it') + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:51.1-54.33 + rule frame{s : store, C : context, `instr*` : instr*, `t*` : valtype*, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*}: + `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t*{t <- `t*`} ++ t_2*{t_2 <- `t_2*`}))) + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t*{t <- `t*`})) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:5.1-5.55 +relation Expr_ok2: `%;%|-%:%`(store, context, expr, resulttype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:57.1-59.44 + rule _{s : store, C : context, `instr*` : instr*, `t*` : valtype*}: + `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%`_resulttype(t*{t <- `t*`})) + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(t*{t <- `t*`}))) +} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Taginst_ok: `%|-%:%`(store, taginst, tagtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, jt : tagtype}: + `%|-%:%`(s, {TYPE jt}, jt) + -- Tagtype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, jt) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Globalinst_ok: `%|-%:%`(store, globalinst, globaltype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `mut?` : mut?, t : valtype, val : val}: + `%|-%:%`(s, {TYPE `%%`_globaltype(mut?{mut <- `mut?`}, t), VALUE val}, `%%`_globaltype(mut?{mut <- `mut?`}, t)) + -- Globaltype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, `%%`_globaltype(mut?{mut <- `mut?`}, t)) + -- Val_ok: `%|-%:%`(s, val, t) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Meminst_ok: `%|-%:%`(store, meminst, memtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, at : addrtype, n : n, m : m, `b*` : byte*}: + `%|-%:%`(s, {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m)))), BYTES b*{b <- `b*`}}, `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))))) + -- Memtype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))))) + -- if (|b*{b <- `b*`}| = (n * (64 * $Ki))) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Tableinst_ok: `%|-%:%`(store, tableinst, tabletype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, at : addrtype, n : n, m : m, rt : reftype, `ref*` : ref*}: + `%|-%:%`(s, {TYPE `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt), REFS ref*{ref <- `ref*`}}, `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt)) + -- Tabletype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt)) + -- if (|ref*{ref <- `ref*`}| = n) + -- (Ref_ok: `%|-%:%`(s, ref, rt))*{ref <- `ref*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Funcinst_ok: `%|-%:%`(store, funcinst, deftype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, dt : deftype, moduleinst : moduleinst, func : func, C : context, dt' : deftype}: + `%|-%:%`(s, {TYPE dt, MODULE moduleinst, CODE (func : func <: funccode)}, dt) + -- Deftype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, dt) + -- Moduleinst_ok: `%|-%:%`(s, moduleinst, C) + -- Func_ok: `%|-%:%`(C, func, dt') + -- Deftype_sub: `%|-%<:%`(C, dt', dt) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Structinst_ok: `%|-%:OK`(store, structinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, dt : deftype, `fv*` : fieldval*, `mut?*` : mut?*, `zt*` : storagetype*}: + `%|-%:OK`(s, {TYPE dt, FIELDS fv*{fv <- `fv*`}}) + -- Expand: `%~~%`(dt, STRUCT_comptype(`%`_list(`%%`_fieldtype(mut?{mut <- `mut?`}, zt)*{`mut?` <- `mut?*`, zt <- `zt*`}))) + -- (Fieldval_ok: `%|-%:%`(s, fv, zt))*{fv <- `fv*`, zt <- `zt*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Arrayinst_ok: `%|-%:OK`(store, arrayinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, dt : deftype, `fv*` : fieldval*, `mut?` : mut?, zt : storagetype}: + `%|-%:OK`(s, {TYPE dt, FIELDS fv*{fv <- `fv*`}}) + -- Expand: `%~~%`(dt, ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) + -- (Fieldval_ok: `%|-%:%`(s, fv, zt))*{fv <- `fv*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Exninst_ok: `%|-%:OK`(store, exninst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, ta : tagaddr, `val*` : val*, dt : deftype, `t*` : valtype*}: + `%|-%:OK`(s, {TAG ta, FIELDS val*{val <- `val*`}}) + -- if ((dt : deftype <: typeuse) = s.TAGS_store[ta].TYPE_taginst) + -- Expand: `%~~%`(dt, `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- (Val_ok: `%|-%:%`(s, val, t))*{t <- `t*`, val <- `val*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +rec { + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:205.1-205.50 +relation ImmReachable: `%>>_%%`(fieldval, store, fieldval) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:217.1-220.33 + rule trans{fv_1 : fieldval, s : store, fv_2 : fieldval, fv' : fieldval}: + `%>>_%%`(fv_1, s, fv_2) + -- ImmReachable: `%>>_%%`(fv_1, s, fv') + -- ImmReachable: `%>>_%%`(fv', s, fv_2) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:222.1-225.20 + rule `ref.struct`{a : addr, s : store, i : nat, `ft*` : fieldtype*, zt : storagetype}: + `%>>_%%`(`REF.STRUCT_ADDR`_fieldval(a), s, s.STRUCTS_store[a].FIELDS_structinst[i]) + -- Expand: `%~~%`(s.STRUCTS_store[a].TYPE_structinst, STRUCT_comptype(`%`_list(ft*{ft <- `ft*`}))) + -- if (ft*{ft <- `ft*`}[i] = `%%`_fieldtype(?(), zt)) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:227.1-229.42 + rule `ref.array`{a : addr, s : store, i : nat, zt : storagetype}: + `%>>_%%`(`REF.ARRAY_ADDR`_fieldval(a), s, s.ARRAYS_store[a].FIELDS_arrayinst[i]) + -- Expand: `%~~%`(s.ARRAYS_store[a].TYPE_arrayinst, ARRAY_comptype(`%%`_fieldtype(?(), zt))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:231.1-232.44 + rule `ref.exn`{a : addr, s : store, i : nat}: + `%>>_%%`(`REF.EXN_ADDR`_fieldval(a), s, (s.EXNS_store[a].FIELDS_exninst[i] : val <: fieldval)) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:234.1-235.28 + rule `ref.extern`{ref : ref, s : store}: + `%>>_%%`(`REF.EXTERN`_fieldval(ref), s, (ref : ref <: fieldval)) +} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +def $NotImmReachable(fieldval : fieldval, store : store, fieldval : fieldval) : bool + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + def $NotImmReachable{fv_1 : fieldval, s : store, fv_2 : fieldval}(fv_1, s, fv_2) = false + -- ImmReachable: `%>>_%%`(fv_1, s, fv_2) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + def $NotImmReachable{fv_1 : fieldval, s : store, fv_2 : fieldval}(fv_1, s, fv_2) = true + -- otherwise + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation NotImmReachable: `~%>>_%%`(fieldval, store, fieldval) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{fv_1 : fieldval, s : store, fv_2 : fieldval}: + `~%>>_%%`(fv_1, s, fv_2) + -- if $NotImmReachable(fv_1, s, fv_2) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Store_ok: `|-%:OK`(store) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `taginst*` : taginst*, `tagtype*` : tagtype*, `globalinst*` : globalinst*, `globaltype*` : globaltype*, `meminst*` : meminst*, `memtype*` : memtype*, `tableinst*` : tableinst*, `tabletype*` : tabletype*, `deftype*` : deftype*, `funcinst*` : funcinst*, `datainst*` : datainst*, `datatype*` : datatype*, `eleminst*` : eleminst*, `elemtype*` : elemtype*, `structinst*` : structinst*, `arrayinst*` : arrayinst*, `exninst*` : exninst*}: + `|-%:OK`(s) + -- (Taginst_ok: `%|-%:%`(s, taginst, tagtype))*{taginst <- `taginst*`, tagtype <- `tagtype*`} + -- (Globalinst_ok: `%|-%:%`(s, globalinst, globaltype))*{globalinst <- `globalinst*`, globaltype <- `globaltype*`} + -- (Meminst_ok: `%|-%:%`(s, meminst, memtype))*{meminst <- `meminst*`, memtype <- `memtype*`} + -- (Tableinst_ok: `%|-%:%`(s, tableinst, tabletype))*{tableinst <- `tableinst*`, tabletype <- `tabletype*`} + -- (Funcinst_ok: `%|-%:%`(s, funcinst, deftype))*{deftype <- `deftype*`, funcinst <- `funcinst*`} + -- (Datainst_ok: `%|-%:%`(s, datainst, datatype))*{datainst <- `datainst*`, datatype <- `datatype*`} + -- (Eleminst_ok: `%|-%:%`(s, eleminst, elemtype))*{eleminst <- `eleminst*`, elemtype <- `elemtype*`} + -- (Structinst_ok: `%|-%:OK`(s, structinst))*{structinst <- `structinst*`} + -- (Arrayinst_ok: `%|-%:OK`(s, arrayinst))*{arrayinst <- `arrayinst*`} + -- (Exninst_ok: `%|-%:OK`(s, exninst))*{exninst <- `exninst*`} + -- (NotImmReachable: `~%>>_%%`(`REF.STRUCT_ADDR`_fieldval(a), s, `REF.STRUCT_ADDR`_fieldval(a)))^(a<|structinst*{structinst <- `structinst*`}|){} + -- (NotImmReachable: `~%>>_%%`(`REF.ARRAY_ADDR`_fieldval(a), s, `REF.ARRAY_ADDR`_fieldval(a)))^(a<|arrayinst*{arrayinst <- `arrayinst*`}|){} + -- (NotImmReachable: `~%>>_%%`(`REF.EXN_ADDR`_fieldval(a), s, `REF.EXN_ADDR`_fieldval(a)))^(a<|exninst*{exninst <- `exninst*`}|){} + -- if (s = {TAGS taginst*{taginst <- `taginst*`}, GLOBALS globalinst*{globalinst <- `globalinst*`}, MEMS meminst*{meminst <- `meminst*`}, TABLES tableinst*{tableinst <- `tableinst*`}, FUNCS funcinst*{funcinst <- `funcinst*`}, DATAS datainst*{datainst <- `datainst*`}, ELEMS eleminst*{eleminst <- `eleminst*`}, STRUCTS structinst*{structinst <- `structinst*`}, ARRAYS arrayinst*{arrayinst <- `arrayinst*`}, EXNS exninst*{exninst <- `exninst*`}}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_taginst: `%<=%`(taginst, taginst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{jt : tagtype}: + `%<=%`({TYPE jt}, {TYPE jt}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_globalinst: `%<=%`(globalinst, globalinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{`mut?` : mut?, t : valtype, val : val, val' : val}: + `%<=%`({TYPE `%%`_globaltype(mut?{mut <- `mut?`}, t), VALUE val}, {TYPE `%%`_globaltype(mut?{mut <- `mut?`}, t), VALUE val'}) + -- if ((mut?{mut <- `mut?`} = ?(MUT_mut)) \/ (val = val')) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_meminst: `%<=%`(meminst, meminst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{at : addrtype, n : n, m : m, `b*` : byte*, n' : n, `b'*` : byte*}: + `%<=%`({TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m)))), BYTES b*{b <- `b*`}}, {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n'), ?(`%`_u64(m)))), BYTES b'*{b' <- `b'*`}}) + -- if (n <= n') + -- if (|b*{b <- `b*`}| <= |b'*{b' <- `b'*`}|) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_tableinst: `%<=%`(tableinst, tableinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{at : addrtype, n : n, m : m, rt : reftype, `ref*` : ref*, n' : n, `ref'*` : ref*}: + `%<=%`({TYPE `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt), REFS ref*{ref <- `ref*`}}, {TYPE `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n'), ?(`%`_u64(m))), rt), REFS ref'*{ref' <- `ref'*`}}) + -- if (n <= n') + -- if (|ref*{ref <- `ref*`}| <= |ref'*{ref' <- `ref'*`}|) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_funcinst: `%<=%`(funcinst, funcinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{dt : deftype, mm : moduleinst, fc : funccode}: + `%<=%`({TYPE dt, MODULE mm, CODE fc}, {TYPE dt, MODULE mm, CODE fc}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_datainst: `%<=%`(datainst, datainst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{`b*` : byte*, `b'*` : byte*}: + `%<=%`({BYTES b*{b <- `b*`}}, {BYTES b'*{b' <- `b'*`}}) + -- if ((b*{b <- `b*`} = b'*{b' <- `b'*`}) \/ (b'*{b' <- `b'*`} = [])) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_eleminst: `%<=%`(eleminst, eleminst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{rt : reftype, `ref*` : ref*, `ref'*` : ref*}: + `%<=%`({TYPE rt, REFS ref*{ref <- `ref*`}}, {TYPE rt, REFS ref'*{ref' <- `ref'*`}}) + -- if ((ref*{ref <- `ref*`} = ref'*{ref' <- `ref'*`}) \/ (ref'*{ref' <- `ref'*`} = [])) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_structinst: `%<=%`(structinst, structinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{dt : deftype, `fv*` : fieldval*, `fv'*` : fieldval*, `mut?*` : mut?*, `zt*` : storagetype*}: + `%<=%`({TYPE dt, FIELDS fv*{fv <- `fv*`}}, {TYPE dt, FIELDS fv'*{fv' <- `fv'*`}}) + -- Expand: `%~~%`(dt, STRUCT_comptype(`%`_list(`%%`_fieldtype(mut?{mut <- `mut?`}, zt)*{`mut?` <- `mut?*`, zt <- `zt*`}))) + -- (if ((mut?{mut <- `mut?`} = ?(MUT_mut)) \/ (fv = fv')))*{fv <- `fv*`, fv' <- `fv'*`, `mut?` <- `mut?*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_arrayinst: `%<=%`(arrayinst, arrayinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{dt : deftype, `fv*` : fieldval*, `fv'*` : fieldval*, `mut?` : mut?, zt : storagetype}: + `%<=%`({TYPE dt, FIELDS fv*{fv <- `fv*`}}, {TYPE dt, FIELDS fv'*{fv' <- `fv'*`}}) + -- Expand: `%~~%`(dt, ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) + -- (if ((mut?{mut <- `mut?`} = ?(MUT_mut)) \/ (fv = fv')))*{fv <- `fv*`, fv' <- `fv'*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_exninst: `%<=%`(exninst, exninst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{ta : tagaddr, `val*` : val*}: + `%<=%`({TAG ta, FIELDS val*{val <- `val*`}}, {TAG ta, FIELDS val*{val <- `val*`}}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_store: `%<=%`(store, store) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, s' : store}: + `%<=%`(s, s') + -- (Extend_taginst: `%<=%`(s.TAGS_store[a], s'.TAGS_store[a]))^(a<|s.TAGS_store|){} + -- (Extend_globalinst: `%<=%`(s.GLOBALS_store[a], s'.GLOBALS_store[a]))^(a<|s.GLOBALS_store|){} + -- (Extend_meminst: `%<=%`(s.MEMS_store[a], s'.MEMS_store[a]))^(a<|s.MEMS_store|){} + -- (Extend_tableinst: `%<=%`(s.TABLES_store[a], s'.TABLES_store[a]))^(a<|s.TABLES_store|){} + -- (Extend_funcinst: `%<=%`(s.FUNCS_store[a], s'.FUNCS_store[a]))^(a<|s.FUNCS_store|){} + -- (Extend_datainst: `%<=%`(s.DATAS_store[a], s'.DATAS_store[a]))^(a<|s.DATAS_store|){} + -- (Extend_eleminst: `%<=%`(s.ELEMS_store[a], s'.ELEMS_store[a]))^(a<|s.ELEMS_store|){} + -- (Extend_structinst: `%<=%`(s.STRUCTS_store[a], s'.STRUCTS_store[a]))^(a<|s.STRUCTS_store|){} + -- (Extend_arrayinst: `%<=%`(s.ARRAYS_store[a], s'.ARRAYS_store[a]))^(a<|s.ARRAYS_store|){} + -- (Extend_exninst: `%<=%`(s.EXNS_store[a], s'.EXNS_store[a]))^(a<|s.EXNS_store|){} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation State_ok: `|-%:%`(state, context) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, f : frame, C : context}: + `|-%:%`(`%;%`_state(s, f), C) + -- Store_ok: `|-%:OK`(s) + -- Frame_ok: `%|-%:%`(s, f, C) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Config_ok: `|-%:OK`(config) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{z : state, `instr*` : instr*, C : context, `t*` : valtype*}: + `|-%:OK`(`%;%`_config(z, instr*{instr <- `instr*`})) + -- State_ok: `|-%:%`(z, C) + -- Expr_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, `%`_resulttype(t*{t <- `t*`})) + ;; ../../../../specification/wasm-latest/X.1-notation.syntax.spectec syntax A = nat diff --git a/spectec/test-interpreter/TEST.md b/spectec/test-interpreter/TEST.md index 1540225f42..eeda9ed40d 100644 --- a/spectec/test-interpreter/TEST.md +++ b/spectec/test-interpreter/TEST.md @@ -9,6 +9,7 @@ spectec 0.5 generator == Running pass sideconditions... == IL Validation after pass sideconditions... == Translating to AL... +../../../_specification/wasm-latest/7.1-soundness.configurations.spectec:211.62-211.76: translate_rulepr: Yet `(fv_1, s, fv_2)` == Initializing interpreter... == Interpreting... 42 @@ -21,6 +22,7 @@ spectec 0.5 generator == Running pass sideconditions... == IL Validation after pass sideconditions... == Translating to AL... +../../../_specification/wasm-latest/7.1-soundness.configurations.spectec:211.62-211.76: translate_rulepr: Yet `(fv_1, s, fv_2)` == Initializing interpreter... == Interpreting... 42 @@ -33,6 +35,7 @@ spectec 0.5 generator == Running pass sideconditions... == IL Validation after pass sideconditions... == Translating to AL... +../../../_specification/wasm-latest/7.1-soundness.configurations.spectec:211.62-211.76: translate_rulepr: Yet `(fv_1, s, fv_2)` == Initializing interpreter... == Interpreting... - print_i32: 10 @@ -113,6 +116,7 @@ spectec 0.5 generator == Running pass sideconditions... == IL Validation after pass sideconditions... == Translating to AL... +../../../_specification/wasm-3.0/7.1-soundness.configurations.spectec:211.62-211.76: translate_rulepr: Yet `(fv_1, s, fv_2)` == Initializing interpreter... == Interpreting... - print_i32: 83 diff --git a/spectec/test-latex/Makefile b/spectec/test-latex/Makefile index e08fa4dcf6..a227c0e578 100644 --- a/spectec/test-latex/Makefile +++ b/spectec/test-latex/Makefile @@ -48,7 +48,7 @@ $(GENOUTNAME)-%.tex: $(GENOUTNAME).tex $(GENOUTNAME)-%.pdf: $(GENOUTNAME)-%.tex $(EXE) $(GENINNAME)-%.tex ln -f $(GENINNAME)-$*.tex $(GENINNAME).tex - pdflatex $< + pdflatex -halt-on-error -file-line-error $< rm $(GENINNAME).tex test-test: $(TESTFILES:%.$(EXT)=test-%.pdf) @@ -59,7 +59,7 @@ test-%.tex: %.$(EXT) $(EXE) test-%.pdf: test-%.tex $(GENOUTNAME).tex ln -f $< $(GENINNAME).tex ln -f $(GENOUTNAME).tex $< - pdflatex $< + pdflatex -halt-on-error -file-line-error $< rm $(GENINNAME).tex $< diff --git a/spectec/test-latex/TEST.md b/spectec/test-latex/TEST.md index 07faa4f442..c5883e5c1e 100644 --- a/spectec/test-latex/TEST.md +++ b/spectec/test-latex/TEST.md @@ -4636,6 +4636,16 @@ C \vdash {\mathit{typeuse}} : \mathsf{ok} \end{array} $$ +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +}{ +C \vdash \mathsf{bot} : \mathsf{ok} +} \, {[\textsc{\scriptsize K{-}heap{-}bot}]} +\qquad +\end{array} +$$ + $$ \begin{array}{@{}c@{}}\displaystyle \frac{ @@ -7326,7 +7336,7 @@ $$ $$ \begin{array}{@{}c@{}}\displaystyle \frac{ -C \vdash {{\mathit{instr}}^\ast} : \epsilon \rightarrow_{\epsilon} {t^\ast} +C \vdash {{\mathit{instr}}^\ast} : \epsilon \rightarrow {t^\ast} }{ C \vdash {{\mathit{instr}}^\ast} : {t^\ast} } \, {[\textsc{\scriptsize T{-}expr}]} @@ -9536,6 +9546,44 @@ $$ \vspace{1ex} +$\boxed{{\mathit{store}} \vdash {\mathit{packval}} : {\mathit{packtype}}}$ + +$\boxed{{\mathit{store}} \vdash {\mathit{fieldval}} : {\mathit{storagetype}}}$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +}{ +s \vdash {\mathit{pt}}{.}\mathsf{pack}~c : {\mathit{pt}} +} \, {[\textsc{\scriptsize Packval\_ok}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s \vdash {\mathit{val}} : t +}{ +s \vdash {\mathit{val}} : t +} \, {[\textsc{\scriptsize Fieldval\_ok{-}val}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s \vdash {\mathit{packval}} : {\mathit{pt}} +}{ +s \vdash {\mathit{packval}} : {\mathit{pt}} +} \, {[\textsc{\scriptsize Fieldval\_ok{-}packval}]} +\qquad +\end{array} +$$ + +\vspace{1ex} + $\boxed{{\mathit{store}} \vdash {\mathit{externaddr}} : {\mathit{externtype}}}$ $$ @@ -13967,6 +14015,750 @@ $$ \end{array} $$ +$\boxed{{\mathit{store}} ; {\mathit{context}} \vdash {\mathit{instr}} : {\mathit{instrtype}}}$ + +$\boxed{{\mathit{store}} ; {\mathit{context}} \vdash {{\mathit{instr}}^\ast} : {\mathit{instrtype}}}$ + +$\boxed{{\mathit{store}} ; {\mathit{context}} \vdash {\mathit{expr}} : {\mathit{resulttype}}}$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +C \vdash {\mathit{instr}} : {t_1^\ast} \rightarrow_{{x^\ast}} {t_2^\ast} +}{ +s ; C \vdash {\mathit{instr}} : {t_1^\ast} \rightarrow_{{x^\ast}} {t_2^\ast} +} \, {[\textsc{\scriptsize Instr\_ok2{-}plain}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s \vdash {\mathit{ref}} : {\mathit{rt}} +}{ +s ; C \vdash {\mathit{ref}} : \epsilon \rightarrow {\mathit{rt}} +} \, {[\textsc{\scriptsize Instr\_ok2{-}ref}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s ; C \vdash {{\mathit{instr}'}^\ast} : {{t'}^{n}} \rightarrow_{{{x'}^\ast}} {t^\ast} + \qquad +s ; \{ \mathsf{labels}~{({t'})^{n}} \} \oplus C \vdash {{\mathit{instr}}^\ast} : \epsilon \rightarrow_{{x^\ast}} {t^\ast} +}{ +s ; C \vdash {{\mathsf{label}}_{n}}{\{ {{\mathit{instr}'}^\ast} \}}~{{\mathit{instr}}^\ast} : \epsilon \rightarrow {t^\ast} +} \, {[\textsc{\scriptsize Instr\_ok2{-}label}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s \vdash f : {C'} + \qquad +s ; {C'} \vdash {{\mathit{instr}}^\ast} : {t^{n}} +}{ +s ; C \vdash {{\mathsf{frame}}_{n}}{\{ f \}}~{{\mathit{instr}}^\ast} : \epsilon \rightarrow {t^{n}} +} \, {[\textsc{\scriptsize Instr\_ok2{-}frame}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +(C \vdash {\mathit{catch}} : \mathsf{ok})^\ast + \qquad +s ; C \vdash {{\mathit{instr}}^\ast} : {t_1^\ast} \rightarrow_{{x^\ast}} {t_2^\ast} +}{ +s ; C \vdash {{\mathsf{handler}}_{n}}{\{ {{\mathit{catch}}^\ast} \}}~{{\mathit{instr}}^\ast} : {t_1^\ast} \rightarrow {t_2^\ast} +} \, {[\textsc{\scriptsize Instr\_ok2{-}handler}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +C \vdash {t_1^\ast} \rightarrow {t_2^\ast} : \mathsf{ok} +}{ +s ; C \vdash \mathsf{trap} : {t_1^\ast} \rightarrow {t_2^\ast} +} \, {[\textsc{\scriptsize Instr\_ok2{-}trap}]} +\qquad +\end{array} +$$ + +\vspace{1ex} + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +}{ +s ; C \vdash \epsilon : \epsilon \rightarrow \epsilon +} \, {[\textsc{\scriptsize Instrs\_ok2{-}empty}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s ; C \vdash {\mathit{instr}}_1 : {t_1^\ast} \rightarrow_{{x_1^\ast}} {t_2^\ast} + \qquad +(C{.}\mathsf{locals}{}[x_1] = {\mathit{init}}~t)^\ast + \qquad +s ; C{}[{.}\mathsf{local}{}[{x_1^\ast}] = {(\mathsf{set}~t)^\ast}] \vdash {{\mathit{instr}}_2^\ast} : {t_2^\ast} \rightarrow_{{x_2^\ast}} {t_3^\ast} +}{ +s ; C \vdash {\mathit{instr}}_1~{{\mathit{instr}}_2^\ast} : {t_1^\ast} \rightarrow_{{x_1^\ast}~{x_2^\ast}} {t_3^\ast} +} \, {[\textsc{\scriptsize Instrs\_ok2{-}seq}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s ; C \vdash {{\mathit{instr}}^\ast} : {\mathit{it}} + \qquad +C \vdash {\mathit{it}} \leq {\mathit{it}'} + \qquad +C \vdash {\mathit{it}'} : \mathsf{ok} +}{ +s ; C \vdash {{\mathit{instr}}^\ast} : {\mathit{it}'} +} \, {[\textsc{\scriptsize Instrs\_ok2{-}sub}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s ; C \vdash {{\mathit{instr}}^\ast} : {t_1^\ast} \rightarrow_{{x^\ast}} {t_2^\ast} + \qquad +C \vdash {t^\ast} : \mathsf{ok} +}{ +s ; C \vdash {{\mathit{instr}}^\ast} : ({t^\ast}~{t_1^\ast}) \rightarrow_{{x^\ast}} ({t^\ast}~{t_2^\ast}) +} \, {[\textsc{\scriptsize Instrs\_ok2{-}frame}]} +\qquad +\end{array} +$$ + +\vspace{1ex} + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s ; C \vdash {{\mathit{instr}}^\ast} : \epsilon \rightarrow {t^\ast} +}{ +s ; C \vdash {{\mathit{instr}}^\ast} : {t^\ast} +} \, {[\textsc{\scriptsize Expr\_ok2}]} +\qquad +\end{array} +$$ + +\vspace{1ex} + +$\boxed{{\mathit{store}} \vdash {\mathit{taginst}} : {\mathit{tagtype}}}$ + +$\boxed{{\mathit{store}} \vdash {\mathit{globalinst}} : {\mathit{globaltype}}}$ + +$\boxed{{\mathit{store}} \vdash {\mathit{meminst}} : {\mathit{memtype}}}$ + +$\boxed{{\mathit{store}} \vdash {\mathit{tableinst}} : {\mathit{tabletype}}}$ + +$\boxed{{\mathit{store}} \vdash {\mathit{funcinst}} : {\mathit{deftype}}}$ + +$\boxed{{\mathit{store}} \vdash {\mathit{datainst}} : {\mathit{datatype}}}$ + +$\boxed{{\mathit{store}} \vdash {\mathit{eleminst}} : {\mathit{elemtype}}}$ + +$\boxed{{\mathit{store}} \vdash {\mathit{exportinst}} : \mathsf{ok}}$ + +$\boxed{{\mathit{store}} \vdash {\mathit{structinst}} : \mathsf{ok}}$ + +$\boxed{{\mathit{store}} \vdash {\mathit{arrayinst}} : \mathsf{ok}}$ + +$\boxed{{\mathit{store}} \vdash {\mathit{exninst}} : \mathsf{ok}}$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +\{ \} \vdash {\mathit{jt}} : \mathsf{ok} +}{ +s \vdash \{ \mathsf{type}~{\mathit{jt}} \} : {\mathit{jt}} +} \, {[\textsc{\scriptsize Taginst\_ok}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +\{ \} \vdash {\mathsf{mut}^?}~t : \mathsf{ok} + \qquad +s \vdash {\mathit{val}} : t +}{ +s \vdash \{ \mathsf{type}~{\mathsf{mut}^?}~t,\;\allowbreak \mathsf{value}~{\mathit{val}} \} : {\mathsf{mut}^?}~t +} \, {[\textsc{\scriptsize Globalinst\_ok}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +\{ \} \vdash {\mathit{at}}~{}[ n .. m ]~\mathsf{page} : \mathsf{ok} + \qquad +{|{b^\ast}|} = n \cdot 64 \, {\mathrm{Ki}} +}{ +s \vdash \{ \mathsf{type}~{\mathit{at}}~{}[ n .. m ]~\mathsf{page},\;\allowbreak \mathsf{bytes}~{b^\ast} \} : {\mathit{at}}~{}[ n .. m ]~\mathsf{page} +} \, {[\textsc{\scriptsize Meminst\_ok}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +\{ \} \vdash {\mathit{at}}~{}[ n .. m ]~{\mathit{rt}} : \mathsf{ok} + \qquad +{|{{\mathit{ref}}^\ast}|} = n + \qquad +(s \vdash {\mathit{ref}} : {\mathit{rt}})^\ast +}{ +s \vdash \{ \mathsf{type}~{\mathit{at}}~{}[ n .. m ]~{\mathit{rt}},\;\allowbreak \mathsf{refs}~{{\mathit{ref}}^\ast} \} : {\mathit{at}}~{}[ n .. m ]~{\mathit{rt}} +} \, {[\textsc{\scriptsize Tableinst\_ok}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +\begin{array}{@{}c@{}} +\{ \} \vdash {\mathit{dt}} : \mathsf{ok} + \qquad +s \vdash {\mathit{moduleinst}} : C + \\ +C \vdash {\mathit{func}} : {\mathit{dt}'} + \qquad +C \vdash {\mathit{dt}'} \leq {\mathit{dt}} +\end{array} +}{ +s \vdash \{ \mathsf{type}~{\mathit{dt}},\;\allowbreak \mathsf{module}~{\mathit{moduleinst}},\;\allowbreak \mathsf{code}~{\mathit{func}} \} : {\mathit{dt}} +} \, {[\textsc{\scriptsize Funcinst\_ok}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +}{ +s \vdash \{ \mathsf{bytes}~{b^\ast} \} : \mathsf{ok} +} \, {[\textsc{\scriptsize Datainst\_ok}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +\{ \} \vdash {\mathit{rt}} : \mathsf{ok} + \qquad +(s \vdash {\mathit{ref}} : {\mathit{rt}})^\ast +}{ +s \vdash \{ \mathsf{type}~{\mathit{rt}},\;\allowbreak \mathsf{refs}~{{\mathit{ref}}^\ast} \} : {\mathit{rt}} +} \, {[\textsc{\scriptsize Eleminst\_ok}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s \vdash {\mathit{xa}} : {\mathit{xt}} +}{ +s \vdash \{ \mathsf{name}~{\mathit{nm}},\;\allowbreak \mathsf{addr}~{\mathit{xa}} \} : \mathsf{ok} +} \, {[\textsc{\scriptsize Exportinst\_ok}]} +\qquad +\end{array} +$$ + +\vspace{1ex} + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +{\mathit{dt}} \approx \mathsf{struct}~{({\mathsf{mut}^?}~{\mathit{zt}})^\ast} + \qquad +(s \vdash {\mathit{fv}} : {\mathit{zt}})^\ast +}{ +s \vdash \{ \mathsf{type}~{\mathit{dt}},\;\allowbreak \mathsf{fields}~{{\mathit{fv}}^\ast} \} : \mathsf{ok} +} \, {[\textsc{\scriptsize Structinst\_ok}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +{\mathit{dt}} \approx \mathsf{array}~({\mathsf{mut}^?}~{\mathit{zt}}) + \qquad +(s \vdash {\mathit{fv}} : {\mathit{zt}})^\ast +}{ +s \vdash \{ \mathsf{type}~{\mathit{dt}},\;\allowbreak \mathsf{fields}~{{\mathit{fv}}^\ast} \} : \mathsf{ok} +} \, {[\textsc{\scriptsize Arrayinst\_ok}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +{\mathit{dt}} = s{.}\mathsf{tags}{}[{\mathit{ta}}]{.}\mathsf{type} + \qquad +{\mathit{dt}} \approx \mathsf{func}~{t^\ast} \rightarrow \epsilon + \qquad +(s \vdash {\mathit{val}} : t)^\ast +}{ +s \vdash \{ \mathsf{tag}~{\mathit{ta}},\;\allowbreak \mathsf{fields}~{{\mathit{val}}^\ast} \} : \mathsf{ok} +} \, {[\textsc{\scriptsize Exninst\_ok}]} +\qquad +\end{array} +$$ + +\vspace{1ex} + +$\boxed{{\mathit{store}} \vdash {\mathit{moduleinst}} : {\mathit{context}}}$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +\begin{array}{@{}c@{}} +(\{ \} \vdash {\mathit{deftype}} : \mathsf{ok})^\ast + \qquad +(s \vdash \mathsf{tag}~{\mathit{tagaddr}} : \mathsf{tag}~{\mathit{tagtype}})^\ast + \\ +(s \vdash \mathsf{global}~{\mathit{globaladdr}} : \mathsf{global}~{\mathit{globaltype}})^\ast + \qquad +(s \vdash \mathsf{func}~{\mathit{funcaddr}} : \mathsf{func}~{\mathit{deftype}}_{\mathsf{f}})^\ast + \\ +(s \vdash \mathsf{mem}~{\mathit{memaddr}} : \mathsf{mem}~{\mathit{memtype}})^\ast + \qquad +(s \vdash \mathsf{table}~{\mathit{tableaddr}} : \mathsf{table}~{\mathit{tabletype}})^\ast + \\ +(s \vdash s{.}\mathsf{datas}{}[{\mathit{dataaddr}}] : {\mathit{datatype}})^\ast + \qquad +(s \vdash s{.}\mathsf{elems}{}[{\mathit{elemaddr}}] : {\mathit{elemtype}})^\ast + \\ +(s \vdash {\mathit{exportinst}} : \mathsf{ok})^\ast + \qquad +{({\mathit{exportinst}}{.}\mathsf{name})^\ast}~{\mathrm{disjoint}} + \\ +({\mathit{exportinst}}{.}\mathsf{addr} \in {(\mathsf{tag}~{\mathit{tagaddr}})^\ast}~{(\mathsf{global}~{\mathit{globaladdr}})^\ast}~{(\mathsf{mem}~{\mathit{memaddr}})^\ast}~{(\mathsf{table}~{\mathit{tableaddr}})^\ast}~{(\mathsf{func}~{\mathit{funcaddr}})^\ast})^\ast +\end{array} +}{ +s \vdash \{ \begin{array}[t]{@{}l@{}} +\mathsf{types}~{{\mathit{deftype}}^\ast},\; \\ + \mathsf{tags}~{{\mathit{tagaddr}}^\ast},\; \\ + \mathsf{globals}~{{\mathit{globaladdr}}^\ast},\; \\ + \mathsf{mems}~{{\mathit{memaddr}}^\ast},\; \\ + \mathsf{tables}~{{\mathit{tableaddr}}^\ast},\; \\ + \mathsf{funcs}~{{\mathit{funcaddr}}^\ast},\; \\ + \mathsf{datas}~{{\mathit{dataaddr}}^\ast},\; \\ + \mathsf{elems}~{{\mathit{elemaddr}}^\ast},\; \\ + \mathsf{exports}~{{\mathit{exportinst}}^\ast} \}\end{array} : \{ \begin{array}[t]{@{}l@{}} +\mathsf{types}~{{\mathit{deftype}}^\ast},\; \\ + \mathsf{recs}~{{\mathit{subtype}}^\ast},\; \\ + \mathsf{tags}~{{\mathit{tagtype}}^\ast},\; \\ + \mathsf{globals}~{{\mathit{globaltype}}^\ast},\; \\ + \mathsf{mems}~{{\mathit{memtype}}^\ast},\; \\ + \mathsf{tables}~{{\mathit{tabletype}}^\ast},\; \\ + \mathsf{funcs}~{{\mathit{deftype}}_{\mathsf{f}}^\ast},\; \\ + \mathsf{datas}~{{\mathit{datatype}}^\ast},\; \\ + \mathsf{elems}~{{\mathit{elemtype}}^\ast},\; \\ + \mathsf{refs}~{(i)^{i<{|{{\mathit{funcaddr}}^\ast}|}}} \}\end{array} +} \, {[\textsc{\scriptsize Moduleinst\_ok}]} +\qquad +\end{array} +$$ + +\vspace{1ex} + +$\boxed{{\vdash}\, {\mathit{store}} : \mathsf{ok}}$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +\begin{array}{@{}c@{}} +(s \vdash {\mathit{taginst}} : {\mathit{tagtype}})^\ast + \qquad +(s \vdash {\mathit{globalinst}} : {\mathit{globaltype}})^\ast + \\ +(s \vdash {\mathit{meminst}} : {\mathit{memtype}})^\ast + \qquad +(s \vdash {\mathit{tableinst}} : {\mathit{tabletype}})^\ast + \\ +(s \vdash {\mathit{funcinst}} : {\mathit{deftype}})^\ast + \qquad +(s \vdash {\mathit{datainst}} : {\mathit{datatype}})^\ast + \qquad +(s \vdash {\mathit{eleminst}} : {\mathit{elemtype}})^\ast + \\ +(s \vdash {\mathit{structinst}} : \mathsf{ok})^\ast + \qquad +(s \vdash {\mathit{arrayinst}} : \mathsf{ok})^\ast + \qquad +(s \vdash {\mathit{exninst}} : \mathsf{ok})^\ast + \\ +(\neg~(\mathsf{ref{.}struct}~a) \succ_{s} (\mathsf{ref{.}struct}~a))^{a<{|{{\mathit{structinst}}^\ast}|}} + \qquad +(\neg~(\mathsf{ref{.}array}~a) \succ_{s} (\mathsf{ref{.}array}~a))^{a<{|{{\mathit{arrayinst}}^\ast}|}} + \qquad +(\neg~(\mathsf{ref{.}exn}~a) \succ_{s} (\mathsf{ref{.}exn}~a))^{a<{|{{\mathit{exninst}}^\ast}|}} + \\ +s = \{ \begin{array}[t]{@{}l@{}} +\mathsf{tags}~{{\mathit{taginst}}^\ast},\; \mathsf{globals}~{{\mathit{globalinst}}^\ast},\; \mathsf{mems}~{{\mathit{meminst}}^\ast},\; \mathsf{tables}~{{\mathit{tableinst}}^\ast},\; \mathsf{funcs}~{{\mathit{funcinst}}^\ast},\; \\ + \mathsf{datas}~{{\mathit{datainst}}^\ast},\; \mathsf{elems}~{{\mathit{eleminst}}^\ast},\; \mathsf{structs}~{{\mathit{structinst}}^\ast},\; \mathsf{arrays}~{{\mathit{arrayinst}}^\ast},\; \mathsf{exns}~{{\mathit{exninst}}^\ast} \}\end{array} +\end{array} +}{ +{\vdash}\, s : \mathsf{ok} +} \, {[\textsc{\scriptsize Store\_ok}]} +\qquad +\end{array} +$$ + +\vspace{1ex} + +$\boxed{{\mathit{fieldval}} \succ_{{\mathit{store}}} {\mathit{fieldval}}}$ + +$\boxed{\neg~{\mathit{fieldval}} \succ_{{\mathit{store}}} {\mathit{fieldval}}}$ + +$$ +\begin{array}[t]{@{}lcl@{}l@{}} +{\mathrm{NotImmReachable}}({\mathit{fv}}_1, s, {\mathit{fv}}_2) & = & \mathsf{false} & \quad \mbox{if}~ {\mathit{fv}}_1 \succ_{s} {\mathit{fv}}_2 \\ +{\mathrm{NotImmReachable}}({\mathit{fv}}_1, s, {\mathit{fv}}_2) & = & \mathsf{true} & \quad \mbox{otherwise} \\ +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +{\mathrm{NotImmReachable}}({\mathit{fv}}_1, s, {\mathit{fv}}_2) +}{ +\neg~{\mathit{fv}}_1 \succ_{s} {\mathit{fv}}_2 +} \, {[\textsc{\scriptsize NotImmReachable}]} +\qquad +\end{array} +$$ + +\vspace{1ex} + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +{\mathit{fv}}_1 \succ_{s} {\mathit{fv}'} + \qquad +{\mathit{fv}'} \succ_{s} {\mathit{fv}}_2 +}{ +{\mathit{fv}}_1 \succ_{s} {\mathit{fv}}_2 +} \, {[\textsc{\scriptsize ImmReachable{-}trans}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s{.}\mathsf{structs}{}[a]{.}\mathsf{type} \approx \mathsf{struct}~{{\mathit{ft}}^\ast} + \qquad +{{\mathit{ft}}^\ast}{}[i] = {\mathit{zt}} +}{ +(\mathsf{ref{.}struct}~a) \succ_{s} s{.}\mathsf{structs}{}[a]{.}\mathsf{fields}{}[i] +} \, {[\textsc{\scriptsize ImmReachable{-}ref.struct}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s{.}\mathsf{arrays}{}[a]{.}\mathsf{type} \approx \mathsf{array}~{\mathit{zt}} +}{ +(\mathsf{ref{.}array}~a) \succ_{s} s{.}\mathsf{arrays}{}[a]{.}\mathsf{fields}{}[i] +} \, {[\textsc{\scriptsize ImmReachable{-}ref.array}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +}{ +(\mathsf{ref{.}exn}~a) \succ_{s} s{.}\mathsf{exns}{}[a]{.}\mathsf{fields}{}[i] +} \, {[\textsc{\scriptsize ImmReachable{-}ref.exn}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +}{ +(\mathsf{ref{.}extern}~{\mathit{ref}}) \succ_{s} {\mathit{ref}} +} \, {[\textsc{\scriptsize ImmReachable{-}ref.extern}]} +\qquad +\end{array} +$$ + +\vspace{1ex} + +$\boxed{{\mathit{taginst}}~\leq~{\mathit{taginst}}}$ + +$\boxed{{\mathit{globalinst}}~\leq~{\mathit{globalinst}}}$ + +$\boxed{{\mathit{meminst}}~\leq~{\mathit{meminst}}}$ + +$\boxed{{\mathit{tableinst}}~\leq~{\mathit{tableinst}}}$ + +$\boxed{{\mathit{funcinst}}~\leq~{\mathit{funcinst}}}$ + +$\boxed{{\mathit{datainst}}~\leq~{\mathit{datainst}}}$ + +$\boxed{{\mathit{eleminst}}~\leq~{\mathit{eleminst}}}$ + +$\boxed{{\mathit{structinst}}~\leq~{\mathit{structinst}}}$ + +$\boxed{{\mathit{arrayinst}}~\leq~{\mathit{arrayinst}}}$ + +$\boxed{{\mathit{exninst}}~\leq~{\mathit{exninst}}}$ + +$\boxed{{\mathit{store}}~\leq~{\mathit{store}}}$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +}{ +\{ \mathsf{type}~{\mathit{jt}} \}~\leq~\{ \mathsf{type}~{\mathit{jt}} \} +} \, {[\textsc{\scriptsize Extend\_taginst}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +{\mathsf{mut}^?} = \mathsf{mut} \lor {\mathit{val}} = {\mathit{val}'} +}{ +\{ \mathsf{type}~{\mathsf{mut}^?}~t,\;\allowbreak \mathsf{value}~{\mathit{val}} \}~\leq~\{ \mathsf{type}~{\mathsf{mut}^?}~t,\;\allowbreak \mathsf{value}~{\mathit{val}'} \} +} \, {[\textsc{\scriptsize Extend\_globalinst}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +n \leq {n'} + \qquad +{|{b^\ast}|} \leq {|{{b'}^\ast}|} +}{ +\{ \mathsf{type}~{\mathit{at}}~{}[ n .. m ]~\mathsf{page},\;\allowbreak \mathsf{bytes}~{b^\ast} \}~\leq~\{ \mathsf{type}~{\mathit{at}}~{}[ {n'} .. m ]~\mathsf{page},\;\allowbreak \mathsf{bytes}~{{b'}^\ast} \} +} \, {[\textsc{\scriptsize Extend\_meminst}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +n \leq {n'} + \qquad +{|{{\mathit{ref}}^\ast}|} \leq {|{{\mathit{ref}'}^\ast}|} +}{ +\{ \mathsf{type}~{\mathit{at}}~{}[ n .. m ]~{\mathit{rt}},\;\allowbreak \mathsf{refs}~{{\mathit{ref}}^\ast} \}~\leq~\{ \mathsf{type}~{\mathit{at}}~{}[ {n'} .. m ]~{\mathit{rt}},\;\allowbreak \mathsf{refs}~{{\mathit{ref}'}^\ast} \} +} \, {[\textsc{\scriptsize Extend\_tableinst}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +}{ +\{ \mathsf{type}~{\mathit{dt}},\;\allowbreak \mathsf{module}~{\mathit{mm}},\;\allowbreak \mathsf{code}~{\mathit{fc}} \}~\leq~\{ \mathsf{type}~{\mathit{dt}},\;\allowbreak \mathsf{module}~{\mathit{mm}},\;\allowbreak \mathsf{code}~{\mathit{fc}} \} +} \, {[\textsc{\scriptsize Extend\_funcinst}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +{b^\ast} = {{b'}^\ast} \lor {{b'}^\ast} = \epsilon +}{ +\{ \mathsf{bytes}~{b^\ast} \}~\leq~\{ \mathsf{bytes}~{{b'}^\ast} \} +} \, {[\textsc{\scriptsize Extend\_datainst}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +{{\mathit{ref}}^\ast} = {{\mathit{ref}'}^\ast} \lor {{\mathit{ref}'}^\ast} = \epsilon +}{ +\{ \mathsf{type}~{\mathit{rt}},\;\allowbreak \mathsf{refs}~{{\mathit{ref}}^\ast} \}~\leq~\{ \mathsf{type}~{\mathit{rt}},\;\allowbreak \mathsf{refs}~{{\mathit{ref}'}^\ast} \} +} \, {[\textsc{\scriptsize Extend\_eleminst}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +{\mathit{dt}} \approx \mathsf{struct}~{({\mathsf{mut}^?}~{\mathit{zt}})^\ast} + \qquad +({\mathsf{mut}^?} = \mathsf{mut} \lor {\mathit{fv}} = {\mathit{fv}'})^\ast +}{ +\{ \mathsf{type}~{\mathit{dt}},\;\allowbreak \mathsf{fields}~{{\mathit{fv}}^\ast} \}~\leq~\{ \mathsf{type}~{\mathit{dt}},\;\allowbreak \mathsf{fields}~{{\mathit{fv}'}^\ast} \} +} \, {[\textsc{\scriptsize Extend\_structinst}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +{\mathit{dt}} \approx \mathsf{array}~({\mathsf{mut}^?}~{\mathit{zt}}) + \qquad +({\mathsf{mut}^?} = \mathsf{mut} \lor {\mathit{fv}} = {\mathit{fv}'})^\ast +}{ +\{ \mathsf{type}~{\mathit{dt}},\;\allowbreak \mathsf{fields}~{{\mathit{fv}}^\ast} \}~\leq~\{ \mathsf{type}~{\mathit{dt}},\;\allowbreak \mathsf{fields}~{{\mathit{fv}'}^\ast} \} +} \, {[\textsc{\scriptsize Extend\_arrayinst}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +}{ +\{ \mathsf{tag}~{\mathit{ta}},\;\allowbreak \mathsf{fields}~{{\mathit{val}}^\ast} \}~\leq~\{ \mathsf{tag}~{\mathit{ta}},\;\allowbreak \mathsf{fields}~{{\mathit{val}}^\ast} \} +} \, {[\textsc{\scriptsize Extend\_exninst}]} +\qquad +\end{array} +$$ + +\vspace{1ex} + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +\begin{array}{@{}c@{}} +(s{.}\mathsf{tags}{}[a]~\leq~{s'}{.}\mathsf{tags}{}[a])^{a<{|s{.}\mathsf{tags}|}} + \qquad +(s{.}\mathsf{globals}{}[a]~\leq~{s'}{.}\mathsf{globals}{}[a])^{a<{|s{.}\mathsf{globals}|}} + \\ +(s{.}\mathsf{mems}{}[a]~\leq~{s'}{.}\mathsf{mems}{}[a])^{a<{|s{.}\mathsf{mems}|}} + \qquad +(s{.}\mathsf{tables}{}[a]~\leq~{s'}{.}\mathsf{tables}{}[a])^{a<{|s{.}\mathsf{tables}|}} + \\ +(s{.}\mathsf{funcs}{}[a]~\leq~{s'}{.}\mathsf{funcs}{}[a])^{a<{|s{.}\mathsf{funcs}|}} + \qquad +(s{.}\mathsf{datas}{}[a]~\leq~{s'}{.}\mathsf{datas}{}[a])^{a<{|s{.}\mathsf{datas}|}} + \\ +(s{.}\mathsf{elems}{}[a]~\leq~{s'}{.}\mathsf{elems}{}[a])^{a<{|s{.}\mathsf{elems}|}} + \qquad +(s{.}\mathsf{structs}{}[a]~\leq~{s'}{.}\mathsf{structs}{}[a])^{a<{|s{.}\mathsf{structs}|}} + \\ +(s{.}\mathsf{arrays}{}[a]~\leq~{s'}{.}\mathsf{arrays}{}[a])^{a<{|s{.}\mathsf{arrays}|}} + \qquad +(s{.}\mathsf{exns}{}[a]~\leq~{s'}{.}\mathsf{exns}{}[a])^{a<{|s{.}\mathsf{exns}|}} +\end{array} +}{ +s~\leq~{s'} +} \, {[\textsc{\scriptsize Extend\_store}]} +\qquad +\end{array} +$$ + +\vspace{1ex} + +$\boxed{{\mathit{store}} \vdash {{\mathit{val}}^?} : {\mathit{localtype}}}$ + +$\boxed{{\mathit{store}} \vdash {\mathit{frame}} : {\mathit{context}}}$ + +$\boxed{{\vdash}\, {\mathit{state}} : {\mathit{context}}}$ + +$\boxed{{\vdash}\, {\mathit{config}} : \mathsf{ok}}$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s \vdash {\mathit{val}} : t +}{ +s \vdash {\mathit{val}} : \mathsf{set}~t +} \, {[\textsc{\scriptsize Localval\_ok{-}set}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +}{ +s \vdash \epsilon : \mathsf{unset}~\mathsf{bot} +} \, {[\textsc{\scriptsize Localval\_ok{-}unset}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +s \vdash {\mathit{moduleinst}} : C + \qquad +(s \vdash {{\mathit{val}}^?} : {{\mathit{lt}}})^\ast +}{ +s \vdash \{ \mathsf{locals}~{({{\mathit{val}}^?})^\ast},\;\allowbreak \mathsf{module}~{\mathit{moduleinst}} \} : C \oplus \{ \mathsf{locals}~{{{\mathit{lt}}}^\ast} \} +} \, {[\textsc{\scriptsize Frame\_ok}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +{\vdash}\, s : \mathsf{ok} + \qquad +s \vdash f : C +}{ +{\vdash}\, s ; f : C +} \, {[\textsc{\scriptsize State\_ok}]} +\qquad +\end{array} +$$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +{\vdash}\, z : C + \qquad +C \vdash {{\mathit{instr}}^\ast} : {t^\ast} +}{ +{\vdash}\, z ; {{\mathit{instr}}^\ast} : \mathsf{ok} +} \, {[\textsc{\scriptsize Config\_ok}]} +\qquad +\end{array} +$$ + \vspace{1ex} $$ diff --git a/spectec/test-middlend/TEST.md b/spectec/test-middlend/TEST.md index 52de5c986f..61300662d5 100644 --- a/spectec/test-middlend/TEST.md +++ b/spectec/test-middlend/TEST.md @@ -2782,98 +2782,102 @@ relation Heaptype_ok: `%|-%:OK`(context, heaptype) `%|-%:OK`(C, (typeuse : typeuse <: heaptype)) -- Typeuse_ok: `%|-%:OK`(C, typeuse) + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:27.1-28.16 + rule bot{C : context}: + `%|-%:OK`(C, BOT_heaptype) + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:10.1-10.91 relation Reftype_ok: `%|-%:OK`(context, reftype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:27.1-29.37 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:30.1-32.37 rule _{C : context, heaptype : heaptype}: `%|-%:OK`(C, REF_reftype(NULL_null?{}, heaptype)) -- Heaptype_ok: `%|-%:OK`(C, heaptype) ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:11.1-11.91 relation Valtype_ok: `%|-%:OK`(context, valtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:31.1-33.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:34.1-36.35 rule num{C : context, numtype : numtype}: `%|-%:OK`(C, (numtype : numtype <: valtype)) -- Numtype_ok: `%|-%:OK`(C, numtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:35.1-37.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:38.1-40.35 rule vec{C : context, vectype : vectype}: `%|-%:OK`(C, (vectype : vectype <: valtype)) -- Vectype_ok: `%|-%:OK`(C, vectype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:39.1-41.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:42.1-44.35 rule ref{C : context, reftype : reftype}: `%|-%:OK`(C, (reftype : reftype <: valtype)) -- Reftype_ok: `%|-%:OK`(C, reftype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:43.1-44.16 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:46.1-47.16 rule bot{C : context}: `%|-%:OK`(C, BOT_valtype) ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:12.1-12.94 relation Typeuse_ok: `%|-%:OK`(context, typeuse) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:99.1-101.30 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:102.1-104.30 rule typeidx{C : context, typeidx : typeidx, dt : deftype}: `%|-%:OK`(C, _IDX_typeuse(typeidx)) -- if (C.TYPES_context[typeidx!`%`_typeidx.0] = dt) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:103.1-105.23 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:106.1-108.23 rule rec{C : context, i : n, st : subtype}: `%|-%:OK`(C, REC_typeuse(i)) -- if (C.RECS_context[i] = st) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:107.1-109.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:110.1-112.35 rule deftype{C : context, deftype : deftype}: `%|-%:OK`(C, (deftype : deftype <: typeuse)) -- Deftype_ok: `%|-%:OK`(C, deftype) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:49.1-49.100 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:52.1-52.100 relation Resulttype_ok: `%|-%:OK`(context, resulttype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:52.1-54.32 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:55.1-57.32 rule _{C : context, `t*` : valtype*}: `%|-%:OK`(C, `%`_resulttype(t*{t <- `t*`})) -- (Valtype_ok: `%|-%:OK`(C, t))*{t <- `t*`} -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:85.1-85.104 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:88.1-88.104 relation Fieldtype_ok: `%|-%:OK`(context, fieldtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:123.1-125.43 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:126.1-128.43 rule _{C : context, storagetype : storagetype}: `%|-%:OK`(C, `%%`_fieldtype(MUT_mut?{}, storagetype)) -- Storagetype_ok: `%|-%:OK`(C, storagetype) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:86.1-86.106 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:89.1-89.106 relation Storagetype_ok: `%|-%:OK`(context, storagetype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:115.1-117.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:118.1-120.35 rule val{C : context, valtype : valtype}: `%|-%:OK`(C, (valtype : valtype <: storagetype)) -- Valtype_ok: `%|-%:OK`(C, valtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:119.1-121.37 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:122.1-124.37 rule pack{C : context, packtype : packtype}: `%|-%:OK`(C, (packtype : packtype <: storagetype)) -- Packtype_ok: `%|-%:OK`(C, packtype) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:87.1-87.103 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:90.1-90.103 relation Comptype_ok: `%|-%:OK`(context, comptype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:128.1-130.42 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:131.1-133.42 rule struct{C : context, `fieldtype*` : fieldtype*}: `%|-%:OK`(C, STRUCT_comptype(`%`_list(fieldtype*{fieldtype <- `fieldtype*`}))) -- (Fieldtype_ok: `%|-%:OK`(C, fieldtype))*{fieldtype <- `fieldtype*`} - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:132.1-134.39 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:135.1-137.39 rule array{C : context, fieldtype : fieldtype}: `%|-%:OK`(C, ARRAY_comptype(fieldtype)) -- Fieldtype_ok: `%|-%:OK`(C, fieldtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:136.1-139.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:139.1-142.35 rule func{C : context, `t_1*` : valtype*, `t_2*` : valtype*}: `%|-%:OK`(C, `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t_1*{t_1 <- `t_1*`})) -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t_2*{t_2 <- `t_2*`})) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:88.1-88.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:91.1-91.126 relation Subtype_ok: `%|-%:%`(context, subtype, oktypeidx) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:142.1-149.49 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:145.1-152.49 rule _{C : context, `x*` : idx*, comptype : comptype, x_0 : idx, `comptype'*` : comptype*, `x'**` : idx**}: `%|-%:%`(C, SUB_subtype(FINAL_final?{}, _IDX_typeuse(x)*{x <- `x*`}, comptype), OK_oktypeidx(x_0)) -- if (|x*{x <- `x*`}| <= 1) @@ -2882,26 +2886,26 @@ relation Subtype_ok: `%|-%:%`(context, subtype, oktypeidx) -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:89.1-89.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:92.1-92.126 relation Rectype_ok: `%|-%:%`(context, rectype, oktypeidx) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:171.1-172.23 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:174.1-175.23 rule empty{C : context, x : idx}: `%|-%:%`(C, REC_rectype(`%`_list([])), OK_oktypeidx(x)) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:174.1-177.48 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:177.1-180.48 rule cons{C : context, subtype_1 : subtype, `subtype*` : subtype*, x : idx}: `%|-%:%`(C, REC_rectype(`%`_list([subtype_1] ++ subtype*{subtype <- `subtype*`})), OK_oktypeidx(x)) -- Subtype_ok: `%|-%:%`(C, subtype_1, OK_oktypeidx(x)) -- Rectype_ok: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidx(`%`_typeidx((x!`%`_idx.0 + 1)))) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:179.1-181.60 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:182.1-184.60 rule _rec2{C : context, `subtype*` : subtype*, x : idx}: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidx(x)) -- Rectype_ok2: `%|-%:%`({TYPES [], RECS subtype*{subtype <- `subtype*`}, TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []} +++ C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(x, 0)) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:90.1-90.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:93.1-93.126 relation Subtype_ok2: `%|-%:%`(context, subtype, oktypeidxnat) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:161.1-168.49 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:164.1-171.49 rule _{C : context, `typeuse*` : typeuse*, compttype : comptype, x : idx, i : nat, `comptype'*` : comptype*, `typeuse'**` : typeuse**, comptype : comptype}: `%|-%:%`(C, SUB_subtype(FINAL_final?{}, typeuse*{typeuse <- `typeuse*`}, compttype), OK_oktypeidxnat(x, i)) -- if (|typeuse*{typeuse <- `typeuse*`}| <= 1) @@ -2910,28 +2914,28 @@ relation Subtype_ok2: `%|-%:%`(context, subtype, oktypeidxnat) -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:91.1-91.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:94.1-94.126 relation Rectype_ok2: `%|-%:%`(context, rectype, oktypeidxnat) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:183.1-184.24 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:186.1-187.24 rule empty{C : context, x : idx, i : nat}: `%|-%:%`(C, REC_rectype(`%`_list([])), OK_oktypeidxnat(x, i)) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:186.1-189.55 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:189.1-192.55 rule cons{C : context, subtype_1 : subtype, `subtype*` : subtype*, x : idx, i : nat}: `%|-%:%`(C, REC_rectype(`%`_list([subtype_1] ++ subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(x, i)) -- Subtype_ok2: `%|-%:%`(C, subtype_1, OK_oktypeidxnat(x, i)) -- Rectype_ok2: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(`%`_typeidx((x!`%`_idx.0 + 1)), (i + 1))) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:92.1-92.102 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:95.1-95.102 relation Deftype_ok: `%|-%:OK`(context, deftype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:192.1-196.14 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:195.1-199.14 rule _{C : context, rectype : rectype, i : n, x : idx, n : n, `subtype*` : subtype*}: `%|-%:OK`(C, _DEF_deftype(rectype, i)) -- Rectype_ok: `%|-%:%`(C, rectype, OK_oktypeidx(x)) -- if (rectype = REC_rectype(`%`_list(subtype^n{subtype <- `subtype*`}))) -- if (i < n) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:95.1-95.108 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:98.1-98.108 relation Comptype_sub: `%|-%<:%`(context, comptype, comptype) ;; ../../../../specification/wasm-latest/2.2-validation.subtyping.spectec:169.1-171.41 rule struct{C : context, `ft_1*` : fieldtype*, `ft'_1*` : fieldtype*, `ft_2*` : fieldtype*}: @@ -2949,7 +2953,7 @@ relation Comptype_sub: `%|-%<:%`(context, comptype, comptype) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t_21*{t_21 <- `t_21*`}), `%`_resulttype(t_11*{t_11 <- `t_11*`})) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t_12*{t_12 <- `t_12*`}), `%`_resulttype(t_22*{t_22 <- `t_22*`})) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:96.1-96.107 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:99.1-99.107 relation Deftype_sub: `%|-%<:%`(context, deftype, deftype) ;; ../../../../specification/wasm-latest/2.2-validation.subtyping.spectec:183.1-185.66 rule refl{C : context, deftype_1 : deftype, deftype_2 : deftype}: @@ -5905,37 +5909,55 @@ relation Val_ok: `%|-%:%`(store, val, valtype) `%|-%:%`(s, (ref : ref <: val), (rt : reftype <: valtype)) -- Ref_ok: `%|-%:%`(s, ref, rt) +;; ../../../../specification/wasm-latest/4.1-execution.values.spectec +relation Packval_ok: `%|-%:%`(store, packval, packtype) + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec + rule _{s : store, pt : packtype, c : iN($psizenn(pt))}: + `%|-%:%`(s, PACK_packval(pt, c), pt) + +;; ../../../../specification/wasm-latest/4.1-execution.values.spectec +relation Fieldval_ok: `%|-%:%`(store, fieldval, storagetype) + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec + rule val{s : store, val : val, t : valtype}: + `%|-%:%`(s, (val : val <: fieldval), (t : valtype <: storagetype)) + -- Val_ok: `%|-%:%`(s, val, t) + + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec + rule packval{s : store, packval : packval, pt : packtype}: + `%|-%:%`(s, (packval : packval <: fieldval), (pt : packtype <: storagetype)) + -- Packval_ok: `%|-%:%`(s, packval, pt) + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec rec { -;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:86.1-86.84 +;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:103.1-103.84 relation Externaddr_ok: `%|-%:%`(store, externaddr, externtype) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:88.1-90.28 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:105.1-107.28 rule tag{s : store, a : addr, taginst : taginst}: `%|-%:%`(s, TAG_externaddr(a), TAG_externtype(taginst.TYPE_taginst)) -- if (s.TAGS_store[a] = taginst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:92.1-94.34 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:109.1-111.34 rule global{s : store, a : addr, globalinst : globalinst}: `%|-%:%`(s, GLOBAL_externaddr(a), GLOBAL_externtype(globalinst.TYPE_globalinst)) -- if (s.GLOBALS_store[a] = globalinst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:96.1-98.28 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:113.1-115.28 rule mem{s : store, a : addr, meminst : meminst}: `%|-%:%`(s, MEM_externaddr(a), MEM_externtype(meminst.TYPE_meminst)) -- if (s.MEMS_store[a] = meminst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:100.1-102.32 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:117.1-119.32 rule table{s : store, a : addr, tableinst : tableinst}: `%|-%:%`(s, TABLE_externaddr(a), TABLE_externtype(tableinst.TYPE_tableinst)) -- if (s.TABLES_store[a] = tableinst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:104.1-106.30 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:121.1-123.30 rule func{s : store, a : addr, funcinst : funcinst}: `%|-%:%`(s, FUNC_externaddr(a), FUNC_externtype((funcinst.TYPE_funcinst : deftype <: typeuse))) -- if (s.FUNCS_store[a] = funcinst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:108.1-111.37 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:125.1-128.37 rule sub{s : store, externaddr : externaddr, xt : externtype, xt' : externtype}: `%|-%:%`(s, externaddr, xt) -- Externaddr_ok: `%|-%:%`(s, externaddr, xt') @@ -7623,6 +7645,372 @@ def $ordered(decl*) : bool ;; ../../../../specification/wasm-latest/6.4-text.modules.spectec def $ordered{`decl_1*` : decl*, import : import, `decl_2*` : decl*}(decl_1*{decl_1 <- `decl_1*`} ++ [(import : import <: decl)] ++ decl_2*{decl_2 <- `decl_2*`}) = (((((($importsd(decl_1*{decl_1 <- `decl_1*`}) = []) /\ ($tagsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($globalsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($memsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($tablesd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($funcsd(decl_1*{decl_1 <- `decl_1*`}) = [])) +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Localval_ok: `%|-%:%`(store, val?, localtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule set{s : store, val : val, t : valtype}: + `%|-%:%`(s, ?(val), `%%`_localtype(SET_init, t)) + -- Val_ok: `%|-%:%`(s, val, t) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule unset{s : store}: + `%|-%:%`(s, ?(), `%%`_localtype(UNSET_init, BOT_valtype)) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Datainst_ok: `%|-%:%`(store, datainst, datatype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `b*` : byte*}: + `%|-%:%`(s, {BYTES b*{b <- `b*`}}, OK_datatype) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Eleminst_ok: `%|-%:%`(store, eleminst, elemtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, rt : reftype, `ref*` : ref*}: + `%|-%:%`(s, {TYPE rt, REFS ref*{ref <- `ref*`}}, rt) + -- Reftype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rt) + -- (Ref_ok: `%|-%:%`(s, ref, rt))*{ref <- `ref*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Exportinst_ok: `%|-%:OK`(store, exportinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, nm : name, xa : externaddr, xt : externtype}: + `%|-%:OK`(s, {NAME nm, ADDR xa}) + -- Externaddr_ok: `%|-%:%`(s, xa, xt) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Moduleinst_ok: `%|-%:%`(store, moduleinst, context) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `deftype*` : deftype*, `tagaddr*` : tagaddr*, `globaladdr*` : globaladdr*, `memaddr*` : memaddr*, `tableaddr*` : tableaddr*, `funcaddr*` : funcaddr*, `dataaddr*` : dataaddr*, `elemaddr*` : elemaddr*, `exportinst*` : exportinst*, `subtype*` : subtype*, `tagtype*` : tagtype*, `globaltype*` : globaltype*, `memtype*` : memtype*, `tabletype*` : tabletype*, `deftype_F*` : deftype*, `datatype*` : datatype*, `elemtype*` : elemtype*}: + `%|-%:%`(s, {TYPES deftype*{deftype <- `deftype*`}, TAGS tagaddr*{tagaddr <- `tagaddr*`}, GLOBALS globaladdr*{globaladdr <- `globaladdr*`}, MEMS memaddr*{memaddr <- `memaddr*`}, TABLES tableaddr*{tableaddr <- `tableaddr*`}, FUNCS funcaddr*{funcaddr <- `funcaddr*`}, DATAS dataaddr*{dataaddr <- `dataaddr*`}, ELEMS elemaddr*{elemaddr <- `elemaddr*`}, EXPORTS exportinst*{exportinst <- `exportinst*`}}, {TYPES deftype*{deftype <- `deftype*`}, RECS subtype*{subtype <- `subtype*`}, TAGS tagtype*{tagtype <- `tagtype*`}, GLOBALS globaltype*{globaltype <- `globaltype*`}, MEMS memtype*{memtype <- `memtype*`}, TABLES tabletype*{tabletype <- `tabletype*`}, FUNCS deftype_F*{deftype_F <- `deftype_F*`}, DATAS datatype*{datatype <- `datatype*`}, ELEMS elemtype*{elemtype <- `elemtype*`}, LOCALS [], LABELS [], RETURN ?(), REFS `%`_funcidx(i)^(i<|funcaddr*{funcaddr <- `funcaddr*`}|){}}) + -- (Deftype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, deftype))*{deftype <- `deftype*`} + -- (Externaddr_ok: `%|-%:%`(s, TAG_externaddr(tagaddr), TAG_externtype(tagtype)))*{tagaddr <- `tagaddr*`, tagtype <- `tagtype*`} + -- (Externaddr_ok: `%|-%:%`(s, GLOBAL_externaddr(globaladdr), GLOBAL_externtype(globaltype)))*{globaladdr <- `globaladdr*`, globaltype <- `globaltype*`} + -- (Externaddr_ok: `%|-%:%`(s, FUNC_externaddr(funcaddr), FUNC_externtype((deftype_F : deftype <: typeuse))))*{deftype_F <- `deftype_F*`, funcaddr <- `funcaddr*`} + -- (Externaddr_ok: `%|-%:%`(s, MEM_externaddr(memaddr), MEM_externtype(memtype)))*{memaddr <- `memaddr*`, memtype <- `memtype*`} + -- (Externaddr_ok: `%|-%:%`(s, TABLE_externaddr(tableaddr), TABLE_externtype(tabletype)))*{tableaddr <- `tableaddr*`, tabletype <- `tabletype*`} + -- (Datainst_ok: `%|-%:%`(s, s.DATAS_store[dataaddr], datatype))*{dataaddr <- `dataaddr*`, datatype <- `datatype*`} + -- (Eleminst_ok: `%|-%:%`(s, s.ELEMS_store[elemaddr], elemtype))*{elemaddr <- `elemaddr*`, elemtype <- `elemtype*`} + -- (Exportinst_ok: `%|-%:OK`(s, exportinst))*{exportinst <- `exportinst*`} + -- if $disjoint_(syntax name, exportinst.NAME_exportinst*{exportinst <- `exportinst*`}) + -- (if (exportinst.ADDR_exportinst <- TAG_externaddr(tagaddr)*{tagaddr <- `tagaddr*`} ++ GLOBAL_externaddr(globaladdr)*{globaladdr <- `globaladdr*`} ++ MEM_externaddr(memaddr)*{memaddr <- `memaddr*`} ++ TABLE_externaddr(tableaddr)*{tableaddr <- `tableaddr*`} ++ FUNC_externaddr(funcaddr)*{funcaddr <- `funcaddr*`}))*{exportinst <- `exportinst*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Frame_ok: `%|-%:%`(store, frame, context) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `val?*` : val?*, moduleinst : moduleinst, C : context, `lct*` : localtype*}: + `%|-%:%`(s, {LOCALS val?{val <- `val?`}*{`val?` <- `val?*`}, MODULE moduleinst}, C +++ {TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS lct*{lct <- `lct*`}, LABELS [], RETURN ?(), REFS []}) + -- Moduleinst_ok: `%|-%:%`(s, moduleinst, C) + -- (Localval_ok: `%|-%:%`(s, val?{val <- `val?`}, lct))*{lct <- `lct*`, `val?` <- `val?*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +rec { + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:3.1-3.56 +relation Instr_ok2: `%;%|-%:%`(store, context, instr, instrtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:7.1-9.46 + rule plain{s : store, C : context, instr : instr, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*}: + `%;%|-%:%`(s, C, instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- Instr_ok: `%|-%:%`(C, instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:11.1-13.27 + rule ref{s : store, C : context, ref : ref, rt : reftype}: + `%;%|-%:%`(s, C, (ref : ref <: instr), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(rt : reftype <: valtype)]))) + -- Ref_ok: `%|-%:%`(s, ref, rt) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:15.1-18.68 + rule label{s : store, C : context, n : n, `instr'*` : instr*, `instr*` : instr*, `t*` : valtype*, `t'*` : valtype*, `x'*` : idx*, `x*` : idx*}: + `%;%|-%:%`(s, C, `LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(t*{t <- `t*`}))) + -- Instrs_ok2: `%;%|-%:%`(s, C, instr'*{instr' <- `instr'*`}, `%->_%%`_instrtype(`%`_resulttype(t'^n{t' <- `t'*`}), x'*{x' <- `x'*`}, `%`_resulttype(t*{t <- `t*`}))) + -- Instrs_ok2: `%;%|-%:%`(s, {TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [`%`_resulttype(t'^n{t' <- `t'*`})], RETURN ?(), REFS []} +++ C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype([]), x*{x <- `x*`}, `%`_resulttype(t*{t <- `t*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:20.1-23.37 + rule frame{s : store, C : context, n : n, f : frame, `instr*` : instr*, `t*` : valtype*, C' : context}: + `%;%|-%:%`(s, C, `FRAME_%{%}%`_instr(n, f, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(t^n{t <- `t*`}))) + -- Frame_ok: `%|-%:%`(s, f, C') + -- Expr_ok2: `%;%|-%:%`(s, C', instr*{instr <- `instr*`}, `%`_resulttype(t^n{t <- `t*`})) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:25.1-28.52 + rule handler{s : store, C : context, n : n, `catch*` : catch*, `instr*` : instr*, `t_1*` : valtype*, `t_2*` : valtype*, `x*` : idx*}: + `%;%|-%:%`(s, C, `HANDLER_%{%}%`_instr(n, catch*{catch <- `catch*`}, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- (Catch_ok: `%|-%:OK`(C, catch))*{catch <- `catch*`} + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:30.1-32.42 + rule trap{s : store, C : context, `t_1*` : valtype*, `t_2*` : valtype*}: + `%;%|-%:%`(s, C, TRAP_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:4.1-4.58 +relation Instrs_ok2: `%;%|-%:%`(store, context, instr*, instrtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:35.1-36.27 + rule empty{s : store, C : context}: + `%;%|-%:%`(s, C, [], `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:38.1-42.86 + rule seq{s : store, C : context, instr_1 : instr, `instr_2*` : instr*, `t_1*` : valtype*, `x_1*` : idx*, `x_2*` : idx*, `t_3*` : valtype*, `t_2*` : valtype*, `init*` : init*, `t*` : valtype*}: + `%;%|-%:%`(s, C, [instr_1] ++ instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`} ++ x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) + -- Instr_ok2: `%;%|-%:%`(s, C, instr_1, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- (if (C.LOCALS_context[x_1!`%`_idx.0] = `%%`_localtype(init, t)))*{init <- `init*`, t <- `t*`, x_1 <- `x_1*`} + -- Instrs_ok2: `%;%|-%:%`(s, $with_locals(C, x_1*{x_1 <- `x_1*`}, `%%`_localtype(SET_init, t)*{t <- `t*`}), instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_2*{t_2 <- `t_2*`}), x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:44.1-48.33 + rule sub{s : store, C : context, `instr*` : instr*, it' : instrtype, it : instrtype}: + `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, it') + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, it) + -- Instrtype_sub: `%|-%<:%`(C, it, it') + -- Instrtype_ok: `%|-%:OK`(C, it') + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:51.1-54.33 + rule frame{s : store, C : context, `instr*` : instr*, `t*` : valtype*, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*}: + `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t*{t <- `t*`} ++ t_2*{t_2 <- `t_2*`}))) + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t*{t <- `t*`})) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:5.1-5.55 +relation Expr_ok2: `%;%|-%:%`(store, context, expr, resulttype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:57.1-59.44 + rule _{s : store, C : context, `instr*` : instr*, `t*` : valtype*}: + `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%`_resulttype(t*{t <- `t*`})) + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(t*{t <- `t*`}))) +} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Taginst_ok: `%|-%:%`(store, taginst, tagtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, jt : tagtype}: + `%|-%:%`(s, {TYPE jt}, jt) + -- Tagtype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, jt) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Globalinst_ok: `%|-%:%`(store, globalinst, globaltype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `mut?` : mut?, t : valtype, val : val}: + `%|-%:%`(s, {TYPE `%%`_globaltype(mut?{mut <- `mut?`}, t), VALUE val}, `%%`_globaltype(mut?{mut <- `mut?`}, t)) + -- Globaltype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, `%%`_globaltype(mut?{mut <- `mut?`}, t)) + -- Val_ok: `%|-%:%`(s, val, t) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Meminst_ok: `%|-%:%`(store, meminst, memtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, at : addrtype, n : n, m : m, `b*` : byte*}: + `%|-%:%`(s, {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m)))), BYTES b*{b <- `b*`}}, `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))))) + -- Memtype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))))) + -- if (|b*{b <- `b*`}| = (n * (64 * $Ki))) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Tableinst_ok: `%|-%:%`(store, tableinst, tabletype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, at : addrtype, n : n, m : m, rt : reftype, `ref*` : ref*}: + `%|-%:%`(s, {TYPE `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt), REFS ref*{ref <- `ref*`}}, `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt)) + -- Tabletype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt)) + -- if (|ref*{ref <- `ref*`}| = n) + -- (Ref_ok: `%|-%:%`(s, ref, rt))*{ref <- `ref*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Funcinst_ok: `%|-%:%`(store, funcinst, deftype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, dt : deftype, moduleinst : moduleinst, func : func, C : context, dt' : deftype}: + `%|-%:%`(s, {TYPE dt, MODULE moduleinst, CODE (func : func <: funccode)}, dt) + -- Deftype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, dt) + -- Moduleinst_ok: `%|-%:%`(s, moduleinst, C) + -- Func_ok: `%|-%:%`(C, func, dt') + -- Deftype_sub: `%|-%<:%`(C, dt', dt) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Structinst_ok: `%|-%:OK`(store, structinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, dt : deftype, `fv*` : fieldval*, `mut?*` : mut?*, `zt*` : storagetype*}: + `%|-%:OK`(s, {TYPE dt, FIELDS fv*{fv <- `fv*`}}) + -- Expand: `%~~%`(dt, STRUCT_comptype(`%`_list(`%%`_fieldtype(mut?{mut <- `mut?`}, zt)*{`mut?` <- `mut?*`, zt <- `zt*`}))) + -- (Fieldval_ok: `%|-%:%`(s, fv, zt))*{fv <- `fv*`, zt <- `zt*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Arrayinst_ok: `%|-%:OK`(store, arrayinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, dt : deftype, `fv*` : fieldval*, `mut?` : mut?, zt : storagetype}: + `%|-%:OK`(s, {TYPE dt, FIELDS fv*{fv <- `fv*`}}) + -- Expand: `%~~%`(dt, ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) + -- (Fieldval_ok: `%|-%:%`(s, fv, zt))*{fv <- `fv*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Exninst_ok: `%|-%:OK`(store, exninst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, ta : tagaddr, `val*` : val*, dt : deftype, `t*` : valtype*}: + `%|-%:OK`(s, {TAG ta, FIELDS val*{val <- `val*`}}) + -- if ((dt : deftype <: typeuse) = s.TAGS_store[ta].TYPE_taginst) + -- Expand: `%~~%`(dt, `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- (Val_ok: `%|-%:%`(s, val, t))*{t <- `t*`, val <- `val*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +rec { + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:205.1-205.50 +relation ImmReachable: `%>>_%%`(fieldval, store, fieldval) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:217.1-220.33 + rule trans{fv_1 : fieldval, s : store, fv_2 : fieldval, fv' : fieldval}: + `%>>_%%`(fv_1, s, fv_2) + -- ImmReachable: `%>>_%%`(fv_1, s, fv') + -- ImmReachable: `%>>_%%`(fv', s, fv_2) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:222.1-225.20 + rule `ref.struct`{a : addr, s : store, i : nat, `ft*` : fieldtype*, zt : storagetype}: + `%>>_%%`(`REF.STRUCT_ADDR`_fieldval(a), s, s.STRUCTS_store[a].FIELDS_structinst[i]) + -- Expand: `%~~%`(s.STRUCTS_store[a].TYPE_structinst, STRUCT_comptype(`%`_list(ft*{ft <- `ft*`}))) + -- if (ft*{ft <- `ft*`}[i] = `%%`_fieldtype(?(), zt)) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:227.1-229.42 + rule `ref.array`{a : addr, s : store, i : nat, zt : storagetype}: + `%>>_%%`(`REF.ARRAY_ADDR`_fieldval(a), s, s.ARRAYS_store[a].FIELDS_arrayinst[i]) + -- Expand: `%~~%`(s.ARRAYS_store[a].TYPE_arrayinst, ARRAY_comptype(`%%`_fieldtype(?(), zt))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:231.1-232.44 + rule `ref.exn`{a : addr, s : store, i : nat}: + `%>>_%%`(`REF.EXN_ADDR`_fieldval(a), s, (s.EXNS_store[a].FIELDS_exninst[i] : val <: fieldval)) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:234.1-235.28 + rule `ref.extern`{ref : ref, s : store}: + `%>>_%%`(`REF.EXTERN`_fieldval(ref), s, (ref : ref <: fieldval)) +} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +def $NotImmReachable(fieldval : fieldval, store : store, fieldval : fieldval) : bool + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + def $NotImmReachable{fv_1 : fieldval, s : store, fv_2 : fieldval}(fv_1, s, fv_2) = false + -- ImmReachable: `%>>_%%`(fv_1, s, fv_2) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + def $NotImmReachable{fv_1 : fieldval, s : store, fv_2 : fieldval}(fv_1, s, fv_2) = true + -- otherwise + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation NotImmReachable: `~%>>_%%`(fieldval, store, fieldval) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{fv_1 : fieldval, s : store, fv_2 : fieldval}: + `~%>>_%%`(fv_1, s, fv_2) + -- if $NotImmReachable(fv_1, s, fv_2) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Store_ok: `|-%:OK`(store) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `taginst*` : taginst*, `tagtype*` : tagtype*, `globalinst*` : globalinst*, `globaltype*` : globaltype*, `meminst*` : meminst*, `memtype*` : memtype*, `tableinst*` : tableinst*, `tabletype*` : tabletype*, `deftype*` : deftype*, `funcinst*` : funcinst*, `datainst*` : datainst*, `datatype*` : datatype*, `eleminst*` : eleminst*, `elemtype*` : elemtype*, `structinst*` : structinst*, `arrayinst*` : arrayinst*, `exninst*` : exninst*}: + `|-%:OK`(s) + -- (Taginst_ok: `%|-%:%`(s, taginst, tagtype))*{taginst <- `taginst*`, tagtype <- `tagtype*`} + -- (Globalinst_ok: `%|-%:%`(s, globalinst, globaltype))*{globalinst <- `globalinst*`, globaltype <- `globaltype*`} + -- (Meminst_ok: `%|-%:%`(s, meminst, memtype))*{meminst <- `meminst*`, memtype <- `memtype*`} + -- (Tableinst_ok: `%|-%:%`(s, tableinst, tabletype))*{tableinst <- `tableinst*`, tabletype <- `tabletype*`} + -- (Funcinst_ok: `%|-%:%`(s, funcinst, deftype))*{deftype <- `deftype*`, funcinst <- `funcinst*`} + -- (Datainst_ok: `%|-%:%`(s, datainst, datatype))*{datainst <- `datainst*`, datatype <- `datatype*`} + -- (Eleminst_ok: `%|-%:%`(s, eleminst, elemtype))*{eleminst <- `eleminst*`, elemtype <- `elemtype*`} + -- (Structinst_ok: `%|-%:OK`(s, structinst))*{structinst <- `structinst*`} + -- (Arrayinst_ok: `%|-%:OK`(s, arrayinst))*{arrayinst <- `arrayinst*`} + -- (Exninst_ok: `%|-%:OK`(s, exninst))*{exninst <- `exninst*`} + -- (NotImmReachable: `~%>>_%%`(`REF.STRUCT_ADDR`_fieldval(a), s, `REF.STRUCT_ADDR`_fieldval(a)))^(a<|structinst*{structinst <- `structinst*`}|){} + -- (NotImmReachable: `~%>>_%%`(`REF.ARRAY_ADDR`_fieldval(a), s, `REF.ARRAY_ADDR`_fieldval(a)))^(a<|arrayinst*{arrayinst <- `arrayinst*`}|){} + -- (NotImmReachable: `~%>>_%%`(`REF.EXN_ADDR`_fieldval(a), s, `REF.EXN_ADDR`_fieldval(a)))^(a<|exninst*{exninst <- `exninst*`}|){} + -- if (s = {TAGS taginst*{taginst <- `taginst*`}, GLOBALS globalinst*{globalinst <- `globalinst*`}, MEMS meminst*{meminst <- `meminst*`}, TABLES tableinst*{tableinst <- `tableinst*`}, FUNCS funcinst*{funcinst <- `funcinst*`}, DATAS datainst*{datainst <- `datainst*`}, ELEMS eleminst*{eleminst <- `eleminst*`}, STRUCTS structinst*{structinst <- `structinst*`}, ARRAYS arrayinst*{arrayinst <- `arrayinst*`}, EXNS exninst*{exninst <- `exninst*`}}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_taginst: `%<=%`(taginst, taginst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{jt : tagtype}: + `%<=%`({TYPE jt}, {TYPE jt}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_globalinst: `%<=%`(globalinst, globalinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{`mut?` : mut?, t : valtype, val : val, val' : val}: + `%<=%`({TYPE `%%`_globaltype(mut?{mut <- `mut?`}, t), VALUE val}, {TYPE `%%`_globaltype(mut?{mut <- `mut?`}, t), VALUE val'}) + -- if ((mut?{mut <- `mut?`} = ?(MUT_mut)) \/ (val = val')) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_meminst: `%<=%`(meminst, meminst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{at : addrtype, n : n, m : m, `b*` : byte*, n' : n, `b'*` : byte*}: + `%<=%`({TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m)))), BYTES b*{b <- `b*`}}, {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n'), ?(`%`_u64(m)))), BYTES b'*{b' <- `b'*`}}) + -- if (n <= n') + -- if (|b*{b <- `b*`}| <= |b'*{b' <- `b'*`}|) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_tableinst: `%<=%`(tableinst, tableinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{at : addrtype, n : n, m : m, rt : reftype, `ref*` : ref*, n' : n, `ref'*` : ref*}: + `%<=%`({TYPE `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt), REFS ref*{ref <- `ref*`}}, {TYPE `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n'), ?(`%`_u64(m))), rt), REFS ref'*{ref' <- `ref'*`}}) + -- if (n <= n') + -- if (|ref*{ref <- `ref*`}| <= |ref'*{ref' <- `ref'*`}|) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_funcinst: `%<=%`(funcinst, funcinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{dt : deftype, mm : moduleinst, fc : funccode}: + `%<=%`({TYPE dt, MODULE mm, CODE fc}, {TYPE dt, MODULE mm, CODE fc}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_datainst: `%<=%`(datainst, datainst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{`b*` : byte*, `b'*` : byte*}: + `%<=%`({BYTES b*{b <- `b*`}}, {BYTES b'*{b' <- `b'*`}}) + -- if ((b*{b <- `b*`} = b'*{b' <- `b'*`}) \/ (b'*{b' <- `b'*`} = [])) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_eleminst: `%<=%`(eleminst, eleminst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{rt : reftype, `ref*` : ref*, `ref'*` : ref*}: + `%<=%`({TYPE rt, REFS ref*{ref <- `ref*`}}, {TYPE rt, REFS ref'*{ref' <- `ref'*`}}) + -- if ((ref*{ref <- `ref*`} = ref'*{ref' <- `ref'*`}) \/ (ref'*{ref' <- `ref'*`} = [])) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_structinst: `%<=%`(structinst, structinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{dt : deftype, `fv*` : fieldval*, `fv'*` : fieldval*, `mut?*` : mut?*, `zt*` : storagetype*}: + `%<=%`({TYPE dt, FIELDS fv*{fv <- `fv*`}}, {TYPE dt, FIELDS fv'*{fv' <- `fv'*`}}) + -- Expand: `%~~%`(dt, STRUCT_comptype(`%`_list(`%%`_fieldtype(mut?{mut <- `mut?`}, zt)*{`mut?` <- `mut?*`, zt <- `zt*`}))) + -- (if ((mut?{mut <- `mut?`} = ?(MUT_mut)) \/ (fv = fv')))*{fv <- `fv*`, fv' <- `fv'*`, `mut?` <- `mut?*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_arrayinst: `%<=%`(arrayinst, arrayinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{dt : deftype, `fv*` : fieldval*, `fv'*` : fieldval*, `mut?` : mut?, zt : storagetype}: + `%<=%`({TYPE dt, FIELDS fv*{fv <- `fv*`}}, {TYPE dt, FIELDS fv'*{fv' <- `fv'*`}}) + -- Expand: `%~~%`(dt, ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) + -- (if ((mut?{mut <- `mut?`} = ?(MUT_mut)) \/ (fv = fv')))*{fv <- `fv*`, fv' <- `fv'*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_exninst: `%<=%`(exninst, exninst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{ta : tagaddr, `val*` : val*}: + `%<=%`({TAG ta, FIELDS val*{val <- `val*`}}, {TAG ta, FIELDS val*{val <- `val*`}}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_store: `%<=%`(store, store) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, s' : store}: + `%<=%`(s, s') + -- (Extend_taginst: `%<=%`(s.TAGS_store[a], s'.TAGS_store[a]))^(a<|s.TAGS_store|){} + -- (Extend_globalinst: `%<=%`(s.GLOBALS_store[a], s'.GLOBALS_store[a]))^(a<|s.GLOBALS_store|){} + -- (Extend_meminst: `%<=%`(s.MEMS_store[a], s'.MEMS_store[a]))^(a<|s.MEMS_store|){} + -- (Extend_tableinst: `%<=%`(s.TABLES_store[a], s'.TABLES_store[a]))^(a<|s.TABLES_store|){} + -- (Extend_funcinst: `%<=%`(s.FUNCS_store[a], s'.FUNCS_store[a]))^(a<|s.FUNCS_store|){} + -- (Extend_datainst: `%<=%`(s.DATAS_store[a], s'.DATAS_store[a]))^(a<|s.DATAS_store|){} + -- (Extend_eleminst: `%<=%`(s.ELEMS_store[a], s'.ELEMS_store[a]))^(a<|s.ELEMS_store|){} + -- (Extend_structinst: `%<=%`(s.STRUCTS_store[a], s'.STRUCTS_store[a]))^(a<|s.STRUCTS_store|){} + -- (Extend_arrayinst: `%<=%`(s.ARRAYS_store[a], s'.ARRAYS_store[a]))^(a<|s.ARRAYS_store|){} + -- (Extend_exninst: `%<=%`(s.EXNS_store[a], s'.EXNS_store[a]))^(a<|s.EXNS_store|){} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation State_ok: `|-%:%`(state, context) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, f : frame, C : context}: + `|-%:%`(`%;%`_state(s, f), C) + -- Store_ok: `|-%:OK`(s) + -- Frame_ok: `%|-%:%`(s, f, C) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Config_ok: `|-%:OK`(config) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{z : state, `instr*` : instr*, C : context, `t*` : valtype*}: + `|-%:OK`(`%;%`_config(z, instr*{instr <- `instr*`})) + -- State_ok: `|-%:%`(z, C) + -- Expr_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, `%`_resulttype(t*{t <- `t*`})) + ;; ../../../../specification/wasm-latest/X.1-notation.syntax.spectec syntax A = nat @@ -14206,98 +14594,102 @@ relation Heaptype_ok: `%|-%:OK`(context, heaptype) `%|-%:OK`(C, (typeuse : typeuse <: heaptype)) -- Typeuse_ok: `%|-%:OK`(C, typeuse) + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:27.1-28.16 + rule bot{C : context}: + `%|-%:OK`(C, BOT_heaptype) + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:10.1-10.91 relation Reftype_ok: `%|-%:OK`(context, reftype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:27.1-29.37 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:30.1-32.37 rule _{C : context, heaptype : heaptype}: `%|-%:OK`(C, REF_reftype(NULL_null?{}, heaptype)) -- Heaptype_ok: `%|-%:OK`(C, heaptype) ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:11.1-11.91 relation Valtype_ok: `%|-%:OK`(context, valtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:31.1-33.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:34.1-36.35 rule num{C : context, numtype : numtype}: `%|-%:OK`(C, (numtype : numtype <: valtype)) -- Numtype_ok: `%|-%:OK`(C, numtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:35.1-37.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:38.1-40.35 rule vec{C : context, vectype : vectype}: `%|-%:OK`(C, (vectype : vectype <: valtype)) -- Vectype_ok: `%|-%:OK`(C, vectype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:39.1-41.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:42.1-44.35 rule ref{C : context, reftype : reftype}: `%|-%:OK`(C, (reftype : reftype <: valtype)) -- Reftype_ok: `%|-%:OK`(C, reftype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:43.1-44.16 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:46.1-47.16 rule bot{C : context}: `%|-%:OK`(C, BOT_valtype) ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:12.1-12.94 relation Typeuse_ok: `%|-%:OK`(context, typeuse) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:99.1-101.30 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:102.1-104.30 rule typeidx{C : context, typeidx : typeidx, dt : deftype}: `%|-%:OK`(C, _IDX_typeuse(typeidx)) -- if (C.TYPES_context[typeidx!`%`_typeidx.0] = dt) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:103.1-105.23 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:106.1-108.23 rule rec{C : context, i : n, st : subtype}: `%|-%:OK`(C, REC_typeuse(i)) -- if (C.RECS_context[i] = st) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:107.1-109.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:110.1-112.35 rule deftype{C : context, deftype : deftype}: `%|-%:OK`(C, (deftype : deftype <: typeuse)) -- Deftype_ok: `%|-%:OK`(C, deftype) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:49.1-49.100 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:52.1-52.100 relation Resulttype_ok: `%|-%:OK`(context, resulttype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:52.1-54.32 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:55.1-57.32 rule _{C : context, `t*` : valtype*}: `%|-%:OK`(C, `%`_resulttype(t*{t <- `t*`})) -- (Valtype_ok: `%|-%:OK`(C, t))*{t <- `t*`} -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:85.1-85.104 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:88.1-88.104 relation Fieldtype_ok: `%|-%:OK`(context, fieldtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:123.1-125.43 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:126.1-128.43 rule _{C : context, storagetype : storagetype}: `%|-%:OK`(C, `%%`_fieldtype(MUT_mut?{}, storagetype)) -- Storagetype_ok: `%|-%:OK`(C, storagetype) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:86.1-86.106 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:89.1-89.106 relation Storagetype_ok: `%|-%:OK`(context, storagetype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:115.1-117.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:118.1-120.35 rule val{C : context, valtype : valtype}: `%|-%:OK`(C, (valtype : valtype <: storagetype)) -- Valtype_ok: `%|-%:OK`(C, valtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:119.1-121.37 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:122.1-124.37 rule pack{C : context, packtype : packtype}: `%|-%:OK`(C, (packtype : packtype <: storagetype)) -- Packtype_ok: `%|-%:OK`(C, packtype) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:87.1-87.103 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:90.1-90.103 relation Comptype_ok: `%|-%:OK`(context, comptype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:128.1-130.42 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:131.1-133.42 rule struct{C : context, `fieldtype*` : fieldtype*}: `%|-%:OK`(C, STRUCT_comptype(`%`_list(fieldtype*{fieldtype <- `fieldtype*`}))) -- (Fieldtype_ok: `%|-%:OK`(C, fieldtype))*{fieldtype <- `fieldtype*`} - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:132.1-134.39 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:135.1-137.39 rule array{C : context, fieldtype : fieldtype}: `%|-%:OK`(C, ARRAY_comptype(fieldtype)) -- Fieldtype_ok: `%|-%:OK`(C, fieldtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:136.1-139.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:139.1-142.35 rule func{C : context, `t_1*` : valtype*, `t_2*` : valtype*}: `%|-%:OK`(C, `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t_1*{t_1 <- `t_1*`})) -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t_2*{t_2 <- `t_2*`})) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:88.1-88.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:91.1-91.126 relation Subtype_ok: `%|-%:%`(context, subtype, oktypeidx) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:142.1-149.49 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:145.1-152.49 rule _{C : context, `x*` : idx*, comptype : comptype, x_0 : idx, `comptype'*` : comptype*, `x'**` : idx**}: `%|-%:%`(C, SUB_subtype(FINAL_final?{}, _IDX_typeuse(x)*{x <- `x*`}, comptype), OK_oktypeidx(x_0)) -- if (|x*{x <- `x*`}| <= 1) @@ -14306,26 +14698,26 @@ relation Subtype_ok: `%|-%:%`(context, subtype, oktypeidx) -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:89.1-89.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:92.1-92.126 relation Rectype_ok: `%|-%:%`(context, rectype, oktypeidx) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:171.1-172.23 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:174.1-175.23 rule empty{C : context, x : idx}: `%|-%:%`(C, REC_rectype(`%`_list([])), OK_oktypeidx(x)) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:174.1-177.48 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:177.1-180.48 rule cons{C : context, subtype_1 : subtype, `subtype*` : subtype*, x : idx}: `%|-%:%`(C, REC_rectype(`%`_list([subtype_1] ++ subtype*{subtype <- `subtype*`})), OK_oktypeidx(x)) -- Subtype_ok: `%|-%:%`(C, subtype_1, OK_oktypeidx(x)) -- Rectype_ok: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidx(`%`_typeidx((x!`%`_idx.0 + 1)))) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:179.1-181.60 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:182.1-184.60 rule _rec2{C : context, `subtype*` : subtype*, x : idx}: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidx(x)) -- Rectype_ok2: `%|-%:%`({TYPES [], RECS subtype*{subtype <- `subtype*`}, TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []} +++ C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(x, 0)) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:90.1-90.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:93.1-93.126 relation Subtype_ok2: `%|-%:%`(context, subtype, oktypeidxnat) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:161.1-168.49 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:164.1-171.49 rule _{C : context, `typeuse*` : typeuse*, compttype : comptype, x : idx, i : nat, `comptype'*` : comptype*, `typeuse'**` : typeuse**, comptype : comptype}: `%|-%:%`(C, SUB_subtype(FINAL_final?{}, typeuse*{typeuse <- `typeuse*`}, compttype), OK_oktypeidxnat(x, i)) -- if (|typeuse*{typeuse <- `typeuse*`}| <= 1) @@ -14334,28 +14726,28 @@ relation Subtype_ok2: `%|-%:%`(context, subtype, oktypeidxnat) -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:91.1-91.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:94.1-94.126 relation Rectype_ok2: `%|-%:%`(context, rectype, oktypeidxnat) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:183.1-184.24 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:186.1-187.24 rule empty{C : context, x : idx, i : nat}: `%|-%:%`(C, REC_rectype(`%`_list([])), OK_oktypeidxnat(x, i)) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:186.1-189.55 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:189.1-192.55 rule cons{C : context, subtype_1 : subtype, `subtype*` : subtype*, x : idx, i : nat}: `%|-%:%`(C, REC_rectype(`%`_list([subtype_1] ++ subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(x, i)) -- Subtype_ok2: `%|-%:%`(C, subtype_1, OK_oktypeidxnat(x, i)) -- Rectype_ok2: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(`%`_typeidx((x!`%`_idx.0 + 1)), (i + 1))) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:92.1-92.102 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:95.1-95.102 relation Deftype_ok: `%|-%:OK`(context, deftype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:192.1-196.14 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:195.1-199.14 rule _{C : context, rectype : rectype, i : n, x : idx, n : n, `subtype*` : subtype*}: `%|-%:OK`(C, _DEF_deftype(rectype, i)) -- Rectype_ok: `%|-%:%`(C, rectype, OK_oktypeidx(x)) -- if (rectype = REC_rectype(`%`_list(subtype^n{subtype <- `subtype*`}))) -- if (i < n) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:95.1-95.108 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:98.1-98.108 relation Comptype_sub: `%|-%<:%`(context, comptype, comptype) ;; ../../../../specification/wasm-latest/2.2-validation.subtyping.spectec:169.1-171.41 rule struct{C : context, `ft_1*` : fieldtype*, `ft'_1*` : fieldtype*, `ft_2*` : fieldtype*}: @@ -14373,7 +14765,7 @@ relation Comptype_sub: `%|-%<:%`(context, comptype, comptype) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t_21*{t_21 <- `t_21*`}), `%`_resulttype(t_11*{t_11 <- `t_11*`})) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t_12*{t_12 <- `t_12*`}), `%`_resulttype(t_22*{t_22 <- `t_22*`})) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:96.1-96.107 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:99.1-99.107 relation Deftype_sub: `%|-%<:%`(context, deftype, deftype) ;; ../../../../specification/wasm-latest/2.2-validation.subtyping.spectec:183.1-185.66 rule refl{C : context, deftype_1 : deftype, deftype_2 : deftype}: @@ -17331,37 +17723,55 @@ relation Val_ok: `%|-%:%`(store, val, valtype) `%|-%:%`(s, (ref : ref <: val), (rt : reftype <: valtype)) -- Ref_ok: `%|-%:%`(s, ref, rt) +;; ../../../../specification/wasm-latest/4.1-execution.values.spectec +relation Packval_ok: `%|-%:%`(store, packval, packtype) + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec + rule _{s : store, pt : packtype, c : iN($psizenn(pt))}: + `%|-%:%`(s, PACK_packval(pt, c), pt) + +;; ../../../../specification/wasm-latest/4.1-execution.values.spectec +relation Fieldval_ok: `%|-%:%`(store, fieldval, storagetype) + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec + rule val{s : store, val : val, t : valtype}: + `%|-%:%`(s, (val : val <: fieldval), (t : valtype <: storagetype)) + -- Val_ok: `%|-%:%`(s, val, t) + + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec + rule packval{s : store, packval : packval, pt : packtype}: + `%|-%:%`(s, (packval : packval <: fieldval), (pt : packtype <: storagetype)) + -- Packval_ok: `%|-%:%`(s, packval, pt) + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec rec { -;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:86.1-86.84 +;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:103.1-103.84 relation Externaddr_ok: `%|-%:%`(store, externaddr, externtype) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:88.1-90.28 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:105.1-107.28 rule tag{s : store, a : addr, taginst : taginst}: `%|-%:%`(s, TAG_externaddr(a), TAG_externtype(taginst.TYPE_taginst)) -- if (s.TAGS_store[a] = taginst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:92.1-94.34 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:109.1-111.34 rule global{s : store, a : addr, globalinst : globalinst}: `%|-%:%`(s, GLOBAL_externaddr(a), GLOBAL_externtype(globalinst.TYPE_globalinst)) -- if (s.GLOBALS_store[a] = globalinst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:96.1-98.28 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:113.1-115.28 rule mem{s : store, a : addr, meminst : meminst}: `%|-%:%`(s, MEM_externaddr(a), MEM_externtype(meminst.TYPE_meminst)) -- if (s.MEMS_store[a] = meminst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:100.1-102.32 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:117.1-119.32 rule table{s : store, a : addr, tableinst : tableinst}: `%|-%:%`(s, TABLE_externaddr(a), TABLE_externtype(tableinst.TYPE_tableinst)) -- if (s.TABLES_store[a] = tableinst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:104.1-106.30 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:121.1-123.30 rule func{s : store, a : addr, funcinst : funcinst}: `%|-%:%`(s, FUNC_externaddr(a), FUNC_externtype((funcinst.TYPE_funcinst : deftype <: typeuse))) -- if (s.FUNCS_store[a] = funcinst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:108.1-111.37 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:125.1-128.37 rule sub{s : store, externaddr : externaddr, xt : externtype, xt' : externtype}: `%|-%:%`(s, externaddr, xt) -- Externaddr_ok: `%|-%:%`(s, externaddr, xt') @@ -19049,6 +19459,372 @@ def $ordered(decl*) : bool ;; ../../../../specification/wasm-latest/6.4-text.modules.spectec def $ordered{`decl_1*` : decl*, import : import, `decl_2*` : decl*}(decl_1*{decl_1 <- `decl_1*`} ++ [(import : import <: decl)] ++ decl_2*{decl_2 <- `decl_2*`}) = (((((($importsd(decl_1*{decl_1 <- `decl_1*`}) = []) /\ ($tagsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($globalsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($memsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($tablesd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($funcsd(decl_1*{decl_1 <- `decl_1*`}) = [])) +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Localval_ok: `%|-%:%`(store, val?, localtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule set{s : store, val : val, t : valtype}: + `%|-%:%`(s, ?(val), `%%`_localtype(SET_init, t)) + -- Val_ok: `%|-%:%`(s, val, t) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule unset{s : store}: + `%|-%:%`(s, ?(), `%%`_localtype(UNSET_init, BOT_valtype)) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Datainst_ok: `%|-%:%`(store, datainst, datatype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `b*` : byte*}: + `%|-%:%`(s, {BYTES b*{b <- `b*`}}, OK_datatype) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Eleminst_ok: `%|-%:%`(store, eleminst, elemtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, rt : reftype, `ref*` : ref*}: + `%|-%:%`(s, {TYPE rt, REFS ref*{ref <- `ref*`}}, rt) + -- Reftype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rt) + -- (Ref_ok: `%|-%:%`(s, ref, rt))*{ref <- `ref*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Exportinst_ok: `%|-%:OK`(store, exportinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, nm : name, xa : externaddr, xt : externtype}: + `%|-%:OK`(s, {NAME nm, ADDR xa}) + -- Externaddr_ok: `%|-%:%`(s, xa, xt) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Moduleinst_ok: `%|-%:%`(store, moduleinst, context) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `deftype*` : deftype*, `tagaddr*` : tagaddr*, `globaladdr*` : globaladdr*, `memaddr*` : memaddr*, `tableaddr*` : tableaddr*, `funcaddr*` : funcaddr*, `dataaddr*` : dataaddr*, `elemaddr*` : elemaddr*, `exportinst*` : exportinst*, `subtype*` : subtype*, `tagtype*` : tagtype*, `globaltype*` : globaltype*, `memtype*` : memtype*, `tabletype*` : tabletype*, `deftype_F*` : deftype*, `datatype*` : datatype*, `elemtype*` : elemtype*}: + `%|-%:%`(s, {TYPES deftype*{deftype <- `deftype*`}, TAGS tagaddr*{tagaddr <- `tagaddr*`}, GLOBALS globaladdr*{globaladdr <- `globaladdr*`}, MEMS memaddr*{memaddr <- `memaddr*`}, TABLES tableaddr*{tableaddr <- `tableaddr*`}, FUNCS funcaddr*{funcaddr <- `funcaddr*`}, DATAS dataaddr*{dataaddr <- `dataaddr*`}, ELEMS elemaddr*{elemaddr <- `elemaddr*`}, EXPORTS exportinst*{exportinst <- `exportinst*`}}, {TYPES deftype*{deftype <- `deftype*`}, RECS subtype*{subtype <- `subtype*`}, TAGS tagtype*{tagtype <- `tagtype*`}, GLOBALS globaltype*{globaltype <- `globaltype*`}, MEMS memtype*{memtype <- `memtype*`}, TABLES tabletype*{tabletype <- `tabletype*`}, FUNCS deftype_F*{deftype_F <- `deftype_F*`}, DATAS datatype*{datatype <- `datatype*`}, ELEMS elemtype*{elemtype <- `elemtype*`}, LOCALS [], LABELS [], RETURN ?(), REFS `%`_funcidx(i)^(i<|funcaddr*{funcaddr <- `funcaddr*`}|){}}) + -- (Deftype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, deftype))*{deftype <- `deftype*`} + -- (Externaddr_ok: `%|-%:%`(s, TAG_externaddr(tagaddr), TAG_externtype(tagtype)))*{tagaddr <- `tagaddr*`, tagtype <- `tagtype*`} + -- (Externaddr_ok: `%|-%:%`(s, GLOBAL_externaddr(globaladdr), GLOBAL_externtype(globaltype)))*{globaladdr <- `globaladdr*`, globaltype <- `globaltype*`} + -- (Externaddr_ok: `%|-%:%`(s, FUNC_externaddr(funcaddr), FUNC_externtype((deftype_F : deftype <: typeuse))))*{deftype_F <- `deftype_F*`, funcaddr <- `funcaddr*`} + -- (Externaddr_ok: `%|-%:%`(s, MEM_externaddr(memaddr), MEM_externtype(memtype)))*{memaddr <- `memaddr*`, memtype <- `memtype*`} + -- (Externaddr_ok: `%|-%:%`(s, TABLE_externaddr(tableaddr), TABLE_externtype(tabletype)))*{tableaddr <- `tableaddr*`, tabletype <- `tabletype*`} + -- (Datainst_ok: `%|-%:%`(s, s.DATAS_store[dataaddr], datatype))*{dataaddr <- `dataaddr*`, datatype <- `datatype*`} + -- (Eleminst_ok: `%|-%:%`(s, s.ELEMS_store[elemaddr], elemtype))*{elemaddr <- `elemaddr*`, elemtype <- `elemtype*`} + -- (Exportinst_ok: `%|-%:OK`(s, exportinst))*{exportinst <- `exportinst*`} + -- if $disjoint_(syntax name, exportinst.NAME_exportinst*{exportinst <- `exportinst*`}) + -- (if (exportinst.ADDR_exportinst <- TAG_externaddr(tagaddr)*{tagaddr <- `tagaddr*`} ++ GLOBAL_externaddr(globaladdr)*{globaladdr <- `globaladdr*`} ++ MEM_externaddr(memaddr)*{memaddr <- `memaddr*`} ++ TABLE_externaddr(tableaddr)*{tableaddr <- `tableaddr*`} ++ FUNC_externaddr(funcaddr)*{funcaddr <- `funcaddr*`}))*{exportinst <- `exportinst*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Frame_ok: `%|-%:%`(store, frame, context) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `val?*` : val?*, moduleinst : moduleinst, C : context, `lct*` : localtype*}: + `%|-%:%`(s, {LOCALS val?{val <- `val?`}*{`val?` <- `val?*`}, MODULE moduleinst}, C +++ {TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS lct*{lct <- `lct*`}, LABELS [], RETURN ?(), REFS []}) + -- Moduleinst_ok: `%|-%:%`(s, moduleinst, C) + -- (Localval_ok: `%|-%:%`(s, val?{val <- `val?`}, lct))*{lct <- `lct*`, `val?` <- `val?*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +rec { + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:3.1-3.56 +relation Instr_ok2: `%;%|-%:%`(store, context, instr, instrtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:7.1-9.46 + rule plain{s : store, C : context, instr : instr, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*}: + `%;%|-%:%`(s, C, instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- Instr_ok: `%|-%:%`(C, instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:11.1-13.27 + rule ref{s : store, C : context, ref : ref, rt : reftype}: + `%;%|-%:%`(s, C, (ref : ref <: instr), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(rt : reftype <: valtype)]))) + -- Ref_ok: `%|-%:%`(s, ref, rt) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:15.1-18.68 + rule label{s : store, C : context, n : n, `instr'*` : instr*, `instr*` : instr*, `t*` : valtype*, `t'*` : valtype*, `x'*` : idx*, `x*` : idx*}: + `%;%|-%:%`(s, C, `LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(t*{t <- `t*`}))) + -- Instrs_ok2: `%;%|-%:%`(s, C, instr'*{instr' <- `instr'*`}, `%->_%%`_instrtype(`%`_resulttype(t'^n{t' <- `t'*`}), x'*{x' <- `x'*`}, `%`_resulttype(t*{t <- `t*`}))) + -- Instrs_ok2: `%;%|-%:%`(s, {TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [`%`_resulttype(t'^n{t' <- `t'*`})], RETURN ?(), REFS []} +++ C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype([]), x*{x <- `x*`}, `%`_resulttype(t*{t <- `t*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:20.1-23.37 + rule frame{s : store, C : context, n : n, f : frame, `instr*` : instr*, `t*` : valtype*, C' : context}: + `%;%|-%:%`(s, C, `FRAME_%{%}%`_instr(n, f, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(t^n{t <- `t*`}))) + -- Frame_ok: `%|-%:%`(s, f, C') + -- Expr_ok2: `%;%|-%:%`(s, C', instr*{instr <- `instr*`}, `%`_resulttype(t^n{t <- `t*`})) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:25.1-28.52 + rule handler{s : store, C : context, n : n, `catch*` : catch*, `instr*` : instr*, `t_1*` : valtype*, `t_2*` : valtype*, `x*` : idx*}: + `%;%|-%:%`(s, C, `HANDLER_%{%}%`_instr(n, catch*{catch <- `catch*`}, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- (Catch_ok: `%|-%:OK`(C, catch))*{catch <- `catch*`} + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:30.1-32.42 + rule trap{s : store, C : context, `t_1*` : valtype*, `t_2*` : valtype*}: + `%;%|-%:%`(s, C, TRAP_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:4.1-4.58 +relation Instrs_ok2: `%;%|-%:%`(store, context, instr*, instrtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:35.1-36.27 + rule empty{s : store, C : context}: + `%;%|-%:%`(s, C, [], `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:38.1-42.86 + rule seq{s : store, C : context, instr_1 : instr, `instr_2*` : instr*, `t_1*` : valtype*, `x_1*` : idx*, `x_2*` : idx*, `t_3*` : valtype*, `t_2*` : valtype*, `init*` : init*, `t*` : valtype*}: + `%;%|-%:%`(s, C, [instr_1] ++ instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`} ++ x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) + -- Instr_ok2: `%;%|-%:%`(s, C, instr_1, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- (if (C.LOCALS_context[x_1!`%`_idx.0] = `%%`_localtype(init, t)))*{init <- `init*`, t <- `t*`, x_1 <- `x_1*`} + -- Instrs_ok2: `%;%|-%:%`(s, $with_locals(C, x_1*{x_1 <- `x_1*`}, `%%`_localtype(SET_init, t)*{t <- `t*`}), instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_2*{t_2 <- `t_2*`}), x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:44.1-48.33 + rule sub{s : store, C : context, `instr*` : instr*, it' : instrtype, it : instrtype}: + `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, it') + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, it) + -- Instrtype_sub: `%|-%<:%`(C, it, it') + -- Instrtype_ok: `%|-%:OK`(C, it') + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:51.1-54.33 + rule frame{s : store, C : context, `instr*` : instr*, `t*` : valtype*, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*}: + `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t*{t <- `t*`} ++ t_2*{t_2 <- `t_2*`}))) + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t*{t <- `t*`})) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:5.1-5.55 +relation Expr_ok2: `%;%|-%:%`(store, context, expr, resulttype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:57.1-59.44 + rule _{s : store, C : context, `instr*` : instr*, `t*` : valtype*}: + `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%`_resulttype(t*{t <- `t*`})) + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(t*{t <- `t*`}))) +} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Taginst_ok: `%|-%:%`(store, taginst, tagtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, jt : tagtype}: + `%|-%:%`(s, {TYPE jt}, jt) + -- Tagtype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, jt) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Globalinst_ok: `%|-%:%`(store, globalinst, globaltype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `mut?` : mut?, t : valtype, val : val}: + `%|-%:%`(s, {TYPE `%%`_globaltype(mut?{mut <- `mut?`}, t), VALUE val}, `%%`_globaltype(mut?{mut <- `mut?`}, t)) + -- Globaltype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, `%%`_globaltype(mut?{mut <- `mut?`}, t)) + -- Val_ok: `%|-%:%`(s, val, t) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Meminst_ok: `%|-%:%`(store, meminst, memtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, at : addrtype, n : n, m : m, `b*` : byte*}: + `%|-%:%`(s, {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m)))), BYTES b*{b <- `b*`}}, `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))))) + -- Memtype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))))) + -- if (|b*{b <- `b*`}| = (n * (64 * $Ki))) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Tableinst_ok: `%|-%:%`(store, tableinst, tabletype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, at : addrtype, n : n, m : m, rt : reftype, `ref*` : ref*}: + `%|-%:%`(s, {TYPE `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt), REFS ref*{ref <- `ref*`}}, `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt)) + -- Tabletype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt)) + -- if (|ref*{ref <- `ref*`}| = n) + -- (Ref_ok: `%|-%:%`(s, ref, rt))*{ref <- `ref*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Funcinst_ok: `%|-%:%`(store, funcinst, deftype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, dt : deftype, moduleinst : moduleinst, func : func, C : context, dt' : deftype}: + `%|-%:%`(s, {TYPE dt, MODULE moduleinst, CODE (func : func <: funccode)}, dt) + -- Deftype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, dt) + -- Moduleinst_ok: `%|-%:%`(s, moduleinst, C) + -- Func_ok: `%|-%:%`(C, func, dt') + -- Deftype_sub: `%|-%<:%`(C, dt', dt) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Structinst_ok: `%|-%:OK`(store, structinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, dt : deftype, `fv*` : fieldval*, `mut?*` : mut?*, `zt*` : storagetype*}: + `%|-%:OK`(s, {TYPE dt, FIELDS fv*{fv <- `fv*`}}) + -- Expand: `%~~%`(dt, STRUCT_comptype(`%`_list(`%%`_fieldtype(mut?{mut <- `mut?`}, zt)*{`mut?` <- `mut?*`, zt <- `zt*`}))) + -- (Fieldval_ok: `%|-%:%`(s, fv, zt))*{fv <- `fv*`, zt <- `zt*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Arrayinst_ok: `%|-%:OK`(store, arrayinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, dt : deftype, `fv*` : fieldval*, `mut?` : mut?, zt : storagetype}: + `%|-%:OK`(s, {TYPE dt, FIELDS fv*{fv <- `fv*`}}) + -- Expand: `%~~%`(dt, ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) + -- (Fieldval_ok: `%|-%:%`(s, fv, zt))*{fv <- `fv*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Exninst_ok: `%|-%:OK`(store, exninst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, ta : tagaddr, `val*` : val*, dt : deftype, `t*` : valtype*}: + `%|-%:OK`(s, {TAG ta, FIELDS val*{val <- `val*`}}) + -- if ((dt : deftype <: typeuse) = s.TAGS_store[ta].TYPE_taginst) + -- Expand: `%~~%`(dt, `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- (Val_ok: `%|-%:%`(s, val, t))*{t <- `t*`, val <- `val*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +rec { + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:205.1-205.50 +relation ImmReachable: `%>>_%%`(fieldval, store, fieldval) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:217.1-220.33 + rule trans{fv_1 : fieldval, s : store, fv_2 : fieldval, fv' : fieldval}: + `%>>_%%`(fv_1, s, fv_2) + -- ImmReachable: `%>>_%%`(fv_1, s, fv') + -- ImmReachable: `%>>_%%`(fv', s, fv_2) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:222.1-225.20 + rule `ref.struct`{a : addr, s : store, i : nat, `ft*` : fieldtype*, zt : storagetype}: + `%>>_%%`(`REF.STRUCT_ADDR`_fieldval(a), s, s.STRUCTS_store[a].FIELDS_structinst[i]) + -- Expand: `%~~%`(s.STRUCTS_store[a].TYPE_structinst, STRUCT_comptype(`%`_list(ft*{ft <- `ft*`}))) + -- if (ft*{ft <- `ft*`}[i] = `%%`_fieldtype(?(), zt)) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:227.1-229.42 + rule `ref.array`{a : addr, s : store, i : nat, zt : storagetype}: + `%>>_%%`(`REF.ARRAY_ADDR`_fieldval(a), s, s.ARRAYS_store[a].FIELDS_arrayinst[i]) + -- Expand: `%~~%`(s.ARRAYS_store[a].TYPE_arrayinst, ARRAY_comptype(`%%`_fieldtype(?(), zt))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:231.1-232.44 + rule `ref.exn`{a : addr, s : store, i : nat}: + `%>>_%%`(`REF.EXN_ADDR`_fieldval(a), s, (s.EXNS_store[a].FIELDS_exninst[i] : val <: fieldval)) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:234.1-235.28 + rule `ref.extern`{ref : ref, s : store}: + `%>>_%%`(`REF.EXTERN`_fieldval(ref), s, (ref : ref <: fieldval)) +} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +def $NotImmReachable(fieldval : fieldval, store : store, fieldval : fieldval) : bool + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + def $NotImmReachable{fv_1 : fieldval, s : store, fv_2 : fieldval}(fv_1, s, fv_2) = false + -- ImmReachable: `%>>_%%`(fv_1, s, fv_2) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + def $NotImmReachable{fv_1 : fieldval, s : store, fv_2 : fieldval}(fv_1, s, fv_2) = true + -- otherwise + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation NotImmReachable: `~%>>_%%`(fieldval, store, fieldval) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{fv_1 : fieldval, s : store, fv_2 : fieldval}: + `~%>>_%%`(fv_1, s, fv_2) + -- if $NotImmReachable(fv_1, s, fv_2) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Store_ok: `|-%:OK`(store) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `taginst*` : taginst*, `tagtype*` : tagtype*, `globalinst*` : globalinst*, `globaltype*` : globaltype*, `meminst*` : meminst*, `memtype*` : memtype*, `tableinst*` : tableinst*, `tabletype*` : tabletype*, `deftype*` : deftype*, `funcinst*` : funcinst*, `datainst*` : datainst*, `datatype*` : datatype*, `eleminst*` : eleminst*, `elemtype*` : elemtype*, `structinst*` : structinst*, `arrayinst*` : arrayinst*, `exninst*` : exninst*}: + `|-%:OK`(s) + -- (Taginst_ok: `%|-%:%`(s, taginst, tagtype))*{taginst <- `taginst*`, tagtype <- `tagtype*`} + -- (Globalinst_ok: `%|-%:%`(s, globalinst, globaltype))*{globalinst <- `globalinst*`, globaltype <- `globaltype*`} + -- (Meminst_ok: `%|-%:%`(s, meminst, memtype))*{meminst <- `meminst*`, memtype <- `memtype*`} + -- (Tableinst_ok: `%|-%:%`(s, tableinst, tabletype))*{tableinst <- `tableinst*`, tabletype <- `tabletype*`} + -- (Funcinst_ok: `%|-%:%`(s, funcinst, deftype))*{deftype <- `deftype*`, funcinst <- `funcinst*`} + -- (Datainst_ok: `%|-%:%`(s, datainst, datatype))*{datainst <- `datainst*`, datatype <- `datatype*`} + -- (Eleminst_ok: `%|-%:%`(s, eleminst, elemtype))*{eleminst <- `eleminst*`, elemtype <- `elemtype*`} + -- (Structinst_ok: `%|-%:OK`(s, structinst))*{structinst <- `structinst*`} + -- (Arrayinst_ok: `%|-%:OK`(s, arrayinst))*{arrayinst <- `arrayinst*`} + -- (Exninst_ok: `%|-%:OK`(s, exninst))*{exninst <- `exninst*`} + -- (NotImmReachable: `~%>>_%%`(`REF.STRUCT_ADDR`_fieldval(a), s, `REF.STRUCT_ADDR`_fieldval(a)))^(a<|structinst*{structinst <- `structinst*`}|){} + -- (NotImmReachable: `~%>>_%%`(`REF.ARRAY_ADDR`_fieldval(a), s, `REF.ARRAY_ADDR`_fieldval(a)))^(a<|arrayinst*{arrayinst <- `arrayinst*`}|){} + -- (NotImmReachable: `~%>>_%%`(`REF.EXN_ADDR`_fieldval(a), s, `REF.EXN_ADDR`_fieldval(a)))^(a<|exninst*{exninst <- `exninst*`}|){} + -- if (s = {TAGS taginst*{taginst <- `taginst*`}, GLOBALS globalinst*{globalinst <- `globalinst*`}, MEMS meminst*{meminst <- `meminst*`}, TABLES tableinst*{tableinst <- `tableinst*`}, FUNCS funcinst*{funcinst <- `funcinst*`}, DATAS datainst*{datainst <- `datainst*`}, ELEMS eleminst*{eleminst <- `eleminst*`}, STRUCTS structinst*{structinst <- `structinst*`}, ARRAYS arrayinst*{arrayinst <- `arrayinst*`}, EXNS exninst*{exninst <- `exninst*`}}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_taginst: `%<=%`(taginst, taginst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{jt : tagtype}: + `%<=%`({TYPE jt}, {TYPE jt}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_globalinst: `%<=%`(globalinst, globalinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{`mut?` : mut?, t : valtype, val : val, val' : val}: + `%<=%`({TYPE `%%`_globaltype(mut?{mut <- `mut?`}, t), VALUE val}, {TYPE `%%`_globaltype(mut?{mut <- `mut?`}, t), VALUE val'}) + -- if ((mut?{mut <- `mut?`} = ?(MUT_mut)) \/ (val = val')) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_meminst: `%<=%`(meminst, meminst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{at : addrtype, n : n, m : m, `b*` : byte*, n' : n, `b'*` : byte*}: + `%<=%`({TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m)))), BYTES b*{b <- `b*`}}, {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n'), ?(`%`_u64(m)))), BYTES b'*{b' <- `b'*`}}) + -- if (n <= n') + -- if (|b*{b <- `b*`}| <= |b'*{b' <- `b'*`}|) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_tableinst: `%<=%`(tableinst, tableinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{at : addrtype, n : n, m : m, rt : reftype, `ref*` : ref*, n' : n, `ref'*` : ref*}: + `%<=%`({TYPE `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt), REFS ref*{ref <- `ref*`}}, {TYPE `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n'), ?(`%`_u64(m))), rt), REFS ref'*{ref' <- `ref'*`}}) + -- if (n <= n') + -- if (|ref*{ref <- `ref*`}| <= |ref'*{ref' <- `ref'*`}|) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_funcinst: `%<=%`(funcinst, funcinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{dt : deftype, mm : moduleinst, fc : funccode}: + `%<=%`({TYPE dt, MODULE mm, CODE fc}, {TYPE dt, MODULE mm, CODE fc}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_datainst: `%<=%`(datainst, datainst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{`b*` : byte*, `b'*` : byte*}: + `%<=%`({BYTES b*{b <- `b*`}}, {BYTES b'*{b' <- `b'*`}}) + -- if ((b*{b <- `b*`} = b'*{b' <- `b'*`}) \/ (b'*{b' <- `b'*`} = [])) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_eleminst: `%<=%`(eleminst, eleminst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{rt : reftype, `ref*` : ref*, `ref'*` : ref*}: + `%<=%`({TYPE rt, REFS ref*{ref <- `ref*`}}, {TYPE rt, REFS ref'*{ref' <- `ref'*`}}) + -- if ((ref*{ref <- `ref*`} = ref'*{ref' <- `ref'*`}) \/ (ref'*{ref' <- `ref'*`} = [])) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_structinst: `%<=%`(structinst, structinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{dt : deftype, `fv*` : fieldval*, `fv'*` : fieldval*, `mut?*` : mut?*, `zt*` : storagetype*}: + `%<=%`({TYPE dt, FIELDS fv*{fv <- `fv*`}}, {TYPE dt, FIELDS fv'*{fv' <- `fv'*`}}) + -- Expand: `%~~%`(dt, STRUCT_comptype(`%`_list(`%%`_fieldtype(mut?{mut <- `mut?`}, zt)*{`mut?` <- `mut?*`, zt <- `zt*`}))) + -- (if ((mut?{mut <- `mut?`} = ?(MUT_mut)) \/ (fv = fv')))*{fv <- `fv*`, fv' <- `fv'*`, `mut?` <- `mut?*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_arrayinst: `%<=%`(arrayinst, arrayinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{dt : deftype, `fv*` : fieldval*, `fv'*` : fieldval*, `mut?` : mut?, zt : storagetype}: + `%<=%`({TYPE dt, FIELDS fv*{fv <- `fv*`}}, {TYPE dt, FIELDS fv'*{fv' <- `fv'*`}}) + -- Expand: `%~~%`(dt, ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) + -- (if ((mut?{mut <- `mut?`} = ?(MUT_mut)) \/ (fv = fv')))*{fv <- `fv*`, fv' <- `fv'*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_exninst: `%<=%`(exninst, exninst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{ta : tagaddr, `val*` : val*}: + `%<=%`({TAG ta, FIELDS val*{val <- `val*`}}, {TAG ta, FIELDS val*{val <- `val*`}}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_store: `%<=%`(store, store) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, s' : store}: + `%<=%`(s, s') + -- (Extend_taginst: `%<=%`(s.TAGS_store[a], s'.TAGS_store[a]))^(a<|s.TAGS_store|){} + -- (Extend_globalinst: `%<=%`(s.GLOBALS_store[a], s'.GLOBALS_store[a]))^(a<|s.GLOBALS_store|){} + -- (Extend_meminst: `%<=%`(s.MEMS_store[a], s'.MEMS_store[a]))^(a<|s.MEMS_store|){} + -- (Extend_tableinst: `%<=%`(s.TABLES_store[a], s'.TABLES_store[a]))^(a<|s.TABLES_store|){} + -- (Extend_funcinst: `%<=%`(s.FUNCS_store[a], s'.FUNCS_store[a]))^(a<|s.FUNCS_store|){} + -- (Extend_datainst: `%<=%`(s.DATAS_store[a], s'.DATAS_store[a]))^(a<|s.DATAS_store|){} + -- (Extend_eleminst: `%<=%`(s.ELEMS_store[a], s'.ELEMS_store[a]))^(a<|s.ELEMS_store|){} + -- (Extend_structinst: `%<=%`(s.STRUCTS_store[a], s'.STRUCTS_store[a]))^(a<|s.STRUCTS_store|){} + -- (Extend_arrayinst: `%<=%`(s.ARRAYS_store[a], s'.ARRAYS_store[a]))^(a<|s.ARRAYS_store|){} + -- (Extend_exninst: `%<=%`(s.EXNS_store[a], s'.EXNS_store[a]))^(a<|s.EXNS_store|){} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation State_ok: `|-%:%`(state, context) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, f : frame, C : context}: + `|-%:%`(`%;%`_state(s, f), C) + -- Store_ok: `|-%:OK`(s) + -- Frame_ok: `%|-%:%`(s, f, C) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Config_ok: `|-%:OK`(config) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{z : state, `instr*` : instr*, C : context, `t*` : valtype*}: + `|-%:OK`(`%;%`_config(z, instr*{instr <- `instr*`})) + -- State_ok: `|-%:%`(z, C) + -- Expr_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, `%`_resulttype(t*{t <- `t*`})) + ;; ../../../../specification/wasm-latest/X.1-notation.syntax.spectec syntax A = nat @@ -25632,100 +26408,104 @@ relation Heaptype_ok: `%|-%:OK`(context, heaptype) `%|-%:OK`(C, (typeuse : typeuse <: heaptype)) -- Typeuse_ok: `%|-%:OK`(C, typeuse) + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:27.1-28.16 + rule bot{C : context}: + `%|-%:OK`(C, BOT_heaptype) + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:10.1-10.91 relation Reftype_ok: `%|-%:OK`(context, reftype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:27.1-29.37 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:30.1-32.37 rule _{C : context, heaptype : heaptype}: `%|-%:OK`(C, REF_reftype(NULL_null?{}, heaptype)) -- Heaptype_ok: `%|-%:OK`(C, heaptype) ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:11.1-11.91 relation Valtype_ok: `%|-%:OK`(context, valtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:31.1-33.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:34.1-36.35 rule num{C : context, numtype : numtype}: `%|-%:OK`(C, (numtype : numtype <: valtype)) -- Numtype_ok: `%|-%:OK`(C, numtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:35.1-37.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:38.1-40.35 rule vec{C : context, vectype : vectype}: `%|-%:OK`(C, (vectype : vectype <: valtype)) -- Vectype_ok: `%|-%:OK`(C, vectype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:39.1-41.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:42.1-44.35 rule ref{C : context, reftype : reftype}: `%|-%:OK`(C, (reftype : reftype <: valtype)) -- Reftype_ok: `%|-%:OK`(C, reftype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:43.1-44.16 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:46.1-47.16 rule bot{C : context}: `%|-%:OK`(C, BOT_valtype) ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:12.1-12.94 relation Typeuse_ok: `%|-%:OK`(context, typeuse) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:99.1-101.30 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:102.1-104.30 rule typeidx{C : context, typeidx : typeidx, dt : deftype}: `%|-%:OK`(C, _IDX_typeuse(typeidx)) -- if (typeidx!`%`_typeidx.0 < |C.TYPES_context|) -- if (C.TYPES_context[typeidx!`%`_typeidx.0] = dt) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:103.1-105.23 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:106.1-108.23 rule rec{C : context, i : n, st : subtype}: `%|-%:OK`(C, REC_typeuse(i)) -- if (i < |C.RECS_context|) -- if (C.RECS_context[i] = st) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:107.1-109.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:110.1-112.35 rule deftype{C : context, deftype : deftype}: `%|-%:OK`(C, (deftype : deftype <: typeuse)) -- Deftype_ok: `%|-%:OK`(C, deftype) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:49.1-49.100 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:52.1-52.100 relation Resulttype_ok: `%|-%:OK`(context, resulttype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:52.1-54.32 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:55.1-57.32 rule _{C : context, `t*` : valtype*}: `%|-%:OK`(C, `%`_resulttype(t*{t <- `t*`})) -- (Valtype_ok: `%|-%:OK`(C, t))*{t <- `t*`} -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:85.1-85.104 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:88.1-88.104 relation Fieldtype_ok: `%|-%:OK`(context, fieldtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:123.1-125.43 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:126.1-128.43 rule _{C : context, storagetype : storagetype}: `%|-%:OK`(C, `%%`_fieldtype(MUT_mut?{}, storagetype)) -- Storagetype_ok: `%|-%:OK`(C, storagetype) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:86.1-86.106 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:89.1-89.106 relation Storagetype_ok: `%|-%:OK`(context, storagetype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:115.1-117.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:118.1-120.35 rule val{C : context, valtype : valtype}: `%|-%:OK`(C, (valtype : valtype <: storagetype)) -- Valtype_ok: `%|-%:OK`(C, valtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:119.1-121.37 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:122.1-124.37 rule pack{C : context, packtype : packtype}: `%|-%:OK`(C, (packtype : packtype <: storagetype)) -- Packtype_ok: `%|-%:OK`(C, packtype) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:87.1-87.103 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:90.1-90.103 relation Comptype_ok: `%|-%:OK`(context, comptype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:128.1-130.42 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:131.1-133.42 rule struct{C : context, `fieldtype*` : fieldtype*}: `%|-%:OK`(C, STRUCT_comptype(`%`_list(fieldtype*{fieldtype <- `fieldtype*`}))) -- (Fieldtype_ok: `%|-%:OK`(C, fieldtype))*{fieldtype <- `fieldtype*`} - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:132.1-134.39 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:135.1-137.39 rule array{C : context, fieldtype : fieldtype}: `%|-%:OK`(C, ARRAY_comptype(fieldtype)) -- Fieldtype_ok: `%|-%:OK`(C, fieldtype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:136.1-139.35 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:139.1-142.35 rule func{C : context, `t_1*` : valtype*, `t_2*` : valtype*}: `%|-%:OK`(C, `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t_1*{t_1 <- `t_1*`})) -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t_2*{t_2 <- `t_2*`})) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:88.1-88.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:91.1-91.126 relation Subtype_ok: `%|-%:%`(context, subtype, oktypeidx) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:142.1-149.49 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:145.1-152.49 rule _{C : context, `x*` : idx*, comptype : comptype, x_0 : idx, `comptype'*` : comptype*, `x'**` : idx**}: `%|-%:%`(C, SUB_subtype(FINAL_final?{}, _IDX_typeuse(x)*{x <- `x*`}, comptype), OK_oktypeidx(x_0)) -- if (|x*{x <- `x*`}| <= 1) @@ -25737,26 +26517,26 @@ relation Subtype_ok: `%|-%:%`(context, subtype, oktypeidx) -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:89.1-89.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:92.1-92.126 relation Rectype_ok: `%|-%:%`(context, rectype, oktypeidx) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:171.1-172.23 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:174.1-175.23 rule empty{C : context, x : idx}: `%|-%:%`(C, REC_rectype(`%`_list([])), OK_oktypeidx(x)) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:174.1-177.48 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:177.1-180.48 rule cons{C : context, subtype_1 : subtype, `subtype*` : subtype*, x : idx}: `%|-%:%`(C, REC_rectype(`%`_list([subtype_1] ++ subtype*{subtype <- `subtype*`})), OK_oktypeidx(x)) -- Subtype_ok: `%|-%:%`(C, subtype_1, OK_oktypeidx(x)) -- Rectype_ok: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidx(`%`_typeidx((x!`%`_idx.0 + 1)))) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:179.1-181.60 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:182.1-184.60 rule _rec2{C : context, `subtype*` : subtype*, x : idx}: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidx(x)) -- Rectype_ok2: `%|-%:%`({TYPES [], RECS subtype*{subtype <- `subtype*`}, TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []} +++ C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(x, 0)) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:90.1-90.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:93.1-93.126 relation Subtype_ok2: `%|-%:%`(context, subtype, oktypeidxnat) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:161.1-168.49 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:164.1-171.49 rule _{C : context, `typeuse*` : typeuse*, compttype : comptype, x : idx, i : nat, `comptype'*` : comptype*, `typeuse'**` : typeuse**, comptype : comptype}: `%|-%:%`(C, SUB_subtype(FINAL_final?{}, typeuse*{typeuse <- `typeuse*`}, compttype), OK_oktypeidxnat(x, i)) -- if (|typeuse*{typeuse <- `typeuse*`}| <= 1) @@ -25767,28 +26547,28 @@ relation Subtype_ok2: `%|-%:%`(context, subtype, oktypeidxnat) -- Comptype_ok: `%|-%:OK`(C, comptype) -- (Comptype_sub: `%|-%<:%`(C, comptype, comptype'))*{comptype' <- `comptype'*`} -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:91.1-91.126 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:94.1-94.126 relation Rectype_ok2: `%|-%:%`(context, rectype, oktypeidxnat) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:183.1-184.24 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:186.1-187.24 rule empty{C : context, x : idx, i : nat}: `%|-%:%`(C, REC_rectype(`%`_list([])), OK_oktypeidxnat(x, i)) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:186.1-189.55 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:189.1-192.55 rule cons{C : context, subtype_1 : subtype, `subtype*` : subtype*, x : idx, i : nat}: `%|-%:%`(C, REC_rectype(`%`_list([subtype_1] ++ subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(x, i)) -- Subtype_ok2: `%|-%:%`(C, subtype_1, OK_oktypeidxnat(x, i)) -- Rectype_ok2: `%|-%:%`(C, REC_rectype(`%`_list(subtype*{subtype <- `subtype*`})), OK_oktypeidxnat(`%`_typeidx((x!`%`_idx.0 + 1)), (i + 1))) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:92.1-92.102 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:95.1-95.102 relation Deftype_ok: `%|-%:OK`(context, deftype) - ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:192.1-196.14 + ;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:195.1-199.14 rule _{C : context, rectype : rectype, i : n, x : idx, n : n, `subtype*` : subtype*}: `%|-%:OK`(C, _DEF_deftype(rectype, i)) -- Rectype_ok: `%|-%:%`(C, rectype, OK_oktypeidx(x)) -- if (rectype = REC_rectype(`%`_list(subtype^n{subtype <- `subtype*`}))) -- if (i < n) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:95.1-95.108 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:98.1-98.108 relation Comptype_sub: `%|-%<:%`(context, comptype, comptype) ;; ../../../../specification/wasm-latest/2.2-validation.subtyping.spectec:169.1-171.41 rule struct{C : context, `ft_1*` : fieldtype*, `ft'_1*` : fieldtype*, `ft_2*` : fieldtype*}: @@ -25807,7 +26587,7 @@ relation Comptype_sub: `%|-%<:%`(context, comptype, comptype) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t_21*{t_21 <- `t_21*`}), `%`_resulttype(t_11*{t_11 <- `t_11*`})) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t_12*{t_12 <- `t_12*`}), `%`_resulttype(t_22*{t_22 <- `t_22*`})) -;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:96.1-96.107 +;; ../../../../specification/wasm-latest/2.1-validation.types.spectec:99.1-99.107 relation Deftype_sub: `%|-%<:%`(context, deftype, deftype) ;; ../../../../specification/wasm-latest/2.2-validation.subtyping.spectec:183.1-185.66 rule refl{C : context, deftype_1 : deftype, deftype_2 : deftype}: @@ -28885,42 +29665,60 @@ relation Val_ok: `%|-%:%`(store, val, valtype) `%|-%:%`(s, (ref : ref <: val), (rt : reftype <: valtype)) -- Ref_ok: `%|-%:%`(s, ref, rt) +;; ../../../../specification/wasm-latest/4.1-execution.values.spectec +relation Packval_ok: `%|-%:%`(store, packval, packtype) + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec + rule _{s : store, pt : packtype, c : iN($psizenn(pt))}: + `%|-%:%`(s, PACK_packval(pt, c), pt) + +;; ../../../../specification/wasm-latest/4.1-execution.values.spectec +relation Fieldval_ok: `%|-%:%`(store, fieldval, storagetype) + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec + rule val{s : store, val : val, t : valtype}: + `%|-%:%`(s, (val : val <: fieldval), (t : valtype <: storagetype)) + -- Val_ok: `%|-%:%`(s, val, t) + + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec + rule packval{s : store, packval : packval, pt : packtype}: + `%|-%:%`(s, (packval : packval <: fieldval), (pt : packtype <: storagetype)) + -- Packval_ok: `%|-%:%`(s, packval, pt) + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec rec { -;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:86.1-86.84 +;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:103.1-103.84 relation Externaddr_ok: `%|-%:%`(store, externaddr, externtype) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:88.1-90.28 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:105.1-107.28 rule tag{s : store, a : addr, taginst : taginst}: `%|-%:%`(s, TAG_externaddr(a), TAG_externtype(taginst.TYPE_taginst)) -- if (a < |s.TAGS_store|) -- if (s.TAGS_store[a] = taginst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:92.1-94.34 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:109.1-111.34 rule global{s : store, a : addr, globalinst : globalinst}: `%|-%:%`(s, GLOBAL_externaddr(a), GLOBAL_externtype(globalinst.TYPE_globalinst)) -- if (a < |s.GLOBALS_store|) -- if (s.GLOBALS_store[a] = globalinst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:96.1-98.28 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:113.1-115.28 rule mem{s : store, a : addr, meminst : meminst}: `%|-%:%`(s, MEM_externaddr(a), MEM_externtype(meminst.TYPE_meminst)) -- if (a < |s.MEMS_store|) -- if (s.MEMS_store[a] = meminst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:100.1-102.32 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:117.1-119.32 rule table{s : store, a : addr, tableinst : tableinst}: `%|-%:%`(s, TABLE_externaddr(a), TABLE_externtype(tableinst.TYPE_tableinst)) -- if (a < |s.TABLES_store|) -- if (s.TABLES_store[a] = tableinst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:104.1-106.30 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:121.1-123.30 rule func{s : store, a : addr, funcinst : funcinst}: `%|-%:%`(s, FUNC_externaddr(a), FUNC_externtype((funcinst.TYPE_funcinst : deftype <: typeuse))) -- if (a < |s.FUNCS_store|) -- if (s.FUNCS_store[a] = funcinst) - ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:108.1-111.37 + ;; ../../../../specification/wasm-latest/4.1-execution.values.spectec:125.1-128.37 rule sub{s : store, externaddr : externaddr, xt : externtype, xt' : externtype}: `%|-%:%`(s, externaddr, xt) -- Externaddr_ok: `%|-%:%`(s, externaddr, xt') @@ -30654,6 +31452,426 @@ def $ordered(decl*) : bool ;; ../../../../specification/wasm-latest/6.4-text.modules.spectec def $ordered{`decl_1*` : decl*, import : import, `decl_2*` : decl*}(decl_1*{decl_1 <- `decl_1*`} ++ [(import : import <: decl)] ++ decl_2*{decl_2 <- `decl_2*`}) = (((((($importsd(decl_1*{decl_1 <- `decl_1*`}) = []) /\ ($tagsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($globalsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($memsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($tablesd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($funcsd(decl_1*{decl_1 <- `decl_1*`}) = [])) +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Localval_ok: `%|-%:%`(store, val?, localtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule set{s : store, val : val, t : valtype}: + `%|-%:%`(s, ?(val), `%%`_localtype(SET_init, t)) + -- Val_ok: `%|-%:%`(s, val, t) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule unset{s : store}: + `%|-%:%`(s, ?(), `%%`_localtype(UNSET_init, BOT_valtype)) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Datainst_ok: `%|-%:%`(store, datainst, datatype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `b*` : byte*}: + `%|-%:%`(s, {BYTES b*{b <- `b*`}}, OK_datatype) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Eleminst_ok: `%|-%:%`(store, eleminst, elemtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, rt : reftype, `ref*` : ref*}: + `%|-%:%`(s, {TYPE rt, REFS ref*{ref <- `ref*`}}, rt) + -- Reftype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, rt) + -- (Ref_ok: `%|-%:%`(s, ref, rt))*{ref <- `ref*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Exportinst_ok: `%|-%:OK`(store, exportinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, nm : name, xa : externaddr, xt : externtype}: + `%|-%:OK`(s, {NAME nm, ADDR xa}) + -- Externaddr_ok: `%|-%:%`(s, xa, xt) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Moduleinst_ok: `%|-%:%`(store, moduleinst, context) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `deftype*` : deftype*, `tagaddr*` : tagaddr*, `globaladdr*` : globaladdr*, `memaddr*` : memaddr*, `tableaddr*` : tableaddr*, `funcaddr*` : funcaddr*, `dataaddr*` : dataaddr*, `elemaddr*` : elemaddr*, `exportinst*` : exportinst*, `subtype*` : subtype*, `tagtype*` : tagtype*, `globaltype*` : globaltype*, `memtype*` : memtype*, `tabletype*` : tabletype*, `deftype_F*` : deftype*, `datatype*` : datatype*, `elemtype*` : elemtype*}: + `%|-%:%`(s, {TYPES deftype*{deftype <- `deftype*`}, TAGS tagaddr*{tagaddr <- `tagaddr*`}, GLOBALS globaladdr*{globaladdr <- `globaladdr*`}, MEMS memaddr*{memaddr <- `memaddr*`}, TABLES tableaddr*{tableaddr <- `tableaddr*`}, FUNCS funcaddr*{funcaddr <- `funcaddr*`}, DATAS dataaddr*{dataaddr <- `dataaddr*`}, ELEMS elemaddr*{elemaddr <- `elemaddr*`}, EXPORTS exportinst*{exportinst <- `exportinst*`}}, {TYPES deftype*{deftype <- `deftype*`}, RECS subtype*{subtype <- `subtype*`}, TAGS tagtype*{tagtype <- `tagtype*`}, GLOBALS globaltype*{globaltype <- `globaltype*`}, MEMS memtype*{memtype <- `memtype*`}, TABLES tabletype*{tabletype <- `tabletype*`}, FUNCS deftype_F*{deftype_F <- `deftype_F*`}, DATAS datatype*{datatype <- `datatype*`}, ELEMS elemtype*{elemtype <- `elemtype*`}, LOCALS [], LABELS [], RETURN ?(), REFS `%`_funcidx(i)^(i<|funcaddr*{funcaddr <- `funcaddr*`}|){}}) + -- (Deftype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, deftype))*{deftype <- `deftype*`} + -- if (|`tagaddr*`| = |`tagtype*`|) + -- (Externaddr_ok: `%|-%:%`(s, TAG_externaddr(tagaddr), TAG_externtype(tagtype)))*{tagaddr <- `tagaddr*`, tagtype <- `tagtype*`} + -- if (|`globaladdr*`| = |`globaltype*`|) + -- (Externaddr_ok: `%|-%:%`(s, GLOBAL_externaddr(globaladdr), GLOBAL_externtype(globaltype)))*{globaladdr <- `globaladdr*`, globaltype <- `globaltype*`} + -- if (|`deftype_F*`| = |`funcaddr*`|) + -- (Externaddr_ok: `%|-%:%`(s, FUNC_externaddr(funcaddr), FUNC_externtype((deftype_F : deftype <: typeuse))))*{deftype_F <- `deftype_F*`, funcaddr <- `funcaddr*`} + -- if (|`memaddr*`| = |`memtype*`|) + -- (Externaddr_ok: `%|-%:%`(s, MEM_externaddr(memaddr), MEM_externtype(memtype)))*{memaddr <- `memaddr*`, memtype <- `memtype*`} + -- if (|`tableaddr*`| = |`tabletype*`|) + -- (Externaddr_ok: `%|-%:%`(s, TABLE_externaddr(tableaddr), TABLE_externtype(tabletype)))*{tableaddr <- `tableaddr*`, tabletype <- `tabletype*`} + -- if (|`dataaddr*`| = |`datatype*`|) + -- (if (dataaddr < |s.DATAS_store|))*{dataaddr <- `dataaddr*`} + -- (Datainst_ok: `%|-%:%`(s, s.DATAS_store[dataaddr], datatype))*{dataaddr <- `dataaddr*`, datatype <- `datatype*`} + -- if (|`elemaddr*`| = |`elemtype*`|) + -- (if (elemaddr < |s.ELEMS_store|))*{elemaddr <- `elemaddr*`} + -- (Eleminst_ok: `%|-%:%`(s, s.ELEMS_store[elemaddr], elemtype))*{elemaddr <- `elemaddr*`, elemtype <- `elemtype*`} + -- (Exportinst_ok: `%|-%:OK`(s, exportinst))*{exportinst <- `exportinst*`} + -- if $disjoint_(syntax name, exportinst.NAME_exportinst*{exportinst <- `exportinst*`}) + -- if (|TAG_externaddr(tagaddr)*{tagaddr <- `tagaddr*`} ++ GLOBAL_externaddr(globaladdr)*{globaladdr <- `globaladdr*`} ++ MEM_externaddr(memaddr)*{memaddr <- `memaddr*`} ++ TABLE_externaddr(tableaddr)*{tableaddr <- `tableaddr*`} ++ FUNC_externaddr(funcaddr)*{funcaddr <- `funcaddr*`}| > 0) + -- (if (exportinst.ADDR_exportinst <- TAG_externaddr(tagaddr)*{tagaddr <- `tagaddr*`} ++ GLOBAL_externaddr(globaladdr)*{globaladdr <- `globaladdr*`} ++ MEM_externaddr(memaddr)*{memaddr <- `memaddr*`} ++ TABLE_externaddr(tableaddr)*{tableaddr <- `tableaddr*`} ++ FUNC_externaddr(funcaddr)*{funcaddr <- `funcaddr*`}))*{exportinst <- `exportinst*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Frame_ok: `%|-%:%`(store, frame, context) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `val?*` : val?*, moduleinst : moduleinst, C : context, `lct*` : localtype*}: + `%|-%:%`(s, {LOCALS val?{val <- `val?`}*{`val?` <- `val?*`}, MODULE moduleinst}, C +++ {TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS lct*{lct <- `lct*`}, LABELS [], RETURN ?(), REFS []}) + -- Moduleinst_ok: `%|-%:%`(s, moduleinst, C) + -- if (|`lct*`| = |`val?*`|) + -- (Localval_ok: `%|-%:%`(s, val?{val <- `val?`}, lct))*{lct <- `lct*`, `val?` <- `val?*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +rec { + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:3.1-3.56 +relation Instr_ok2: `%;%|-%:%`(store, context, instr, instrtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:7.1-9.46 + rule plain{s : store, C : context, instr : instr, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*}: + `%;%|-%:%`(s, C, instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- Instr_ok: `%|-%:%`(C, instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:11.1-13.27 + rule ref{s : store, C : context, ref : ref, rt : reftype}: + `%;%|-%:%`(s, C, (ref : ref <: instr), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(rt : reftype <: valtype)]))) + -- Ref_ok: `%|-%:%`(s, ref, rt) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:15.1-18.68 + rule label{s : store, C : context, n : n, `instr'*` : instr*, `instr*` : instr*, `t*` : valtype*, `t'*` : valtype*, `x'*` : idx*, `x*` : idx*}: + `%;%|-%:%`(s, C, `LABEL_%{%}%`_instr(n, instr'*{instr' <- `instr'*`}, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(t*{t <- `t*`}))) + -- Instrs_ok2: `%;%|-%:%`(s, C, instr'*{instr' <- `instr'*`}, `%->_%%`_instrtype(`%`_resulttype(t'^n{t' <- `t'*`}), x'*{x' <- `x'*`}, `%`_resulttype(t*{t <- `t*`}))) + -- Instrs_ok2: `%;%|-%:%`(s, {TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [`%`_resulttype(t'^n{t' <- `t'*`})], RETURN ?(), REFS []} +++ C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype([]), x*{x <- `x*`}, `%`_resulttype(t*{t <- `t*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:20.1-23.37 + rule frame{s : store, C : context, n : n, f : frame, `instr*` : instr*, `t*` : valtype*, C' : context}: + `%;%|-%:%`(s, C, `FRAME_%{%}%`_instr(n, f, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(t^n{t <- `t*`}))) + -- Frame_ok: `%|-%:%`(s, f, C') + -- Expr_ok2: `%;%|-%:%`(s, C', instr*{instr <- `instr*`}, `%`_resulttype(t^n{t <- `t*`})) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:25.1-28.52 + rule handler{s : store, C : context, n : n, `catch*` : catch*, `instr*` : instr*, `t_1*` : valtype*, `t_2*` : valtype*, `x*` : idx*}: + `%;%|-%:%`(s, C, `HANDLER_%{%}%`_instr(n, catch*{catch <- `catch*`}, instr*{instr <- `instr*`}), `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- (Catch_ok: `%|-%:OK`(C, catch))*{catch <- `catch*`} + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:30.1-32.42 + rule trap{s : store, C : context, `t_1*` : valtype*, `t_2*` : valtype*}: + `%;%|-%:%`(s, C, TRAP_instr, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:4.1-4.58 +relation Instrs_ok2: `%;%|-%:%`(store, context, instr*, instrtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:35.1-36.27 + rule empty{s : store, C : context}: + `%;%|-%:%`(s, C, [], `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:38.1-42.86 + rule seq{s : store, C : context, instr_1 : instr, `instr_2*` : instr*, `t_1*` : valtype*, `x_1*` : idx*, `x_2*` : idx*, `t_3*` : valtype*, `t_2*` : valtype*, `init*` : init*, `t*` : valtype*}: + `%;%|-%:%`(s, C, [instr_1] ++ instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`} ++ x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) + -- Instr_ok2: `%;%|-%:%`(s, C, instr_1, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- if (|`init*`| = |`t*`|) + -- if (|`init*`| = |`x_1*`|) + -- (if (x_1!`%`_idx.0 < |C.LOCALS_context|))*{x_1 <- `x_1*`} + -- (if (C.LOCALS_context[x_1!`%`_idx.0] = `%%`_localtype(init, t)))*{init <- `init*`, t <- `t*`, x_1 <- `x_1*`} + -- Instrs_ok2: `%;%|-%:%`(s, $with_locals(C, x_1*{x_1 <- `x_1*`}, `%%`_localtype(SET_init, t)*{t <- `t*`}), instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_2*{t_2 <- `t_2*`}), x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:44.1-48.33 + rule sub{s : store, C : context, `instr*` : instr*, it' : instrtype, it : instrtype}: + `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, it') + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, it) + -- Instrtype_sub: `%|-%<:%`(C, it, it') + -- Instrtype_ok: `%|-%:OK`(C, it') + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:51.1-54.33 + rule frame{s : store, C : context, `instr*` : instr*, `t*` : valtype*, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*}: + `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t*{t <- `t*`} ++ t_2*{t_2 <- `t_2*`}))) + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- Resulttype_ok: `%|-%:OK`(C, `%`_resulttype(t*{t <- `t*`})) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:5.1-5.55 +relation Expr_ok2: `%;%|-%:%`(store, context, expr, resulttype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:57.1-59.44 + rule _{s : store, C : context, `instr*` : instr*, `t*` : valtype*}: + `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%`_resulttype(t*{t <- `t*`})) + -- Instrs_ok2: `%;%|-%:%`(s, C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype(t*{t <- `t*`}))) +} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Taginst_ok: `%|-%:%`(store, taginst, tagtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, jt : tagtype}: + `%|-%:%`(s, {TYPE jt}, jt) + -- Tagtype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, jt) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Globalinst_ok: `%|-%:%`(store, globalinst, globaltype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `mut?` : mut?, t : valtype, val : val}: + `%|-%:%`(s, {TYPE `%%`_globaltype(mut?{mut <- `mut?`}, t), VALUE val}, `%%`_globaltype(mut?{mut <- `mut?`}, t)) + -- Globaltype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, `%%`_globaltype(mut?{mut <- `mut?`}, t)) + -- Val_ok: `%|-%:%`(s, val, t) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Meminst_ok: `%|-%:%`(store, meminst, memtype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, at : addrtype, n : n, m : m, `b*` : byte*}: + `%|-%:%`(s, {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m)))), BYTES b*{b <- `b*`}}, `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))))) + -- Memtype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))))) + -- if (|b*{b <- `b*`}| = (n * (64 * $Ki))) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Tableinst_ok: `%|-%:%`(store, tableinst, tabletype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, at : addrtype, n : n, m : m, rt : reftype, `ref*` : ref*}: + `%|-%:%`(s, {TYPE `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt), REFS ref*{ref <- `ref*`}}, `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt)) + -- Tabletype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt)) + -- if (|ref*{ref <- `ref*`}| = n) + -- (Ref_ok: `%|-%:%`(s, ref, rt))*{ref <- `ref*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Funcinst_ok: `%|-%:%`(store, funcinst, deftype) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, dt : deftype, moduleinst : moduleinst, func : func, C : context, dt' : deftype}: + `%|-%:%`(s, {TYPE dt, MODULE moduleinst, CODE (func : func <: funccode)}, dt) + -- Deftype_ok: `%|-%:OK`({TYPES [], RECS [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], RETURN ?(), REFS []}, dt) + -- Moduleinst_ok: `%|-%:%`(s, moduleinst, C) + -- Func_ok: `%|-%:%`(C, func, dt') + -- Deftype_sub: `%|-%<:%`(C, dt', dt) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Structinst_ok: `%|-%:OK`(store, structinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, dt : deftype, `fv*` : fieldval*, `mut?*` : mut?*, `zt*` : storagetype*}: + `%|-%:OK`(s, {TYPE dt, FIELDS fv*{fv <- `fv*`}}) + -- Expand: `%~~%`(dt, STRUCT_comptype(`%`_list(`%%`_fieldtype(mut?{mut <- `mut?`}, zt)*{`mut?` <- `mut?*`, zt <- `zt*`}))) + -- if (|`fv*`| = |`zt*`|) + -- (Fieldval_ok: `%|-%:%`(s, fv, zt))*{fv <- `fv*`, zt <- `zt*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Arrayinst_ok: `%|-%:OK`(store, arrayinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, dt : deftype, `fv*` : fieldval*, `mut?` : mut?, zt : storagetype}: + `%|-%:OK`(s, {TYPE dt, FIELDS fv*{fv <- `fv*`}}) + -- Expand: `%~~%`(dt, ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) + -- (Fieldval_ok: `%|-%:%`(s, fv, zt))*{fv <- `fv*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Exninst_ok: `%|-%:OK`(store, exninst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, ta : tagaddr, `val*` : val*, dt : deftype, `t*` : valtype*}: + `%|-%:OK`(s, {TAG ta, FIELDS val*{val <- `val*`}}) + -- if (ta < |s.TAGS_store|) + -- if ((dt : deftype <: typeuse) = s.TAGS_store[ta].TYPE_taginst) + -- Expand: `%~~%`(dt, `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- if (|`t*`| = |`val*`|) + -- (Val_ok: `%|-%:%`(s, val, t))*{t <- `t*`, val <- `val*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +rec { + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:205.1-205.50 +relation ImmReachable: `%>>_%%`(fieldval, store, fieldval) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:217.1-220.33 + rule trans{fv_1 : fieldval, s : store, fv_2 : fieldval, fv' : fieldval}: + `%>>_%%`(fv_1, s, fv_2) + -- ImmReachable: `%>>_%%`(fv_1, s, fv') + -- ImmReachable: `%>>_%%`(fv', s, fv_2) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:222.1-225.20 + rule `ref.struct`{a : addr, s : store, i : nat, `ft*` : fieldtype*, zt : storagetype}: + `%>>_%%`(`REF.STRUCT_ADDR`_fieldval(a), s, s.STRUCTS_store[a].FIELDS_structinst[i]) + -- if (i < |s.STRUCTS_store[a].FIELDS_structinst|) + -- if (a < |s.STRUCTS_store|) + -- Expand: `%~~%`(s.STRUCTS_store[a].TYPE_structinst, STRUCT_comptype(`%`_list(ft*{ft <- `ft*`}))) + -- if (i < |ft*{ft <- `ft*`}|) + -- if (ft*{ft <- `ft*`}[i] = `%%`_fieldtype(?(), zt)) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:227.1-229.42 + rule `ref.array`{a : addr, s : store, i : nat, zt : storagetype}: + `%>>_%%`(`REF.ARRAY_ADDR`_fieldval(a), s, s.ARRAYS_store[a].FIELDS_arrayinst[i]) + -- if (i < |s.ARRAYS_store[a].FIELDS_arrayinst|) + -- if (a < |s.ARRAYS_store|) + -- Expand: `%~~%`(s.ARRAYS_store[a].TYPE_arrayinst, ARRAY_comptype(`%%`_fieldtype(?(), zt))) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:231.1-232.44 + rule `ref.exn`{a : addr, s : store, i : nat}: + `%>>_%%`(`REF.EXN_ADDR`_fieldval(a), s, (s.EXNS_store[a].FIELDS_exninst[i] : val <: fieldval)) + -- if (i < |s.EXNS_store[a].FIELDS_exninst|) + -- if (a < |s.EXNS_store|) + + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec:234.1-235.28 + rule `ref.extern`{ref : ref, s : store}: + `%>>_%%`(`REF.EXTERN`_fieldval(ref), s, (ref : ref <: fieldval)) +} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +def $NotImmReachable(fieldval : fieldval, store : store, fieldval : fieldval) : bool + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + def $NotImmReachable{fv_1 : fieldval, s : store, fv_2 : fieldval}(fv_1, s, fv_2) = false + -- ImmReachable: `%>>_%%`(fv_1, s, fv_2) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + def $NotImmReachable{fv_1 : fieldval, s : store, fv_2 : fieldval}(fv_1, s, fv_2) = true + -- otherwise + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation NotImmReachable: `~%>>_%%`(fieldval, store, fieldval) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{fv_1 : fieldval, s : store, fv_2 : fieldval}: + `~%>>_%%`(fv_1, s, fv_2) + -- if $NotImmReachable(fv_1, s, fv_2) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Store_ok: `|-%:OK`(store) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, `taginst*` : taginst*, `tagtype*` : tagtype*, `globalinst*` : globalinst*, `globaltype*` : globaltype*, `meminst*` : meminst*, `memtype*` : memtype*, `tableinst*` : tableinst*, `tabletype*` : tabletype*, `deftype*` : deftype*, `funcinst*` : funcinst*, `datainst*` : datainst*, `datatype*` : datatype*, `eleminst*` : eleminst*, `elemtype*` : elemtype*, `structinst*` : structinst*, `arrayinst*` : arrayinst*, `exninst*` : exninst*}: + `|-%:OK`(s) + -- if (|`taginst*`| = |`tagtype*`|) + -- (Taginst_ok: `%|-%:%`(s, taginst, tagtype))*{taginst <- `taginst*`, tagtype <- `tagtype*`} + -- if (|`globalinst*`| = |`globaltype*`|) + -- (Globalinst_ok: `%|-%:%`(s, globalinst, globaltype))*{globalinst <- `globalinst*`, globaltype <- `globaltype*`} + -- if (|`meminst*`| = |`memtype*`|) + -- (Meminst_ok: `%|-%:%`(s, meminst, memtype))*{meminst <- `meminst*`, memtype <- `memtype*`} + -- if (|`tableinst*`| = |`tabletype*`|) + -- (Tableinst_ok: `%|-%:%`(s, tableinst, tabletype))*{tableinst <- `tableinst*`, tabletype <- `tabletype*`} + -- if (|`deftype*`| = |`funcinst*`|) + -- (Funcinst_ok: `%|-%:%`(s, funcinst, deftype))*{deftype <- `deftype*`, funcinst <- `funcinst*`} + -- if (|`datainst*`| = |`datatype*`|) + -- (Datainst_ok: `%|-%:%`(s, datainst, datatype))*{datainst <- `datainst*`, datatype <- `datatype*`} + -- if (|`eleminst*`| = |`elemtype*`|) + -- (Eleminst_ok: `%|-%:%`(s, eleminst, elemtype))*{eleminst <- `eleminst*`, elemtype <- `elemtype*`} + -- (Structinst_ok: `%|-%:OK`(s, structinst))*{structinst <- `structinst*`} + -- (Arrayinst_ok: `%|-%:OK`(s, arrayinst))*{arrayinst <- `arrayinst*`} + -- (Exninst_ok: `%|-%:OK`(s, exninst))*{exninst <- `exninst*`} + -- (NotImmReachable: `~%>>_%%`(`REF.STRUCT_ADDR`_fieldval(a), s, `REF.STRUCT_ADDR`_fieldval(a)))^(a<|structinst*{structinst <- `structinst*`}|){} + -- (NotImmReachable: `~%>>_%%`(`REF.ARRAY_ADDR`_fieldval(a), s, `REF.ARRAY_ADDR`_fieldval(a)))^(a<|arrayinst*{arrayinst <- `arrayinst*`}|){} + -- (NotImmReachable: `~%>>_%%`(`REF.EXN_ADDR`_fieldval(a), s, `REF.EXN_ADDR`_fieldval(a)))^(a<|exninst*{exninst <- `exninst*`}|){} + -- if (s = {TAGS taginst*{taginst <- `taginst*`}, GLOBALS globalinst*{globalinst <- `globalinst*`}, MEMS meminst*{meminst <- `meminst*`}, TABLES tableinst*{tableinst <- `tableinst*`}, FUNCS funcinst*{funcinst <- `funcinst*`}, DATAS datainst*{datainst <- `datainst*`}, ELEMS eleminst*{eleminst <- `eleminst*`}, STRUCTS structinst*{structinst <- `structinst*`}, ARRAYS arrayinst*{arrayinst <- `arrayinst*`}, EXNS exninst*{exninst <- `exninst*`}}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_taginst: `%<=%`(taginst, taginst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{jt : tagtype}: + `%<=%`({TYPE jt}, {TYPE jt}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_globalinst: `%<=%`(globalinst, globalinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{`mut?` : mut?, t : valtype, val : val, val' : val}: + `%<=%`({TYPE `%%`_globaltype(mut?{mut <- `mut?`}, t), VALUE val}, {TYPE `%%`_globaltype(mut?{mut <- `mut?`}, t), VALUE val'}) + -- if ((mut?{mut <- `mut?`} = ?(MUT_mut)) \/ (val = val')) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_meminst: `%<=%`(meminst, meminst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{at : addrtype, n : n, m : m, `b*` : byte*, n' : n, `b'*` : byte*}: + `%<=%`({TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m)))), BYTES b*{b <- `b*`}}, {TYPE `%%PAGE`_memtype(at, `[%..%]`_limits(`%`_u64(n'), ?(`%`_u64(m)))), BYTES b'*{b' <- `b'*`}}) + -- if (n <= n') + -- if (|b*{b <- `b*`}| <= |b'*{b' <- `b'*`}|) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_tableinst: `%<=%`(tableinst, tableinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{at : addrtype, n : n, m : m, rt : reftype, `ref*` : ref*, n' : n, `ref'*` : ref*}: + `%<=%`({TYPE `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n), ?(`%`_u64(m))), rt), REFS ref*{ref <- `ref*`}}, {TYPE `%%%`_tabletype(at, `[%..%]`_limits(`%`_u64(n'), ?(`%`_u64(m))), rt), REFS ref'*{ref' <- `ref'*`}}) + -- if (n <= n') + -- if (|ref*{ref <- `ref*`}| <= |ref'*{ref' <- `ref'*`}|) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_funcinst: `%<=%`(funcinst, funcinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{dt : deftype, mm : moduleinst, fc : funccode}: + `%<=%`({TYPE dt, MODULE mm, CODE fc}, {TYPE dt, MODULE mm, CODE fc}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_datainst: `%<=%`(datainst, datainst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{`b*` : byte*, `b'*` : byte*}: + `%<=%`({BYTES b*{b <- `b*`}}, {BYTES b'*{b' <- `b'*`}}) + -- if ((b*{b <- `b*`} = b'*{b' <- `b'*`}) \/ (b'*{b' <- `b'*`} = [])) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_eleminst: `%<=%`(eleminst, eleminst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{rt : reftype, `ref*` : ref*, `ref'*` : ref*}: + `%<=%`({TYPE rt, REFS ref*{ref <- `ref*`}}, {TYPE rt, REFS ref'*{ref' <- `ref'*`}}) + -- if ((ref*{ref <- `ref*`} = ref'*{ref' <- `ref'*`}) \/ (ref'*{ref' <- `ref'*`} = [])) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_structinst: `%<=%`(structinst, structinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{dt : deftype, `fv*` : fieldval*, `fv'*` : fieldval*, `mut?*` : mut?*, `zt*` : storagetype*}: + `%<=%`({TYPE dt, FIELDS fv*{fv <- `fv*`}}, {TYPE dt, FIELDS fv'*{fv' <- `fv'*`}}) + -- Expand: `%~~%`(dt, STRUCT_comptype(`%`_list(`%%`_fieldtype(mut?{mut <- `mut?`}, zt)*{`mut?` <- `mut?*`, zt <- `zt*`}))) + -- if (|`fv*`| = |`fv'*`|) + -- if (|`fv*`| = |`mut?*`|) + -- (if ((mut?{mut <- `mut?`} = ?(MUT_mut)) \/ (fv = fv')))*{fv <- `fv*`, fv' <- `fv'*`, `mut?` <- `mut?*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_arrayinst: `%<=%`(arrayinst, arrayinst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{dt : deftype, `fv*` : fieldval*, `fv'*` : fieldval*, `mut?` : mut?, zt : storagetype}: + `%<=%`({TYPE dt, FIELDS fv*{fv <- `fv*`}}, {TYPE dt, FIELDS fv'*{fv' <- `fv'*`}}) + -- Expand: `%~~%`(dt, ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) + -- if (|`fv*`| = |`fv'*`|) + -- (if ((mut?{mut <- `mut?`} = ?(MUT_mut)) \/ (fv = fv')))*{fv <- `fv*`, fv' <- `fv'*`} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_exninst: `%<=%`(exninst, exninst) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{ta : tagaddr, `val*` : val*}: + `%<=%`({TAG ta, FIELDS val*{val <- `val*`}}, {TAG ta, FIELDS val*{val <- `val*`}}) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Extend_store: `%<=%`(store, store) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, s' : store}: + `%<=%`(s, s') + -- (if (a < |s.TAGS_store|))^(a<|s.TAGS_store|){} + -- (if (a < |s'.TAGS_store|))^(a<|s.TAGS_store|){} + -- (Extend_taginst: `%<=%`(s.TAGS_store[a], s'.TAGS_store[a]))^(a<|s.TAGS_store|){} + -- (if (a < |s.GLOBALS_store|))^(a<|s.GLOBALS_store|){} + -- (if (a < |s'.GLOBALS_store|))^(a<|s.GLOBALS_store|){} + -- (Extend_globalinst: `%<=%`(s.GLOBALS_store[a], s'.GLOBALS_store[a]))^(a<|s.GLOBALS_store|){} + -- (if (a < |s.MEMS_store|))^(a<|s.MEMS_store|){} + -- (if (a < |s'.MEMS_store|))^(a<|s.MEMS_store|){} + -- (Extend_meminst: `%<=%`(s.MEMS_store[a], s'.MEMS_store[a]))^(a<|s.MEMS_store|){} + -- (if (a < |s.TABLES_store|))^(a<|s.TABLES_store|){} + -- (if (a < |s'.TABLES_store|))^(a<|s.TABLES_store|){} + -- (Extend_tableinst: `%<=%`(s.TABLES_store[a], s'.TABLES_store[a]))^(a<|s.TABLES_store|){} + -- (if (a < |s.FUNCS_store|))^(a<|s.FUNCS_store|){} + -- (if (a < |s'.FUNCS_store|))^(a<|s.FUNCS_store|){} + -- (Extend_funcinst: `%<=%`(s.FUNCS_store[a], s'.FUNCS_store[a]))^(a<|s.FUNCS_store|){} + -- (if (a < |s.DATAS_store|))^(a<|s.DATAS_store|){} + -- (if (a < |s'.DATAS_store|))^(a<|s.DATAS_store|){} + -- (Extend_datainst: `%<=%`(s.DATAS_store[a], s'.DATAS_store[a]))^(a<|s.DATAS_store|){} + -- (if (a < |s.ELEMS_store|))^(a<|s.ELEMS_store|){} + -- (if (a < |s'.ELEMS_store|))^(a<|s.ELEMS_store|){} + -- (Extend_eleminst: `%<=%`(s.ELEMS_store[a], s'.ELEMS_store[a]))^(a<|s.ELEMS_store|){} + -- (if (a < |s.STRUCTS_store|))^(a<|s.STRUCTS_store|){} + -- (if (a < |s'.STRUCTS_store|))^(a<|s.STRUCTS_store|){} + -- (Extend_structinst: `%<=%`(s.STRUCTS_store[a], s'.STRUCTS_store[a]))^(a<|s.STRUCTS_store|){} + -- (if (a < |s.ARRAYS_store|))^(a<|s.ARRAYS_store|){} + -- (if (a < |s'.ARRAYS_store|))^(a<|s.ARRAYS_store|){} + -- (Extend_arrayinst: `%<=%`(s.ARRAYS_store[a], s'.ARRAYS_store[a]))^(a<|s.ARRAYS_store|){} + -- (if (a < |s.EXNS_store|))^(a<|s.EXNS_store|){} + -- (if (a < |s'.EXNS_store|))^(a<|s.EXNS_store|){} + -- (Extend_exninst: `%<=%`(s.EXNS_store[a], s'.EXNS_store[a]))^(a<|s.EXNS_store|){} + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation State_ok: `|-%:%`(state, context) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{s : store, f : frame, C : context}: + `|-%:%`(`%;%`_state(s, f), C) + -- Store_ok: `|-%:OK`(s) + -- Frame_ok: `%|-%:%`(s, f, C) + +;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec +relation Config_ok: `|-%:OK`(config) + ;; ../../../../specification/wasm-latest/7.1-soundness.configurations.spectec + rule _{z : state, `instr*` : instr*, C : context, `t*` : valtype*}: + `|-%:OK`(`%;%`_config(z, instr*{instr <- `instr*`})) + -- State_ok: `|-%:%`(z, C) + -- Expr_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, `%`_resulttype(t*{t <- `t*`})) + ;; ../../../../specification/wasm-latest/X.1-notation.syntax.spectec syntax A = nat