anhinga_anhinga: (Anhinga)
anhinga_anhinga ([personal profile] anhinga_anhinga) wrote2015-12-27 06:28 pm

Dataflow programming and linear models of computation



https://www.youtube.com/watch?v=fEWcg_A5UZc

More on linear models of computation:


https://github.com/anhinga/fluid contains open source code, demo videos, and links to the reference paper and other preprints written by our group on this topic.

We finally have a model of computation which allows us to continuously deform programs and, moreover, to represent large classes of programs by matrices of real numbers.

We consider classes of computations which admit taking linear combinations of execution runs. Two well known large classes of computations with this property are probabilistic sampling and generalized animation. Both allow for enough higher-order constructions to make us believe that limiting consideration to either of these two classes is not a restriction of generality compared to general-purpose computations.

Since both probabilistic sampling and generalized animation represent stream-based computing architecture, it is natural to consider dataflow programming in this context. We experimented with several different dataflow architectures (the animation above demonstrates the first of the architectures we considered).

We eventually obtained the following solution. If one takes a countable number of built-in stream transformers of one's choice (usually, one takes a finite number of those, and then considers a countable number of copies of each), one can then take each input to be a countable sum of all outputs.

The way to think about this is to say that the set of built-in transformers defines a language, and the coefficients in the countable sums define a program in that language. So a program is defined by a countable-sized matrix; usually one requires that only a finite number of those coefficients are non-zero in order to fit all this into a finite machine.

Then one can change the program in a continuous fashion by continuously changing the matrix coefficients. Because a countable-size matrix has a countable number of matrix elements, one can compute the matrix elements themselves via the streams of real numbers computed by the program itself, thus enabling a variety of higher-order mechanisms (the continuous version of self-modifying code).

[identity profile] anhinga-drafts.livejournal.com 2015-12-28 01:17 am (UTC)(link)
Examples of continuous cellular automata we implemented:

https://www.youtube.com/watch?v=KZHQxdZUlSU

https://www.youtube.com/watch?v=rulK7l4jS-o

https://www.youtube.com/watch?v=-pFil1_GEA4

These were implemented using the third of the architectures we considered (which was based on the matrix representation mentioned in the post).

[identity profile] sober-space.livejournal.com 2015-12-28 12:26 pm (UTC)(link)
Очень интересно. И еще интересно, получится ли для таких вещей К(в)АНтование и что это будет. Но это уже за пределами практических применений, во всяком случае пока.

[identity profile] anhinga-anhinga.livejournal.com 2015-12-28 03:22 pm (UTC)(link)
Да, пока что за пределами практических применений. Но здесь у меня есть как некатегорный, так и категорный комментарий. Сначала некатегорный.

Вообще говоря, эта область любит отрицательные вероятности. С практической точки зрения можно обойтись без них (правда, с некоторыми потерями), но концептуально связь с квантовой теорией здесь очень тесная (обсуждение и ссылки в секции 1.2 статьи).

Дальше, в статье есть "математическая начинка" (секция 4, фактически это вторая статья, связанная с первой пока что скорее исторически и мотивационно, и помещенная в тот же текст в надежде, что связи со временем станут глубже; а так это две независимые статьи (всё, что до и после секции 4, и секция 4)). И там есть пространство стрелок, и связанный с ним мотив инволюции, и архитектура вычислений с инволюциями, и "моральная" связь с квантовыми алгоритмами там очень сильная (секции 4.1, 4.5, 4.14).

Категорная часть комментария, которая есть у меня, состоит в том, что в контексте обогащенных категорий пространство стрелок (domain of arrows) очень сильно связано с профункторами (дистрибьюторами), и это тема крайне богатая, с большим потенциалом.

[identity profile] anhinga-anhinga.livejournal.com 2015-12-28 04:00 pm (UTC)(link)
продолжая категорную линию, да, расширения Кана там вроде сразу возникают, в этом контексте профункторов (дистрибьюторов, модулей)...

как только рассматриваем формулу для их композиции, так они уже появляются...

[identity profile] sober-space.livejournal.com 2015-12-28 09:50 am (UTC)(link)
>>For 0 < α < 1 and random being a generator of uniformly distributed reals between 0 and 1, the
linear operator corresponding to the program if random < α then P else Q is a linear combination of
the linear operators corresponding to programs P and Q with coefficients α and 1−α.


Это звучит очень похоже на то, что было у меня здесь: Тогда конструкция if-else точно есть в Set(относительно декартова произведения), вроде бы присутствует в Vect (относительно тензорного), во всяком случае для конечномерных, и в Top вроде тоже есть (гомотопия, относительно произведения топ. пространств), но кажется в Top не может быть while.

[identity profile] anhinga-anhinga.livejournal.com 2015-12-28 03:02 pm (UTC)(link)
Я, наверное, могу прокомментировать это на некатегорном уровне (я бы был рад взглянуть на это и на категорном уровне тоже).

В контексте денотационной векторной семантики, есть статья Dexter Kozen, Semantics of probabilistic programs (it seems that scholar.google.com points to its free download), откуда это изначально ко мне пришло. Там линейные операторы на пространстве знакопеременных мер, и, что касается Scott topology, то обычный Scott domain подвероятностных мер вложен в положительных конус этик векторных пространств, и семантика while там аккуратно сделана через неподвижные точки, в обычной манере для топологий Скотта.

В контексте экспериментов с synchronous dataflow (которые по сути есть операционная векторная семантика), ситуация в чем-то похожа на обычную машину фон Неймана. Машина описывается программой "while(true) {рабочий шаг}", только здесь за рабочий шаг прокручивается весь огромный "арифмометр", ассоциированный с графом dataflow. Поскольку рабочий шаг имеет сложность "близкую к фиксированной", как и в машине фон Неймана приходится выражать while через if. Но в машине фон Неймана это делается условным переходом контроля исполнения, а здесь это делается по сути "условным перенаправлением потоков по графу dataflow".

Работа со списками действительно похожа, интересно было бы посмотреть подробнее...

[identity profile] am.livejournal.com 2015-12-29 04:41 pm (UTC)(link)
Cool! Thanks for uploading.