Closed yuriy0 closed 7 years ago
From a CAS perspective, tests t44Add
and t57
should be fixed by having an Ord
instance for most parts of abt
, and 'sorting' commutative terms. The Ord
instance could be obtained via hash-consing. [Note that I am not necessarily suggesting we do this - there might be very good reasons not to!].
t4
is trickier, as it would need a 'polynomial normal form'. Maple does have this. But in Haskell-Hakaru, we don't really have 'polynomials'. So I am not sure how feasible this is.
t35
and t45
feel different: we should agree on where we expect the return
to be (based on the input), and make sure that that is what we get. Note that in both cases a "control flow" piecewise was expected, but a dataflow one was received instead. The question is: given the actual input in each case, what should we be expecting? Simplify
is now quite careful about that [unlike the previous code, which wasn't], and these tests were written for the old behaviour.
From a CAS perspective, tests t44Add and t57 should be fixed by having an Ord instance for most parts of abt, and 'sorting' commutative terms. The Ord instance could be obtained via hash-consing. [Note that I am not necessarily suggesting we do this - there might be very good reasons not to!].
t4 is trickier, as it would need a 'polynomial normal form'. Maple does have this. But in Haskell-Hakaru, we don't really have 'polynomials'. So I am not sure how feasible this is.
I agree both these problems may be entirely non-trivial.
t35 and t45 may be outdated test cases.
t35 tests that both programs (return (match ..)
and match( .. : return .. )
) to simplify to the latter, but they both simplify to themselves. I think this is what we want. It should be two test cases with each program simplifying to itself.
t45 does the same thing, and additionally tests that a third program which currently (genuinely) doesn't simplify (although I don't think it gets to that test).
So I think that t35 and t45 might be outdated. @ccshan ? I think they should indeed simplify to themselves.
For the 3rd program in t45, that might be worth separating out in a different issue.
Regarding hakaru/tests/RoundTrip/t[34]5.*
nowadays:
t35.0.hk
and for simplifying t35.expected.hk
, the better result to produce is t35.0.hk
, but it is acceptable to produce t35.expected.hk
too. And for simplifying t45.0.hk
and t45.1.hk
and t45.expected.hk
, the better result to produce is t45.0.hk
, but it is acceptable to produce t45.expected.hk
too.t45.1.hk
simplifies to itself, but it shouldn't be the result of simplifying t45.0.hk
or t45.expected.hk
.
I hope this helps.Making sure that @GenevaS sees this too.
At least for testing purposes, this is fixed by changing the expected outputs. Maple reliably produces x^2
instead of x*x
so that should be fine. The literal-related issues are fixed by the recent changes to parser/pretty printer.
As of 21774d0e, at least five of the tests in RoundTrip.hs fail because the equality test is too weak.
It is unclear if this should be implemented as a new equality predicate, or a change to
alphaEq
, or a normalization which makes the expressions in question alpha-equivalent.5:RoundTrip:0:7:t44Add
operator associativity
5:RoundTrip:0:13:t57
operator associativity
5:RoundTrip:3:0:t4
ring algebra
5:RoundTrip:1:5:t35
return distributes over match
5:RoundTrip:2:16:t45
return distributes over match