diff --git a/specification/wasm-3.0/1.2-syntax.types.spectec b/specification/wasm-3.0/1.2-syntax.types.spectec index 0311906225..d740dc0b11 100644 --- a/specification/wasm-3.0/1.2-syntax.types.spectec +++ b/specification/wasm-3.0/1.2-syntax.types.spectec @@ -197,7 +197,7 @@ def $size(numtype) : nat hint(show |%|) def $vsize(vectype) : nat hint(show |%|) def $psize(packtype) : nat hint(show |%|) def $lsize(lanetype) : nat hint(show |%|) -def $zsize(storagetype) : nat hint(show |%|) +def $zsize(storagetype) : nat hint(show |%|) hint(partial) def $isize(Inn) : nat hint(show |%|) hint(inverse $inv_isize) def $jsize(Jnn) : nat hint(show |%|) hint(inverse $inv_jsize) def $fsize(Fnn) : nat hint(show |%|) hint(inverse $inv_fsize) @@ -297,7 +297,7 @@ def $diffrt((REF null_1? ht_1), (REF NULL ht_2)) = (REF ht_1) def $diffrt((REF null_1? ht_1), (REF ht_2)) = (REF null_1? ht_1) ;; TODO(3, rossberg): Could this be inferable as a narrowing coercion? -def $as_deftype(typeuse) : deftype hint(show %) +def $as_deftype(typeuse) : deftype hint(show %) hint(partial) def $as_deftype(dt) = dt @@ -494,13 +494,13 @@ def $free_comptype(comptype) : free def $free_subtype(subtype) : free def $free_rectype(rectype) : free -def $free_tagtype(tagtype) : free +def $free_tagtype(tagtype) : free hint(partial) def $free_globaltype(globaltype) : free def $free_memtype(memtype) : free def $free_tabletype(tabletype) : free def $free_datatype(datatype) : free def $free_elemtype(elemtype) : free -def $free_externtype(externtype) : free +def $free_externtype(externtype) : free hint(partial) def $free_moduletype(moduletype) : free diff --git a/specification/wasm-3.0/3.1-numerics.scalar.spectec b/specification/wasm-3.0/3.1-numerics.scalar.spectec index 17171da2d1..21e4b41663 100644 --- a/specification/wasm-3.0/3.1-numerics.scalar.spectec +++ b/specification/wasm-3.0/3.1-numerics.scalar.spectec @@ -58,7 +58,7 @@ def $inv_signed_(N, i) = i -- if $(0 <= i < 2^(N-1)) def $inv_signed_(N, i) = $(i + 2^N) -- if $(-2^(N-1) <= i < 0) -def $sx(storagetype) : sx? hint(show $sx(%)) +def $sx(storagetype) : sx? hint(show $sx(%)) hint(partial) def $sx(consttype) = eps def $sx(packtype) = S diff --git a/spectec/test-middlend/specification.03-totalize.exp b/spectec/test-middlend/specification.03-totalize.exp index 53b48bc1f9..36a3525f4c 100644 --- a/spectec/test-middlend/specification.03-totalize.exp +++ b/spectec/test-middlend/specification.03-totalize.exp @@ -1320,13 +1320,14 @@ def $lsize(lanetype : lanetype) : nat def $lsize{packtype : packtype}((packtype : packtype <: lanetype)) = $psize(packtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $zsize(storagetype : storagetype) : nat +def $zsize(storagetype : storagetype) : nat? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{numtype : numtype}((numtype : numtype <: storagetype)) = $size(numtype) + def $zsize{numtype : numtype}((numtype : numtype <: storagetype)) = ?($size(numtype)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{vectype : vectype}((vectype : vectype <: storagetype)) = $vsize(vectype) + def $zsize{vectype : vectype}((vectype : vectype <: storagetype)) = ?($vsize(vectype)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{packtype : packtype}((packtype : packtype <: storagetype)) = $psize(packtype) + def $zsize{packtype : packtype}((packtype : packtype <: storagetype)) = ?($psize(packtype)) + def $zsize{x0 : storagetype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $isize(Inn : Inn) : nat @@ -1481,9 +1482,10 @@ def $diffrt(reftype : reftype, reftype : reftype) : reftype -- wf_reftype: `%`(REF_reftype(null_1?{null_1 <- `null_1?`}, ht_1)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $as_deftype(typeuse : typeuse) : deftype +def $as_deftype(typeuse : typeuse) : deftype? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $as_deftype{dt : deftype}((dt : deftype <: typeuse)) = dt + def $as_deftype{dt : deftype}((dt : deftype <: typeuse)) = ?(dt) + def $as_deftype{x0 : typeuse}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec rec { @@ -2081,9 +2083,10 @@ def $free_deftype(deftype : deftype) : free } ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $free_tagtype(tagtype : tagtype) : free +def $free_tagtype(tagtype : tagtype) : free? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_tagtype{deftype : deftype}((deftype : deftype <: typeuse)) = $free_deftype(deftype) + def $free_tagtype{deftype : deftype}((deftype : deftype <: typeuse)) = ?($free_deftype(deftype)) + def $free_tagtype{x0 : tagtype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $free_globaltype(globaltype : globaltype) : free @@ -2117,27 +2120,28 @@ def $free_elemtype(elemtype : elemtype) : free -- wf_reftype: `%`(reftype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $free_externtype(externtype : externtype) : free +def $free_externtype(externtype : externtype) : free? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{tagtype : typeuse}(TAG_externtype(tagtype)) = $free_tagtype(tagtype) + def $free_externtype{tagtype : typeuse}(TAG_externtype(tagtype)) = ?(!($free_tagtype(tagtype))) -- wf_typeuse: `%`(tagtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{globaltype : globaltype}(GLOBAL_externtype(globaltype)) = $free_globaltype(globaltype) + def $free_externtype{globaltype : globaltype}(GLOBAL_externtype(globaltype)) = ?($free_globaltype(globaltype)) -- wf_globaltype: `%`(globaltype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{memtype : memtype}(MEM_externtype(memtype)) = $free_memtype(memtype) + def $free_externtype{memtype : memtype}(MEM_externtype(memtype)) = ?($free_memtype(memtype)) -- wf_memtype: `%`(memtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{tabletype : tabletype}(TABLE_externtype(tabletype)) = $free_tabletype(tabletype) + def $free_externtype{tabletype : tabletype}(TABLE_externtype(tabletype)) = ?($free_tabletype(tabletype)) -- wf_tabletype: `%`(tabletype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{typeuse : typeuse}(FUNC_externtype(typeuse)) = $free_typeuse(typeuse) + def $free_externtype{typeuse : typeuse}(FUNC_externtype(typeuse)) = ?($free_typeuse(typeuse)) -- wf_typeuse: `%`(typeuse) + def $free_externtype{x0 : externtype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $free_moduletype(moduletype : moduletype) : free ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_moduletype{`externtype_1*` : externtype*, `externtype_2*` : externtype*}(`%->%`_moduletype(externtype_1*{externtype_1 <- `externtype_1*`}, externtype_2*{externtype_2 <- `externtype_2*`})) = $free_list($free_externtype(externtype_1)*{externtype_1 <- `externtype_1*`}) +++ $free_list($free_externtype(externtype_2)*{externtype_2 <- `externtype_2*`}) + def $free_moduletype{`externtype_1*` : externtype*, `externtype_2*` : externtype*}(`%->%`_moduletype(externtype_1*{externtype_1 <- `externtype_1*`}, externtype_2*{externtype_2 <- `externtype_2*`})) = $free_list(!($free_externtype(externtype_1))*{externtype_1 <- `externtype_1*`}) +++ $free_list(!($free_externtype(externtype_2))*{externtype_2 <- `externtype_2*`}) -- (wf_externtype: `%`(externtype_1))*{externtype_1 <- `externtype_1*`} -- (wf_externtype: `%`(externtype_2))*{externtype_2 <- `externtype_2*`} @@ -5057,7 +5061,7 @@ def $free_type(type : type) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec def $free_tag(tag : tag) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec - def $free_tag{tagtype : typeuse}(TAG_tag(tagtype)) = $free_tagtype(tagtype) + def $free_tag{tagtype : typeuse}(TAG_tag(tagtype)) = !($free_tagtype(tagtype)) -- wf_typeuse: `%`(tagtype) ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec @@ -5141,7 +5145,7 @@ def $free_start(start : start) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec def $free_import(import : import) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec - def $free_import{name_1 : name, name_2 : name, externtype : externtype}(IMPORT_import(name_1, name_2, externtype)) = $free_externtype(externtype) + def $free_import{name_1 : name, name_2 : name, externtype : externtype}(IMPORT_import(name_1, name_2, externtype)) = !($free_externtype(externtype)) -- wf_name: `%`(name_1) -- wf_name: `%`(name_2) -- wf_externtype: `%`(externtype) @@ -6170,7 +6174,7 @@ relation Catch_ok: `%|-%:OK`(context, catch) -- wf_context: `%`(C) -- wf_catch: `%`(CATCH_catch(x, l)) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t*{t <- `t*`}), C.LABELS_context[l!`%`_uN.0]) ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec @@ -6179,7 +6183,7 @@ relation Catch_ok: `%|-%:OK`(context, catch) -- wf_context: `%`(C) -- wf_catch: `%`(CATCH_REF_catch(x, l)) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(), EXN_heaptype)]), C.LABELS_context[l!`%`_uN.0]) ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec @@ -6477,7 +6481,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) -- wf_instrtype: `%`(`%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- wf_instrtype: `%`(`%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:171.1-173.42 @@ -7874,11 +7878,12 @@ def $inv_signed_(N : N, int : int) : nat -- if ((- ((2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int) <= i) /\ (i < (0 : nat <:> int))) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec -def $sx(storagetype : storagetype) : sx? +def $sx(storagetype : storagetype) : sx?? ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec - def $sx{consttype : consttype}((consttype : consttype <: storagetype)) = ?() + def $sx{consttype : consttype}((consttype : consttype <: storagetype)) = ?(?()) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec - def $sx{packtype : packtype}((packtype : packtype <: storagetype)) = ?(S_sx) + def $sx{packtype : packtype}((packtype : packtype <: storagetype)) = ?(?(S_sx)) + def $sx{x0 : storagetype}(x0) = ?() ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec def $zero(lanetype : lanetype) : lane_ @@ -11608,7 +11613,7 @@ relation Step_read: `%~>%`(config, instr*) -- wf_instr: `%`(TRAP_instr) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) - -- if ((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.new_data-num`{z : state, i : num_, n : n, x : idx, y : idx, zt : storagetype, `c*` : lit_*, `mut?` : mut?}: @@ -11618,7 +11623,7 @@ relation Step_read: `%~>%`(config, instr*) -- wf_instr: `%`(ARRAY.NEW_FIXED_instr(x, `%`_u32(n))) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) - -- if ($concatn_(syntax byte, $zbytes_(zt, c)^n{c <- `c*`}, ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, i))!`%`_uN.0 : ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($concatn_(syntax byte, $zbytes_(zt, c)^n{c <- `c*`}, (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, i))!`%`_uN.0 : ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.get-null`{z : state, ht : heaptype, i : num_, `sx?` : sx?, x : idx}: @@ -11734,7 +11739,7 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- otherwise -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = $sx(zt_2))) + -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = !($sx(zt_2)))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.copy-gt`{z : state, a_1 : addr, i_1 : num_, a_2 : addr, i_2 : num_, n : n, x_1 : idx, x_2 : idx, `sx?` : sx?, `mut?` : mut?, zt_2 : storagetype}: @@ -11753,7 +11758,7 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- otherwise -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if (sx?{sx <- `sx?`} = $sx(zt_2)) + -- if (sx?{sx <- `sx?`} = !($sx(zt_2))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_elem-null`{z : state, ht : heaptype, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -11817,7 +11822,7 @@ relation Step_read: `%~>%`(config, instr*) -- wf_instr: `%`(TRAP_instr) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) - -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-zero`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -11828,20 +11833,20 @@ relation Step_read: `%~>%`(config, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-num`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx, zt : storagetype, c : lit_, `mut?` : mut?}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) $const(!($cunpack(zt)), $cunpacknum_(zt, c)) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1)))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat))))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))) ARRAY.INIT_DATA_instr(x, y)]) + `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) $const(!($cunpack(zt)), $cunpacknum_(zt, c)) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1)))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat))))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))) ARRAY.INIT_DATA_instr(x, y)]) -- wf_lit_: `%%`(zt, c) -- wf_config: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)])) -- wf_instr: `%`(REF.ARRAY_ADDR_instr(a)) -- wf_instr: `%`(CONST_instr(I32_numtype, i)) -- wf_instr: `%`(ARRAY.SET_instr(x)) -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1))))) - -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)))))) + -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)))))) -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))))) -- wf_instr: `%`(ARRAY.INIT_DATA_instr(x, y)) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- otherwise -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) - -- if ($zbytes_(zt, c) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, j))!`%`_uN.0 : ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($zbytes_(zt, c) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, j))!`%`_uN.0 : (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rec { @@ -11897,7 +11902,7 @@ relation Step: `%~>%`(config, config) -- wf_config: `%`(`%;%`_config($add_exninst(z, [exn]), [REF.EXN_ADDR_instr(a) THROW_REF_instr])) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) -- wf_exninst: `%`({TAG $tagaddr(z)[x!`%`_uN.0], FIELDS val^n{val <- `val*`}}) - -- Expand: `%~~%`($as_deftype($tag(z, x).TYPE_taginst), `FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype($tag(z, x).TYPE_taginst)), `FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) -- if (a = |$exninst(z)|) -- if (exn = {TAG $tagaddr(z)[x!`%`_uN.0], FIELDS val^n{val <- `val*`}}) diff --git a/spectec/test-middlend/specification.04-else.exp b/spectec/test-middlend/specification.04-else.exp index db735f6626..c8e48b6009 100644 --- a/spectec/test-middlend/specification.04-else.exp +++ b/spectec/test-middlend/specification.04-else.exp @@ -1320,13 +1320,14 @@ def $lsize(lanetype : lanetype) : nat def $lsize{packtype : packtype}((packtype : packtype <: lanetype)) = $psize(packtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $zsize(storagetype : storagetype) : nat +def $zsize(storagetype : storagetype) : nat? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{numtype : numtype}((numtype : numtype <: storagetype)) = $size(numtype) + def $zsize{numtype : numtype}((numtype : numtype <: storagetype)) = ?($size(numtype)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{vectype : vectype}((vectype : vectype <: storagetype)) = $vsize(vectype) + def $zsize{vectype : vectype}((vectype : vectype <: storagetype)) = ?($vsize(vectype)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{packtype : packtype}((packtype : packtype <: storagetype)) = $psize(packtype) + def $zsize{packtype : packtype}((packtype : packtype <: storagetype)) = ?($psize(packtype)) + def $zsize{x0 : storagetype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $isize(Inn : Inn) : nat @@ -1481,9 +1482,10 @@ def $diffrt(reftype : reftype, reftype : reftype) : reftype -- wf_reftype: `%`(REF_reftype(null_1?{null_1 <- `null_1?`}, ht_1)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $as_deftype(typeuse : typeuse) : deftype +def $as_deftype(typeuse : typeuse) : deftype? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $as_deftype{dt : deftype}((dt : deftype <: typeuse)) = dt + def $as_deftype{dt : deftype}((dt : deftype <: typeuse)) = ?(dt) + def $as_deftype{x0 : typeuse}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec rec { @@ -2081,9 +2083,10 @@ def $free_deftype(deftype : deftype) : free } ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $free_tagtype(tagtype : tagtype) : free +def $free_tagtype(tagtype : tagtype) : free? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_tagtype{deftype : deftype}((deftype : deftype <: typeuse)) = $free_deftype(deftype) + def $free_tagtype{deftype : deftype}((deftype : deftype <: typeuse)) = ?($free_deftype(deftype)) + def $free_tagtype{x0 : tagtype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $free_globaltype(globaltype : globaltype) : free @@ -2117,27 +2120,28 @@ def $free_elemtype(elemtype : elemtype) : free -- wf_reftype: `%`(reftype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $free_externtype(externtype : externtype) : free +def $free_externtype(externtype : externtype) : free? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{tagtype : typeuse}(TAG_externtype(tagtype)) = $free_tagtype(tagtype) + def $free_externtype{tagtype : typeuse}(TAG_externtype(tagtype)) = ?(!($free_tagtype(tagtype))) -- wf_typeuse: `%`(tagtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{globaltype : globaltype}(GLOBAL_externtype(globaltype)) = $free_globaltype(globaltype) + def $free_externtype{globaltype : globaltype}(GLOBAL_externtype(globaltype)) = ?($free_globaltype(globaltype)) -- wf_globaltype: `%`(globaltype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{memtype : memtype}(MEM_externtype(memtype)) = $free_memtype(memtype) + def $free_externtype{memtype : memtype}(MEM_externtype(memtype)) = ?($free_memtype(memtype)) -- wf_memtype: `%`(memtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{tabletype : tabletype}(TABLE_externtype(tabletype)) = $free_tabletype(tabletype) + def $free_externtype{tabletype : tabletype}(TABLE_externtype(tabletype)) = ?($free_tabletype(tabletype)) -- wf_tabletype: `%`(tabletype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{typeuse : typeuse}(FUNC_externtype(typeuse)) = $free_typeuse(typeuse) + def $free_externtype{typeuse : typeuse}(FUNC_externtype(typeuse)) = ?($free_typeuse(typeuse)) -- wf_typeuse: `%`(typeuse) + def $free_externtype{x0 : externtype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $free_moduletype(moduletype : moduletype) : free ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_moduletype{`externtype_1*` : externtype*, `externtype_2*` : externtype*}(`%->%`_moduletype(externtype_1*{externtype_1 <- `externtype_1*`}, externtype_2*{externtype_2 <- `externtype_2*`})) = $free_list($free_externtype(externtype_1)*{externtype_1 <- `externtype_1*`}) +++ $free_list($free_externtype(externtype_2)*{externtype_2 <- `externtype_2*`}) + def $free_moduletype{`externtype_1*` : externtype*, `externtype_2*` : externtype*}(`%->%`_moduletype(externtype_1*{externtype_1 <- `externtype_1*`}, externtype_2*{externtype_2 <- `externtype_2*`})) = $free_list(!($free_externtype(externtype_1))*{externtype_1 <- `externtype_1*`}) +++ $free_list(!($free_externtype(externtype_2))*{externtype_2 <- `externtype_2*`}) -- (wf_externtype: `%`(externtype_1))*{externtype_1 <- `externtype_1*`} -- (wf_externtype: `%`(externtype_2))*{externtype_2 <- `externtype_2*`} @@ -5057,7 +5061,7 @@ def $free_type(type : type) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec def $free_tag(tag : tag) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec - def $free_tag{tagtype : typeuse}(TAG_tag(tagtype)) = $free_tagtype(tagtype) + def $free_tag{tagtype : typeuse}(TAG_tag(tagtype)) = !($free_tagtype(tagtype)) -- wf_typeuse: `%`(tagtype) ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec @@ -5141,7 +5145,7 @@ def $free_start(start : start) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec def $free_import(import : import) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec - def $free_import{name_1 : name, name_2 : name, externtype : externtype}(IMPORT_import(name_1, name_2, externtype)) = $free_externtype(externtype) + def $free_import{name_1 : name, name_2 : name, externtype : externtype}(IMPORT_import(name_1, name_2, externtype)) = !($free_externtype(externtype)) -- wf_name: `%`(name_1) -- wf_name: `%`(name_2) -- wf_externtype: `%`(externtype) @@ -6170,7 +6174,7 @@ relation Catch_ok: `%|-%:OK`(context, catch) -- wf_context: `%`(C) -- wf_catch: `%`(CATCH_catch(x, l)) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t*{t <- `t*`}), C.LABELS_context[l!`%`_uN.0]) ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec @@ -6179,7 +6183,7 @@ relation Catch_ok: `%|-%:OK`(context, catch) -- wf_context: `%`(C) -- wf_catch: `%`(CATCH_REF_catch(x, l)) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(), EXN_heaptype)]), C.LABELS_context[l!`%`_uN.0]) ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec @@ -6477,7 +6481,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) -- wf_instrtype: `%`(`%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- wf_instrtype: `%`(`%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:171.1-173.42 @@ -7874,11 +7878,12 @@ def $inv_signed_(N : N, int : int) : nat -- if ((- ((2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int) <= i) /\ (i < (0 : nat <:> int))) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec -def $sx(storagetype : storagetype) : sx? +def $sx(storagetype : storagetype) : sx?? ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec - def $sx{consttype : consttype}((consttype : consttype <: storagetype)) = ?() + def $sx{consttype : consttype}((consttype : consttype <: storagetype)) = ?(?()) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec - def $sx{packtype : packtype}((packtype : packtype <: storagetype)) = ?(S_sx) + def $sx{packtype : packtype}((packtype : packtype <: storagetype)) = ?(?(S_sx)) + def $sx{x0 : storagetype}(x0) = ?() ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec def $zero(lanetype : lanetype) : lane_ @@ -11421,7 +11426,7 @@ relation `Step_read_before_array.copy-gt`: `%`(config) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- ~ `Step_read_before_array.copy-le`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.COPY_instr(x_1, x_2)])) -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = $sx(zt_2))) + -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = !($sx(zt_2)))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.copy-zero_1`{z : state, a_1 : addr, i_1 : num_, a_2 : addr, i_2 : num_, n : n, x_1 : idx, x_2 : idx}: @@ -11492,7 +11497,7 @@ relation `Step_read_before_array.init_data-zero`: `%`(config) -- wf_instr: `%`(TRAP_instr) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) - -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-oob1_0`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -11517,7 +11522,7 @@ relation `Step_read_before_array.init_data-num`: `%`(config) -- wf_instr: `%`(TRAP_instr) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) - -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-oob1_1`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -12167,7 +12172,7 @@ relation Step_read: `%~>%`(config, instr*) -- wf_instr: `%`(TRAP_instr) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) - -- if ((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.new_data-num`{z : state, i : num_, n : n, x : idx, y : idx, zt : storagetype, `c*` : lit_*, `mut?` : mut?}: @@ -12177,7 +12182,7 @@ relation Step_read: `%~>%`(config, instr*) -- wf_instr: `%`(ARRAY.NEW_FIXED_instr(x, `%`_u32(n))) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) - -- if ($concatn_(syntax byte, $zbytes_(zt, c)^n{c <- `c*`}, ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, i))!`%`_uN.0 : ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($concatn_(syntax byte, $zbytes_(zt, c)^n{c <- `c*`}, (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, i))!`%`_uN.0 : ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.get-null`{z : state, ht : heaptype, i : num_, `sx?` : sx?, x : idx}: @@ -12293,7 +12298,7 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- ~ `Step_read_before_array.copy-le`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.COPY_instr(x_1, x_2)])) -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = $sx(zt_2))) + -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = !($sx(zt_2)))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.copy-gt`{z : state, a_1 : addr, i_1 : num_, a_2 : addr, i_2 : num_, n : n, x_1 : idx, x_2 : idx, `sx?` : sx?, `mut?` : mut?, zt_2 : storagetype}: @@ -12312,7 +12317,7 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- ~ `Step_read_before_array.copy-gt`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.COPY_instr(x_1, x_2)])) -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if (sx?{sx <- `sx?`} = $sx(zt_2)) + -- if (sx?{sx <- `sx?`} = !($sx(zt_2))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_elem-null`{z : state, ht : heaptype, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -12376,7 +12381,7 @@ relation Step_read: `%~>%`(config, instr*) -- wf_instr: `%`(TRAP_instr) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) - -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-zero`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -12387,20 +12392,20 @@ relation Step_read: `%~>%`(config, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-num`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx, zt : storagetype, c : lit_, `mut?` : mut?}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) $const(!($cunpack(zt)), $cunpacknum_(zt, c)) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1)))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat))))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))) ARRAY.INIT_DATA_instr(x, y)]) + `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) $const(!($cunpack(zt)), $cunpacknum_(zt, c)) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1)))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat))))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))) ARRAY.INIT_DATA_instr(x, y)]) -- wf_lit_: `%%`(zt, c) -- wf_config: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)])) -- wf_instr: `%`(REF.ARRAY_ADDR_instr(a)) -- wf_instr: `%`(CONST_instr(I32_numtype, i)) -- wf_instr: `%`(ARRAY.SET_instr(x)) -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1))))) - -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)))))) + -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)))))) -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))))) -- wf_instr: `%`(ARRAY.INIT_DATA_instr(x, y)) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- ~ `Step_read_before_array.init_data-num`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)])) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) - -- if ($zbytes_(zt, c) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, j))!`%`_uN.0 : ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($zbytes_(zt, c) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, j))!`%`_uN.0 : (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rec { @@ -12456,7 +12461,7 @@ relation Step: `%~>%`(config, config) -- wf_config: `%`(`%;%`_config($add_exninst(z, [exn]), [REF.EXN_ADDR_instr(a) THROW_REF_instr])) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) -- wf_exninst: `%`({TAG $tagaddr(z)[x!`%`_uN.0], FIELDS val^n{val <- `val*`}}) - -- Expand: `%~~%`($as_deftype($tag(z, x).TYPE_taginst), `FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype($tag(z, x).TYPE_taginst)), `FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) -- if (a = |$exninst(z)|) -- if (exn = {TAG $tagaddr(z)[x!`%`_uN.0], FIELDS val^n{val <- `val*`}}) diff --git a/spectec/test-middlend/specification.05-sideconditions.exp b/spectec/test-middlend/specification.05-sideconditions.exp index 58aeda0289..1e1a08fe68 100644 --- a/spectec/test-middlend/specification.05-sideconditions.exp +++ b/spectec/test-middlend/specification.05-sideconditions.exp @@ -1320,13 +1320,14 @@ def $lsize(lanetype : lanetype) : nat def $lsize{packtype : packtype}((packtype : packtype <: lanetype)) = $psize(packtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $zsize(storagetype : storagetype) : nat +def $zsize(storagetype : storagetype) : nat? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{numtype : numtype}((numtype : numtype <: storagetype)) = $size(numtype) + def $zsize{numtype : numtype}((numtype : numtype <: storagetype)) = ?($size(numtype)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{vectype : vectype}((vectype : vectype <: storagetype)) = $vsize(vectype) + def $zsize{vectype : vectype}((vectype : vectype <: storagetype)) = ?($vsize(vectype)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{packtype : packtype}((packtype : packtype <: storagetype)) = $psize(packtype) + def $zsize{packtype : packtype}((packtype : packtype <: storagetype)) = ?($psize(packtype)) + def $zsize{x0 : storagetype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $isize(Inn : Inn) : nat @@ -1481,9 +1482,10 @@ def $diffrt(reftype : reftype, reftype : reftype) : reftype -- wf_reftype: `%`(REF_reftype(null_1?{null_1 <- `null_1?`}, ht_1)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $as_deftype(typeuse : typeuse) : deftype +def $as_deftype(typeuse : typeuse) : deftype? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $as_deftype{dt : deftype}((dt : deftype <: typeuse)) = dt + def $as_deftype{dt : deftype}((dt : deftype <: typeuse)) = ?(dt) + def $as_deftype{x0 : typeuse}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec rec { @@ -2081,9 +2083,10 @@ def $free_deftype(deftype : deftype) : free } ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $free_tagtype(tagtype : tagtype) : free +def $free_tagtype(tagtype : tagtype) : free? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_tagtype{deftype : deftype}((deftype : deftype <: typeuse)) = $free_deftype(deftype) + def $free_tagtype{deftype : deftype}((deftype : deftype <: typeuse)) = ?($free_deftype(deftype)) + def $free_tagtype{x0 : tagtype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $free_globaltype(globaltype : globaltype) : free @@ -2117,27 +2120,28 @@ def $free_elemtype(elemtype : elemtype) : free -- wf_reftype: `%`(reftype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $free_externtype(externtype : externtype) : free +def $free_externtype(externtype : externtype) : free? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{tagtype : typeuse}(TAG_externtype(tagtype)) = $free_tagtype(tagtype) + def $free_externtype{tagtype : typeuse}(TAG_externtype(tagtype)) = ?(!($free_tagtype(tagtype))) -- wf_typeuse: `%`(tagtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{globaltype : globaltype}(GLOBAL_externtype(globaltype)) = $free_globaltype(globaltype) + def $free_externtype{globaltype : globaltype}(GLOBAL_externtype(globaltype)) = ?($free_globaltype(globaltype)) -- wf_globaltype: `%`(globaltype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{memtype : memtype}(MEM_externtype(memtype)) = $free_memtype(memtype) + def $free_externtype{memtype : memtype}(MEM_externtype(memtype)) = ?($free_memtype(memtype)) -- wf_memtype: `%`(memtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{tabletype : tabletype}(TABLE_externtype(tabletype)) = $free_tabletype(tabletype) + def $free_externtype{tabletype : tabletype}(TABLE_externtype(tabletype)) = ?($free_tabletype(tabletype)) -- wf_tabletype: `%`(tabletype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{typeuse : typeuse}(FUNC_externtype(typeuse)) = $free_typeuse(typeuse) + def $free_externtype{typeuse : typeuse}(FUNC_externtype(typeuse)) = ?($free_typeuse(typeuse)) -- wf_typeuse: `%`(typeuse) + def $free_externtype{x0 : externtype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $free_moduletype(moduletype : moduletype) : free ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_moduletype{`externtype_1*` : externtype*, `externtype_2*` : externtype*}(`%->%`_moduletype(externtype_1*{externtype_1 <- `externtype_1*`}, externtype_2*{externtype_2 <- `externtype_2*`})) = $free_list($free_externtype(externtype_1)*{externtype_1 <- `externtype_1*`}) +++ $free_list($free_externtype(externtype_2)*{externtype_2 <- `externtype_2*`}) + def $free_moduletype{`externtype_1*` : externtype*, `externtype_2*` : externtype*}(`%->%`_moduletype(externtype_1*{externtype_1 <- `externtype_1*`}, externtype_2*{externtype_2 <- `externtype_2*`})) = $free_list(!($free_externtype(externtype_1))*{externtype_1 <- `externtype_1*`}) +++ $free_list(!($free_externtype(externtype_2))*{externtype_2 <- `externtype_2*`}) -- (wf_externtype: `%`(externtype_1))*{externtype_1 <- `externtype_1*`} -- (wf_externtype: `%`(externtype_2))*{externtype_2 <- `externtype_2*`} @@ -5057,7 +5061,7 @@ def $free_type(type : type) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec def $free_tag(tag : tag) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec - def $free_tag{tagtype : typeuse}(TAG_tag(tagtype)) = $free_tagtype(tagtype) + def $free_tag{tagtype : typeuse}(TAG_tag(tagtype)) = !($free_tagtype(tagtype)) -- wf_typeuse: `%`(tagtype) ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec @@ -5141,7 +5145,7 @@ def $free_start(start : start) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec def $free_import(import : import) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec - def $free_import{name_1 : name, name_2 : name, externtype : externtype}(IMPORT_import(name_1, name_2, externtype)) = $free_externtype(externtype) + def $free_import{name_1 : name, name_2 : name, externtype : externtype}(IMPORT_import(name_1, name_2, externtype)) = !($free_externtype(externtype)) -- wf_name: `%`(name_1) -- wf_name: `%`(name_2) -- wf_externtype: `%`(externtype) @@ -6190,8 +6194,9 @@ relation Catch_ok: `%|-%:OK`(context, catch) -- wf_context: `%`(C) -- wf_catch: `%`(CATCH_catch(x, l)) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- if ($as_deftype(C.TAGS_context[x!`%`_uN.0]) =/= ?()) -- if (x!`%`_uN.0 < |C.TAGS_context|) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- if (l!`%`_uN.0 < |C.LABELS_context|) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t*{t <- `t*`}), C.LABELS_context[l!`%`_uN.0]) @@ -6201,8 +6206,9 @@ relation Catch_ok: `%|-%:OK`(context, catch) -- wf_context: `%`(C) -- wf_catch: `%`(CATCH_REF_catch(x, l)) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- if ($as_deftype(C.TAGS_context[x!`%`_uN.0]) =/= ?()) -- if (x!`%`_uN.0 < |C.TAGS_context|) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- if (l!`%`_uN.0 < |C.LABELS_context|) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(), EXN_heaptype)]), C.LABELS_context[l!`%`_uN.0]) @@ -6519,8 +6525,9 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) -- wf_instrtype: `%`(`%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- wf_instrtype: `%`(`%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- if ($as_deftype(C.TAGS_context[x!`%`_uN.0]) =/= ?()) -- if (x!`%`_uN.0 < |C.TAGS_context|) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:171.1-173.42 @@ -7998,11 +8005,12 @@ def $inv_signed_(N : N, int : int) : nat -- if ((- ((2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int) <= i) /\ (i < (0 : nat <:> int))) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec -def $sx(storagetype : storagetype) : sx? +def $sx(storagetype : storagetype) : sx?? ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec - def $sx{consttype : consttype}((consttype : consttype <: storagetype)) = ?() + def $sx{consttype : consttype}((consttype : consttype <: storagetype)) = ?(?()) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec - def $sx{packtype : packtype}((packtype : packtype <: storagetype)) = ?(S_sx) + def $sx{packtype : packtype}((packtype : packtype <: storagetype)) = ?(?(S_sx)) + def $sx{x0 : storagetype}(x0) = ?() ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec def $zero(lanetype : lanetype) : lane_ @@ -11628,7 +11636,8 @@ relation `Step_read_before_array.copy-gt`: `%`(config) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- ~ `Step_read_before_array.copy-le`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.COPY_instr(x_1, x_2)])) -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = $sx(zt_2))) + -- if ($sx(zt_2) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = !($sx(zt_2)))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.copy-zero_1`{z : state, a_1 : addr, i_1 : num_, a_2 : addr, i_2 : num_, n : n, x_1 : idx, x_2 : idx}: @@ -11710,7 +11719,8 @@ relation `Step_read_before_array.init_data-zero`: `%`(config) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- if ($proj_num__0(I32_Inn, j) =/= ?()) - -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ($zsize(zt) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-oob1_0`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -11738,7 +11748,8 @@ relation `Step_read_before_array.init_data-num`: `%`(config) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- if ($proj_num__0(I32_Inn, j) =/= ?()) - -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ($zsize(zt) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-oob1_1`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -12450,7 +12461,8 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- if ($proj_num__0(I32_Inn, i) =/= ?()) - -- if ((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ($zsize(zt) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.new_data-num`{z : state, i : num_, n : n, x : idx, y : idx, zt : storagetype, `c*` : lit_*, `mut?` : mut?}: @@ -12461,8 +12473,9 @@ relation Step_read: `%~>%`(config, instr*) -- wf_instr: `%`(ARRAY.NEW_FIXED_instr(x, `%`_u32(n))) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) + -- if ($zsize(zt) =/= ?()) -- if ($proj_num__0(I32_Inn, i) =/= ?()) - -- if ($concatn_(syntax byte, $zbytes_(zt, c)^n{c <- `c*`}, ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, i))!`%`_uN.0 : ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($concatn_(syntax byte, $zbytes_(zt, c)^n{c <- `c*`}, (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, i))!`%`_uN.0 : ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.get-null`{z : state, ht : heaptype, i : num_, `sx?` : sx?, x : idx}: @@ -12593,7 +12606,8 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- ~ `Step_read_before_array.copy-le`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.COPY_instr(x_1, x_2)])) -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = $sx(zt_2))) + -- if ($sx(zt_2) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = !($sx(zt_2)))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.copy-gt`{z : state, a_1 : addr, i_1 : num_, a_2 : addr, i_2 : num_, n : n, x_1 : idx, x_2 : idx, `sx?` : sx?, `mut?` : mut?, zt_2 : storagetype}: @@ -12614,7 +12628,8 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- ~ `Step_read_before_array.copy-gt`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.COPY_instr(x_1, x_2)])) -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if (sx?{sx <- `sx?`} = $sx(zt_2)) + -- if ($sx(zt_2) =/= ?()) + -- if (sx?{sx <- `sx?`} = !($sx(zt_2))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_elem-null`{z : state, ht : heaptype, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -12687,7 +12702,8 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- if ($proj_num__0(I32_Inn, j) =/= ?()) - -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ($zsize(zt) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-zero`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -12698,23 +12714,24 @@ relation Step_read: `%~>%`(config, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-num`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx, zt : storagetype, c : lit_, `mut?` : mut?}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) $const(!($cunpack(zt)), $cunpacknum_(zt, c)) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1)))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat))))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))) ARRAY.INIT_DATA_instr(x, y)]) + `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) $const(!($cunpack(zt)), $cunpacknum_(zt, c)) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1)))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat))))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))) ARRAY.INIT_DATA_instr(x, y)]) -- if ($cunpack(zt) =/= ?()) -- if ($proj_num__0(I32_Inn, i) =/= ?()) -- if ($proj_num__0(I32_Inn, j) =/= ?()) + -- if ($zsize(zt) =/= ?()) -- wf_lit_: `%%`(zt, c) -- wf_config: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)])) -- wf_instr: `%`(REF.ARRAY_ADDR_instr(a)) -- wf_instr: `%`(CONST_instr(I32_numtype, i)) -- wf_instr: `%`(ARRAY.SET_instr(x)) -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1))))) - -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)))))) + -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)))))) -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))))) -- wf_instr: `%`(ARRAY.INIT_DATA_instr(x, y)) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- ~ `Step_read_before_array.init_data-num`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)])) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) - -- if ($zbytes_(zt, c) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, j))!`%`_uN.0 : ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($zbytes_(zt, c) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, j))!`%`_uN.0 : (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rec { @@ -12771,7 +12788,8 @@ relation Step: `%~>%`(config, config) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) -- if (x!`%`_uN.0 < |$tagaddr(z)|) -- wf_exninst: `%`({TAG $tagaddr(z)[x!`%`_uN.0], FIELDS val^n{val <- `val*`}}) - -- Expand: `%~~%`($as_deftype($tag(z, x).TYPE_taginst), `FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) + -- if ($as_deftype($tag(z, x).TYPE_taginst) =/= ?()) + -- Expand: `%~~%`(!($as_deftype($tag(z, x).TYPE_taginst)), `FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) -- if (a = |$exninst(z)|) -- if (exn = {TAG $tagaddr(z)[x!`%`_uN.0], FIELDS val^n{val <- `val*`}}) diff --git a/spectec/test-middlend/specification.06-sub.exp b/spectec/test-middlend/specification.06-sub.exp index a40fe80b6d..8cac2d4aaa 100644 --- a/spectec/test-middlend/specification.06-sub.exp +++ b/spectec/test-middlend/specification.06-sub.exp @@ -1462,13 +1462,14 @@ def $lsize(lanetype : lanetype) : nat def $lsize{packtype : packtype}($lanetype_packtype(packtype)) = $psize(packtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $zsize(storagetype : storagetype) : nat +def $zsize(storagetype : storagetype) : nat? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{numtype : numtype}($storagetype_numtype(numtype)) = $size(numtype) + def $zsize{numtype : numtype}($storagetype_numtype(numtype)) = ?($size(numtype)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{vectype : vectype}($storagetype_vectype(vectype)) = $vsize(vectype) + def $zsize{vectype : vectype}($storagetype_vectype(vectype)) = ?($vsize(vectype)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{packtype : packtype}($storagetype_packtype(packtype)) = $psize(packtype) + def $zsize{packtype : packtype}($storagetype_packtype(packtype)) = ?($psize(packtype)) + def $zsize{x0 : storagetype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $isize(Inn : Inn) : nat @@ -1623,9 +1624,10 @@ def $diffrt(reftype : reftype, reftype : reftype) : reftype -- wf_reftype: `%`(REF_reftype(null_1?{null_1 <- `null_1?`}, ht_1)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $as_deftype(typeuse : typeuse) : deftype +def $as_deftype(typeuse : typeuse) : deftype? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $as_deftype{dt : deftype}($typeuse_deftype(dt)) = dt + def $as_deftype{dt : deftype}($typeuse_deftype(dt)) = ?(dt) + def $as_deftype{x0 : typeuse}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec rec { @@ -2223,9 +2225,10 @@ def $free_deftype(deftype : deftype) : free } ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $free_tagtype(tagtype : tagtype) : free +def $free_tagtype(tagtype : tagtype) : free? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_tagtype{deftype : deftype}($typeuse_deftype(deftype)) = $free_deftype(deftype) + def $free_tagtype{deftype : deftype}($typeuse_deftype(deftype)) = ?($free_deftype(deftype)) + def $free_tagtype{x0 : tagtype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $free_globaltype(globaltype : globaltype) : free @@ -2259,27 +2262,28 @@ def $free_elemtype(elemtype : elemtype) : free -- wf_reftype: `%`(reftype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $free_externtype(externtype : externtype) : free +def $free_externtype(externtype : externtype) : free? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{tagtype : typeuse}(TAG_externtype(tagtype)) = $free_tagtype(tagtype) + def $free_externtype{tagtype : typeuse}(TAG_externtype(tagtype)) = ?(!($free_tagtype(tagtype))) -- wf_typeuse: `%`(tagtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{globaltype : globaltype}(GLOBAL_externtype(globaltype)) = $free_globaltype(globaltype) + def $free_externtype{globaltype : globaltype}(GLOBAL_externtype(globaltype)) = ?($free_globaltype(globaltype)) -- wf_globaltype: `%`(globaltype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{memtype : memtype}(MEM_externtype(memtype)) = $free_memtype(memtype) + def $free_externtype{memtype : memtype}(MEM_externtype(memtype)) = ?($free_memtype(memtype)) -- wf_memtype: `%`(memtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{tabletype : tabletype}(TABLE_externtype(tabletype)) = $free_tabletype(tabletype) + def $free_externtype{tabletype : tabletype}(TABLE_externtype(tabletype)) = ?($free_tabletype(tabletype)) -- wf_tabletype: `%`(tabletype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{typeuse : typeuse}(FUNC_externtype(typeuse)) = $free_typeuse(typeuse) + def $free_externtype{typeuse : typeuse}(FUNC_externtype(typeuse)) = ?($free_typeuse(typeuse)) -- wf_typeuse: `%`(typeuse) + def $free_externtype{x0 : externtype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $free_moduletype(moduletype : moduletype) : free ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_moduletype{`externtype_1*` : externtype*, `externtype_2*` : externtype*}(`%->%`_moduletype(externtype_1*{externtype_1 <- `externtype_1*`}, externtype_2*{externtype_2 <- `externtype_2*`})) = $free_list($free_externtype(externtype_1)*{externtype_1 <- `externtype_1*`}) +++ $free_list($free_externtype(externtype_2)*{externtype_2 <- `externtype_2*`}) + def $free_moduletype{`externtype_1*` : externtype*, `externtype_2*` : externtype*}(`%->%`_moduletype(externtype_1*{externtype_1 <- `externtype_1*`}, externtype_2*{externtype_2 <- `externtype_2*`})) = $free_list(!($free_externtype(externtype_1))*{externtype_1 <- `externtype_1*`}) +++ $free_list(!($free_externtype(externtype_2))*{externtype_2 <- `externtype_2*`}) -- (wf_externtype: `%`(externtype_1))*{externtype_1 <- `externtype_1*`} -- (wf_externtype: `%`(externtype_2))*{externtype_2 <- `externtype_2*`} @@ -5220,7 +5224,7 @@ def $free_type(type : type) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec def $free_tag(tag : tag) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec - def $free_tag{tagtype : typeuse}(TAG_tag(tagtype)) = $free_tagtype(tagtype) + def $free_tag{tagtype : typeuse}(TAG_tag(tagtype)) = !($free_tagtype(tagtype)) -- wf_typeuse: `%`(tagtype) ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec @@ -5304,7 +5308,7 @@ def $free_start(start : start) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec def $free_import(import : import) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec - def $free_import{name_1 : name, name_2 : name, externtype : externtype}(IMPORT_import(name_1, name_2, externtype)) = $free_externtype(externtype) + def $free_import{name_1 : name, name_2 : name, externtype : externtype}(IMPORT_import(name_1, name_2, externtype)) = !($free_externtype(externtype)) -- wf_name: `%`(name_1) -- wf_name: `%`(name_2) -- wf_externtype: `%`(externtype) @@ -6353,8 +6357,9 @@ relation Catch_ok: `%|-%:OK`(context, catch) -- wf_context: `%`(C) -- wf_catch: `%`(CATCH_catch(x, l)) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- if ($as_deftype(C.TAGS_context[x!`%`_uN.0]) =/= ?()) -- if (x!`%`_uN.0 < |C.TAGS_context|) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- if (l!`%`_uN.0 < |C.LABELS_context|) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t*{t <- `t*`}), C.LABELS_context[l!`%`_uN.0]) @@ -6364,8 +6369,9 @@ relation Catch_ok: `%|-%:OK`(context, catch) -- wf_context: `%`(C) -- wf_catch: `%`(CATCH_REF_catch(x, l)) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- if ($as_deftype(C.TAGS_context[x!`%`_uN.0]) =/= ?()) -- if (x!`%`_uN.0 < |C.TAGS_context|) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- if (l!`%`_uN.0 < |C.LABELS_context|) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(), EXN_heaptype)]), C.LABELS_context[l!`%`_uN.0]) @@ -6682,8 +6688,9 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) -- wf_instrtype: `%`(`%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- wf_instrtype: `%`(`%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- if ($as_deftype(C.TAGS_context[x!`%`_uN.0]) =/= ?()) -- if (x!`%`_uN.0 < |C.TAGS_context|) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:171.1-173.42 @@ -8161,11 +8168,12 @@ def $inv_signed_(N : N, int : int) : nat -- if ((- ((2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int) <= i) /\ (i < (0 : nat <:> int))) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec -def $sx(storagetype : storagetype) : sx? +def $sx(storagetype : storagetype) : sx?? ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec - def $sx{consttype : consttype}($storagetype_consttype(consttype)) = ?() + def $sx{consttype : consttype}($storagetype_consttype(consttype)) = ?(?()) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec - def $sx{packtype : packtype}($storagetype_packtype(packtype)) = ?(S_sx) + def $sx{packtype : packtype}($storagetype_packtype(packtype)) = ?(?(S_sx)) + def $sx{x0 : storagetype}(x0) = ?() ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec def $zero(lanetype : lanetype) : lane_ @@ -11838,7 +11846,8 @@ relation `Step_read_before_array.copy-gt`: `%`(config) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- ~ `Step_read_before_array.copy-le`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.COPY_instr(x_1, x_2)])) -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = $sx(zt_2))) + -- if ($sx(zt_2) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = !($sx(zt_2)))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.copy-zero_1`{z : state, a_1 : addr, i_1 : num_, a_2 : addr, i_2 : num_, n : n, x_1 : idx, x_2 : idx}: @@ -11920,7 +11929,8 @@ relation `Step_read_before_array.init_data-zero`: `%`(config) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- if ($proj_num__0(I32_Inn, j) =/= ?()) - -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ($zsize(zt) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-oob1_0`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -11948,7 +11958,8 @@ relation `Step_read_before_array.init_data-num`: `%`(config) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- if ($proj_num__0(I32_Inn, j) =/= ?()) - -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ($zsize(zt) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-oob1_1`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -12660,7 +12671,8 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- if ($proj_num__0(I32_Inn, i) =/= ?()) - -- if ((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ($zsize(zt) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.new_data-num`{z : state, i : num_, n : n, x : idx, y : idx, zt : storagetype, `c*` : lit_*, `mut?` : mut?}: @@ -12671,8 +12683,9 @@ relation Step_read: `%~>%`(config, instr*) -- wf_instr: `%`(ARRAY.NEW_FIXED_instr(x, `%`_u32(n))) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) + -- if ($zsize(zt) =/= ?()) -- if ($proj_num__0(I32_Inn, i) =/= ?()) - -- if ($concatn_(syntax byte, $zbytes_(zt, c)^n{c <- `c*`}, ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, i))!`%`_uN.0 : ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($concatn_(syntax byte, $zbytes_(zt, c)^n{c <- `c*`}, (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, i))!`%`_uN.0 : ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.get-null`{z : state, ht : heaptype, i : num_, `sx?` : sx?, x : idx}: @@ -12803,7 +12816,8 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- ~ `Step_read_before_array.copy-le`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.COPY_instr(x_1, x_2)])) -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = $sx(zt_2))) + -- if ($sx(zt_2) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = !($sx(zt_2)))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.copy-gt`{z : state, a_1 : addr, i_1 : num_, a_2 : addr, i_2 : num_, n : n, x_1 : idx, x_2 : idx, `sx?` : sx?, `mut?` : mut?, zt_2 : storagetype}: @@ -12824,7 +12838,8 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- ~ `Step_read_before_array.copy-gt`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.COPY_instr(x_1, x_2)])) -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if (sx?{sx <- `sx?`} = $sx(zt_2)) + -- if ($sx(zt_2) =/= ?()) + -- if (sx?{sx <- `sx?`} = !($sx(zt_2))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_elem-null`{z : state, ht : heaptype, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -12897,7 +12912,8 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- if ($proj_num__0(I32_Inn, j) =/= ?()) - -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ($zsize(zt) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-zero`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -12908,23 +12924,24 @@ relation Step_read: `%~>%`(config, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-num`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx, zt : storagetype, c : lit_, `mut?` : mut?}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) $const(!($cunpack(zt)), $cunpacknum_(zt, c)) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1)))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat))))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))) ARRAY.INIT_DATA_instr(x, y)]) + `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) $const(!($cunpack(zt)), $cunpacknum_(zt, c)) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1)))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat))))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))) ARRAY.INIT_DATA_instr(x, y)]) -- if ($cunpack(zt) =/= ?()) -- if ($proj_num__0(I32_Inn, i) =/= ?()) -- if ($proj_num__0(I32_Inn, j) =/= ?()) + -- if ($zsize(zt) =/= ?()) -- wf_lit_: `%%`(zt, c) -- wf_config: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)])) -- wf_instr: `%`(REF.ARRAY_ADDR_instr(a)) -- wf_instr: `%`(CONST_instr(I32_numtype, i)) -- wf_instr: `%`(ARRAY.SET_instr(x)) -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1))))) - -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)))))) + -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)))))) -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))))) -- wf_instr: `%`(ARRAY.INIT_DATA_instr(x, y)) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- ~ `Step_read_before_array.init_data-num`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)])) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) - -- if ($zbytes_(zt, c) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, j))!`%`_uN.0 : ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($zbytes_(zt, c) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, j))!`%`_uN.0 : (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rec { @@ -12981,7 +12998,8 @@ relation Step: `%~>%`(config, config) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) -- if (x!`%`_uN.0 < |$tagaddr(z)|) -- wf_exninst: `%`({TAG $tagaddr(z)[x!`%`_uN.0], FIELDS val^n{val <- `val*`}}) - -- Expand: `%~~%`($as_deftype($tag(z, x).TYPE_taginst), `FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) + -- if ($as_deftype($tag(z, x).TYPE_taginst) =/= ?()) + -- Expand: `%~~%`(!($as_deftype($tag(z, x).TYPE_taginst)), `FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) -- if (a = |$exninst(z)|) -- if (exn = {TAG $tagaddr(z)[x!`%`_uN.0], FIELDS val^n{val <- `val*`}}) diff --git a/spectec/test-middlend/specification.07-alias-demut.exp b/spectec/test-middlend/specification.07-alias-demut.exp index 3d553e1e63..8f24b74cf7 100644 --- a/spectec/test-middlend/specification.07-alias-demut.exp +++ b/spectec/test-middlend/specification.07-alias-demut.exp @@ -1462,13 +1462,14 @@ def $lsize(lanetype : lanetype) : nat def $lsize{packtype : packtype}($lanetype_packtype(packtype)) = $psize(packtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $zsize(storagetype : storagetype) : nat +def $zsize(storagetype : storagetype) : nat? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{numtype : numtype}($storagetype_numtype(numtype)) = $size(numtype) + def $zsize{numtype : numtype}($storagetype_numtype(numtype)) = ?($size(numtype)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{vectype : vectype}($storagetype_vectype(vectype)) = $vsize(vectype) + def $zsize{vectype : vectype}($storagetype_vectype(vectype)) = ?($vsize(vectype)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $zsize{packtype : packtype}($storagetype_packtype(packtype)) = $psize(packtype) + def $zsize{packtype : packtype}($storagetype_packtype(packtype)) = ?($psize(packtype)) + def $zsize{x0 : storagetype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $isize(Inn : Inn) : nat @@ -1623,9 +1624,10 @@ def $diffrt(reftype : reftype, reftype : reftype) : reftype -- wf_reftype: `%`(REF_reftype(null_1?{null_1 <- `null_1?`}, ht_1)) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $as_deftype(typeuse : typeuse) : deftype +def $as_deftype(typeuse : typeuse) : deftype? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $as_deftype{dt : deftype}($typeuse_deftype(dt)) = dt + def $as_deftype{dt : deftype}($typeuse_deftype(dt)) = ?(dt) + def $as_deftype{x0 : typeuse}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec rec { @@ -2223,9 +2225,10 @@ def $free_deftype(deftype : deftype) : free } ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $free_tagtype(tagtype : tagtype) : free +def $free_tagtype(tagtype : tagtype) : free? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_tagtype{deftype : deftype}($typeuse_deftype(deftype)) = $free_deftype(deftype) + def $free_tagtype{deftype : deftype}($typeuse_deftype(deftype)) = ?($free_deftype(deftype)) + def $free_tagtype{x0 : tagtype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $free_globaltype(globaltype : globaltype) : free @@ -2259,27 +2262,28 @@ def $free_elemtype(elemtype : elemtype) : free -- wf_reftype: `%`(reftype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec -def $free_externtype(externtype : externtype) : free +def $free_externtype(externtype : externtype) : free? ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{tagtype : typeuse}(TAG_externtype(tagtype)) = $free_tagtype(tagtype) + def $free_externtype{tagtype : typeuse}(TAG_externtype(tagtype)) = ?(!($free_tagtype(tagtype))) -- wf_typeuse: `%`(tagtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{globaltype : globaltype}(GLOBAL_externtype(globaltype)) = $free_globaltype(globaltype) + def $free_externtype{globaltype : globaltype}(GLOBAL_externtype(globaltype)) = ?($free_globaltype(globaltype)) -- wf_globaltype: `%`(globaltype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{memtype : memtype}(MEM_externtype(memtype)) = $free_memtype(memtype) + def $free_externtype{memtype : memtype}(MEM_externtype(memtype)) = ?($free_memtype(memtype)) -- wf_memtype: `%`(memtype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{tabletype : tabletype}(TABLE_externtype(tabletype)) = $free_tabletype(tabletype) + def $free_externtype{tabletype : tabletype}(TABLE_externtype(tabletype)) = ?($free_tabletype(tabletype)) -- wf_tabletype: `%`(tabletype) ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_externtype{typeuse : typeuse}(FUNC_externtype(typeuse)) = $free_typeuse(typeuse) + def $free_externtype{typeuse : typeuse}(FUNC_externtype(typeuse)) = ?($free_typeuse(typeuse)) -- wf_typeuse: `%`(typeuse) + def $free_externtype{x0 : externtype}(x0) = ?() ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec def $free_moduletype(moduletype : moduletype) : free ;; ../../../../specification/wasm-3.0/1.2-syntax.types.spectec - def $free_moduletype{`externtype_1*` : externtype*, `externtype_2*` : externtype*}(`%->%`_moduletype(externtype_1*{externtype_1 <- `externtype_1*`}, externtype_2*{externtype_2 <- `externtype_2*`})) = $free_list($free_externtype(externtype_1)*{externtype_1 <- `externtype_1*`}) +++ $free_list($free_externtype(externtype_2)*{externtype_2 <- `externtype_2*`}) + def $free_moduletype{`externtype_1*` : externtype*, `externtype_2*` : externtype*}(`%->%`_moduletype(externtype_1*{externtype_1 <- `externtype_1*`}, externtype_2*{externtype_2 <- `externtype_2*`})) = $free_list(!($free_externtype(externtype_1))*{externtype_1 <- `externtype_1*`}) +++ $free_list(!($free_externtype(externtype_2))*{externtype_2 <- `externtype_2*`}) -- (wf_externtype: `%`(externtype_1))*{externtype_1 <- `externtype_1*`} -- (wf_externtype: `%`(externtype_2))*{externtype_2 <- `externtype_2*`} @@ -5220,7 +5224,7 @@ def $free_type(type : type) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec def $free_tag(tag : tag) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec - def $free_tag{tagtype : typeuse}(TAG_tag(tagtype)) = $free_tagtype(tagtype) + def $free_tag{tagtype : typeuse}(TAG_tag(tagtype)) = !($free_tagtype(tagtype)) -- wf_typeuse: `%`(tagtype) ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec @@ -5304,7 +5308,7 @@ def $free_start(start : start) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec def $free_import(import : import) : free ;; ../../../../specification/wasm-3.0/1.4-syntax.modules.spectec - def $free_import{name_1 : name, name_2 : name, externtype : externtype}(IMPORT_import(name_1, name_2, externtype)) = $free_externtype(externtype) + def $free_import{name_1 : name, name_2 : name, externtype : externtype}(IMPORT_import(name_1, name_2, externtype)) = !($free_externtype(externtype)) -- wf_name: `%`(name_1) -- wf_name: `%`(name_2) -- wf_externtype: `%`(externtype) @@ -6353,8 +6357,9 @@ relation Catch_ok: `%|-%:OK`(context, catch) -- wf_context: `%`(C) -- wf_catch: `%`(CATCH_catch(x, l)) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- if ($as_deftype(C.TAGS_context[x!`%`_uN.0]) =/= ?()) -- if (x!`%`_uN.0 < |C.TAGS_context|) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- if (l!`%`_uN.0 < |C.LABELS_context|) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t*{t <- `t*`}), C.LABELS_context[l!`%`_uN.0]) @@ -6364,8 +6369,9 @@ relation Catch_ok: `%|-%:OK`(context, catch) -- wf_context: `%`(C) -- wf_catch: `%`(CATCH_REF_catch(x, l)) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- if ($as_deftype(C.TAGS_context[x!`%`_uN.0]) =/= ?()) -- if (x!`%`_uN.0 < |C.TAGS_context|) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- if (l!`%`_uN.0 < |C.LABELS_context|) -- Resulttype_sub: `%|-%<:%`(C, `%`_resulttype(t*{t <- `t*`} ++ [REF_valtype(?(), EXN_heaptype)]), C.LABELS_context[l!`%`_uN.0]) @@ -6682,8 +6688,9 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) -- wf_instrtype: `%`(`%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`} ++ t*{t <- `t*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- wf_instrtype: `%`(`%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) + -- if ($as_deftype(C.TAGS_context[x!`%`_uN.0]) =/= ?()) -- if (x!`%`_uN.0 < |C.TAGS_context|) - -- Expand: `%~~%`($as_deftype(C.TAGS_context[x!`%`_uN.0]), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) + -- Expand: `%~~%`(!($as_deftype(C.TAGS_context[x!`%`_uN.0])), `FUNC%->%`_comptype(`%`_resulttype(t*{t <- `t*`}), `%`_resulttype([]))) -- Instrtype_ok: `%|-%:OK`(C, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), [], `%`_resulttype(t_2*{t_2 <- `t_2*`}))) ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:171.1-173.42 @@ -8161,11 +8168,12 @@ def $inv_signed_(N : N, int : int) : nat -- if ((- ((2 ^ (((N : nat <:> int) - (1 : nat <:> int)) : int <:> nat)) : nat <:> int) <= i) /\ (i < (0 : nat <:> int))) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec -def $sx(storagetype : storagetype) : sx? +def $sx(storagetype : storagetype) : sx?? ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec - def $sx{consttype : consttype}($storagetype_consttype(consttype)) = ?() + def $sx{consttype : consttype}($storagetype_consttype(consttype)) = ?(?()) ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec - def $sx{packtype : packtype}($storagetype_packtype(packtype)) = ?(S_sx) + def $sx{packtype : packtype}($storagetype_packtype(packtype)) = ?(?(S_sx)) + def $sx{x0 : storagetype}(x0) = ?() ;; ../../../../specification/wasm-3.0/3.1-numerics.scalar.spectec def $zero(lanetype : lanetype) : lane_ @@ -11838,7 +11846,8 @@ relation `Step_read_before_array.copy-gt`: `%`(config) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- ~ `Step_read_before_array.copy-le`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.COPY_instr(x_1, x_2)])) -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = $sx(zt_2))) + -- if ($sx(zt_2) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = !($sx(zt_2)))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.copy-zero_1`{z : state, a_1 : addr, i_1 : num_, a_2 : addr, i_2 : num_, n : n, x_1 : idx, x_2 : idx}: @@ -11920,7 +11929,8 @@ relation `Step_read_before_array.init_data-zero`: `%`(config) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- if ($proj_num__0(I32_Inn, j) =/= ?()) - -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ($zsize(zt) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-oob1_0`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -11948,7 +11958,8 @@ relation `Step_read_before_array.init_data-num`: `%`(config) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- if ($proj_num__0(I32_Inn, j) =/= ?()) - -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ($zsize(zt) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-oob1_1`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -12660,7 +12671,8 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- if ($proj_num__0(I32_Inn, i) =/= ?()) - -- if ((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ($zsize(zt) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.new_data-num`{z : state, i : num_, n : n, x : idx, y : idx, zt : storagetype, `c*` : lit_*, `mut?` : mut?}: @@ -12671,8 +12683,9 @@ relation Step_read: `%~>%`(config, instr*) -- wf_instr: `%`(ARRAY.NEW_FIXED_instr(x, `%`_u32(n))) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) + -- if ($zsize(zt) =/= ?()) -- if ($proj_num__0(I32_Inn, i) =/= ?()) - -- if ($concatn_(syntax byte, $zbytes_(zt, c)^n{c <- `c*`}, ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, i))!`%`_uN.0 : ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($concatn_(syntax byte, $zbytes_(zt, c)^n{c <- `c*`}, (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, i))!`%`_uN.0 : ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.get-null`{z : state, ht : heaptype, i : num_, `sx?` : sx?, x : idx}: @@ -12803,7 +12816,8 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- ~ `Step_read_before_array.copy-le`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.COPY_instr(x_1, x_2)])) -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = $sx(zt_2))) + -- if ($sx(zt_2) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, i_1))!`%`_uN.0 <= !($proj_num__0(I32_Inn, i_2))!`%`_uN.0) /\ (sx?{sx <- `sx?`} = !($sx(zt_2)))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.copy-gt`{z : state, a_1 : addr, i_1 : num_, a_2 : addr, i_2 : num_, n : n, x_1 : idx, x_2 : idx, `sx?` : sx?, `mut?` : mut?, zt_2 : storagetype}: @@ -12824,7 +12838,8 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) -- ~ `Step_read_before_array.copy-gt`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a_1) CONST_instr(I32_numtype, i_1) REF.ARRAY_ADDR_instr(a_2) CONST_instr(I32_numtype, i_2) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.COPY_instr(x_1, x_2)])) -- Expand: `%~~%`($type(z, x_2), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt_2))) - -- if (sx?{sx <- `sx?`} = $sx(zt_2)) + -- if ($sx(zt_2) =/= ?()) + -- if (sx?{sx <- `sx?`} = !($sx(zt_2))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_elem-null`{z : state, ht : heaptype, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -12897,7 +12912,8 @@ relation Step_read: `%~>%`(config, instr*) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- if ($proj_num__0(I32_Inn, j) =/= ?()) - -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * $zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) + -- if ($zsize(zt) =/= ?()) + -- if ((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((((n * !($zsize(zt))) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$data(z, y).BYTES_datainst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-zero`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx}: @@ -12908,23 +12924,24 @@ relation Step_read: `%~>%`(config, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `array.init_data-num`{z : state, a : addr, i : num_, j : num_, n : n, x : idx, y : idx, zt : storagetype, c : lit_, `mut?` : mut?}: - `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) $const(!($cunpack(zt)), $cunpacknum_(zt, c)) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1)))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat))))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))) ARRAY.INIT_DATA_instr(x, y)]) + `%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)]), [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) $const(!($cunpack(zt)), $cunpacknum_(zt, c)) ARRAY.SET_instr(x) REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1)))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat))))) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat)))) ARRAY.INIT_DATA_instr(x, y)]) -- if ($cunpack(zt) =/= ?()) -- if ($proj_num__0(I32_Inn, i) =/= ?()) -- if ($proj_num__0(I32_Inn, j) =/= ?()) + -- if ($zsize(zt) =/= ?()) -- wf_lit_: `%%`(zt, c) -- wf_config: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)])) -- wf_instr: `%`(REF.ARRAY_ADDR_instr(a)) -- wf_instr: `%`(CONST_instr(I32_numtype, i)) -- wf_instr: `%`(ARRAY.SET_instr(x)) -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, i))!`%`_uN.0 + 1))))) - -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)))))) + -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((!($proj_num__0(I32_Inn, j))!`%`_uN.0 + (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)))))) -- wf_instr: `%`(CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN((((n : nat <:> int) - (1 : nat <:> int)) : int <:> nat))))) -- wf_instr: `%`(ARRAY.INIT_DATA_instr(x, y)) -- wf_comptype: `%`(ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) -- ~ `Step_read_before_array.init_data-num`: `%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, i) CONST_instr(I32_numtype, j) CONST_instr(I32_numtype, mk_num__0_num_(I32_Inn, `%`_uN(n))) ARRAY.INIT_DATA_instr(x, y)])) -- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_fieldtype(mut?{mut <- `mut?`}, zt))) - -- if ($zbytes_(zt, c) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, j))!`%`_uN.0 : ((($zsize(zt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($zbytes_(zt, c) = $data(z, y).BYTES_datainst[!($proj_num__0(I32_Inn, j))!`%`_uN.0 : (((!($zsize(zt)) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rec { @@ -12981,7 +12998,8 @@ relation Step: `%~>%`(config, config) -- wf_comptype: `%`(`FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) -- if (x!`%`_uN.0 < |$tagaddr(z)|) -- wf_exninst: `%`({TAG $tagaddr(z)[x!`%`_uN.0], FIELDS val^n{val <- `val*`}}) - -- Expand: `%~~%`($as_deftype($tag(z, x).TYPE_taginst), `FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) + -- if ($as_deftype($tag(z, x).TYPE_taginst) =/= ?()) + -- Expand: `%~~%`(!($as_deftype($tag(z, x).TYPE_taginst)), `FUNC%->%`_comptype(`%`_resulttype(t^n{t <- `t*`}), `%`_resulttype([]))) -- if (a = |$exninst(z)|) -- if (exn = {TAG $tagaddr(z)[x!`%`_uN.0], FIELDS val^n{val <- `val*`}})