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

2

u/captainAwesomePants Apr 29 '22

Godel's Incompleteness Theorem states that any consistent mathematical system will have facts that are true but can never be proven.

That means that there are almost certainly some big math questions that are true or false (like P=NP or others) but that nobody will ever be able to conclusively answer. This is very unfortunate if you have made a career out of searching for a proof for a big math question.

1

u/BigBootyBear Apr 29 '22

How can you find out if a problem cannot be proved?

1

u/captainAwesomePants Apr 29 '22

For some problems, you can prove that they are undecidable one way or the other. For other problems, though, you won't ever be able to know for sure, and that's the bit that makes mathematicians sad. Some of them are doomed to spend lifetimes searching for a proof of something that is true and that they suspect is true but that can't be proven and can't be shown not to be probable.

1

u/BigBootyBear Apr 29 '22

Oh I see! Very interesting!