Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

VirtualMachine

Guides

  • Virtual Machine Package

Symbols

  • VirtualMachineAdd
  • VirtualMachineDefinition
  • VirtualMachineExecute
  • VirtualMachineList
  • VirtualMachine
  • VirtualMachineObject
  • VirtualMachineObjectQ
  • $VirtualMachines

Other

  • Intel4004
  • MOS6502
  • NFA
  • PDP1
  • PDP8
  • RegisterMachine
"NFA"
​
"NFA" a nondeterministic finite automaton (NFA)
​
▪
Creating a virtual machine instance:
VirtualMachine
["NFA",assoc]
create a new instance of a nondeterministic finite automaton configured according to
assoc
▪
The following keys can be used to specify a
"RegisterMachine"
given as an association:
"AcceptingStates"
{
s
1
,
s
2
,…}
a list of the machine's accepting states
"InitialState"
s
the machine's initial state
"InputSymbols"
Automatic
a list of allowed input symbols
"States"
Automatic
a list of allowed machine states
"TransitionFunction"
{{
s
in
,in}{
s
out1
,
s
out2
,…},…}
a list of rules specifying the state's transition function
▪
If
"InputSymbols"
Automatic
, the allowed symbols are determined from the value of
"TransitionFunction"
.
▪
If
"States"
Automatic
, the allowed states are determined from the value of
"TransitionFunction"
.
▪
For the
"RegisterMachine"
virtual machine, the following properties can be queried:
obj["Definition"]
an
Association
representing the definition of the machine
obj["Evolution"]
a list representing the evolution of the machine
obj["EvolutionDataset"]
a
Dataset
representing the evolution of the machine
obj["Input"]
a list representing the machine's current input
obj["MachineState"]
an
Association
representing the current state of the machine
obj["StepCount"]
the number of steps run
obj["TransitionFunction"]
a formatted version of the machine's transition function
obj["TransitionTable"]
a table version of the machine's transition function
▪
For the
"RegisterMachine"
virtual machine, the following commands can be executed using
VirtualMachineExecute
:
VirtualMachineExecute
[obj,"PushInput",input]
set the current machine's input to
input
VirtualMachineExecute
[obj,"Reset"]
reset the state of the machine to its initial configuration
VirtualMachineExecute
[obj,"Run",n]
run
n
steps of the machine
Examples
MoreExamples⊳
Create an instance of a
"NFA"
that accepts all lists ending in
{…,0,1}
:
In[1]:=
nfa=
VirtualMachine
[​​"NFA",​​​​"TransitionFunction"{{
q
0
,0}{
q
0
,
q
1
},{
q
0
,1}{
q
0
},{
q
1
,1}{
q
2
}},​​"InitialState"
q
0
,​​"AcceptingStates"{
q
2
}​​]
Out[1]=
VirtualMachineObject
Machine: NFA
StepCount: 0
Status: Waiting
Input: {}

Obtain information about the object:
In[2]:=
Information[nfa]
Out[2]=
VirtualMachineObject
Machine Name
NFA
Properties
{Definition,Evolution,EvolutionDataset,Input,Machine,MachineState,StepCount,TransitionFunction,TransitionFunctionFormatted,TransitionTable}
Commands
{PushInput,Reset,Run}
Functions
{Information,Normal}
Get an association representing the machine state:
In[3]:=
nfa["MachineState"]
Out[3]=
CurrentStates{
q
0
},Input{},StatusWaiting,TerminationReasonNone
Visualize the transition function:
In[4]:=
nfa["TransitionTable"]
Out[4]//TableForm=
0
1
⟶
q
0
{
q
0
,
q
1
}
{
q
0
}
q
1
∅
{
q
2
}
*
q
2
∅
∅
Push an input into the machine:
In[5]:=
VirtualMachineExecute
[nfa,"PushInput",{1,1,0,0,1}]
Out[5]=
VirtualMachineObject
Machine: NFA
StepCount: 0
Status: Waiting
Input: {1,1,0,0,1}

Run the NFA until it halts:
In[6]:=
VirtualMachineExecute
[nfa,"Run",Infinity]
Out[6]=
VirtualMachineObject
Machine: NFA
StepCount: 5
Status: Halted
(InputAccepted)
Input: {}

Extract the evolution history of the executed steps:
In[7]:=
nfa["EvolutionDataset"]
Out[7]=
Step
Input
States
0
None
{
q
0
}
1
1
{
q
0
}
2
1
{
q
0
}
3
0
{
q
0
,
q
1
}
4
0
{
q
0
,
q
1
}
5
1
{
q
0
,
q
2
}
The NFA has accepted the input:
In[8]:=
nfa["MachineState"]["TerminationReason"]
Out[8]=
InputAccepted
Basic Examples
Neat Examples
""

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com