[<<][haskell][>>][..]

Fri Jun 29 11:48:08 EDT 2018

## Netlist aliases

EDIT: This is a detour. See next posts: the core idea is that a
netlist is a partition (set of disjoint sets), and that a net name is
just one of the elements of a subset. Not realizing this yielded a
lot of confusion.
Getting into mathy territory.
I'm having problem expressing joins of nets when names are involved.
How to name the union?
One approach is to compute the union of the names as the new name,
i.e. switch from NetName to (Set NetName) as names of nets.
It is tempting to then define:
newtype NetName' = NetName' (Set NetName)
instance Eq NetName' where
(NetName' a) == (NetName' b) =
not $ Set.null $ Set.intersection a b
But this is not transitive. E.g.
E.g. given elements {1,2}, {2,3}, {3,4}, it is clear that
{1,2} == {2,3} and {2,3} == {3,4},
but {1,2} /= {3,4}
To make this work, a transitive closure is needed, which I don't see
how to define explicitly.
It does seem possible though to use this transitive closure implicitly
when operating on a map-like structure that uses (Set NetName) as
keys, but doesn't rely on the Haskell Eq and Ord classes.
With this implicit implementation as a map, it is likely possible to
distill equality relative to the contents of the map. Weird...
What happens when searching for "set-indexed map" ?
Trying to implement this I run into inconsistencies..
Maybe it doesn't make sense?
Particularly, lookup has a weird meaning.
Given a map:
{1,2} => {a}
(3,4} => {b}
What is lookup {1,3} ? The only sane thing here is to have it be
{a,b}, but in the lookup itself there is already a join happening.
Sets are way stranger than I thought!
The net shorting function falls right out.

[Reply][About]

[<<][haskell][>>][..]