r/learnprogramming • • Apr 28 '22

If everything is ultimately binary, does't that just make programs a specific number?

I did the CS50 course a while ago and they covered binary in there. I did binary back in 2006 when I was at college too so understood the logic behind it already. It's either on or off!

When a C program compiles, it goes through it's phases and compiles to assembly and then ultimately machine code i.e binary.

Let's say our program is 5,000,000 pages of 1's and 0's. All of those 1's and 0's make up a single number....albeit a super long number.

Does that mean that the entire Linux operating system, for example, can be represented by an actual number?

If so, why are we not storing programs as a number because that would take up less space than the 5,000 pages of 1's and 0's.

110101000101011111011011111110111100 = 57000443836 in decimal. So why don't we store programs in decimal and convert that to 1's and 0's in real time?

Storage would be much less. Is that how compression works?

These may be crazy questions but it just entered my head earlier when thinking about what the binary of a program can represent.

Even shorter than decimal is HEX.... So why don't we store programs in Hex?

Any help appreciated on this one so I can wrap my head around it.

1.7k Upvotes

346 comments sorted by

View all comments

Show parent comments

33

u/Sufficient_Drop5013 Apr 29 '22

It may very well be a misconception, but you can't prove it's not true.

40

u/jcb088 Apr 29 '22

Until he can! If he can! Maybe that's his life's work!

This conversation might be the start of something incredible!

39

u/schoolmonky Apr 29 '22

Depending on what exactly you mean by "it," you totally can, and /u/l_am_wildthing did.

If by "it" you meant the statement "Pi doesn't contain every possible number," then yes, that's currently believed to be false, and therefore unprovable.

But if you read carefully, that's not the statement that /u/l_am_wildthing is arguing against. What they actually say is that the facts that a number (in this case, pi) is infinite and non-repeating do not imply that it contains every possible number. He's not making a claim about whether pi has all numbers in it, but instead about the logical relationship between whether pi is infinite and non-repeating and whether pi contains all numbers.

1

u/Smooth_Measurement_1 Apr 30 '22

So many replies on this Pi thing! I can't believe that Pi contains every number in the world. The possibility of having a long row of 0's and 1's is quite slim given there are another batch of numbers to mix in there.

-34

u/Sufficient_Drop5013 Apr 29 '22

But ontologically the fact that pi is a non repeating infinite number does imply that every possible combination of numbers are in it, and ontologically is also a fact that you can't prove something doesn't exist. You can argue that is highly unlikely, but given enough time, unlikely becomes certain as the time axis approaches infinity, infinity being a property of pi, assuming that pi is a non repeating infinite number.

10

u/Cybyss Apr 29 '22

the fact that pi is a non repeating infinite number does imply that every possible combination of numbers are in it

Not true. Consider the following number:

0.1010010001000010000010000001...

This is, you have an increasing number of zeroes between each consecutive 1.

This is an irrational number. Its digits are non-periodic and infinite.

Nowhere in these digits will you find a '2'. Nowhere will you even find the sequences '11' or '10101'.

Thus, we have a nonrepeating infinite number which does not contain every possible "number" within its digits.

and ontologically is also a fact that you can't prove something doesn't exist

You can in mathematics, to a point at least. For example you can prove that there are no integers a and b such that a/b = sqrt(2) within the set of real numbers, because the existence of such integers would violate the definition of real numbers.

I should point out, however, that this doesn't apply to alternate mathematical systems. In finite field arithmetic sqrt(2) can be an integer, but you're no longer working with the set of real numbers in this case.

-3

u/Sufficient_Drop5013 Apr 29 '22

I really don't like to put myself in a situation when I could be perceived as the irrational one, but neither of those points actually apply to pi. The only way to prove it would be to calculate every digit of pi, and since it's infinite, it is imposible. The only way to disprove it would be to demonstrate that either pi is not infinite or it's digits are not random. That being said, I did pull out a sophism on you, by making you the bearer of the burden of proof. You can easily tell me that I can't prove that any and all possible combinations of numbers exist within the digits of pi, and you would have been right.

7

u/Cybyss Apr 29 '22

The only way to prove it would be to calculate every digit of pi

Not necessarily. Whether or not pi is normal is currently an open question. Mathematicians just haven't found a proof yet for whether it is, isn't, or whether the question is undecidable.

It's entirely possible that some equation known to generate the digits of pi has an as-yet undiscovered property that could prove whether it also generates all possible finite sequences of digits.

19

u/schoolmonky Apr 29 '22

That whole comment is nonsense. Literally every single statement in it is wrong.

2

u/[deleted] Apr 29 '22

Is’nt there a paradox? If pi contains every number combinations ever there is, doesn’t that mean pi contains pi in somewhere(without a decimal)? Then it would just repeat pi forever and ever.

5

u/mcaruso Apr 29 '22

Every finite number.

30

u/nimbledaemon Apr 29 '22

If you start believing everything you can't prove to be false, you're going to end up believing a lot of bullshit.

-1

u/Sufficient_Drop5013 Apr 29 '22

Exactly, no one can prove that God doesn't exists, nor anyone can prove that he/she/it Does exists. In the end, it's just a matter of faith. So if I have to choose, I choose to have faith in pi.

9

u/nimbledaemon Apr 29 '22 edited Apr 30 '22

That's the thing, though, you don't have to choose. Just admit we don't know the answer, and if it really interests you do some academic research or whatever they call it in math, maybe you'll find the answer one way or another. But believing one or the other before doing so just means that if in reality the opposite is true, you just made the process a lot harder for yourself, and if you made any assumptions based on your belief then all of those are going to be wrong as well, and it just turns into this whole thing you have to deconstruct because you made a faulty assumption somewhere.

Software developers should know the importance of this since one of the most common problems with software is making faulty assumptions about what your code is doing or how it should work, which can cause huge problems down the line when a lot of your code depends on one bad piece. This is also why modularization is important as well, it reduces how much of your code can break if something goes wrong.

3

u/Sufficient_Drop5013 Apr 29 '22

I like the way you think

24

u/Putnam3145 Apr 29 '22

Sure, but you can't claim it like it's a known fact either. Lots of people suspect P != NP but I'm not gonna go around proclaiming it.

0

u/pyronius Apr 29 '22

I can prove it.

In order for something to be said to exist, it must be at least theoretically possible to prove it's existence either through direct or indirect observation. (This, admittedly is probably the most contentious piece of my proof)

Regardless of whether the properties of pi are such that it would contain every number in existence, the fact of the matter is that it does not, because many of these numbers cannot be observed.

If we take some number n, then there is a length of time and an amount of energy that it would necessarily take to calculate where in pi n could be found. But as we increase the number of digits in n, we necessarily increase the average amount of energy and time that it would take to calculate its location in pi. Therefore, there must be some number nx for which the amount of energy necessary to calculate its location in pi is greater than the amount of energy in the universe.

nx in pi is thus theoretically impossible to observe and therefore does not exist.

(Don't hate me, I'm just an idiot talking out my ass for the hell of it)

1

u/PioVIII Apr 30 '22

you have a peculiar understanding of the term "theoretically"

1

u/Cybyss Apr 30 '22 edited May 01 '22

It sounds like you subscribe to the Ultrafinitism philosophy. That is the set of natural numbers cannot be infinite because numbers only come into existence once they are computed, and so far we've only computed a finite number of them.

That's not a widely held view though.

There are some numbers which we know have to exist but which we can never observe/compute. Chaitin's Constant is a famous example. Namely, it's the probability that a randomly generated computer program will halt (this constant is specific to which programming language you choose).

Due to the fact that the Halting Problem - namely, the question of whether a given computer program will halt or go into an infinite loop - is undecidable, it is mathematically impossible to ever actually calculate the digits of Chaitin's Constant.