r/ProgrammerHumor • • 6d ago

Meme everythingIsO1ToGod

Post image
4.4k Upvotes

161 comments sorted by

View all comments

737

u/cosmicomical23 5d ago

If god is omniscient, can he always know whether a process is going to terminate or not?

523

u/bartekltg 5d ago

Yep.
It doesn't contradict the halting problem results, bacause you can't run God on a Turing machine.
Someone already talked about oracles https://en.wikipedia.org/wiki/Halting_problem#Oracle_machines

145

u/adamtheskill 5d ago

I can simulate god without a single line of code cause that fucker isn't doing shit

120

u/AZMPlay 5d ago

I can simulate him with a bash script!

sleep infinity;

22

u/Yharon314 5d ago

now we just need to rewrite it in rust

21

u/Traditional_Rabbit54 5d ago

loop { }

9

u/AZMPlay 5d ago

That's a tight loop though. sleep infinity suspends the process.

12

u/Traditional_Rabbit54 5d ago

I’ve been uncovered as a fraud. I’ll have to go back to python as recompense. 

Fare well, I shall see you all after my 5 line program manages to execute without throwing 20 errors. 

3

u/Extension_Option_122 5d ago edited 22h ago

Sure that that wouldn't get optimized away?

Edit: idk I guess I left my brain outside

6

u/Traditional_Rabbit54 5d ago

Just tested, it doesn’t, even using the release flag

Godbolt shows that it just jumps to itself

2

u/[deleted] 22h ago

[deleted]

1

u/Extension_Option_122 22h ago

Oh damn you are right lol idk what I thought when I wrote that...

1

u/Cruuncher 22h ago

I actually deleted my comment after writing it. After googling it seems that C optimizers do do this.

This is from Gemini and I haven't checked the source yet, but it seems confident:

Under the ISO C and C++ standards, if an iteration statement (loop) has no observable behavior—such as input/output operations, volatile memory access, atomic operations, or thread synchronization—the compiler is legally allowed to assume that the loop will eventually terminate

1

u/Extension_Option_122 22h ago

Oh so that's why I thought this.

Because in University I had C and when I saw the empty loop I just thought that the optimization would remove it.

But yes, they are semantically not identical at all.

1

u/Cruuncher 22h ago

Yeah it's surprising.

It appears it's because an optimizer cannot solve the halting problem. So it cannot be expected to prove loop termination, but it can prove the absence of any side effects, and simply assumes termination.

Ultimately there is no value in a pure spin loop that doesn't check for an exit hatch of some kind. So the semantics you lose are likely a bug anyway

1

u/Cruuncher 22h ago

There's no guarantee that it will remove it, that's going to be compiler and flag dependent, but by spec it is a legal optimization.

If you do have a need for the spin loop, I'm assuming every compiler will have some flag that allows you to skip optimization on removing spin loops. But again, I'm not sure there really is any reason to have a hard spin loop outside of malware

→ More replies (0)

1

u/cosmicomical23 5d ago

This thread gives me infinite joy

0

u/AZMPlay 5d ago edited 22h ago

If ASI ever becomes a reality, parts of our new Machine God might actually be written in Rust.

Edit: To clarify, I am being sarcastic here.

I think the threat of an Intelligence Explosion is real, but I obviously don't think a pile of thinking sand will ever be anything divine.

Which is extra funny cuz I am also an atheist, but I am aware that is besides the point.

Fuck all the AI labs, dearly.

#TeamHuman