Alphabets
KnuthBendix.Alphabet — Type
Alphabet(letters::AbstractVector[, inversions])An alphabet consists of the symbols of a common type T.
An Alphabet defines a bijection between consecutive integers and its letters, i.e. it can be queried for the index of a letter, or the letter corresponding to a given index.
Example
julia> al = Alphabet([:a, :b, :c])
Alphabet of Symbol
1. a
2. b
3. c
julia> al[2]
:b
julia> al[:c]
3
julia> Alphabet([:a, :A, :b], [2, 1, 0])
Alphabet of Symbol
1. a (inverse of: A)
2. A (inverse of: a)
3. bKnuthBendix.setinverse! — Function
setinverse!(A::Alphabet{T}, x::T, X::T) where TSet the inversion of x to X (and vice versa).
Example
julia> al = Alphabet([:a, :b, :c])
Alphabet of Symbol
1. a
2. b
3. c
julia> KnuthBendix.setinverse!(al, :a, :c)
Alphabet of Symbol
1. a (inverse of: c)
2. b
3. c (inverse of: a)
julia> KnuthBendix.setinverse!(al, :a, :b)
┌ Warning: a already has an inverse: c; overriding
└ @ KnuthBendix ~/.julia/dev/KnuthBendix/src/alphabets.jl:161
Alphabet of Symbol
1. a (inverse of: b)
2. b (inverse of: a)
3. cKnuthBendix.hasinverse — Function
hasinverse(idx::Integer, A::Alphabet)
hasinverse(letter, A::Alphabet)Check if alphabet A defines the inverse of letter.