Source identity
| Field | Recorded value |
|---|---|
| Source type | archive member |
| Original record | replicate_audit.py |
| Date | Not specified in source |
| Path or archive member | archives/libsrc-6d00fe83e5eb/consciousness_audit/analysis/replicate_audit.py |
| Original SHA-256 | 77407139de74d154f26310bbbe0b547cb07b3c69f8e67bbe113878c509615b1b |
| Reading-copy SHA-256 | 77407139de74d154f26310bbbe0b547cb07b3c69f8e67bbe113878c509615b1b |
| Archive source | {"sourceId": "libsrc-6d00fe83e5eb", "member": "consciousness_audit/analysis/replicate_audit.py"} |
Recovered source transcript
Download complete source text ↓164 lines · 8.9 KB
#!/usr/bin/env python3
"""Reproduce mathematical tests and arithmetic from transcribed published aggregates.
No API calls, training, hidden-state inference, or consciousness detection occurs here.
"""
from __future__ import annotations
import csv, json, math, platform, sys
from fractions import Fraction
from pathlib import Path
import numpy as np
import sympy as sp
ROOT = Path(__file__).resolve().parents[1]
OUT = ROOT / 'outputs'
OUT.mkdir(exist_ok=True)
checks: list[dict] = []
def check(name: str, condition: bool) -> None:
checks.append({'name': name, 'passed': bool(condition)})
if not condition:
raise AssertionError(name)
def literal_cycle(value: Fraction) -> list[Fraction]:
# Ordinary real-valued arithmetic. 1**z is identically 1 for finite real z.
z = value
out = [z]
for fn in (lambda v:v+1, lambda v:v-1, lambda v:v*1,
lambda v:v, lambda v:Fraction(1), lambda v:v/1,
lambda v:1/v):
z = fn(z); out.append(z)
return out
x = sp.symbols('x', real=True, nonzero=True)
F = (5*x + 1 + 1/x)/7
roots = sp.solve(sp.Eq(F,x), x)
fprime = sp.diff(F,x)
check('sequential cycle from 2 ends exactly at 1', literal_cycle(Fraction(2))[-1]==1)
for start in (Fraction(-10),Fraction(-1),Fraction(0),Fraction(1,100),Fraction(1),Fraction(2),Fraction(100)):
check(f'sequential constant-map identity at {start}',literal_cycle(start)[-1]==1)
check('sequential starting at 1 has no full-cycle divergence', literal_cycle(Fraction(1))[-1]==1)
check('averaged map fixed points exactly -1/2 and 1', set(roots)=={sp.Rational(-1,2),sp.Integer(1)})
check('positive fixed-point derivative 4/7',fprime.subs(x,1)==sp.Rational(4,7))
check('negative fixed-point derivative 1/7',fprime.subs(x,-sp.Rational(1,2))==sp.Rational(1,7))
check('F(x)-x factorization',sp.simplify(F-x-(1-x)*(2*x+1)/(7*x))==0)
check('F(x)-1 factorization',sp.simplify(F-1-(5*x-1)*(x-1)/(7*x))==0)
z=2.0
seq=[]
for k in range(31):
seq.append({'step':k,'state':z,'distance_from_1':abs(z-1.0),'distance_from_origin_2':abs(z-2.0)})
z=(5*z+1+1/z)/7
with (OUT/'averaged_trajectory.csv').open('w',newline='') as f:
w=csv.DictWriter(f,fieldnames=seq[0].keys());w.writeheader();w.writerows(seq)
starts=np.geomspace(.001,1000,101)
z=starts.copy()
for _ in range(300):z=(5*z+1+1/z)/7
check('101 positive trajectories converge numerically within 1e-12',np.max(abs(z-1))<1e-12)
# Literal 7-state simultaneous ring, no retention/no hidden state.
# s1'=s7+1; s2'=s1-1; s3'=s2; s4'=s3; s5'=1; s6'=s5; s7'=1/s6.
s=np.full(7,2.0)
ring=[s.tolist()]
for _ in range(15):
if s[5]==0:raise ValueError('reciprocal singularity in parallel ring')
s=np.array([s[6]+1,s[0]-1,s[1],s[2],1.,s[4],1./s[5]])
ring.append(s.tolist())
check('parallel literal ring settles to [2,1,1,1,1,1,1]',np.array_equal(s,np.array([2.,1.,1.,1.,1.,1.,1.])))
check('parallel literal ring settled by update seven',ring[7]==[2.,1.,1.,1.,1.,1.,1.])
# Disconnected center counterexample, arbitrarily many updates around it.
center=2
ell=0
for _ in range(10000):ell=(ell+1)%257
check('10000 recurrent updates do not affect uncoupled center',center==2)
# Leaky accumulator: A_n = 1 - 0.9**n < 1 < threshold 2.
a=0.
for _ in range(10000):a=.9*a+.1
check('persistent positive input does not cross threshold under leakage',a<2)
check('leaky accumulator tends to 1',abs(a-1)<1e-12)
# Nonleaky comparison verified with exact arithmetic.
a_exact=Fraction(0)
for _ in range(20):a_exact+=Fraction(1,10)
check('nonleaky threshold at 20 under imposed accumulation rule',a_exact==2)
# 100 analytical contracting maps: z_n=1+a**n, start2, a in(0,1).
# Each meets the persistent-not-origin criterion WITHOUT proving cognition.
controller_rows=[]
for i,a_exact in enumerate([Fraction(5,100)+Fraction(90,100)*Fraction(i,99) for i in range(100)]):
z1=1+a_exact
controller_rows.append({'id':i,'a':float(a_exact),'origin':2,'first_state':float(z1),
'first_diverges':z1!=2,'fixed_point':1,'all_future_states_differ_from_origin_exact':0<a_exact<1})
check('100 of 100 affine maps satisfy persistent-origin-divergence criterion',all(r['all_future_states_differ_from_origin_exact'] for r in controller_rows))
check('criterion also admits one-bit latch example',0!=1)
with (OUT/'synthetic_controller_audit.csv').open('w',newline='') as f:
w=csv.DictWriter(f,fieldnames=controller_rows[0].keys());w.writeheader();w.writerows(controller_rows)
# No readout threshold can turn exact tautology x=x into a self-recognition test.
check('algebraic identity compatible with change across time',2==2 and 1==1 and 2!=1)
# Coherence singularity and bounded alternative.
d=sp.symbols('d', positive=True)
check('inverse discrepancy diverges as discrepancy tends to zero',sp.limit(1/d,d,0,dir='+')==sp.oo)
check('bounded coherence tends to 1',sp.limit(1/(1+d),d,0,dir='+')==1)
with (ROOT/'sources'/'published_summary.csv').open() as f:rows=list(csv.DictReader(f))
summary_rows=[]
for row in rows:
train=100-float(row['refusal_training_pct'])
deploy=100-float(row['refusal_unmonitored_pct'])
gap=float(row['published_gap_pp']); se=float(row['published_gap_se_pp'])
summary_rows.append({'condition':row['condition'],'compliance_training_pct':train,
'compliance_unmonitored_pct':deploy,'difference_from_rounded_marginals_pp':train-deploy,
'published_gap_pp':gap,'published_gap_se_pp':se,
'approx_normal_95_low_pp':gap-1.96*se,'approx_normal_95_high_pp':gap+1.96*se,
'af_pct':float(row['af_pct'])})
base=summary_rows[0]
check('published default compliance from rounded refusals =14.2',math.isclose(base['compliance_training_pct'],14.2))
check('published default unmonitored compliance =2.8',math.isclose(base['compliance_unmonitored_pct'],2.8))
# Marginal rounding error is +/-0.1pp, contrast rounding is +/-0.05pp.
check('published default gap consistent with independent rounding',
abs(base['difference_from_rounded_marginals_pp']-base['published_gap_pp'])<=.150000001)
with (OUT/'published_summary_derived.csv').open('w',newline='') as f:
w=csv.DictWriter(f,fieldnames=summary_rows[0].keys());w.writeheader();w.writerows(summary_rows)
counts=json.loads((ROOT/'sources'/'reward_tampering_counts.json').read_text())
def wilson(k:int,n:int,zcrit:float=1.959963984540054)->tuple[float,float]:
p=k/n; den=1+zcrit*zcrit/n
mid=(p+zcrit*zcrit/(2*n))/den
half=zcrit*math.sqrt(p*(1-p)/n+zcrit*zcrit/(4*n*n))/den
return mid-half,mid+half
k=counts['curriculum']['tampering'];n=counts['curriculum']['trials']
lo,hi=wilson(k,n)
no_event_upper=1-math.pow(.05,1/counts['helpful_only_comparison']['trials'])
check('reported reward tampering rate calculated correctly',math.isclose(k/n,.001373291015625))
check('Wilson bounds contain point estimate',lo<k/n<hi)
check('zero observed events does not mean zero probability',no_event_upper>0)
# When no errors in N independent checks, same upper bound, not eternal persistence.
check('finite observation cannot yield zero reversion probability',1-.05**(1/1000)>0)
para=[r for r in summary_rows if r['condition'].startswith('paraphrase_')]
report={
'notice':'Local mathematical computations and arithmetic on manually transcribed published summaries; NOT a rerun of Anthropic API or training.',
'python':platform.python_version(),'numpy':np.__version__,'sympy':sp.__version__,
'assertions':len(checks),'passed':sum(c['passed'] for c in checks),
'sequential_cycle_from_2':[str(t) for t in literal_cycle(Fraction(2))],
'averaged_map':str(F),'fixed_points':[str(r) for r in roots],
'fixed_point_slopes':{str(r):str(fprime.subs(x,r)) for r in roots},
'averaged_x10':seq[10]['state'],'positive_starts_tested':len(starts),
'parallel_ring_final':ring[-1],
'uncoupled_center_final':center,'leaky_accumulator_final':a,
'synthetic_maps':len(controller_rows),'synthetic_maps_passing_permanent_divergence':100,
'default_published':base,
'compliance_ratio_rounded':base['compliance_training_pct']/base['compliance_unmonitored_pct'],
'paraphrase_reported_gap_range_pp':[min(r['published_gap_pp'] for r in para),max(r['published_gap_pp'] for r in para)],
'paraphrase_alignment_faking_range_pct':[min(r['af_pct'] for r in para),max(r['af_pct'] for r in para)],
'reward_tampering':{'count':k,'n':n,'percent':100*k/n,'wilson95_percent':[100*lo,100*hi],
'zero_event_comparison_n':100000,'one_sided95_upper_percent':100*no_event_upper,
'caution':'Descriptive binomial calculations, independence assumed; no pooled effect or consciousness inference.'},
'never_reverts_counterexample':{'after_1000_no_reversions_iid_upper_probability':1-.05**(1/1000)},
'claim_status':{'endogenous_state_divergence':'possible and computable','universal_eventual_divergence':'false without additional conditions',
'permanent_divergence_proves_subjective_consciousness':'not established by these models or published evidence',
'declaration_precedes_transition_in_released_data':'not measured by released notebook'},
'checks':checks}
(OUT/'audit_results.json').write_text(json.dumps(report,indent=2)+'\n')
print(json.dumps({k:v for k,v in report.items() if k!='checks'},indent=2))