I am trying to find the lowest level of things that you just can't implement because they are too low level. So it seems that all computation can be constructed from the NAND gate.
From the truth table it is easy to "implement" in JavaScript:
function nand(a, b) {
if (a == 0 && b == 0) return 1
if (a == 0 && b == 1) return 1
if (a == 1 && b == 0) return 1
if (a == 1 && b == 1) return 0
}
But this is cheating. Because how are the IF statements implemented? I don't quite know how to represent that if-statement link in code since I'm not sure familiar with logic gates/circuits, but I am pretty sure the IF statement itself could be represented as a combination of NAND gates.
So then it's turtles all the way down! A NAND gate is implemented with more NAND gates (for the if-statements), etc..
So how do we avoid this situation? Do we simply say that a NAND gate is an axiom? I am wondering because I'm wondering where the foundation for formal verification lies.
Put another way, the reason I'm asking is because I've noticed that every function can be implemented as other functions, even the IF statement and such. Everything can be implemented all the way down to NAND gates. But then I am left swinging, the NAND is a function too, but what is it's implementation?!? I'm confused/perplexed and need some guidance on how to think about this.