use crate::object::sheaf::{Cover, SectionTable};
use crate::verify::{CoverGlueInferenceReport, InferenceAttempt, cover_glue_inference_report};
pub fn proof_replay_witnesses_section() -> String {
let mut lines: Vec<String> = Vec::new();
lines.push("witnesses:".to_string());
lines.push(
" witness: kind=ValuationAdditivityWitness, purpose=observed samples of v(x*y) == v(x) + v(y)"
.to_string(),
);
lines.push(
" witness: kind=UltrametricWitness, purpose=observed samples of v(x+y) >= min(v(x), v(y))"
.to_string(),
);
lines.push(
" witness: kind=PrecisionPreservationWitness, purpose=observed samples of precision labels preserved"
.to_string(),
);
lines.push(" source: src/verify/witnesses.rs (P347)".to_string());
lines.join("\n")
}
pub fn proof_replay_cover_glue_section<T: Clone + PartialEq>(
cover: &Cover,
sections: &SectionTable<T>,
) -> String {
let report: CoverGlueInferenceReport = cover_glue_inference_report(cover, sections);
let total = report.attempts.len();
let inferred = report
.attempts
.iter()
.filter(|a| matches!(a, InferenceAttempt::InferredMissingSection { .. }))
.count();
let resolved = report
.attempts
.iter()
.filter(|a| matches!(a, InferenceAttempt::ResolvedOverlap { .. }))
.count();
let failed = report
.attempts
.iter()
.filter(|a| matches!(a, InferenceAttempt::FailedRecovery { .. }))
.count();
let mut lines: Vec<String> = Vec::new();
lines.push("cover_glue_inference:".to_string());
lines.push(format!(
" cover_glue_inference_attempts: total={}, inferred={}, resolved={}, failed={}",
total, inferred, resolved, failed
));
lines.push(format!(
" cover_glue_inference_succeeded: {}",
report.all_succeeded()
));
lines.push(" source: src/verify/cover_glue_inference.rs (P348)".to_string());
lines.join("\n")
}