Kurt Gödel’s first Incompleteness Theorem very roughly states that there will be things that are true in a formal system that are unreachable from its base mechanics.
These are often called emergent properties.
The underlying idea is that as the interactions of the formal system build on each other and more things get considered, new relationships will dynamically form, seemingly out of nowhere.
A while ago, I was playing around with creating an algorithm for graph isomorphism (GI). It had been proven that the problem was at least pseudo-polynomial, so it seemed like a fun idea to try and create a polynomial algorithm for it.
It’s a simple problem in practice: you have two graphs, and you want to see if they are the same graph.
Graphs have an odd quality: they contain information about how the nodes connect to each other, but without any reference to physical location. So, the same graph can be rearranged in any number of crazy ways, and if there are enough nodes, it becomes difficult for even a person to catch on.
You can get a polynomial traversal through a graph, but you never know what the same starting point is for both graphs. Because of that, you’d have to go through all possible combinations of starting points; it’s fully exponential. So, it would take a very long time to brute force a comparison, particularly if the graph is quite large.
But I had an idea. So I came up with a clever algorithm for it.
For small graphs, it worked perfectly. But as I increased the testing size, I quickly hit a size where it failed. When I investigated, I found an emergent property. A place where two different graphs looked oddly identical to each other in my algorithm, but were not the same graph. I had made an assumption based on the smaller graphs that broke when the graphs got larger. I quickly patched the code and went back to testing.
A little later on, I found another emergent property. It was similar. Again, I patched it, but I was getting worried. And then later again, I did tests on massive graphs and watched it fail for another brand new reason. At that point, I clued in and called it a day.
There was going to be an infinite number of these emergent properties, each appearing one after another, but getting farther apart. I knew how to code an algorithm for any graph less than a specific size, but I did not know how to do it for all graphs.
As I was thinking about it, it seems to me that primes are a possible example too. You have this identity, nothing, and an operation. When you apply the operation to the identity, a new prime appears, then another one. You can treat those new objects the same as the original identity. As you keep going, it flip-flops. You get a prime, then a ‘desert’ of composites, then a new prime, and so on. The deserts permute in size, but always keep getting larger, although all of the smaller ones seem to repeat as well. Primes, then, are emergent properties, although in this case: emerging objects, and we know there will be an infinite number of them. At some really huge numbers, there is a massive desert, but it is finite. There is also a desert of size 1 relatively close by to it.
Given that we know that emergent properties exist for all sufficiently complex formal systems, we can start to wonder about neural nets. They are complex entanglements of their relationships and weights, roughly based originally on our own’s brain’s structure.
But our brains run on a biological base, which seems like it might be intrinsically ‘informal’. That is, our own mechanics do glitch from time to time in unexpected ways. We are obviously built to work around that, but it seems possible that that characteristic might be the root of attributes like creativity. We’ll accidentally connect two things that should not be connected. Oops. Then somehow we work through that at a higher level, causing us to come up with interesting new things. That, mixed with our complex mixed-media internal models and lots of contradictions, seems to drive the human experience.
Neural nets running on a computer, however, are strictly bounded by formality. They can only do and expect what is inherent in their construction. But it seems that their mechanics are complex enough that we might also expect emergent properties. So, would we see higher-level behaviours such as ‘intelligence’ and ‘creativity’ emerging above?
Emergent properties are a new dynamic relationship forming that essentially adds on top of what is already there. It disproves assumptions, but it is constructive. It’s not that far away from what Douglas Hofstadter was getting at in Strange Loops, where the effects of a person's presence on another are, in a sense, part of that person. Your memories of someone are a part of them, part of the impact they have on the world. So long as other people remember them, they have not entirely disappeared into the backdrop.
I could almost see intelligence emerging in this way, but it would have to be there as a means of adding or amending existing weights and relationships. Intelligence affects change; it lifts up the behaviours somehow. The model knows something, but then, in fully understanding it, it derives a new conclusion which is written out and used for future results.
Creativity, on the other hand, at least seems accidental. A flaw of some type. You maybe could probabilistically recreate it, but you’d still need some self-healing behaviours on top to really mimic humans.
If we add in this notion that the data model buried in LLMs is just nested traversals through extended word relationships within sentences, then we can kinda see that even if emergent properties exist, it is tied to the underlying objects. That is, at best, inference could use one of these properties to get to a better traversal, but ultimately it is just rearranging the words in a sentence. Any sort of intelligence is buried far in advance in the underlying model data. It is, however, scary that we could amplify the underlying models, then add in secondary mechanics that could really start showing advanced capabilities. But at least they are still dragged down by formality. In that sense, maybe the very best AGI can ever do is a formal mimicry of our informal existence. Even if we ran it on flaky informal hardware, it would still require hugely sophisticated recovery capabilities, so it would still be severely limited.
So, overall, while emergent properties do surprising things to formal systems, the properties that we see as humans seem to come directly and only out of our own informal construction. Roger Penrose had suggested this in his book The Emperor's New Mind, but at the time I didn’t fully appreciate what he was trying to say. All sorts of unexpected things can happen in an informal system; it is not strict, although still limited by the boundaries of physics.
What kinda interests me is whether or not emergent properties follow specific patterns. If there are a finite number of patterns, it seems like Hilbert’s dream is back on. Maybe we really can fully formalize all formal systems. Seems unlikely; the patterns themselves probably have emergent properties, so it may just be turtles all the way up.
But even if we could formalize them, while that takes away some of the mystery, there will always be informal systems. In that sense, maybe we can only understand the depth of the world, just not its breadth? We’d have to deal with endless meta-patterns in that case.
The Programmer's Paradox
Software is a static list of instructions, which we are constantly changing.
Thursday, November 26, 2026
Thursday, November 19, 2026
Analysis
Analysis for software projects is the act of gathering, curating, and collating enough detailed information about a set of given problems that people would like to use software to solve. If it is complete enough, then it can be used as the sole reference for people creating designs for these solutions. It has all of the answers to all of the questions that a designer will have.
All software systems are anchored by the data that they collect.
The usage of these systems is confined within the boundaries of the data that they have access to. In that sense, this data sets the foundation on which any other features or functionality are built.
If there is a problem for which one wants to use software to solve it, then obviously the first and foremost thing that needs to be done is to figure out what data is necessary.
Data comes in two basic forms: a) you collect it directly from people, b) you cross-reference it from somewhere else.
So analysis goes through each and every datum and tries very hard to list it out with proper names, some understanding of expected frequency, location, properties, etc.
The more you know about the data, the smoother the development process will be.
For some data, it is not worth collecting literally; you can get it from relatively easy computations based on other raw data. So, the analysis needs to specify any ‘derived’ data necessary and how to compute it from the underlying raw data.
Since the software is a ‘solution’, it is important to understand how people will use it in order to solve their problems. Most of the time it is not ‘log in and click a button’. It is a considerably more complex ‘workflow’ where the users leverage specific functionality in a bunch of features, over a multi-step process in order to make decisions or create specific artifacts that they share.
The analysis needs to list out all of the known workflows, in as much detail as possible. When there are misfits with using the software, they begin and end in these workflows. That is, if it is only possible to do half the work in the system to accomplish something, then the system isn’t a particularly tight fit. If you can do it all and there is just one button to press, it is really tight, but if there is a lot of functionality in the system, the problem switches to being able to find that button, not pressing it.
Presenting data for decisions is straightforward, but then minimizing the navigation after that decision is critical too. If someone decides that the data indicates a specific action, it would be best if the button to trigger that action was presented at the same time, or at least very close by. So, presentations need to be linked back to their lists of expected actions. That is, you need to know why the data needed to be presented in order to wire up the navigation for the decisions.
Creating new artifacts is similar. They are essentially manually triggered derived data, but the tools to create and edit them can be very complex. The tools need to be arranged in a way that matches the expected usage for creating stuff. And more importantly, the tools should leverage as much of the existing data as they can; the user should not have to retype things, just rearrange them.
For cross-referenced data, there are usually performance vs. quality decisions that need to be made. If you grab the data early and keep it around, there is a chance it can get stale before you update it. That would be worse than if the process of using or presenting the data is really slow. So, there are accuracy expectations for all cross-reference data that need to be taken into account.
The analysis of a set of problems should give enough details about people dealing with those problems that a solid design can be produced. Analysis is nearly timeless. If the business does not change, the “business logic” within does not change either, even if the system gets reimplemented with many different technologies over the years. So, the descriptions, references, tables, etc. in the document should not reference, rely on, or be tied to any technology. In order to deal with a problem, you need to collect data and work with it in the following ways. It’s the ‘what’ portion of the issues, where the design document is the ‘how’.
For example, you might need to know a derived metric like the ‘yield’ of a given bond in the financial markets. There are many different ways to calculate that, all based on the bond’s prospectus. The yield is a real number, which for many technologies is represented using floating-point variables, although there are lots of other ways of representing it.
Analysis should really only be done once for a new line of business, then updated over the years and decades as the underlying domain changes. In this sense, it is independent of any sort of software implementation, and the work to keep it up to date should be disconnected from any IT initiatives. A business should be constantly working through its own analysis in order to keep its own line of business operating as well as possible. If that were done, then software projects would start at ‘design’ instead of ‘analysis’, which would likely take less time and improve their quality.
All software systems are anchored by the data that they collect.
The usage of these systems is confined within the boundaries of the data that they have access to. In that sense, this data sets the foundation on which any other features or functionality are built.
If there is a problem for which one wants to use software to solve it, then obviously the first and foremost thing that needs to be done is to figure out what data is necessary.
Data comes in two basic forms: a) you collect it directly from people, b) you cross-reference it from somewhere else.
So analysis goes through each and every datum and tries very hard to list it out with proper names, some understanding of expected frequency, location, properties, etc.
The more you know about the data, the smoother the development process will be.
For some data, it is not worth collecting literally; you can get it from relatively easy computations based on other raw data. So, the analysis needs to specify any ‘derived’ data necessary and how to compute it from the underlying raw data.
Since the software is a ‘solution’, it is important to understand how people will use it in order to solve their problems. Most of the time it is not ‘log in and click a button’. It is a considerably more complex ‘workflow’ where the users leverage specific functionality in a bunch of features, over a multi-step process in order to make decisions or create specific artifacts that they share.
The analysis needs to list out all of the known workflows, in as much detail as possible. When there are misfits with using the software, they begin and end in these workflows. That is, if it is only possible to do half the work in the system to accomplish something, then the system isn’t a particularly tight fit. If you can do it all and there is just one button to press, it is really tight, but if there is a lot of functionality in the system, the problem switches to being able to find that button, not pressing it.
Presenting data for decisions is straightforward, but then minimizing the navigation after that decision is critical too. If someone decides that the data indicates a specific action, it would be best if the button to trigger that action was presented at the same time, or at least very close by. So, presentations need to be linked back to their lists of expected actions. That is, you need to know why the data needed to be presented in order to wire up the navigation for the decisions.
Creating new artifacts is similar. They are essentially manually triggered derived data, but the tools to create and edit them can be very complex. The tools need to be arranged in a way that matches the expected usage for creating stuff. And more importantly, the tools should leverage as much of the existing data as they can; the user should not have to retype things, just rearrange them.
For cross-referenced data, there are usually performance vs. quality decisions that need to be made. If you grab the data early and keep it around, there is a chance it can get stale before you update it. That would be worse than if the process of using or presenting the data is really slow. So, there are accuracy expectations for all cross-reference data that need to be taken into account.
The analysis of a set of problems should give enough details about people dealing with those problems that a solid design can be produced. Analysis is nearly timeless. If the business does not change, the “business logic” within does not change either, even if the system gets reimplemented with many different technologies over the years. So, the descriptions, references, tables, etc. in the document should not reference, rely on, or be tied to any technology. In order to deal with a problem, you need to collect data and work with it in the following ways. It’s the ‘what’ portion of the issues, where the design document is the ‘how’.
For example, you might need to know a derived metric like the ‘yield’ of a given bond in the financial markets. There are many different ways to calculate that, all based on the bond’s prospectus. The yield is a real number, which for many technologies is represented using floating-point variables, although there are lots of other ways of representing it.
Analysis should really only be done once for a new line of business, then updated over the years and decades as the underlying domain changes. In this sense, it is independent of any sort of software implementation, and the work to keep it up to date should be disconnected from any IT initiatives. A business should be constantly working through its own analysis in order to keep its own line of business operating as well as possible. If that were done, then software projects would start at ‘design’ instead of ‘analysis’, which would likely take less time and improve their quality.
Thursday, November 12, 2026
Unbounded Loops
[ Editor's note: I wrote this because I forgot, again :-( ]
Unbounded loops are bad. If there is a bounded loop that can be used instead, use that instead.
Code really has two major flow-of-control constructs. One is conditional execution. You execute the code “sometimes”. We see that as ‘if’ statements, but there are all sorts of variations on that theme.
The other is loops. Loops come in two flavours, bounded and unbounded. A bounded loop is one that has the number of iterations effectively set in advance. A good example is a ‘for’ statement, with a variable called ‘i’. It starts at 0 and finishes at some ‘size’. The 0..size is the bounds for that loop. It will “always” stay within them.
Sometimes we don’t have bounds. A REPL is a good example. As long as the user keeps typing in text, the loop will continue to run. At some point, the user types in something special that triggers the code to ‘break’ the loop. Could be ‘exit’ or ‘quit’ or ‘EOF’ or something. It could just be a dynamic terminal triggered by the end of work. There are plenty of other places, like communication protocols, where there are often unbounded loops. But all of them are special.
Sometimes, people encode their loops as unbounded, even though they are essentially bounded. If encoding it as a bounded loop is only slightly less convenient, then it should be encoded as a bounded loop. Being clever with loops is really bad.
The reason for this is that it is self-describing. If you hit an unbounded loop, you might have to search around through a whack load of spaghetti to find its bounds. That’s a huge waste of time.
Another good reason is computational complexity. If you are coding loops, you really, really, really need to know how long they are going to take. If it loops on 3 or 4 things, you can quickly ignore it, but if it might loop on a million things, you can’t just chuck code like that out into production and hope for the best. One day it will fail, and people will be angry about it. If it can loop ‘that hard,’ then at bare minimum you’ll need some sort of testing to be in place so that you have the certainty that it won’t be you causing a denial of service attack on the system.
So, if you quickly read the code, and you can instantaneously pick up all of the bounds, then often in your head you can have a reasonable degree of certainty that when this code gets out there in the world, its behaviour will not sufficiently degrade from the behaviour you’ve been seeing while you worked on it in development.
That certainty is everything.
You have become an expert in programming because the code you write does only and exactly what it should do relative to your expectations. Obviously, that doesn’t mean it is “right”; it just means that when it runs, you will not be surprised, and you really don’t want surprises, do you?
Subscribe to:
Posts (Atom)