• Stars
    star
    135
  • Rank 269,297 (Top 6 %)
  • Language
    Java
  • License
    GNU General Publi...
  • Created over 11 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sending the lambda calculus into deep space

CosmicOS: a next-generation Contact message

Communicating programs and simulations into deep space. http://cosmicos.github.io/

Build Status

Communication through theater

It's a familiar problem. You've finally managed to contact that alien civilization. Things are going great. You feel like your world will never be the same, that whole new realms of possibilities are opening up before your eyes. Then, inevitably, a hint of strain starts to creep into your relationship. You find that you don't really have all that much in common. Heck, sometimes it feels like you're not even in the same galaxy. It's as if there is this vast gulf between you, making communication almost impossible. You're not even sure you'd understand each other no matter how physically close you became. What do you do?

You design a language for cosmic intercourse. Hans Freudenthal made a start at one in his book, Lincos, published in 1960.

Lincos

One of the most interesting ideas in Lincos is to bootstrap up from mathematics and logic to conversations about mathematics and logic between imaginary characters Ha and Hb, and from there to statements about behavior of those characters. That's a pretty rich universe of shared ideas already.

In CosmicOS, we develop this idea of communicating through theater by introducing a new topic of conversation: programs and simulations. For example, if discussing logic circuits, we transmit a program for simulating the circuits, so the listener isn't restricted to the examples we show. If discussing movement through space, we transmit a simulation of a small adventure game, and show navigation from room to room. And so on.

Putting on a show

Here's the idea behind CosmicOS:

  • Communicate the usual math and logic basics ...
  • ... then use that to show how to run programs ...
  • ... then send interesting programs that demonstrate behaviors and interactions ...
  • and start communicating ideas through theater and theater commentary.

This is inspired by Freudenthal's idea of staging written conversations between his imaginary characters Ha and Hb.

What the message looks like

What would you like it to look like? A string of numbers?

20321001113223321001113023210101032032233210011130232101010321320322332100111302
32101010321321320322332100111302321010103213213213203223321001113023210101032132
13213213203223321001113023210101032132132132132132032233210011130232101010321321
32132132132132032233210011130232101010321321321321321321321320322332100111302321
01010321321321321321321321321320322332100111302321010103213213213213213213213213
21320322332100111302321010103213213213213213213213213213213203223321001113023210
...

Some kind of spidery scrawl?

spidery scrawl

Vaguely understandable symbols?

...
✉ ᚋ (+) | ✉ ᚌ 3 | ☯ 4 (ᚋ 1 (ᚌ))
☯ 2 | ✉ ᚋ 1 | + $ᚋ 1
☯ 1 | ✉ ᚋ 1 $ᚋ
☯ 14 | ✉ ᚋ 1 14
☯ 4 | ✉ ᚋ (✉ ᚌ 3 | + 1 $ᚌ) $ᚋ
☯ 4 | ✉ ᚋ (✉ ᚋ 3 | + 1 $ᚋ) $ᚋ
✉ ᚋ 1 | ☯ (ᚋ) 1
✉ ᚋ 1 | ☯ $ᚋ 1
...

Logic gates?

A D latch

Audio? You can listen to one rendering of the message at https://cosmicos.github.io/

Building the message

I recommend you use docker to build the message. Install docker (see https://docs.docker.com/install/), then do:

./make.sh tiny

You should find a message saved as build/tiny/index.txt and build/tiny/index.json.

There is a tool for browsing parts of the message in:

node ./build/tiny/bin/cosmsg.js

There will be a simple console for playing with Fritz in:

node ./build/tiny/bin/cosh.js

If you don't want to use docker, you can see all the steps needed in docker/Dockerfile and src/make_without_docker.sh.

By default, ./make.sh will compile the message in json form. There are specific targets if you want other forms of the message. Do ./make.sh help to list all targets.

Message source code

The CosmicOS message is assembled from a series of "chapters". Each chapter is written in one of several languages, which are then compiled into a common language called Fritz. This is a low-level language that is suitable for further conversion into a number of forms for transmission.

Supported languages and how they are treated are:

  • *.scm: These files are incorporated into the message verbatim. They are written in a lisp-like language called Fritz.

  • *.js: These scripts are executed using node, and their output is incorporated into the message.

  • *.java: These files are compiled to bytecode, and that bytecode is then converted into Fritz statements, using elements introduced in the message itself. Not all Java constructs are supported, don't get carried away here.

  • *.pl: These scripts are executed using perl, and their output is incorporated into the message. CosmicOS is so old that its original source is was written in perl, and some of it is still lying around. I can feel you judging me, please stop.

  • *.gate: These files are interpreted as a specification for a kind of circuit. You can find a simulator on the CosmicOS website. The circuit specifications are converted into a form that can be incorporated into the message. Rules for evaluating a circuit are given in the message.

Fritz

The core language of the message is a stripped-down Lisp called Fritz. Here's an example statement:

= 42 (+ 20 22);

If you've coded in scheme or lisp, this should feel familiar, except we've stripped a pair of parentheses around the whole expression, and added a semicolon. In general, Fritz takes every opportunity to reduce nesting, since it seems a cognitive burden. The above would typically be written as:

= 42 | + 20 22;

The | means: nest everything from here to the end of the current expression.

We can define new symbols with @ symbol value, and create functions with ? symbol body:

@ square | ? x | * (x) (x);
= 100 | square 10;

Note the parentheses in * (x) (x), which multiplies an argument stored in x by itself. To get the value of x, you evaluate it like an expression (this makes writing self-referential messages so much easier). A shorthand for (x) is $x, so the above can be written as:

@ square | ? x | * $x $x;
= 100 | square 10;

There's nothing special about symbols in Fritz, this code would work just as well with square and x replaced by arbitrary integers:

@ 9999 | ? 88 | * $88 $88;
= 100 | 9999 10;

The message can be encoded in lots of ways. Originally, CosmicOS was encoded in a four-symbol message, with symbols corresponding to:

  • 0: binary digit zero
  • 1: binary digit one
  • (: open parenthesis
  • ): close parenthesis

Fritz messages can still be encoded this way by expanding out all references to | and $, ignoring ;s, and replacing symbols with arbitrary integers. This does not seem very kind to the reader though, so other encodings are used today. There is a lot of scope for imaginative renderings of the same message.

Variant messages

Perhaps you'd like to work on a somewhat different message without disturbing the main message. You can do that. Take a look in the variant directory. Each file there defines a different message. For example, variant/tiny.cmake contains:

set(COSMIC_DEPENDS
  COS_Intro
  COS_Compare)

This means to build the message by concatenating msg/COS_Intro.* and msg/COS_Compare.*. You can make your own file, mine.cmake, and then build it using:

./make.sh mine

You can optionally add this line:

set(COSMIC_USE_FLATTENER false)

If you think the $ and | message symbols should be converted to parentheses in the message.

Code quality

Oh my goodness what can I say except you're welcome sorry.

Chatter

License

Copyright (C) 2018 Paul Fitzpatrick

CosmicOS is released under the GNU General Public Licence -- See COPYING.txt for license information.

More Repositories

1

mlsql

inferring sql queries from plain-text questions about tables
Python
915
star
2

daff

align and compare tables
Java
800
star
3

coopy

distributed spreadsheets with intelligent merges
C
95
star
4

catsql

cat for sql dbs
Python
73
star
5

visql

edit slices of SQL databases in vi
Python
48
star
6

sheetsite

sync a website or local spreadsheet with a google sheet
Python
34
star
7

makesweet

Put pictures into animations from the command line.
C++
21
star
8

deepmoon

the deep learning framework from beyond the moon
Python
11
star
9

emcycles

Compiling cycles renderer in javascript
C++
11
star
10

ucanvcam

Automatically exported from code.google.com/p/ucanvcam
C++
8
star
11

emacsql

edit a slice of a SQL database in emacs
Python
8
star
12

daff-php

php version of daff
PHP
7
star
13

html2video

JavaScript
6
star
14

segmenty

training convnets to segment visual patterns without annotated data
Python
5
star
15

blender2haxe

a fork of rozengain.com's great AS3Export tool, to support haxe.
Python
5
star
16

exoplanets

calculate exoplanet birthdays
JavaScript
4
star
17

zify

add depth to an icon using blender cycles
Shell
3
star
18

asql

Query a database in natural language
Python
3
star
19

gnumeric

notes on building gnumeric on windows
C
2
star
20

pixplz

need some training images in a hurry? pixplz!
Python
2
star
21

daff-doc

Documentation for daff
CSS
2
star
22

cycles_hack

Blender cycles renderer hacked to remove ... absolutely everything. You don't want this.
C++
2
star
23

coopyhx_gem

wraps up coopyhx for ruby
C++
2
star
24

chumby

Shell
1
star
25

url2020

Enter a URL in mobile chrome in 2020
HTML
1
star
26

glig

All About Gligs
HTML
1
star
27

data_commons

CDI DCP tools
1
star
28

dearet

Scheme
1
star
29

winarm_cmake

C
1
star
30

filabel

file labels for quick image classification projects
Python
1
star
31

grist_quiz

JavaScript
1
star
32

keras_cli

keras cli
Python
1
star
33

icub_skin

C++
1
star
34

daff-web

compare tables, producing a human and machine readable diff that is itself tabular
HTML
1
star
35

robobo

Random robotics
C++
1
star
36

grist-plugin-api-docs

HTML
1
star
37

spelling_bee_prep

spell time
JavaScript
1
star
38

poker

1
star
39

stonesouper

A backend for stonesoup-style directories
TypeScript
1
star
40

yarp_thrift

Use Thrift with YARP
C++
1
star
41

dylan

Extends the lyrics of Bob Dylan's A Hard Rain's A-Gonna Fall
Python
1
star
42

rb_coopy

native ruby implementation of coopy data diff tools
Ruby
1
star
43

grist-widget

JavaScript
1
star