# Semantic representation of all function space?

I have a strange idea, and I’d appreciate any feedback on it, or help on how to achieve it.

Here’s the idea: we all know there are an infinite number of ways to construct any computer function, but in the end all a function does is map inputs to outputs. Give the function some string of symbols and it’ll return a new string of symbols. So in this abstraction, a function isn’t lines of code, it’s merely a transformation of data, we don’t care how it happens, we just care about the mapping from inputs to outputs.

There is, in other words, a data-transformation space where all equivalent functions share the same representation.

Ok, with this abstract definition of a function, I wonder, can we deterministically make a semantic representation of all possible functions? That is, all possible transformation-mappings-of-data?

If this is unclear, let me give a few examples.

Example 1: Equivalency:

``````def function_one(arg):
return arg

def function_two(arg):
return arg + 1 - 1
``````

The above functions do the exact same thing. Though they are constructed differently they are equivalent and should be represented by the same semantic representation (specifically the semantic representation that corresponds to the “identity function”).

Example 2:

Function A mapping:
‘foo’ -> ‘oof’
‘bar’ -> ‘rab’
1 -> 1
123 -> 321

Function B mapping:
‘foo’ -> ‘OOF’
‘bar’ -> ‘RAB’
1 -> 1
123 -> 321

Notice that these mappings are not equivalent. The first reverses the order of the input symbols and the second reverses them and turns the letters into upper case characters.

These two ‘abstracted functions’ (treating ‘functions’ as a mapping of inputs to outputs, without caring how that mapping is coded) should have different semantic representations, however, the representations should be similar because the second function can use the first one to do some of its work.

In other words even these abstract functions can be chained together to create larger, more complex functions.

Thus, if we had a way to apply semantic representations to these abstracted functions… That is to say, if we had a language to describe this state space of all input to output mappings, then we’d have an abstract programming language. We wouldn’t have to care how things are done under the hood; we could just describe the abstract behavior we want.

This language could be described in terms of a vast tree of functions, where any acyclical path down the tree describes a complex abstracted function made up of other abstracted functions.

Anyway it all hinges on the ability to make semantic representations of abstract functions - a language to describe all possible change: a universal language, deterministically derived from the state space of all possible abstract functions.

Can it be done? If so how would you start? I’m looking to create a semantic encoder for all possible transformations of data.

Assume that your function transforms one input pattern to another output pattern.

Let that input pattern be the image on a computer screen.
Any image.
Assume that the output is a string of text describing the content of that screen.

I will run though all patterns starting with a single dot in the upper right hand corner with the color value of 00-00-00 and then switch to a single dot with the color value of 00-00-01, and continue until all colors have been tried. Then I will go to the next dot over and try all the values and possible combinations with the first dot. I will continue in this fashion until the last dot on the screen reaches 256-256-256. Any time a figure such as a blade of grass or a grain of sand or a star or a animal appears as an image this should be recognized and described. If it shows some view of a human I expect the name and some description of what is happening; naturally, this will include multiple views of every human that ever lived. The same for any animal or machine. For bonus points do diagnostic determinations on any displayed tissue pathology. Don’t forget that this input set will include some portion of the text of anything that has ever been written; I expect a book report.

Provide the function that provides this mapping.

When you have solved this problem that you should have a pretty good idea how to solve the problem you are proposing.

I think Bitking’s a little pessimistic (I could be misinterpreting though). Nothing wrong with that, but I feel it too prematurely kills off ideas that are otherwise valid potentialities.

“Let that input pattern be the image on a computer screen.
Any image.
Assume that the output is a string of text describing the content of that screen.”

Like this? Or this?

Have you played with any LISPy languages? (I recommend Racket, along with the ‘Realm of Racket’ book, specifically for its accessibility and ease of getting started).

While not true of all functional programming languages, LISP is famous for data and code being the same.

However, it seems to me that you’re partially describing the functional paradigm of programming, where each function does one thing, and where pieces are built up into compositions of functions that describe either the intended solution or outcome (similar to piping output from shell program into the next, if you’re familiar with one-liners in BASH).

For a side hobby, I’ve been getting into Elixir, which is a functional language based on Erlang and easily distributed threads. I’m following this dude’s course here here: https://bigmachine.io/products/take-off-with-elixir/?utm_source=elixirlang&utm_medium=banner&utm_campaign=elixir_lang_learning.

1 Like

I love elixir, I started playing with it last year and yes, I think it’s functional design has guided my thinking to develop the idea I proposed.

I’m still laughing at this one:

2 Likes

Yeah… isn’t perfect, but imagine those imperfections as “noise”. Where this will all be non-deterministic anyway, running a couple iterations over that, with occasional requests for feedback, with a system segmenting out the areas of understanding like here.

Or hopefully we’ll be able to build similar systems using HTM sometime, that don’t require millions of examples, or HTM acting as a more intelligent filter on top of these systems.

I was trying to give some flavor to what I think is the futility of trying to create a landscape of all functions in a tree. I have described a rather limited set of possible input vectors ( even for a small screen it is still a large but limited set) and realize that it is entirely possible to describe much larger representation spaces without trying very hard.

Combinatorials are the downfall of many a scheme!

1 Like

Fair enough . But I’d be careful about potentially discouraging people willing to try. Who’s to say somebody here doesn’t crack it?

1 Like

My bad: I will confess that I was triggered by “all function space” part; as I indicated - that’s a lot of space.

I will add that the human brain is capable of being trained to work with a subset of these much larger sets; you could populate the parts you need rather than trying to create the entire set.

The basic rules could be a rather simple set; there must be a Turing complete repertoire.

After all - the brain does it with simple trainable coincidence detection.

The trick then is to set the fence around the domain that you are trying to map.

1 Like

Well when I said all possible functions i really meant all possible functions starting at the simplest and building the tree out as far as we find the language to be useful. I don’t imagine it’ll be used to map pixel values to English. I of course didn’t mean to actually instantiate the infinite.

1 Like

HTM and most of the networks I work with start with bits and not letters.