turingMachine-1.0.0.0: An implementation of Turing Machine and Automaton

Copyright(c) Jorge Santiago Alvarez Cuadros 2016
LicenseGPL-3
Maintainersanjorgek@ciencias.unam.mx
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010
Extensions
  • TypeOperators
  • ExplicitNamespaces

Data.Delta

Contents

Description

Map implementation, represent a partial function

Synopsis

Delta

Generic

type (:*>:) a p o = Map (Label a, p) o Source #

Map a tuple, a state and a param, to some output

Deterministic

Constructor

type (:->:) a p1 p2 = (:*>:) a p1 (Label a, p2) Source #

Deterministic Delta

Maps a tuple, a state and a param, to another tuple, a state and a param.

Functions

liftD :: (Ord a, Ord p1) => [(a, p1, a, p2)] -> (:->:) a p1 p2 Source #

Lifts a deterministic delta from a 4-tuple list

nextD :: (Ord p1, Ord a) => (:->:) a p1 p2 -> (Label a, p1) -> Label a Source #

Next state function for deterministic delta

Not deterministic

Constructor

type (:-<:) a p1 p2 = (:*>:) a p1 (Set (Label a, p2)) Source #

Non-Deterministic Delta

Maps a tuple, a state and a param, to a tuple, a state list and a param.

Functions

liftND :: (Ord a, Ord p1, Ord p2) => [(a, p1, [(a, p2)])] -> (:-<:) a p1 p2 Source #

Lifts a non-deterministic delta from a 4-tuple list

nextND :: (Ord p1, Ord a) => (:-<:) a p1 p2 -> p2 -> (Label a, p1) -> Set (Label a) Source #

Next state function for non-deterministic delta

Functions

liftL :: (Ord a, Ord p) => [(a, p, o)] -> (:*>:) a p o Source #

Lift a generic delta/map from a 3-tuple list

nextTMaybe :: (Ord p1, Ord a) => (:*>:) a p1 o -> (Label a, p1) -> Maybe o Source #

Take a state and a param and maybe resolve some output

nextSymbol :: (Ord p1, Ord a) => (:*>:) a p1 Symbol -> (Label a, p1) -> Symbol Source #

For simple map with Chars range

Auxiliar functions

getFirstParam :: Eq b => Map (a, b) a1 -> [b] Source #

Gets all params at domain, for (:->:) and (:-<:)

getFirstParamSet :: Ord b => Map (a, b) a1 -> Set b Source #

Gets all params at domain, for (:-<:) and (:-<:)

getSecondParamD :: Eq p2 => (:->:) a p1 p2 -> [p2] Source #

Gets all params at range, for (:->:)

getSecondParamND :: Ord p2 => (:-<:) a p1 p2 -> [p2] Source #

Gets all params at range, for (:-<:)

getSecondParamSetD :: Ord b => Map k (a, b) -> Set b Source #

Gets all params at range, for (:->:)

getSecondParamSetND :: Ord p2 => (:-<:) a p1 p2 -> Set p2 Source #

Gets all params at range, for (:-<:)

getStateDomain :: Eq a => Map (a, b) a1 -> [a] Source #

Gets all states at domain, for (:->:) and (:-<:)

getStateDomainSet :: Ord a => Map (a, b) a1 -> Set a Source #

Gets all states at domain, for (:->:) and (:-<:)

getStateRangeD :: Eq a => (:->:) a p1 p2 -> [Label a] Source #

Gets first param at range, for (:->:)

getStateRangeND :: Ord a => (:-<:) a p1 p2 -> [Label a] Source #

Gets state at range in a list, for (:-<:)

getStateRangeSetD :: Ord a => (:->:) a p1 p2 -> Set (Label a) Source #

Gets first param at range, for (:->:)

getStateRangeSetND :: Ord a => (:-<:) a p1 p2 -> Set (Label a) Source #

Gets state at range in a set, for (:-<:)