Closed izgzhen closed 6 years ago
Oh I see, that's why I only saw it being used in tests:
cozy/structures/heaps.py:def to_heap(e : Exp) -> Exp:
tests/solver.py: def test_to_heap(self):
tests/solver.py: assert valid(EEq(e, EHeapPeek(to_heap(e), ELen(e)).with_type(INT)))
Given an
EArgMin
orEArgMax
expression tree,to_heap
outputs an expression that computes a heap that would be useful to implement the expression.That is,
EHeapPeek(to_heap(e))
should produce an expression that is semantically equivalent toe
.We should describe this in
to_heap
's docstring, which is very terse right now. Thanks for asking!