import json from pathlib import Path x = json.loads(Path('results.json').read_text()) checks = x['math_checks'] target_rows = [r for r in x['rows'] if r['sweep'] == 'target'] stiff_rows = [r for r in x['rows'] if r['sweep'] == 'stiffness'] obs_cross = next(r['target'] for r in target_rows if r['baseline']['violation_rate'] > 0) pred_cross = checks['nominal_crossing_target_predicted'] max_shield_violation = max(r['idea']['violation_rate'] for r in x['rows']) max_shield_peak = max(r['idea']['peak_force'] for r in x['rows']) scale_errors = [abs(r['baseline']['peak_force'] - r['k'] * .20) for r in stiff_rows] report = { 'predictions': [ { 'claim': 'static force boundary penetration = F_safe / stiffness', 'predicted': checks['predicted_boundary_penetrations'], 'observed': checks['observed_boundary_penetrations'], 'max_abs_error': checks['force_boundary_max_abs_error'], 'pass': checks['force_boundary_max_abs_error'] < 1e-10, }, { 'claim': 'nominal violation starts near target = F_safe / stiffness', 'predicted': pred_cross, 'observed_grid_first_violation': obs_cross, 'absolute_error': abs(obs_cross - pred_cross), 'pass': abs(obs_cross - pred_cross) <= .01, }, { 'claim': 'shield keeps predicted/actual force below safety level when feasible', 'safety_level_with_margin': .48, 'max_observed_shield_peak_force': max_shield_peak, 'max_shield_violation_rate': max_shield_violation, 'pass': max_shield_violation == 0.0, }, { 'claim': 'unshielded peak force scales as stiffness times target penetration', 'max_abs_scaling_error': max(scale_errors), 'pass': max(scale_errors) <= 1e-10, }, ], 'summary': { 'baseline_target_high_force_violation_rates': { str(r['target']): r['baseline']['violation_rate'] for r in target_rows if r['target'] >= .08 }, 'shield_target_high_force_violation_rates': { str(r['target']): r['idea']['violation_rate'] for r in target_rows if r['target'] >= .08 }, 'shield_feasible_rate_min': min(r['idea']['feasible_rate'] for r in x['rows']), }, } Path('verification_report.json').write_text(json.dumps(report, indent=2)) print(json.dumps(report, indent=2))