Wow... this is possibly the most elegant Haskell I have ever seen...
check out the section titled "Horticulture with Futumorphisms" ...
https://blog.sumtypeofway.com/posts/recursion-schemes-part-4.html
Extreme simplicity, built on top of beautiful abstraction
I have worked out (but not yet typed in) how to define fold and unfold
(catamorphisms, anamorphisms, histomorphisms and futumorphisms) on
hypergraphs and metagraphs.
(By extending the ideas in
https://www.researchgate.net/publication/2423982_An_Initial-Algebra_Approach_to_Directed_Acyclic_Graphs
-- but note the constructors one needs for metagraphs are a bit
different than the ones he describes for dags, though it seems his
basic framework still works)
I believe one can then express
* activation spreading (ECAN), imposing probability distributions on
Atomspace (for sampling), and crossover + mutation, as metagraph
catamorphisms
* logical inference chaining and program execution as metagraph
futumorphisms (anamorphisms with built-in control structures)
* inference "direct evaluation" as a metagraph histomorphism (a
catamorphism that keeps track of its history)
If this is right (and of course some gotcha might emerge in
transferring my scribbled pen-and-paper notes into LaTeX, which I have
no idea when I'll have time for...) then we have a fairly
straightforward mapping of our repertoire of OpenCog cognitive
algorithms as metagraph hylomorphisms.
Since hylomorphisms can represent general recursion, it's not
surprising (actually obvious) that one can represent these cognitive
algorithms as metagraph hylomorphism somehow, but the point is that it
can be done simply and elegantly...
What I'm trying to work toward here is a sort of abstract requirements
spec for what Atomese 2 needs to do to yield efficient implementations
of relevant cognitive algorithms. I think the crux is that we need
to be able to reasonably efficiently do these sorts of morphisms over
Atomspace, in instances where the atomic operations inside the
morphism are small and inexpensive (so that a substantial fraction of
the work is in executing the morphisms rather than doing costly
operations on each Atom).
--
Ben Goertzel, PhD
http://goertzel.org
“Words exist because of meaning; once you've got the meaning you can
forget the words. How can we build an AGI who will forget words so I
can have a word with him?” -- Zhuangzhi++