From 9b57f06e80d4c9946aaedd998aec5015f81cb5a7 Mon Sep 17 00:00:00 2001
From: bobbinth
In a similar manner, we define a value representing the result of hash computation as follows:
--
Note that in the above we use (block address from the current row) rather than (block address from the next row) as we did for for values of and . Also, note that we are not adding a flag indicating whether the block is the first child of a join block (i.e., term is missing). It will be added later on.
++
Above, refers to the value in the IS_LOOP_BODY
column (already constrained to be 0 or 1), located in . Also, note that we are not adding a flag indicating whether the block is the first child of a join block (i.e., term is missing). It will be added later on.
Using the above variables, we define row values to be added to and removed from the block hash table as follows.
When JOIN
operation is executed, hashes of both child nodes are added to the block hash table. We add term to the first child value to differentiate it from the second child (i.e., this sets is_first_child
to ):
@@ -412,11 +412,13 @@
-
When END
operation is executed, hash of the completed block is removed from the block hash table. However, we also need to differentiate between removing the first and the second child of a join block. We do this by looking at the next operation. Specifically, if the next operation is neither END
nor REPEAT
we know that another block is about to be executed, and thus, we have just finished executing the first child of a join block. Thus, if the next operation is neither END
nor REPEAT
we need to set the term for coefficient to as shown below:
+
When the CALL
or SYSCALL
operation is executed, the hash of the callee is added to the block hash table.
+
When END
operation is executed, hash of the completed block is removed from the block hash table. However, we also need to differentiate between removing the first and the second child of a join block. We do this by looking at the next operation. Specifically, if the next operation is neither END
nor REPEAT
nor HALT
, we know that another block is about to be executed, and thus, we have just finished executing the first child of a join block. Thus, if the next operation is neither END
nor REPEAT
nor HALT
we need to set the term for coefficient to as shown below:
Using the above definitions, we can describe the constraint for updating the block hash table as follows:
-+
We need to add and subtract the sum of the relevant operation flags from each side to ensure that when none of the flags is set to , the above constraint reduces to .
The degree of this constraint is .
diff --git a/print.html b/print.html index da170e4a2..73fa0b219 100644 --- a/print.html +++ b/print.html @@ -4319,8 +4319,8 @@In a similar manner, we define a value representing the result of hash computation as follows:
--
Note that in the above we use (block address from the current row) rather than (block address from the next row) as we did for for values of and . Also, note that we are not adding a flag indicating whether the block is the first child of a join block (i.e., term is missing). It will be added later on.
++
Above, refers to the value in the IS_LOOP_BODY
column (already constrained to be 0 or 1), located in . Also, note that we are not adding a flag indicating whether the block is the first child of a join block (i.e., term is missing). It will be added later on.
Using the above variables, we define row values to be added to and removed from the block hash table as follows.
When JOIN
operation is executed, hashes of both child nodes are added to the block hash table. We add term to the first child value to differentiate it from the second child (i.e., this sets is_first_child
to ):
@@ -4333,11 +4333,13 @@
-
When END
operation is executed, hash of the completed block is removed from the block hash table. However, we also need to differentiate between removing the first and the second child of a join block. We do this by looking at the next operation. Specifically, if the next operation is neither END
nor REPEAT
we know that another block is about to be executed, and thus, we have just finished executing the first child of a join block. Thus, if the next operation is neither END
nor REPEAT
we need to set the term for coefficient to as shown below:
+
When the CALL
or SYSCALL
operation is executed, the hash of the callee is added to the block hash table.
+
When END
operation is executed, hash of the completed block is removed from the block hash table. However, we also need to differentiate between removing the first and the second child of a join block. We do this by looking at the next operation. Specifically, if the next operation is neither END
nor REPEAT
nor HALT
, we know that another block is about to be executed, and thus, we have just finished executing the first child of a join block. Thus, if the next operation is neither END
nor REPEAT
nor HALT
we need to set the term for coefficient to as shown below:
Using the above definitions, we can describe the constraint for updating the block hash table as follows:
-+
We need to add and subtract the sum of the relevant operation flags from each side to ensure that when none of the flags is set to , the above constraint reduces to .
The degree of this constraint is .
diff --git a/searchindex.js b/searchindex.js index 9e24ba74c..8b03cc901 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Object.assign(window.search, {"doc_urls":["intro/main.html#introduction","intro/main.html#status-and-features","intro/main.html#feature-highlights","intro/main.html#planned-features","intro/main.html#structure-of-this-document","intro/main.html#license","intro/overview.html#miden-vm-overview","intro/overview.html#writing-programs","intro/overview.html#inputs-and-outputs","intro/overview.html#stack-depth-restrictions","intro/overview.html#nondeterministic-inputs","intro/usage.html#usage","intro/usage.html#cli-interface","intro/usage.html#compiling-miden-vm","intro/usage.html#controlling-parallelism","intro/usage.html#gpu-acceleration","intro/usage.html#simd-acceleration","intro/usage.html#running-miden-vm","intro/usage.html#inputs","intro/usage.html#fibonacci-example","intro/performance.html#performance","intro/performance.html#single-core-prover-performance","intro/performance.html#multi-core-prover-performance","intro/performance.html#recursive-proofs","tools/main.html#development-tools-and-resources","tools/debugger.html#miden-debugger","tools/repl.html#miden-repl","tools/repl.html#miden-assembly-instruction","tools/repl.html#help","tools/repl.html#program","tools/repl.html#stack","tools/repl.html#mem","tools/repl.html#memaddr","tools/repl.html#use","tools/repl.html#undo","user_docs/main.html#user-documentation","user_docs/assembly/main.html#miden-assembly","user_docs/assembly/main.html#terms-and-notations","user_docs/assembly/main.html#design-goals","user_docs/assembly/code_organization.html#code-organization","user_docs/assembly/code_organization.html#procedures","user_docs/assembly/code_organization.html#modules","user_docs/assembly/code_organization.html#constants","user_docs/assembly/code_organization.html#comments","user_docs/assembly/execution_contexts.html#execution-contexts","user_docs/assembly/execution_contexts.html#procedure-invocation-semantics","user_docs/assembly/execution_contexts.html#kernels","user_docs/assembly/execution_contexts.html#memory-layout","user_docs/assembly/execution_contexts.html#example","user_docs/assembly/flow_control.html#flow-control","user_docs/assembly/flow_control.html#conditional-execution","user_docs/assembly/flow_control.html#counter-controlled-loops","user_docs/assembly/flow_control.html#condition-controlled-loops","user_docs/assembly/flow_control.html#no-op","user_docs/assembly/field_operations.html#field-operations","user_docs/assembly/field_operations.html#assertions-and-tests","user_docs/assembly/field_operations.html#arithmetic-and-boolean-operations","user_docs/assembly/field_operations.html#comparison-operations","user_docs/assembly/field_operations.html#extension-field-operations","user_docs/assembly/u32_operations.html#u32-operations","user_docs/assembly/u32_operations.html#notes-on-undefined-behavior","user_docs/assembly/u32_operations.html#conversions-and-tests","user_docs/assembly/u32_operations.html#arithmetic-operations","user_docs/assembly/u32_operations.html#bitwise-operations","user_docs/assembly/u32_operations.html#comparison-operations","user_docs/assembly/stack_manipulation.html#stack-manipulation","user_docs/assembly/stack_manipulation.html#conditional-manipulation","user_docs/assembly/io_operations.html#input--output-operations","user_docs/assembly/io_operations.html#constant-inputs","user_docs/assembly/io_operations.html#environment-inputs","user_docs/assembly/io_operations.html#nondeterministic-inputs","user_docs/assembly/io_operations.html#random-access-memory","user_docs/assembly/cryptographic_operations.html#cryptographic-operations","user_docs/assembly/cryptographic_operations.html#hashing-and-merkle-trees","user_docs/assembly/events.html#events","user_docs/assembly/events.html#tracing","user_docs/assembly/debugging.html#debugging","user_docs/stdlib/main.html#miden-standard-library","user_docs/stdlib/main.html#terms-and-notations","user_docs/stdlib/main.html#organization-and-usage","user_docs/stdlib/main.html#available-modules","user_docs/stdlib/collections.html#collections","user_docs/stdlib/collections.html#merkle-mountain-range","user_docs/stdlib/collections.html#sparse-merkle-tree","user_docs/stdlib/crypto/dsa.html#digital-signatures","user_docs/stdlib/crypto/dsa.html#rpo-falcon512","user_docs/stdlib/crypto/fri.html#fri-verification-procedures","user_docs/stdlib/crypto/fri.html#fri-extension-2-fold-4","user_docs/stdlib/crypto/hashes.html#cryptographic-hashes","user_docs/stdlib/crypto/hashes.html#blake3","user_docs/stdlib/crypto/hashes.html#sha256","user_docs/stdlib/math/u64.html#unsigned-64-bit-integer-operations","user_docs/stdlib/math/u64.html#arithmetic-operations","user_docs/stdlib/math/u64.html#comparison-operations","user_docs/stdlib/math/u64.html#bitwise-operations","user_docs/stdlib/mem.html#memory-procedures","user_docs/stdlib/sys.html#system-procedures","design/main.html#design","design/main.html#vm-components","design/main.html#vm-execution-trace","design/programs.html#programs-in-miden-vm","design/programs.html#code-blocks","design/programs.html#join-block","design/programs.html#split-block","design/programs.html#loop-block","design/programs.html#dyn-block","design/programs.html#call-block","design/programs.html#syscall-block","design/programs.html#span-block","design/programs.html#program-example","design/programs.html#program-hash-computation","design/decoder/main.html#miden-vm-program-decoder","design/decoder/main.html#program-execution","design/decoder/main.html#decoder-structure","design/decoder/main.html#decoder-trace","design/decoder/main.html#program-block-hashing","design/decoder/main.html#control-flow-tables","design/decoder/main.html#control-flow-operation-semantics","design/decoder/main.html#program-decoding","design/decoder/main.html#join-block-decoding","design/decoder/main.html#split-block-decoding","design/decoder/main.html#loop-block-decoding","design/decoder/main.html#dyn-block-decoding","design/decoder/main.html#span-block-decoding","design/decoder/main.html#program-decoding-example","design/decoder/constraints.html#miden-vm-decoder-air-constraints","design/decoder/constraints.html#general-constraints","design/decoder/constraints.html#block-hash-computation-constraints","design/decoder/constraints.html#chiplets-bus-constraints","design/decoder/constraints.html#block-stack-table-constraints","design/decoder/constraints.html#block-hash-table-constraints","design/decoder/constraints.html#span-block","design/decoder/constraints.html#in-span-column-constraints","design/decoder/constraints.html#block-address-constraints","design/decoder/constraints.html#group-count-constraints","design/decoder/constraints.html#op-group-decoding-constraints","design/decoder/constraints.html#op-index-constraints","design/decoder/constraints.html#op-batch-flags-constraints","design/decoder/constraints.html#op-group-table-constraints","design/stack/main.html#operand-stack","design/stack/main.html#stack-representation","design/stack/main.html#overflow-table","design/stack/main.html#right-shift","design/stack/main.html#left-shift","design/stack/main.html#air-constraints","design/stack/main.html#stack-overflow-flag","design/stack/main.html#stack-depth-constraints","design/stack/main.html#overflow-table-constraints","design/stack/main.html#boundary-constraints","design/stack/op_constraints.html#stack-operation-constraints","design/stack/op_constraints.html#operation-flags","design/stack/op_constraints.html#no-stack-shift-operations","design/stack/op_constraints.html#left-stack-shift-operations","design/stack/op_constraints.html#right-stack-shift-operations","design/stack/op_constraints.html#u32-operations","design/stack/op_constraints.html#high-degree-operations","design/stack/op_constraints.html#very-high-degree-operations","design/stack/op_constraints.html#composite-flags","design/stack/op_constraints.html#shift-right-flag","design/stack/op_constraints.html#shift-left-flag","design/stack/op_constraints.html#control-flow-flag","design/stack/op_constraints.html#immediate-value-flag","design/stack/system_ops.html#system-operations","design/stack/system_ops.html#noop","design/stack/system_ops.html#emit","design/stack/system_ops.html#assert","design/stack/system_ops.html#fmpadd","design/stack/system_ops.html#fmpupdate","design/stack/system_ops.html#clk","design/stack/field_ops.html#field-operations","design/stack/field_ops.html#add","design/stack/field_ops.html#neg","design/stack/field_ops.html#mul","design/stack/field_ops.html#inv","design/stack/field_ops.html#incr","design/stack/field_ops.html#not","design/stack/field_ops.html#and","design/stack/field_ops.html#or","design/stack/field_ops.html#eq","design/stack/field_ops.html#eqz","design/stack/field_ops.html#expacc","design/stack/field_ops.html#ext2mul","design/stack/u32_ops.html#u32-operations","design/stack/u32_ops.html#range-checks","design/stack/u32_ops.html#checking-element-validity","design/stack/u32_ops.html#u32split","design/stack/u32_ops.html#u32assert2","design/stack/u32_ops.html#u32add","design/stack/u32_ops.html#u32add3","design/stack/u32_ops.html#u32sub","design/stack/u32_ops.html#u32mul","design/stack/u32_ops.html#u32madd","design/stack/u32_ops.html#u32div","design/stack/u32_ops.html#u32and","design/stack/u32_ops.html#u32xor","design/stack/stack_ops.html#stack-manipulation","design/stack/stack_ops.html#pad","design/stack/stack_ops.html#drop","design/stack/stack_ops.html#dupn","design/stack/stack_ops.html#swap","design/stack/stack_ops.html#swapw","design/stack/stack_ops.html#swapw2","design/stack/stack_ops.html#swapw3","design/stack/stack_ops.html#swapdw","design/stack/stack_ops.html#movupn","design/stack/stack_ops.html#movdnn","design/stack/stack_ops.html#cswap","design/stack/stack_ops.html#cswapw","design/stack/io_ops.html#input--output-operations","design/stack/io_ops.html#push","design/stack/io_ops.html#sdepth","design/stack/io_ops.html#advpop","design/stack/io_ops.html#advpopw","design/stack/io_ops.html#memory-access-operations","design/stack/io_ops.html#mloadw","design/stack/io_ops.html#mload","design/stack/io_ops.html#mstorew","design/stack/io_ops.html#mstore","design/stack/io_ops.html#mstream","design/stack/crypto_ops.html#cryptographic-operations","design/stack/crypto_ops.html#hperm","design/stack/crypto_ops.html#mpverify","design/stack/crypto_ops.html#mrupdate","design/stack/crypto_ops.html#frie2f4","design/stack/crypto_ops.html#rcombbase","design/range.html#range-checker","design/range.html#8-bit-range-checks","design/range.html#a-better-construction","design/range.html#16-bit-range-checks","design/range.html#miden-approach","design/range.html#requirements","design/range.html#capabilities","design/range.html#execution-trace","design/range.html#execution-trace-constraints","design/range.html#communication-bus","design/chiplets/main.html#chiplets","design/chiplets/main.html#chiplets-module-trace","design/chiplets/main.html#chiplets-order","design/chiplets/main.html#additional-requirements-for-stacking-execution-traces","design/chiplets/main.html#operation-labels","design/chiplets/main.html#chiplets-module-constraints","design/chiplets/main.html#chiplet-constraints","design/chiplets/main.html#chiplet-selector-constraints","design/chiplets/main.html#chiplets-bus","design/chiplets/main.html#chiplets-bus-constraints","design/chiplets/main.html#chiplets-virtual-table","design/chiplets/main.html#chiplets-virtual-table-constraints","design/chiplets/hasher.html#hash-chiplet","design/chiplets/hasher.html#chiplet-trace","design/chiplets/hasher.html#instruction-flags","design/chiplets/hasher.html#computation-examples","design/chiplets/hasher.html#single-permutation","design/chiplets/hasher.html#simple-2-to-1-hash","design/chiplets/hasher.html#linear-hash-of-n-elements","design/chiplets/hasher.html#verify-merkle-path","design/chiplets/hasher.html#update-merkle-root","design/chiplets/hasher.html#air-constraints","design/chiplets/hasher.html#selector-columns-constraints","design/chiplets/hasher.html#node-index-constraints","design/chiplets/hasher.html#hasher-state-constraints","design/chiplets/hasher.html#multiset-check-constraints","design/chiplets/bitwise.html#bitwise-chiplet","design/chiplets/bitwise.html#example","design/chiplets/bitwise.html#constraints","design/chiplets/bitwise.html#selectors","design/chiplets/bitwise.html#input-decomposition","design/chiplets/bitwise.html#output-aggregation","design/chiplets/bitwise.html#chiplets-bus-constraints","design/chiplets/memory.html#memory-chiplet","design/chiplets/memory.html#alternative-designs","design/chiplets/memory.html#read-write-memory","design/chiplets/memory.html#non-contiguous-memory","design/chiplets/memory.html#context-separation","design/chiplets/memory.html#miden-approach","design/chiplets/memory.html#air-constraints","design/chiplets/kernel_rom.html#kernel-rom-chiplet","design/chiplets/kernel_rom.html#kernel-rom-trace","design/chiplets/kernel_rom.html#constraints","design/chiplets/kernel_rom.html#chiplets-bus-constraints","design/chiplets/kernel_rom.html#kernel-procedure-table-constraints","design/lookups/main.html#lookup-arguments-in-miden-vm","design/lookups/main.html#virtual-tables-in-miden-vm","design/lookups/main.html#communication-buses-in-miden-vm","design/lookups/main.html#length-of-auxiliary-columns-for-lookup-arguments","design/lookups/main.html#cost-of-auxiliary-columns-for-lookup-arguments","design/lookups/multiset.html#multiset-checks","design/lookups/multiset.html#running-product-columns","design/lookups/multiset.html#virtual-tables","design/lookups/multiset.html#computing-a-virtual-tables-trace-column","design/lookups/multiset.html#virtual-tables-in-miden-vm","design/lookups/multiset.html#communication-buses-via-multiset-checks","design/lookups/multiset.html#communication-bus-constraints","design/lookups/multiset.html#communication-buses-in-miden-vm","design/lookups/logup.html#logup-multivariate-lookups-with-logarithmic-derivatives","design/lookups/logup.html#usage-in-miden-vm","design/lookups/logup.html#constraints","design/lookups/logup.html#extending-the-construction-to-multiple-components","design/lookups/logup.html#extending-the-construction-with-flags","background.html#background-material"],"index":{"documentStore":{"docInfo":{"0":{"body":34,"breadcrumbs":2,"title":1},"1":{"body":53,"breadcrumbs":3,"title":2},"10":{"body":115,"breadcrumbs":4,"title":2},"100":{"body":48,"breadcrumbs":5,"title":3},"101":{"body":0,"breadcrumbs":4,"title":2},"102":{"body":27,"breadcrumbs":4,"title":2},"103":{"body":41,"breadcrumbs":4,"title":2},"104":{"body":67,"breadcrumbs":4,"title":2},"105":{"body":54,"breadcrumbs":4,"title":2},"106":{"body":82,"breadcrumbs":4,"title":2},"107":{"body":85,"breadcrumbs":4,"title":2},"108":{"body":196,"breadcrumbs":4,"title":2},"109":{"body":200,"breadcrumbs":4,"title":2},"11":{"body":72,"breadcrumbs":3,"title":1},"110":{"body":239,"breadcrumbs":5,"title":3},"111":{"body":131,"breadcrumbs":7,"title":4},"112":{"body":215,"breadcrumbs":5,"title":2},"113":{"body":45,"breadcrumbs":5,"title":2},"114":{"body":183,"breadcrumbs":5,"title":2},"115":{"body":298,"breadcrumbs":6,"title":3},"116":{"body":516,"breadcrumbs":6,"title":3},"117":{"body":899,"breadcrumbs":7,"title":4},"118":{"body":91,"breadcrumbs":5,"title":2},"119":{"body":59,"breadcrumbs":6,"title":3},"12":{"body":0,"breadcrumbs":4,"title":2},"120":{"body":54,"breadcrumbs":6,"title":3},"121":{"body":227,"breadcrumbs":6,"title":3},"122":{"body":60,"breadcrumbs":6,"title":3},"123":{"body":1067,"breadcrumbs":6,"title":3},"124":{"body":292,"breadcrumbs":6,"title":3},"125":{"body":312,"breadcrumbs":10,"title":5},"126":{"body":147,"breadcrumbs":7,"title":2},"127":{"body":153,"breadcrumbs":9,"title":4},"128":{"body":448,"breadcrumbs":8,"title":3},"129":{"body":317,"breadcrumbs":9,"title":4},"13":{"body":38,"breadcrumbs":5,"title":3},"130":{"body":436,"breadcrumbs":9,"title":4},"131":{"body":26,"breadcrumbs":7,"title":2},"132":{"body":135,"breadcrumbs":8,"title":3},"133":{"body":70,"breadcrumbs":8,"title":3},"134":{"body":189,"breadcrumbs":8,"title":3},"135":{"body":226,"breadcrumbs":9,"title":4},"136":{"body":133,"breadcrumbs":8,"title":3},"137":{"body":150,"breadcrumbs":9,"title":4},"138":{"body":362,"breadcrumbs":9,"title":4},"139":{"body":120,"breadcrumbs":5,"title":2},"14":{"body":18,"breadcrumbs":4,"title":2},"140":{"body":80,"breadcrumbs":5,"title":2},"141":{"body":172,"breadcrumbs":5,"title":2},"142":{"body":172,"breadcrumbs":5,"title":2},"143":{"body":114,"breadcrumbs":5,"title":2},"144":{"body":59,"breadcrumbs":5,"title":2},"145":{"body":58,"breadcrumbs":6,"title":3},"146":{"body":51,"breadcrumbs":6,"title":3},"147":{"body":132,"breadcrumbs":6,"title":3},"148":{"body":27,"breadcrumbs":5,"title":2},"149":{"body":181,"breadcrumbs":8,"title":3},"15":{"body":48,"breadcrumbs":4,"title":2},"150":{"body":312,"breadcrumbs":7,"title":2},"151":{"body":216,"breadcrumbs":8,"title":3},"152":{"body":129,"breadcrumbs":9,"title":4},"153":{"body":133,"breadcrumbs":9,"title":4},"154":{"body":167,"breadcrumbs":7,"title":2},"155":{"body":168,"breadcrumbs":8,"title":3},"156":{"body":111,"breadcrumbs":9,"title":4},"157":{"body":13,"breadcrumbs":7,"title":2},"158":{"body":41,"breadcrumbs":8,"title":3},"159":{"body":93,"breadcrumbs":8,"title":3},"16":{"body":61,"breadcrumbs":4,"title":2},"160":{"body":37,"breadcrumbs":8,"title":3},"161":{"body":28,"breadcrumbs":8,"title":3},"162":{"body":8,"breadcrumbs":7,"title":2},"163":{"body":34,"breadcrumbs":6,"title":1},"164":{"body":58,"breadcrumbs":6,"title":1},"165":{"body":33,"breadcrumbs":6,"title":1},"166":{"body":35,"breadcrumbs":6,"title":1},"167":{"body":31,"breadcrumbs":6,"title":1},"168":{"body":30,"breadcrumbs":6,"title":1},"169":{"body":14,"breadcrumbs":7,"title":2},"17":{"body":158,"breadcrumbs":5,"title":3},"170":{"body":30,"breadcrumbs":6,"title":1},"171":{"body":28,"breadcrumbs":6,"title":1},"172":{"body":30,"breadcrumbs":6,"title":1},"173":{"body":34,"breadcrumbs":6,"title":1},"174":{"body":28,"breadcrumbs":6,"title":1},"175":{"body":41,"breadcrumbs":5,"title":0},"176":{"body":46,"breadcrumbs":5,"title":0},"177":{"body":46,"breadcrumbs":5,"title":0},"178":{"body":56,"breadcrumbs":6,"title":1},"179":{"body":54,"breadcrumbs":6,"title":1},"18":{"body":177,"breadcrumbs":3,"title":1},"180":{"body":85,"breadcrumbs":6,"title":1},"181":{"body":71,"breadcrumbs":6,"title":1},"182":{"body":17,"breadcrumbs":7,"title":2},"183":{"body":111,"breadcrumbs":7,"title":2},"184":{"body":113,"breadcrumbs":8,"title":3},"185":{"body":95,"breadcrumbs":6,"title":1},"186":{"body":76,"breadcrumbs":6,"title":1},"187":{"body":83,"breadcrumbs":6,"title":1},"188":{"body":85,"breadcrumbs":6,"title":1},"189":{"body":83,"breadcrumbs":6,"title":1},"19":{"body":63,"breadcrumbs":4,"title":2},"190":{"body":98,"breadcrumbs":6,"title":1},"191":{"body":114,"breadcrumbs":6,"title":1},"192":{"body":70,"breadcrumbs":6,"title":1},"193":{"body":74,"breadcrumbs":6,"title":1},"194":{"body":77,"breadcrumbs":6,"title":1},"195":{"body":9,"breadcrumbs":7,"title":2},"196":{"body":28,"breadcrumbs":6,"title":1},"197":{"body":35,"breadcrumbs":6,"title":1},"198":{"body":62,"breadcrumbs":6,"title":1},"199":{"body":30,"breadcrumbs":6,"title":1},"2":{"body":250,"breadcrumbs":3,"title":2},"20":{"body":124,"breadcrumbs":3,"title":1},"200":{"body":33,"breadcrumbs":6,"title":1},"201":{"body":36,"breadcrumbs":6,"title":1},"202":{"body":36,"breadcrumbs":6,"title":1},"203":{"body":33,"breadcrumbs":6,"title":1},"204":{"body":71,"breadcrumbs":6,"title":1},"205":{"body":70,"breadcrumbs":6,"title":1},"206":{"body":60,"breadcrumbs":6,"title":1},"207":{"body":62,"breadcrumbs":6,"title":1},"208":{"body":24,"breadcrumbs":9,"title":3},"209":{"body":38,"breadcrumbs":7,"title":1},"21":{"body":207,"breadcrumbs":6,"title":4},"210":{"body":37,"breadcrumbs":7,"title":1},"211":{"body":38,"breadcrumbs":7,"title":1},"212":{"body":49,"breadcrumbs":7,"title":1},"213":{"body":73,"breadcrumbs":9,"title":3},"214":{"body":90,"breadcrumbs":7,"title":1},"215":{"body":95,"breadcrumbs":7,"title":1},"216":{"body":90,"breadcrumbs":7,"title":1},"217":{"body":102,"breadcrumbs":7,"title":1},"218":{"body":100,"breadcrumbs":7,"title":1},"219":{"body":54,"breadcrumbs":7,"title":2},"22":{"body":116,"breadcrumbs":6,"title":4},"220":{"body":118,"breadcrumbs":6,"title":1},"221":{"body":169,"breadcrumbs":6,"title":1},"222":{"body":204,"breadcrumbs":6,"title":1},"223":{"body":281,"breadcrumbs":6,"title":1},"224":{"body":248,"breadcrumbs":6,"title":1},"225":{"body":65,"breadcrumbs":5,"title":2},"226":{"body":213,"breadcrumbs":7,"title":4},"227":{"body":86,"breadcrumbs":5,"title":2},"228":{"body":130,"breadcrumbs":7,"title":4},"229":{"body":7,"breadcrumbs":5,"title":2},"23":{"body":157,"breadcrumbs":4,"title":2},"230":{"body":34,"breadcrumbs":4,"title":1},"231":{"body":32,"breadcrumbs":4,"title":1},"232":{"body":64,"breadcrumbs":5,"title":2},"233":{"body":35,"breadcrumbs":6,"title":3},"234":{"body":174,"breadcrumbs":5,"title":2},"235":{"body":98,"breadcrumbs":3,"title":1},"236":{"body":121,"breadcrumbs":5,"title":3},"237":{"body":101,"breadcrumbs":4,"title":2},"238":{"body":137,"breadcrumbs":7,"title":5},"239":{"body":121,"breadcrumbs":4,"title":2},"24":{"body":59,"breadcrumbs":5,"title":3},"240":{"body":0,"breadcrumbs":5,"title":3},"241":{"body":75,"breadcrumbs":4,"title":2},"242":{"body":116,"breadcrumbs":5,"title":3},"243":{"body":123,"breadcrumbs":4,"title":2},"244":{"body":52,"breadcrumbs":5,"title":3},"245":{"body":65,"breadcrumbs":5,"title":3},"246":{"body":86,"breadcrumbs":6,"title":4},"247":{"body":313,"breadcrumbs":6,"title":2},"248":{"body":331,"breadcrumbs":6,"title":2},"249":{"body":266,"breadcrumbs":6,"title":2},"25":{"body":212,"breadcrumbs":5,"title":2},"250":{"body":0,"breadcrumbs":6,"title":2},"251":{"body":73,"breadcrumbs":6,"title":2},"252":{"body":84,"breadcrumbs":8,"title":4},"253":{"body":143,"breadcrumbs":8,"title":4},"254":{"body":197,"breadcrumbs":7,"title":3},"255":{"body":215,"breadcrumbs":7,"title":3},"256":{"body":30,"breadcrumbs":6,"title":2},"257":{"body":98,"breadcrumbs":7,"title":3},"258":{"body":148,"breadcrumbs":7,"title":3},"259":{"body":105,"breadcrumbs":7,"title":3},"26":{"body":87,"breadcrumbs":5,"title":2},"260":{"body":559,"breadcrumbs":7,"title":3},"261":{"body":227,"breadcrumbs":6,"title":2},"262":{"body":180,"breadcrumbs":5,"title":1},"263":{"body":24,"breadcrumbs":5,"title":1},"264":{"body":24,"breadcrumbs":5,"title":1},"265":{"body":117,"breadcrumbs":6,"title":2},"266":{"body":86,"breadcrumbs":6,"title":2},"267":{"body":114,"breadcrumbs":7,"title":3},"268":{"body":66,"breadcrumbs":6,"title":2},"269":{"body":139,"breadcrumbs":6,"title":2},"27":{"body":55,"breadcrumbs":6,"title":3},"270":{"body":228,"breadcrumbs":7,"title":3},"271":{"body":147,"breadcrumbs":7,"title":3},"272":{"body":230,"breadcrumbs":6,"title":2},"273":{"body":418,"breadcrumbs":6,"title":2},"274":{"body":253,"breadcrumbs":6,"title":2},"275":{"body":38,"breadcrumbs":8,"title":3},"276":{"body":54,"breadcrumbs":8,"title":3},"277":{"body":103,"breadcrumbs":6,"title":1},"278":{"body":85,"breadcrumbs":8,"title":3},"279":{"body":101,"breadcrumbs":9,"title":4},"28":{"body":8,"breadcrumbs":4,"title":1},"280":{"body":144,"breadcrumbs":7,"title":4},"281":{"body":44,"breadcrumbs":7,"title":4},"282":{"body":117,"breadcrumbs":7,"title":4},"283":{"body":53,"breadcrumbs":8,"title":5},"284":{"body":42,"breadcrumbs":8,"title":5},"285":{"body":17,"breadcrumbs":7,"title":2},"286":{"body":72,"breadcrumbs":8,"title":3},"287":{"body":105,"breadcrumbs":7,"title":2},"288":{"body":58,"breadcrumbs":10,"title":5},"289":{"body":40,"breadcrumbs":9,"title":4},"29":{"body":25,"breadcrumbs":4,"title":1},"290":{"body":111,"breadcrumbs":10,"title":5},"291":{"body":105,"breadcrumbs":8,"title":3},"292":{"body":35,"breadcrumbs":9,"title":4},"293":{"body":113,"breadcrumbs":9,"title":5},"294":{"body":28,"breadcrumbs":7,"title":3},"295":{"body":83,"breadcrumbs":5,"title":1},"296":{"body":40,"breadcrumbs":8,"title":4},"297":{"body":45,"breadcrumbs":7,"title":3},"298":{"body":117,"breadcrumbs":4,"title":2},"3":{"body":69,"breadcrumbs":3,"title":2},"30":{"body":57,"breadcrumbs":4,"title":1},"31":{"body":48,"breadcrumbs":4,"title":1},"32":{"body":24,"breadcrumbs":4,"title":1},"33":{"body":42,"breadcrumbs":4,"title":1},"34":{"body":110,"breadcrumbs":4,"title":1},"35":{"body":57,"breadcrumbs":4,"title":2},"36":{"body":165,"breadcrumbs":6,"title":2},"37":{"body":79,"breadcrumbs":6,"title":2},"38":{"body":160,"breadcrumbs":6,"title":2},"39":{"body":53,"breadcrumbs":8,"title":2},"4":{"body":78,"breadcrumbs":3,"title":2},"40":{"body":396,"breadcrumbs":7,"title":1},"41":{"body":324,"breadcrumbs":7,"title":1},"42":{"body":110,"breadcrumbs":7,"title":1},"43":{"body":37,"breadcrumbs":7,"title":1},"44":{"body":96,"breadcrumbs":8,"title":2},"45":{"body":270,"breadcrumbs":9,"title":3},"46":{"body":90,"breadcrumbs":7,"title":1},"47":{"body":138,"breadcrumbs":8,"title":2},"48":{"body":274,"breadcrumbs":7,"title":1},"49":{"body":26,"breadcrumbs":8,"title":2},"5":{"body":4,"breadcrumbs":2,"title":1},"50":{"body":256,"breadcrumbs":8,"title":2},"51":{"body":50,"breadcrumbs":9,"title":3},"52":{"body":91,"breadcrumbs":9,"title":3},"53":{"body":55,"breadcrumbs":7,"title":1},"54":{"body":53,"breadcrumbs":8,"title":2},"55":{"body":61,"breadcrumbs":8,"title":2},"56":{"body":151,"breadcrumbs":9,"title":3},"57":{"body":86,"breadcrumbs":8,"title":2},"58":{"body":73,"breadcrumbs":9,"title":3},"59":{"body":54,"breadcrumbs":8,"title":2},"6":{"body":173,"breadcrumbs":5,"title":3},"60":{"body":246,"breadcrumbs":9,"title":3},"61":{"body":72,"breadcrumbs":8,"title":2},"62":{"body":177,"breadcrumbs":8,"title":2},"63":{"body":196,"breadcrumbs":8,"title":2},"64":{"body":82,"breadcrumbs":8,"title":2},"65":{"body":235,"breadcrumbs":8,"title":2},"66":{"body":56,"breadcrumbs":8,"title":2},"67":{"body":120,"breadcrumbs":10,"title":3},"68":{"body":93,"breadcrumbs":9,"title":2},"69":{"body":77,"breadcrumbs":9,"title":2},"7":{"body":56,"breadcrumbs":4,"title":2},"70":{"body":427,"breadcrumbs":9,"title":2},"71":{"body":346,"breadcrumbs":10,"title":3},"72":{"body":13,"breadcrumbs":8,"title":2},"73":{"body":266,"breadcrumbs":9,"title":3},"74":{"body":78,"breadcrumbs":6,"title":1},"75":{"body":40,"breadcrumbs":6,"title":1},"76":{"body":145,"breadcrumbs":6,"title":1},"77":{"body":59,"breadcrumbs":8,"title":3},"78":{"body":79,"breadcrumbs":7,"title":2},"79":{"body":47,"breadcrumbs":7,"title":2},"8":{"body":137,"breadcrumbs":4,"title":2},"80":{"body":87,"breadcrumbs":7,"title":2},"81":{"body":25,"breadcrumbs":7,"title":1},"82":{"body":144,"breadcrumbs":9,"title":3},"83":{"body":159,"breadcrumbs":9,"title":3},"84":{"body":19,"breadcrumbs":8,"title":2},"85":{"body":114,"breadcrumbs":8,"title":2},"86":{"body":7,"breadcrumbs":9,"title":3},"87":{"body":210,"breadcrumbs":11,"title":5},"88":{"body":9,"breadcrumbs":8,"title":2},"89":{"body":83,"breadcrumbs":7,"title":1},"9":{"body":44,"breadcrumbs":5,"title":3},"90":{"body":83,"breadcrumbs":7,"title":1},"91":{"body":108,"breadcrumbs":11,"title":5},"92":{"body":320,"breadcrumbs":8,"title":2},"93":{"body":320,"breadcrumbs":8,"title":2},"94":{"body":418,"breadcrumbs":8,"title":2},"95":{"body":124,"breadcrumbs":8,"title":2},"96":{"body":58,"breadcrumbs":8,"title":2},"97":{"body":187,"breadcrumbs":2,"title":1},"98":{"body":151,"breadcrumbs":3,"title":2},"99":{"body":103,"breadcrumbs":4,"title":3}},"docs":{"0":{"body":"Miden VM is a zero-knowledge virtual machine written in Rust. For any program executed on Miden VM, a STARK-based proof of execution is automatically generated. This proof can then be used by anyone to verify that the program was executed correctly without the need for re-executing the program or even knowing the contents of the program.","breadcrumbs":"Introduction » Introduction","id":"0","title":"Introduction"},"1":{"body":"Miden VM is currently on release v0.10. In this release, most of the core features of the VM have been stabilized, and most of the STARK proof generation has been implemented. While we expect to keep making changes to the VM internals, the external interfaces should remain relatively stable, and we will do our best to minimize the amount of breaking changes going forward. At this point, Miden VM is good enough for experimentation, and even for real-world applications, but it is not yet ready for production use. The codebase has not been audited and contains known and unknown bugs and security flaws.","breadcrumbs":"Introduction » Status and features","id":"1","title":"Status and features"},"10":{"body":"The advice provider component is responsible for supplying nondeterministic inputs to the VM. These inputs only need to be known to the prover (i.e., they do not need to be shared with the verifier). The advice provider consists of three components: Advice stack which is a one-dimensional array of field elements. Being a stack, the VM can either push new elements onto the advice stack, or pop the elements from its top. Advice map which is a key-value map where keys are words and values are vectors of field elements. The VM can copy values from the advice map onto the advice stack as well as insert new values into the advice map (e.g., from a region of memory). Merkle store which contain structured data reducible to Merkle paths. Some examples of such structures are: Merkle tree, Sparse Merkle Tree, and a collection of Merkle paths. The VM can request Merkle paths from the Merkle store, as well as mutate it by updating or merging nodes contained in the store. The prover initializes the advice provider prior to executing a program, and from that point on the advice provider is manipulated solely by executing operations on the VM.","breadcrumbs":"Introduction » Overview » Nondeterministic inputs","id":"10","title":"Nondeterministic inputs"},"100":{"body":"Miden VM consumes programs in a form of a Merkelized Abstract Syntax Tree (MAST). This tree is a binary tree where each node is a code block . The VM starts execution at the root of the tree, and attempts to recursively execute each required block according to its semantics. If the execution of a code block fails, the VM halts at that point and no further blocks are executed. A set of currently available blocks and their execution semantics are described below.","breadcrumbs":"Design » Programs » Programs in Miden VM","id":"100","title":"Programs in Miden VM"},"101":{"body":"","breadcrumbs":"Design » Programs » Code blocks","id":"101","title":"Code blocks"},"102":{"body":"A join block is used to describe sequential execution. When the VM encounters a join block, it executes its left child first, and then executes its right child. join_block A join block must always have two children, and thus, cannot be a leaf node in the tree.","breadcrumbs":"Design » Programs » Join block","id":"102","title":"Join block"},"103":{"body":"A split block is used to describe conditional execution. When the VM encounters a split block, it checks the top of the stack. If the top of the stack is 1, it executes the left child, if the top of the stack is 0, it executes the right child. If the top of the stack is neither 0 nor 1, the execution fails. split_block A split block must always have two children, and thus, cannot be a leaf node in the tree.","breadcrumbs":"Design » Programs » Split block","id":"103","title":"Split block"},"104":{"body":"A loop block is used to describe condition-based iterative execution. When the VM encounters a loop block, it checks the top of the stack. If the top of the stack is 1, it executes the loop body, if the top of the stack is 0, the block is not executed. If the top of the stack is neither 0 nor 1, the execution fails. After the body of the loop is executed, the VM checks the top of the stack again. If the top of the stack is 1, the body is executed again, if the top of the stack is 0, the loop is exited. If the top of the stack is neither 0 nor 1, the execution fails. loop_block A loop block must always have one child, and thus, cannot be a leaf node in the tree.","breadcrumbs":"Design » Programs » Loop block","id":"104","title":"Loop block"},"105":{"body":"A dyn block is used to describe a node whose target is specified dynamically via the stack. When the VM encounters a dyn block, it executes a program which hashes to the target specified by the top of the stack. Thus, it has a dynamic target rather than a hardcoded target. In order to execute a dyn block, the VM must be aware of a program with the hash value that is specified by the top of the stack. Otherwise, the execution fails. dyn_block A dyn block must always have one (dynamically-specified) child. Thus, it cannot be a leaf node in the tree.","breadcrumbs":"Design » Programs » Dyn block","id":"105","title":"Dyn block"},"106":{"body":"A call block is used to describe a function call which is executed in a user context . When the VM encounters a call block, it creates a new user context, then executes a program which hashes to the target specified by the call block in the new context. Thus, in order to execute a call block, the VM must be aware of a program with the specified hash. Otherwise, the execution fails. At the end of the call block, execution returns to the previous context. When executing a call block, the VM does the following: Checks if a syscall is already being executed and fails if so. Sets the depth of the stack to 16. Upon return, checks that the depth of the stack is 16. If so, the original stack depth is restored. Otherwise, an error occurs. call_block A call block does not have any children. Thus, it must be leaf node in the tree.","breadcrumbs":"Design » Programs » Call block","id":"106","title":"Call block"},"107":{"body":"A syscall block is used to describe a function call which is executed in the root context . When the VM encounters a syscall block, it returns to the root context, then executes a program which hashes to the target specified by the syscall block. Thus, in order to execute a syscall block, the VM must be aware of a program with the specified hash, and that program must belong to the kernel against which the code is compiled. Otherwise, the execution fails. At the end of the syscall block, execution returns to the previous context. When executing a syscall block, the VM does the following: Checks if a syscall is already being executed and fails if so. Sets the depth of the stack to 16. Upon return, checks that the depth of the stack is 16. If so, the original stack depth is restored. Otherwise, an error occurs. syscall_block A syscall block does not have any children. Thus, it must be leaf node in the tree.","breadcrumbs":"Design » Programs » Syscall block","id":"107","title":"Syscall block"},"108":{"body":"A span block is used to describe a linear sequence of operations. When the VM encounters a span block, it breaks the sequence of operations into batches and groups according to the following rules: A group is represented by a single field element. Thus, assuming a single operation can be encoded using 7 bits, and assuming we are using a 64-bit field, a single group may encode up to 9 operations or a single immediate value. A batch is a set of groups which can be absorbed by a hash function used by the VM in a single permutation. For example, assuming the hash function can absorb up to 8 field elements in a single permutation, a single batch may contain up to 8 groups. There is no limit on the number of batches contained within a single span. Thus, for example, executing 8 pushes in a row will result in two operation batches as illustrated in the picture below: span_block_creation The first batch will contain 8 groups, with the first group containing 7 PUSH opcodes and 1 NOOP, and the remaining 7 groups containing immediate values for each of the push operations. The reason for the NOOP is explained later in this section. The second batch will contain 2 groups, with the first group containing 1 PUSH opcode and 1 NOOP, and the second group containing the immediate value for the last push operation. If a sequence of operations does not have any operations which carry immediate values, up to 72 operations can fit into a single batch. From the user's perspective, all operations are executed in order, however, the VM may insert occasional NOOPs to ensure proper alignment of all operations in the sequence. Currently, the alignment requirements are as follows: An operation carrying an immediate value cannot be the last operation in a group. Thus, for example, if a PUSH operation is the last operation in a group, the VM will insert a NOOP after it. A span block does not have any children, and thus, must be leaf node in the tree.","breadcrumbs":"Design » Programs » Span block","id":"108","title":"Span block"},"109":{"body":"Consider the following program, where a0,...,ai, b0,...,bj etc. represent individual operations: a_0, ..., a_i\nif.true b_0, ..., b_j\nelse c_0, ..., c_k while.true d_0, ..., d_n end e_0, ..., e_m\nend\nf_0, ..., f_l A MAST for this program would look as follows: mast_of_program Execution of this program would proceed as follows: The VM will start execution at the root of the program which is block B5. Since, B5 is a join block , the VM will attempt to execute block B4 first, and only after that execute block f. Block B4 is also a join block , and thus, the VM will execute block a by executing operations a0,...,ai in sequence, and then execute block B3. Block B3 is a split block , and thus, the VM will pop the value off the top of the stack. If the popped value is 1, operations from block b will be executed in sequence. If the popped value is 0, then the VM will attempt to execute block B2. B2 is a join block , thus, the VM will try to execute block B1 first, and then execute operations from block e. Block B1 is also a join_block , and thus, the VM will first execute all operations in block c, and then will attempt to execute block B0. Block B0 is a loop block, thus, the VM will pop the value off the top of the stack. If the pooped value is 1, the VM will execute the body of the loop defined by block d. If the popped value is 0, the VM will not execute block d and instead will move up the tree executing first block e, then f. If the VM does enter the loop, then after operation dn is executed, the VM will pop the value off the top of the stack again. If the popped value is 1, the VM will execute block d again, and again until the top of the stack becomes 0. Once the top of the stack becomes 0, the VM will exit the loop and will move up the tree executing first block e, then f.","breadcrumbs":"Design » Programs » Program example","id":"109","title":"Program example"},"11":{"body":"Before you can use Miden VM, you'll need to make sure you have Rust installed . Miden VM v0.10 requires Rust version 1.80 or later. Miden VM consists of several crates, each of which exposes a small set of functionality. The most notable of these crates are: miden-processor , which can be used to execute Miden VM programs. miden-prover , which can be used to execute Miden VM programs and generate proofs of their execution. miden-verifier , which can be used to verify proofs of program execution generated by Miden VM prover. The above functionality is also exposed via the single miden-vm crate, which also provides a CLI interface for interacting with Miden VM.","breadcrumbs":"Introduction » Usage » Usage","id":"11","title":"Usage"},"110":{"body":"Every Miden VM program can be reduced to a unique hash value. Specifically, it is infeasible to find two Miden VM programs with distinct semantics which hash to the same value. Padding a program with NOOPs does not change a program's execution semantics, and thus, programs which differ only in the number and/or placement of NOOPs may hash to the same value, although in most cases padding with NOOP should not affect program hash. To prevent program hash collisions we implement domain separation across the variants of control blocks. We define the domain value to be the opcode of the operation that initializes the control block. Below we denote hash to be an arithmetization-friendly hash function with 4-element output and capable of absorbing 8 elements in a single permutation. The hash domain is specified as the subscript of the hash function and its value is used to populate the second capacity register upon initialization of control block hashing - hashdomain(a,b). The hash of a join block is computed as hashjoin(a,b), where a and b are hashes of the code block being joined. The hash of a split block is computed as hashsplit(a,b), where a is a hash of a code block corresponding to the true branch of execution, and b is a hash of a code block corresponding to the false branch of execution. The hash of a loop block is computed as hashloop(a,0), where a is a hash of a code block corresponding to the loop body. The hash of a dyn block is set to a constant, so it is the same for all dyn blocks. It does not depend on the hash of the dynamic child. This constant is computed as the RPO hash of two empty words ([ZERO, ZERO, ZERO, ZERO]) using a domain value of DYN_DOMAIN, where DYN_DOMAIN is the op code of the Dyn operation. The hash of a call block is computed as hashcall(a,0), where a is a hash of a program of which the VM is aware. The hash of a syscall block is computed as hashsyscall(a,0), where a is a hash of a program belonging to the kernel against which the code was compiled. The hash of a span block is computed as hash(a1,...,ak), where ai is the ith batch of operations in the span block. Each batch of operations is defined as containing 8 field elements, and thus, hashing a k-batch span block requires k absorption steps. In cases when the number of operations is insufficient to fill the last batch entirely, NOOPs are appended to the end of the last batch to ensure that the number of operations in the batch is always equal to 8.","breadcrumbs":"Design » Programs » Program hash computation","id":"110","title":"Program hash computation"},"111":{"body":"Miden VM program decoder is responsible for ensuring that a program with a given MAST root is executed by the VM. As the VM executes a program, the decoder does the following: Decodes a sequence of field elements supplied by the prover into individual operation codes (or opcodes for short). Organizes the sequence of field elements into code blocks, and computes the hash of the program according to the methodology described here . At the end of program execution, the decoder outputs the computed program hash. This hash binds the sequence of opcodes executed by the VM to a program the prover claims to have executed. The verifier uses this hash during the STARK proof verification process to verify that the proof attests to a correct execution of a specific program (i.e., the prover didn't claim to execute program A while in fact executing a different program B). The sections below describe how Miden VM decoder works. Throughout these sections we make the following assumptions: An opcode requires 7 bits to represent. An immediate value requires one full field element to represent. A NOOP operation has a numeric value of 0, and thus, can be encoded as seven zeros. Executing a NOOP operation does not change the state of the VM, but it does advance operation counter, and may affect program hash.","breadcrumbs":"Design » Program decoder » Miden VM Program decoder","id":"111","title":"Miden VM Program decoder"},"112":{"body":"Miden VM programs consist of a set of code blocks organized into a binary tree. The leaves of the tree contain linear sequences of instructions, and control flow is defined by the internal nodes of the tree. Managing control flow in the VM is accomplished by executing control flow operations listed in the table below. Each of these operations require exactly one VM cycle to execute. Operation Description JOIN Initiates processing of a new Join block . SPLIT Initiates processing of a new Split block . LOOP Initiates processing of a new Loop block . REPEAT Initiates a new iteration of an executing loop. SPAN Initiates processing of a new Span block . RESPAN Initiates processing of a new operation batch within a span block. DYN Initiates processing of a new Dyn block . CALL Initiates processing of a new Call block . SYSCALL Initiates processing ofa new Syscall block . END Marks the end of a program block. HALT Marks the end of the entire program. Let's consider a simple program below: begin> push.1 push.2 push.3 push.4 push.5\n>> exp\n>> u32wrapping_mul\n>> swap\n>> eq.2\n>> assert The !stack command will print out the following state of the stack: >> !stack\n3072 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0","breadcrumbs":"Development tooling » REPL » !stack","id":"30","title":"!stack"},"31":{"body":"The !mem command prints out the contents of all initialized memory locations. For each such location, the address, along with its memory values, is printed. Recall that four elements are stored at each memory address. If the memory has at least one value that has been initialized: >> !mem\n7: [1, 2, 0, 3]\n8: [5, 7, 3, 32]\n9: [9, 10, 2, 0] If the memory is not yet been initialized: >> !mem\nThe memory has not been initialized yet","breadcrumbs":"Development tooling » REPL » !mem","id":"31","title":"!mem"},"32":{"body":"The !mem[addr] command prints out memory contents at the address specified by addr. If the addr has been initialized: >> !mem[9]\n9: [9, 10, 2, 0] If the addr has not been initialized: >> !mem[87]\nMemory at address 87 is empty","breadcrumbs":"Development tooling » REPL » !mem[addr]","id":"32","title":"!mem[addr]"},"33":{"body":"The !use command prints out the list of all modules available for import. If the stdlib was added to the available libraries list !use command will print all its modules: >> !use\nModules available for importing:\nstd::collections::mmr\nstd::collections::smt\n...\nstd::mem\nstd::sys\nstd::utils Using the !use command with a module name will add the specified module to the program imports: >> !use std::math::u64 >> !program\nuse.std::math::u64 begin end","breadcrumbs":"Development tooling » REPL » !use","id":"33","title":"!use"},"34":{"body":"The !undo command reverts to the previous state of the stack and memory by dropping off the last executed assembly instruction from the program. One could use !undo as often as they want to restore the state of a stack and memory n instructions ago (provided there are n instructions in the program). The !undo command will result in an error if no remaining instructions are left in the Miden program. >> push.1 push.2 push.3\n>> push.4\n>> !stack\n4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 >> push.5\n>> !stack\n5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 >> !undo\n4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 >> !undo\n3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0","breadcrumbs":"Development tooling » REPL » !undo","id":"34","title":"!undo"},"35":{"body":"In the following sections, we provide developer-focused documentation useful to those who want to develop on Miden VM or build compilers from higher-level languages to Miden VM. This documentation consists of two high-level sections: Miden assembly which provides a detailed description of Miden assembly language, which is the native language of Miden VM. Miden Standard Library which provides descriptions of all procedures available in Miden Standard Library. For info on how to run programs on Miden VM, please refer to the usage section in the introduction.","breadcrumbs":"User Documentation » User Documentation","id":"35","title":"User Documentation"},"36":{"body":"Miden assembly is a simple, low-level language for writing programs for Miden VM. It stands just above raw Miden VM instruction set, and in fact, many instructions of Miden assembly map directly to raw instructions of Miden VM. Before Miden assembly can be executed on Miden VM, it needs to be compiled into a Program MAST (Merkelized Abstract Syntax Tree) which is a binary tree of code blocks each containing raw Miden VM instructions. assembly_to_VM As compared to raw Miden VM instructions, Miden assembly has several advantages: Miden assembly is intended to be a more stable external interface for the VM. That is, while we plan to make significant changes to the underlying VM to optimize it for stability, performance etc., we intend to make very few breaking changes to Miden assembly. Miden assembly natively supports control flow expressions which the assembler automatically transforms into a program MAST. This greatly simplifies writing programs with complex execution logic. Miden assembly supports macro instructions . These instructions expand into short sequences of raw Miden VM instructions making it easier to encode common operations. Miden assembly supports procedures . These are stand-alone blocks of code which the assembler inlines into program MAST at compile time. This improves program modularity and code organization. The last two points also make Miden assembly much more concise as compared to the raw program MAST. This may be important in the blockchain context where pubic programs need to be stored on chain.","breadcrumbs":"User Documentation » Miden Assembly » Miden Assembly","id":"36","title":"Miden Assembly"},"37":{"body":"In this document we use the following terms and notations: p is the modulus of the VM's base field which is equal to 264−232+1. A binary value means a field element which is either 0 or 1. Inequality comparisons are assumed to be performed on integer representations of field elements in the range [0,p). Throughout this document, we use lower-case letters to refer to individual field elements (e.g., a). Sometimes it is convenient to describe operations over groups of elements. For these purposes we define a word to be a group of four elements. We use upper-case letters to refer to words (e.g., A). To refer to individual elements within a word, we use numerical subscripts. For example, a0 is the first element of word A, b3 is the last element of word B, etc.","breadcrumbs":"User Documentation » Miden Assembly » Terms and notations","id":"37","title":"Terms and notations"},"38":{"body":"The design of Miden assembly tries to achieve the following goals: Miden assembly should be an easy compilation target for high-level languages. Programs written in Miden assembly should be readable, even if the code is generated by a compiler from a high-level language. Control flow should be easy to understand to help in manual inspection, formal verification, and optimization. Compilation of Miden assembly into Miden program MAST should be as straight-forward as possible. Serialization of Miden assembly into a binary representation should be as compact and as straight-forward as possible. In order to achieve the first goal, Miden assembly exposes a set of native operations over 32-bit integers and supports linear read-write memory. Thus, from the stand-point of a higher-level language compiler, Miden VM can be viewed as a regular 32-bit stack machine with linear read-write memory. In order to achieve the second and third goals, Miden assembly facilitates flow control via high-level constructs like while loops, if-else statements, and function calls with statically defined targets. Thus, for example, there are no explicit jump instructions. In order to achieve the fourth goal, Miden assembly retains direct access to the VM stack rather than abstracting it away with higher-level constructs and named variables. Lastly, in order to achieve the fifth goal, each instruction of Miden assembly can be encoded using a single byte. The resulting byte-code is simply a one-to-one mapping of instructions to their binary values.","breadcrumbs":"User Documentation » Miden Assembly » Design goals","id":"38","title":"Design goals"},"39":{"body":"A Miden assembly program is just a sequence of instructions each describing a specific directive or an operation. You can use any combination of whitespace characters to separate one instruction from another. In turn, Miden assembly instructions are just keywords which can be parameterized by zero or more parameters. The notation for specifying parameters is keyword.param1.param2 - i.e., the parameters are separated by periods. For example, push.123 instruction denotes a push operation which is parameterized by value 123. Miden assembly programs are organized into procedures. Procedures, in turn, can be grouped into modules.","breadcrumbs":"User Documentation » Miden Assembly » Code Organization » Code organization","id":"39","title":"Code organization"},"4":{"body":"This document is meant to provide an in-depth description of Miden VM. It is organized as follows: In the introduction, we provide a high-level overview of Miden VM and describe how to run simple programs. In the user documentation section, we provide developer-focused documentation useful to those who want to develop on Miden VM or build compilers from higher-level languages to Miden assembly (the native language of Miden VM). In the design section, we provide in-depth descriptions of the VM's internals, including all AIR constraints for the proving system. We also provide the rationale for settling on specific design choices. Finally, in the background material section, we provide references to materials which could be useful for learning more about STARKs - the proving system behind Miden VM.","breadcrumbs":"Introduction » Structure of this document","id":"4","title":"Structure of this document"},"40":{"body":"A procedure can be used to encapsulate a frequently-used sequence of instructions which can later be invoked via a label. A procedure must start with a proc.