Closed jrbeaumont closed 7 years ago
I think we should combine arcs
and ors
into arcs
:
arcs :: [([a], a)]
arcConcept from to = mempty { arcs = [([from], to)] }
In other words, usual causality is a special case of OR-causality with a singleton list of causes. Pretty sure this will simplify the rest of the code too.
Can be done. Something like: When it comes to handling OR causality in the translation, filter for lists of >1 size and those are OR causality?
Yes, but I don't think you will ever need to do the filtering. Think of singletons as brackets with single variables when doing expansion.
In fact I think all you need is standard Haskell function sequence
which will magically compute all terms for you :-)
See answers here: http://stackoverflow.com/questions/4119730/cartesian-product
For example, try sequence [[1], [2, 3], [4, 5]]
.
Yeah that would work great. I'll replace this part in my implementation and see how it goes.
@snowleopard: I have used your suggestions and re-tested. All works well :)
@snowleopard: Fixes made. Still working correctly.
@snowleopard: Hold off for 2 minutes, I forgot to include AND and OR gate concepts
@snowleopard: OK i'm done, unless you have any further suggestions :)
This should close #34
Great, thanks!
The algorithm for this I will display in a blog post. For now, here is some testing information. The test files are here: Or-causality testing.zip
OR-gate C = A+B: Works as expected. Synthesis produces this circuit: circuit_or_gate.pdf
AND-gate C = AB: Also works as expected. Synthesis produces this circuit: circuit_and_gate.pdf
Two OR-gates - C = (A+B)(D+E): Synthesis produces a predictably complex circuit, but simulation of the STG reveals it to work as expected. To set
C
high (minimum):A+
andD+
.A+
andE+
.B+
andD+
.B+
andE+
. To setC
low: All signals lowAND and OR gate - C = (A+B)DE: Again, synthesis produces something unrecognizable. Simulation reveals correctness: To set
C
high (minimum):A+
,D+
andE+
.B+
,D+
andE+
. To setC
low (minimum):A-
,B-
andE-
.A-
,B-
andD-
.A 2-input OR and a 3-input OR - C = (A+B)(D+E+F): Synthesis doesn't produce much, but simulation is good: To set
C
high (minimum):A+
andD+
.A+
andE+
.A+
andF+
.B+
andD+
.B+
andE+
.B+
andF+
. To setC
low: All signals lowLet me know if you have any other test cases you wish me to try.