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.