Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Informatik 8
CoPaR
Commits
63746baa
Commit
63746baa
authored
Sep 26, 2018
by
Hans-Peter Deifel
Browse files
Document new RefinementTypes for Polynomial functor
parent
effbdc54
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/MA/Functors/Polynomial.hs
View file @
63746baa
...
...
@@ -178,25 +178,52 @@ instance PrettyShow a => PrettyShow (FactorValue a) where
prettyShow
(
ExponentialValue
v
)
=
"["
<>
mconcat
(
intersperse
", "
(
map
prettyShow
(
V
.
toList
v
)))
<>
"]"
type
Three
=
Word8
-- ToRest | ToCompound | ToSub
--deriving (Show, Eq, Ord, Enum)
-- | Morally the type '3'.
--
-- We use Word8 for efficiency, so this should only ever have the values 0, 1
-- and 2 with the following meanings:
--
-- 0: Edge goes to rest
-- 1: Edge goes to compound block
-- 2: Edge goes to subblock
type
Three
=
Word8
toRest
::
Three
toRest
=
0
toCompound
::
Three
toCompound
=
1
toSub
::
Three
toSub
=
2
-- | (Index in Sum, Number of variable Factors, Constant factors)
type
instance
H1
Polynomial
=
(
Int
,
Int
,
Vector
Int
)
-- | Tuple @(a, b)@ of
--
-- [a]: Index of this edge in the product on the second level
-- [b]: Index of this edge in the exponential on the third level
-- | Index of this edge into the product
--
-- For "Identity"s, @b@ is 0. Also note that the top-level co-product doesn't
-- appear in the label at all. It already appears in "H1".
-- Note that this ignores constant factors, so an edge to the X in (2, 5, X)
-- would have 0 as Label, not 2. Also, the top-level co-product doesn't appear
-- in the label at all. It already appears in "H1".
type
instance
Label
Polynomial
=
Int
-- | Defined as H2
--
-- For each variable in the product, this is True if the corresponding successor
-- state belongs to the subblock and False otherwise.
type
instance
Weight
Polynomial
=
VU
.
Vector
Bool
-- | Defined as H3
--
-- Same as for Weight, but now with the three states described in the
-- documentation for Three.
type
instance
H3
Polynomial
=
VU
.
Vector
Three
instance
ParseMorphism
Polynomial
where
parseMorphismPoint
(
Polynomial
expr
)
=
parseSum1
expr
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment