Not to discourage you from trying anything but it looks like you've ignored the complexity issues with this (I won't pick at the fact that you described an O(n^2) algorithm for sorting).
I understand that you don't want to specify the steps to achieving the goal but the steps directly impacts running time.
In your particular example, a compiler could produce a program with the correct output but runs extremely slowly even for small arrays (by simply trying all permutations until it finds one satisfying your constraints, or even worse, randomizes the entries until the constants are satisfied ("bogo sort")).
Furthermore, there are undecidable problem for which the output is easy to specify but no program could exist. For example, deciding if an input piece of code will loop indefinitely.
In your article, you've mixed needless overhead (the dummy/local swapped variable comes to mind) and the steps needed to specify an algorithm.
If you only want to remove the overhead (and thus, some source of mistakes you've pointed out), you could aim for a language where the algorithms are easier to specify.
In the bubble sort case, the code would look something like.
def bubble_sort( array ):
while there is an i such that array[i]<array[i+1]:
swap( array[i], array[i+1] )
(You can almost do this in Python already which seems to be where the syntax is inspired from. I can elaborate if interested.)
Ultimately, I have to agree with other comments saying this will be more useful for checking than specifying a program.
I understand that you don't want to specify the steps to achieving the goal but the steps directly impacts running time.
In your particular example, a compiler could produce a program with the correct output but runs extremely slowly even for small arrays (by simply trying all permutations until it finds one satisfying your constraints, or even worse, randomizes the entries until the constants are satisfied ("bogo sort")).
Furthermore, there are undecidable problem for which the output is easy to specify but no program could exist. For example, deciding if an input piece of code will loop indefinitely.
In your article, you've mixed needless overhead (the dummy/local swapped variable comes to mind) and the steps needed to specify an algorithm.
If you only want to remove the overhead (and thus, some source of mistakes you've pointed out), you could aim for a language where the algorithms are easier to specify.
In the bubble sort case, the code would look something like.
(You can almost do this in Python already which seems to be where the syntax is inspired from. I can elaborate if interested.)Ultimately, I have to agree with other comments saying this will be more useful for checking than specifying a program.
[EDIT: fixed code formatting]