Class Ops
Provides operations for finite automata.
Inherited Members
Namespace: Automata.Core.Operations
Assembly: Automata.Core.dll
Syntax
public static class Ops
Methods
| Edit this page View SourceComplement(Mfa)
Complement of a given MFA.
Declaration
public static Dfa Complement(this Mfa mfa)
Parameters
Type | Name | Description |
---|---|---|
Mfa | mfa | A Mfa to complement. |
Returns
Type | Description |
---|---|
Dfa | A new deterministic finite automaton (DFA) representing the complement of the input MFA. |
Concatenation(Fsa, FsaDet)
Concatenates two finite state automata.
Declaration
public static FsaDet Concatenation(Fsa left, FsaDet right)
Parameters
Type | Name | Description |
---|---|---|
Fsa | left | The left finite state automaton. |
FsaDet | right | The right finite automaton. |
Returns
Type | Description |
---|---|
FsaDet | A new deterministic finite automaton representing a concatenation of the two automata. |
Remarks
Creates a new automaton. For optimal performance, use ConcatenationWith(Nfa, FsaDet) when possible to reduce overhead.
The resulting alphabet will be the union of both alphabets, irrespective of whether all symbols were referenced by right
.
ConcatenationWith(Nfa, FsaDet)
Mutating concatenation: Appends another automaton to the source automaton.
Declaration
public static Nfa ConcatenationWith(this Nfa source, FsaDet right)
Parameters
Type | Name | Description |
---|---|---|
Nfa | source | Source automaton to append to. |
FsaDet | right | Automaton to append. |
Returns
Type | Description |
---|---|
Nfa | Source automaton |
Remarks
This operation mutates source
.
Resulting alphabet of source
will be the union of both alphabets, irrespective of whether all symbols were referenced by right
.
Difference(FsaDet, Mfa)
Computes the difference between two deterministic finite automata.
Declaration
public static FsaDet Difference(this FsaDet minuend, Mfa subtrahend)
Parameters
Type | Name | Description |
---|---|---|
FsaDet | minuend | The automaton from which to subtract. |
Mfa | subtrahend | The automaton whose language will be subtracted from the minuend. |
Returns
Type | Description |
---|---|
FsaDet | A new FsaDet representing the language of the minuend except the language of the subtrahend. |
Intersection(FsaDet, FsaDet)
Intersection of two deterministic finite automata. The resulting automaton accepts only the strings that are accepted by both input automata.
Declaration
public static Mfa Intersection(this FsaDet a, FsaDet b)
Parameters
Type | Name | Description |
---|---|---|
FsaDet | a | The first finite automaton. |
FsaDet | b | The second finite automaton. |
Returns
Type | Description |
---|---|
Mfa | An new Mfa representing the intersection of the two input automata. |
KleenePlusWith(Nfa)
Adds a Kleene plus closure (one or many) to the specified automaton.
Declaration
public static Nfa KleenePlusWith(this Nfa source)
Parameters
Type | Name | Description |
---|---|---|
Nfa | source | Automaton to modify |
Returns
Type | Description |
---|---|
Nfa | Modified |
KleeneStarWith(Nfa)
Adds a Kleene star closure to the specified automaton.
Declaration
public static Nfa KleeneStarWith(this Nfa source)
Parameters
Type | Name | Description |
---|---|---|
Nfa | source | Automaton to modify |
Returns
Type | Description |
---|---|
Nfa | Modified |
OptionWith(Nfa)
Applying Optional closure (?). Ensures the NFA accepts the empty string (ε), modifying it to represent L? = L ∪ {ε}. If the NFA already accepts ε, it is returned unmodified.
Declaration
public static Nfa OptionWith(this Nfa source)
Parameters
Type | Name | Description |
---|---|---|
Nfa | source | The source NFA to modify in place. |
Returns
Type | Description |
---|---|
Nfa | The same automaton, with potential modification. |
Overlaps(FsaDet, FsaDet)
Indicates whether the languages of two deterministic finite automata overlap.
The resulting value is trueiff
there exists at least one string accepted by both input automata.
Declaration
public static bool Overlaps(this FsaDet fsa, FsaDet other)
Parameters
Type | Name | Description |
---|---|---|
FsaDet | fsa | The first finite automaton. |
FsaDet | other | The second finite automaton. |
Returns
Type | Description |
---|---|
bool | true
|
PrefixClosure(Mfa)
Prefix closure of a given automaton, making all states final.
Declaration
public static Dfa PrefixClosure(this Mfa mfa)
Parameters
Type | Name | Description |
---|---|---|
Mfa | mfa | The Mfa to transform. |
Returns
Type | Description |
---|---|
Dfa |
Remarks
The prefix closure is an automaton that accepts all prefixes (including ε) of the language recognized by the original automaton. This transformation makes every state in the original MFA a final state in the resulting DFA.
Properties of the prefix closure:
- All states are final.
- Retains graphical identity: the same alphabet, transitions, and state IDs as the original MFA.
- Retains determinism but not necessarily minimalism. For example, the prefix closure of
a+
isa*
, which can be represented with a single-state MFA.
Reversal(FsaDet)
Creates a new NFA that recognizes the reversal of the language accepted by the given automaton.
Declaration
public static Nfa Reversal(this FsaDet source)
Parameters
Type | Name | Description |
---|---|---|
FsaDet | source |
Returns
Type | Description |
---|---|
Nfa | A new NFA representing the reversed automaton. |
Union(Fsa, FsaDet)
Creates union of two finite state automata.
Declaration
public static FsaDet Union(Fsa left, FsaDet right)
Parameters
Type | Name | Description |
---|---|---|
Fsa | left | First automaton. |
FsaDet | right | Second automaton. |
Returns
Type | Description |
---|---|
FsaDet | A new deterministic finite automaton representing a union of the two automata. |
Remarks
Creates a new automaton. For optimal performance, use UnionWith(Nfa, FsaDet) when possible to reduce overhead.
Resulting alphabet of left
will be the union of both alphabets, irrespective of whether all symbols were referenced by right
.
UnionWith(Nfa, FsaDet)
Unites the source automaton with another automaton (in-place union).
Declaration
public static Nfa UnionWith(this Nfa source, FsaDet other)
Parameters
Type | Name | Description |
---|---|---|
Nfa | source | Source automaton to mutate. |
FsaDet | other | Automaton to union with. |
Returns
Type | Description |
---|---|
Nfa | Source automaton |
Remarks
This operation mutates source
to represent the union of the two automata.
Resulting alphabet of source
will be the union of both alphabets, irrespective of whether all symbols were referenced by other
.