countLines
is ComputableSeptember 15, 2025
countLines
is impossiblecountLines
is definitely computable!countLines
FunctionTheir Strategy: - Create a program that contradicts itself when counting its own lines - Show this creates an impossible situation - Conclude that countLines cannot exist
Let’s examine this logic…
First, they create countLinesPlus1 that returns n+1 instead of n
What happens when we run: weirdCountLines(rf('weirdCountLines.py'))
Question: Does this prove countLines
is impossible?
WeirdCountlines.py
into itself, it should be both equal the number of lines from both countlines
(n) and countlinesplus1
(n+1) at the same time which contradictory. Hence, countlines.py
can’t exist.weirdCountLines
creates a contradiction when analyzing itselfcountLines
cannot existcountlines.py
.countlines
is computablecountlines
is both computable and tractable.
countLines
is provably computable - we can always count lines efficientlyProofgrammers