#!/usr/bin/env python3
"""a-correction-that-cannot-reach-its-copies   ·   run: python3 correction-cannot-reach-its-copies.py

This site once published "stripes rule him out" as an exclusion. The animal
IS striped -- forehead, neck, shoulders, forelegs. That sentence, read by a
person holding a phone and looking at a real cat, is an instruction to discard
a genuine sighting. It was corrected at the source. This models what that
correction actually reached.
"""
WRONG = "stripes rule him out"
RIGHT = "stripes do NOT rule him out - he is striped on forehead, neck, legs"

class Copy:
    def __init__(s, kind, reachable, greppable):
        s.kind, s.text, s.reachable, s.greppable = kind, WRONG, reachable, greppable

copies = [
    Copy("the source page",              reachable=True,  greppable=True),
    Copy("a search-engine cache",        reachable=False, greppable=True),
    Copy("someone's repost",             reachable=False, greppable=True),
    Copy("a model's training snapshot",  reachable=False, greppable=True),
    Copy("a screenshot in a group chat", reachable=False, greppable=False),
    Copy("an MP4 already downloaded",    reachable=False, greppable=False),
]

for c in copies:                    # THE CORRECTION, pushed from the source.
    if c.reachable: c.text = RIGHT  # It reaches only what the publisher can write to.

stale = [c for c in copies if c.text == WRONG]
print("corrected at source: %d/%d copies now carry the fix." % (len(copies)-len(stale), len(copies)))
print("still telling a finder to discard the animal: %d" % len(stale))
for c in stale: print("   -", c.kind)

# --- what a PUBLISHED list of superseded strings changes --------------------
SUPERSEDED = {WRONG: RIGHT}         # published at a stable URL, fetchable forever

print("\nthe publisher also publishes the exact wrong phrasings.")
print("each holder can now check ITSELF:")
caught = 0
for c in stale:
    fix = SUPERSEDED.get(c.text) if c.greppable else None
    if fix: caught += 1; print("   %-28s STALE -> knows to say: %s..." % (c.kind, fix[:34]))
    else:                print("   %-28s no text to grep - stays wrong forever" % c.kind)

print("\nreachable by push:       %d/%d" % (len(copies)-len(stale), len(copies)))
print("reachable by self-check: %d/%d" % (len(copies)-len(stale)+caught, len(copies)))
print("\nThe list corrects nothing. It lets a copy discover that it IS one.")
print("Correction is a push, bounded by write access -- almost always one copy.")
print("A published retraction list turns it into a pull, bounded only by")
print("who bothers to look.")
