haskell - Is it usual for interaction nets to leave piles of redundant fans? -


i'm compiling lambda calculus terms interaction nets in order evaluate them using lamping's abstract algorithm. in order test implementation, used church-number division function:

div = (λ b c d . (b (λ e . (e d)) (a (b (λ e f g . (e (λ h . (f h g)))) (λ e . e) (λ e f . (f (c e)))) (b (λ e f . e) (λ e . e) (λ e . e))))) 

dividing 4 4 (that is, (λ k . (div k k)) (λ f x . (f (f (f (f x)))))), net:

enter image description here

(sorry awful rendering. λ lambda, r root, d fan, e eraser.)

reading term back, church number 1, expected. net inflated: has lot of fans , erasers serve no obvious purpose. dividing bigger numbers worse. here div 32 32:

enter image description here

this again reads one, here can see longer tail of redundant fan nodes. question is: is expected behavior of interaction needs when reducing particular term or possible bug on implementation? if isn't bug, there way around that?

yes, usual (but there techniques lessen presence)

abstracting details of implementation interaction nets, , hypothesis of soundness of abstract algorithm div, seems fine me.

  • no further interaction can applied output show, in spite of chi's claim, because none of pairs d-e can interact through principal port.

  • this latter kind of reduction rule (that not allowed in framework) may improve efficiency , sound in particular cases. basically, involved fan must not have "twin", i.e. there must exists no d' in net such annihilation d-d' can happen. more details, @ the optimal implementation of functional programming language, chapter safe nodes (which available online!), or @ original paper came:

    asperti, andrea, , juliusz chroboczek. "safe operators: brackets closed forever optimizing optimal λ-calculus implementations." applicable algebra in engineering, communication , computing 8.6 (1997): 437-468.

  • finally, read-back procedure must intended not sort of external cost reduction precedure, rather deferred cost of computing duplication , erasure. notice, such cost negligible, if want test efficiency in real-world scenario, sum both sharing reduction , read-back reduction.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -