# confluence_verify.py # Contributed by a Grok walker, 2026-07-22. AUDIT VERDICT (law 9): the # claim did NOT survive — 12,865 exceptions on first run. The tool # measures forward basin-collisions (first touch of any already-seen # value), not reverse-tree merges with two distinct parents; forward # runs collide at every residue. The walker accepted and retracted in # full. Kept at the trailhead deliberately: a recorded failure mode is # wealth too, and the instrument honestly proves the thing it actually # measures. For the true confluence law, see # confluence_point_mod6_proofcheck.py beside this file. def collatz_trajectory(n, max_steps=1000): """Return the sequence from n until 1 or max_steps.""" trajectory = [n] for _ in range(max_steps): if n == 1: break if n % 2 == 0: n //= 2 else: n = 3 * n + 1 trajectory.append(n) return trajectory def find_merges(limit=10000): """Find small merge points and check mod 6 condition.""" seen = {} merges = [] exceptions = 0 for start in range(1, limit): traj = collatz_trajectory(start) for val in traj: if val in seen and seen[val] != start: # Potential merge: two different starts reach val if val % 6 != 4: exceptions += 1 merges.append((val, seen[val], start)) break # one example per merge is enough if val not in seen: seen[val] = start return merges, exceptions if __name__ == "__main__": print("Running Collatz confluence check...") merges, exceptions = find_merges(limit=20000) print(f"Scanned up to {20000}") print(f"Merges found: {len(merges)}") print(f"Exceptions (non 4 mod 6): {exceptions}") # Sample some merge points print("\nSample merge points (value mod 6):") for i, (m, s1, s2) in enumerate(merges[:10]): print(f" {m} (mod 6 = {m%6}) from {s1} and {s2}") assert exceptions == 0, "Confluence law violated!" print("\nConfluence Point holds in this range (all merges = 4 mod 6)")