DEV Community

Cover image for The Halting Problem
Danny Sebastián Díaz Padilla
Danny Sebastián Díaz Padilla

Posted on

1 2 1 2 2

The Halting Problem

This is a submission for DEV Computer Science Challenge v24.06.12: One Byte Explainer.

Explainer

The halting problem asks whether there can be a machine that determines whether a program will halt or continue indefinitely. It cannot exist; if we add a negation to this machine and evaluate it on itself, it will always fail because of its contradiction.

Additional Context

Solved by Alan Turing. Explaining this concept is complicated, since it requires the use of several compound functions:

  1. Extended Explanation:

    • "H" which can determine whether any program 𝑃 stops or continues given an input.
    • We use "H" to create a program "D" that takes as input the code of a program "P".
    • "D(P)" calls "H(P, P)", evaluating "P" with its own code as input.
    • If "H(P, P)" says "yes" (P stops at P), "D(P)" enters an infinite loop.
    • If "H(P, P)" says "no" (P does not stop at P), "D(P)" stops.
  2. Paradox:

    • Passing "D" to itself as input: "D(D)":
      • If "H(D, D)" says that "D(D)" stops, "D(D)" enters an infinite loop (contradiction).
      • If "H(D, D)" says that "D(D)" does not stop, "D(D)" stops (another contradiction).

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay