"""Replay additional analysis, preserving its reported/conditional distinction."""
from pathlib import Path
from decimal import Decimal as D
import csv,math
HERE=Path(__file__).parent
rows=list(csv.DictReader((HERE/"joint-quality-bounds.csv").open()))
for r in rows:
 f,a=D(r["fluency"]),D(r["answerability"])
 lo,hi=max(D(0),f-a),min(f,1-a)
 assert D(r["fluent_not_answerable_lower"])==lo
 assert D(r["fluent_not_answerable_upper"])==hi
 for failure in [lo,hi]:
  both=f-failure;only_a=a-both;neither=1-(both+failure+only_a)
  assert min(both,failure,only_a,neither)>=0 and both+failure+only_a+neither==1
print("Three logical bounds and six feasible endpoint tables verified, no unreported joint counts inferred")
