1use oxilean_kernel::{BinderInfo, Declaration, Environment, Expr, Level, Name};
6
7use super::types::{
8 BarRecursion, BoundType, BoundedArithmetic, CantorNormalForm, Clause, ComplexityBound,
9 CookReckhowThm, CurryHoward, DialecticaFormula, DialecticaInterp, EffectiveBound, EmptyClause,
10 ExtractedProgram, Finitization, FunctionalInterpretation, GentzenNormalization,
11 HerbrandSequenceBuilder, HerbrandTerm, HeuristicFn, MajorizabilityChecker, MetastabilityBound,
12 MetricFixedPointMining, ModelCheckingBound, MonotoneFunctionalInterpretation,
13 OrdinalTermination, PhpPrinciple, ProofComplexityMeasure, ProofSearcher, ProofState,
14 ProofSystem, ProofSystemNew, PropositionalProof, ProverData, QuantitativeCauchy, RamseyBound,
15 RealizabilityInterpretation, RealizedFormula, ResolutionProof, ResolutionRefutation,
16 ResolutionStep, SearchStrategy, TerminationProof, UniformConvexityModulus, WeakKoenigsLemma,
17 WitnessExtractor,
18};
19
20pub fn app(f: Expr, a: Expr) -> Expr {
21 Expr::App(Box::new(f), Box::new(a))
22}
23pub fn app2(f: Expr, a: Expr, b: Expr) -> Expr {
24 app(app(f, a), b)
25}
26pub fn app3(f: Expr, a: Expr, b: Expr, c: Expr) -> Expr {
27 app(app2(f, a, b), c)
28}
29pub fn cst(s: &str) -> Expr {
30 Expr::Const(Name::str(s), vec![])
31}
32pub fn prop() -> Expr {
33 Expr::Sort(Level::zero())
34}
35pub fn type0() -> Expr {
36 Expr::Sort(Level::succ(Level::zero()))
37}
38pub fn pi(bi: BinderInfo, name: &str, dom: Expr, body: Expr) -> Expr {
39 Expr::Pi(bi, Name::str(name), Box::new(dom), Box::new(body))
40}
41pub fn arrow(a: Expr, b: Expr) -> Expr {
42 pi(BinderInfo::Default, "_", a, b)
43}
44pub fn impl_pi(name: &str, dom: Expr, body: Expr) -> Expr {
45 pi(BinderInfo::Implicit, name, dom, body)
46}
47pub fn bvar(n: u32) -> Expr {
48 Expr::BVar(n)
49}
50pub fn nat_ty() -> Expr {
51 cst("Nat")
52}
53pub fn bool_ty() -> Expr {
54 cst("Bool")
55}
56pub fn witness_extractor_ty() -> Expr {
58 type0()
59}
60pub fn realized_formula_ty() -> Expr {
62 type0()
63}
64pub fn realizability_interpretation_ty() -> Expr {
66 arrow(cst("Formula"), type0())
67}
68pub fn herbrand_term_ty() -> Expr {
70 type0()
71}
72pub fn extract_witness_ty() -> Expr {
75 impl_pi(
76 "P",
77 arrow(nat_ty(), prop()),
78 arrow(app2(cst("Exists"), nat_ty(), bvar(0)), cst("HerbrandTerm")),
79 )
80}
81pub fn compute_bound_ty() -> Expr {
84 arrow(cst("WitnessExtractor"), nat_ty())
85}
86pub fn is_realizable_ty() -> Expr {
89 arrow(cst("Formula"), prop())
90}
91pub fn dialectica_formula_ty() -> Expr {
93 type0()
94}
95pub fn functional_interpretation_ty() -> Expr {
97 arrow(cst("DialecticaFormula"), type0())
98}
99pub fn weak_koenighs_lemma_ty() -> Expr {
101 prop()
102}
103pub fn bounded_arithmetic_ty() -> Expr {
105 type0()
106}
107pub fn dialectica_soundness_ty() -> Expr {
110 impl_pi(
111 "A",
112 cst("Formula"),
113 arrow(
114 app(cst("Provable"), bvar(0)),
115 app(cst("Realized"), app(cst("Dialectica"), bvar(1))),
116 ),
117 )
118}
119pub fn proof_system_ty() -> Expr {
121 type0()
122}
123pub fn proof_complexity_measure_ty() -> Expr {
125 type0()
126}
127pub fn propositional_proof_ty() -> Expr {
129 type0()
130}
131pub fn resolution_proof_ty() -> Expr {
133 type0()
134}
135pub fn cook_reckhow_thm_ty() -> Expr {
138 app2(
139 cst("Iff"),
140 app2(
141 cst("Exists"),
142 cst("ProofSystem"),
143 app(cst("Efficient"), bvar(0)),
144 ),
145 cst("NP_equals_CoNP"),
146 )
147}
148pub fn clause_ty() -> Expr {
150 type0()
151}
152pub fn resolution_step_ty() -> Expr {
154 arrow(
155 cst("Clause"),
156 arrow(cst("Clause"), arrow(cst("Clause"), prop())),
157 )
158}
159pub fn empty_clause_ty() -> Expr {
161 prop()
162}
163pub fn resolution_refutation_ty() -> Expr {
165 arrow(app(cst("List"), cst("Clause")), prop())
166}
167pub fn resolution_completeness_ty() -> Expr {
170 impl_pi(
171 "F",
172 cst("CNFFormula"),
173 arrow(
174 arrow(app(cst("Satisfiable"), bvar(0)), cst("False")),
175 app(cst("ResolutionRefutation"), bvar(1)),
176 ),
177 )
178}
179pub fn search_strategy_ty() -> Expr {
181 type0()
182}
183pub fn proof_state_ty() -> Expr {
185 type0()
186}
187pub fn heuristic_fn_ty() -> Expr {
189 arrow(cst("ProofState"), nat_ty())
190}
191pub fn proof_searcher_ty() -> Expr {
193 type0()
194}
195pub fn model_checking_bound_ty() -> Expr {
197 type0()
198}
199pub fn curry_howard_ty() -> Expr {
201 impl_pi(
202 "P",
203 prop(),
204 arrow(app(cst("Proof"), bvar(0)), cst("Program")),
205 )
206}
207pub fn extracted_program_ty() -> Expr {
209 type0()
210}
211pub fn termination_proof_ty() -> Expr {
213 type0()
214}
215pub fn complexity_bound_ty() -> Expr {
217 type0()
218}
219pub fn program_extraction_soundness_ty() -> Expr {
222 impl_pi(
223 "P",
224 prop(),
225 arrow(
226 app(cst("Proof"), bvar(0)),
227 app2(cst("Realizes"), app(cst("Extract"), bvar(1)), bvar(1)),
228 ),
229 )
230}
231pub fn build_env(env: &mut Environment) {
233 let axioms: &[(&str, Expr)] = &[
234 ("WitnessExtractor", witness_extractor_ty()),
235 ("RealizedFormula", realized_formula_ty()),
236 (
237 "RealizabilityInterpretation",
238 realizability_interpretation_ty(),
239 ),
240 ("HerbrandTerm", herbrand_term_ty()),
241 ("Formula", type0()),
242 (
243 "Exists",
244 arrow(type0(), arrow(arrow(type0(), prop()), prop())),
245 ),
246 ("Provable", arrow(cst("Formula"), prop())),
247 ("Realized", arrow(type0(), prop())),
248 ("Dialectica", arrow(cst("Formula"), type0())),
249 ("extract_witness", extract_witness_ty()),
250 ("compute_bound", compute_bound_ty()),
251 ("is_realizable", is_realizable_ty()),
252 ("DialecticaFormula", dialectica_formula_ty()),
253 ("FunctionalInterpretation", functional_interpretation_ty()),
254 ("WeakKoenigsLemma", weak_koenighs_lemma_ty()),
255 ("BoundedArithmetic", bounded_arithmetic_ty()),
256 ("dialectica_soundness", dialectica_soundness_ty()),
257 ("ProofSystem", proof_system_ty()),
258 ("ProofComplexityMeasure", proof_complexity_measure_ty()),
259 ("PropositionalProof", propositional_proof_ty()),
260 ("ResolutionProof", resolution_proof_ty()),
261 ("Efficient", arrow(cst("ProofSystem"), prop())),
262 ("NP_equals_CoNP", prop()),
263 ("cook_reckhow_thm", cook_reckhow_thm_ty()),
264 ("Clause", clause_ty()),
265 ("ResolutionStep", resolution_step_ty()),
266 ("EmptyClause", empty_clause_ty()),
267 ("ResolutionRefutation", resolution_refutation_ty()),
268 ("CNFFormula", type0()),
269 ("Satisfiable", arrow(cst("CNFFormula"), prop())),
270 ("resolution_completeness", resolution_completeness_ty()),
271 ("SearchStrategy", search_strategy_ty()),
272 ("ProofState", proof_state_ty()),
273 ("HeuristicFn", heuristic_fn_ty()),
274 ("ProofSearcher", proof_searcher_ty()),
275 ("ModelCheckingBound", model_checking_bound_ty()),
276 ("Program", type0()),
277 ("Proof", arrow(prop(), type0())),
278 ("Extract", arrow(prop(), cst("Program"))),
279 ("Realizes", arrow(cst("Program"), arrow(prop(), prop()))),
280 ("ExtractedProgram", extracted_program_ty()),
281 ("TerminationProof", termination_proof_ty()),
282 ("ComplexityBound", complexity_bound_ty()),
283 ("curry_howard", curry_howard_ty()),
284 (
285 "program_extraction_soundness",
286 program_extraction_soundness_ty(),
287 ),
288 ];
289 for (name, ty) in axioms {
290 env.add(Declaration::Axiom {
291 name: Name::str(*name),
292 univ_params: vec![],
293 ty: ty.clone(),
294 })
295 .ok();
296 }
297}
298pub fn monotone_functional_interp_ty() -> Expr {
301 arrow(cst("DialecticaFormula"), type0())
302}
303pub fn bounded_primitive_recursor_ty() -> Expr {
306 arrow(
307 arrow(nat_ty(), arrow(nat_ty(), nat_ty())),
308 arrow(nat_ty(), nat_ty()),
309 )
310}
311pub fn we_hpca_ty() -> Expr {
313 prop()
314}
315pub fn we_hrca_ty() -> Expr {
317 prop()
318}
319pub fn model_theoretic_mining_ty() -> Expr {
321 prop()
322}
323pub fn kreisel_modified_realizability_ty() -> Expr {
326 arrow(cst("Formula"), type0())
327}
328pub fn troelstra_modified_realizability_ty() -> Expr {
331 arrow(cst("Formula"), type0())
332}
333pub fn bezem_realizability_ty() -> Expr {
336 arrow(cst("Formula"), type0())
337}
338pub fn modified_realizability_soundness_ty() -> Expr {
340 impl_pi(
341 "A",
342 cst("Formula"),
343 arrow(
344 app(cst("Provable"), bvar(0)),
345 app(cst("KreiselModifiedRealizability"), bvar(1)),
346 ),
347 )
348}
349pub fn howard_majorizability_ty() -> Expr {
352 arrow(
353 arrow(nat_ty(), nat_ty()),
354 arrow(arrow(nat_ty(), nat_ty()), prop()),
355 )
356}
357pub fn bezem_majorizability_ty() -> Expr {
360 arrow(
361 arrow(nat_ty(), nat_ty()),
362 arrow(arrow(nat_ty(), nat_ty()), prop()),
363 )
364}
365pub fn majorizability_closure_ty() -> Expr {
367 impl_pi(
368 "f",
369 arrow(nat_ty(), nat_ty()),
370 impl_pi(
371 "g",
372 arrow(nat_ty(), nat_ty()),
373 impl_pi(
374 "h",
375 arrow(nat_ty(), nat_ty()),
376 arrow(
377 app2(cst("HowardMajorizability"), bvar(2), bvar(1)),
378 arrow(
379 app2(cst("HowardMajorizability"), bvar(2), bvar(1)),
380 app2(cst("HowardMajorizability"), bvar(3), bvar(1)),
381 ),
382 ),
383 ),
384 ),
385 )
386}
387pub fn herbrand_bound_ty() -> Expr {
390 arrow(nat_ty(), nat_ty())
391}
392pub fn metastability_bound_ty_axiom() -> Expr {
395 arrow(arrow(nat_ty(), nat_ty()), prop())
396}
397pub fn cauchy_rate_ty() -> Expr {
400 arrow(arrow(nat_ty(), nat_ty()), prop())
401}
402pub fn fluctuation_rate_ty() -> Expr {
405 arrow(nat_ty(), nat_ty())
406}
407pub fn herbrand_bound_extraction_ty() -> Expr {
409 impl_pi(
410 "f",
411 arrow(nat_ty(), nat_ty()),
412 arrow(
413 app(cst("MetastabilityBoundTy"), bvar(0)),
414 app(
415 app(cst("Exists"), nat_ty()),
416 app(cst("HerbrandBoundBound"), bvar(0)),
417 ),
418 ),
419 )
420}
421pub fn no_counterexample_interp_ty() -> Expr {
424 arrow(cst("Formula"), type0())
425}
426pub fn dialectica_nci_equiv_ty() -> Expr {
428 impl_pi(
429 "A",
430 cst("Formula"),
431 app2(
432 cst("Iff"),
433 app(cst("Dialectica"), bvar(0)),
434 app(cst("NoCounterexampleInterpretation"), bvar(1)),
435 ),
436 )
437}
438pub fn godel_functional_interp_ty() -> Expr {
441 arrow(cst("Formula"), type0())
442}
443pub fn uniform_continuity_modulus_ty() -> Expr {
446 arrow(arrow(nat_ty(), nat_ty()), arrow(nat_ty(), nat_ty()))
447}
448pub fn weak_compactness_mining_ty() -> Expr {
451 prop()
452}
453pub fn ergodic_theorem_mining_ty() -> Expr {
456 prop()
457}
458pub fn uniform_continuity_extraction_ty() -> Expr {
461 impl_pi(
462 "f",
463 arrow(nat_ty(), nat_ty()),
464 arrow(
465 app(cst("WeakCompact"), bvar(0)),
466 app(
467 app(cst("Exists"), arrow(nat_ty(), nat_ty())),
468 app(cst("IsModulus"), bvar(0)),
469 ),
470 ),
471 )
472}
473pub fn herbrand_sequence_ty() -> Expr {
476 arrow(cst("Formula"), type0())
477}
478pub fn herbrand_theorem_ty() -> Expr {
480 impl_pi(
481 "A",
482 cst("Formula"),
483 arrow(
484 app(cst("Valid"), bvar(0)),
485 app(
486 app(cst("Exists"), cst("HerbrandSequenceObj")),
487 app(cst("HerbrandWitness"), bvar(0)),
488 ),
489 ),
490 )
491}
492pub fn herbrand_complexity_ty() -> Expr {
495 arrow(cst("HerbrandSequenceObj"), nat_ty())
496}
497pub fn shoenfield_completeness_ty() -> Expr {
500 prop()
501}
502pub fn barwise_compactness_ty() -> Expr {
505 prop()
506}
507pub fn choice_function_realization_ty() -> Expr {
510 arrow(arrow(nat_ty(), prop()), arrow(nat_ty(), nat_ty()))
511}
512pub fn ordinal_ty() -> Expr {
514 type0()
515}
516pub fn epsilon0_ty() -> Expr {
518 cst("Ordinal")
519}
520pub fn gamma0_ty() -> Expr {
522 cst("Ordinal")
523}
524pub fn veblen_function_ty() -> Expr {
527 arrow(cst("Ordinal"), arrow(cst("Ordinal"), cst("Ordinal")))
528}
529pub fn ordinal_analysis_ty() -> Expr {
532 arrow(cst("ProofSystem"), arrow(cst("Ordinal"), prop()))
533}
534pub fn pa_ordinal_epsilon0_ty() -> Expr {
536 app2(cst("OrdinalAnalysis"), cst("PA"), cst("Epsilon0"))
537}
538pub fn atr0_ordinal_gamma0_ty() -> Expr {
540 app2(cst("OrdinalAnalysis"), cst("ATR0"), cst("Gamma0"))
541}
542pub fn build_env_extended(env: &mut Environment) {
544 build_env(env);
545 let axioms: &[(&str, Expr)] = &[
546 ("MonotoneFunctionalInterp", monotone_functional_interp_ty()),
547 ("BoundedPrimitiveRecursor", bounded_primitive_recursor_ty()),
548 ("WE_HPCA", we_hpca_ty()),
549 ("WE_HRCA", we_hrca_ty()),
550 ("ModelTheoreticMining", model_theoretic_mining_ty()),
551 (
552 "KreiselModifiedRealizability",
553 kreisel_modified_realizability_ty(),
554 ),
555 (
556 "TroelstraModifiedRealizability",
557 troelstra_modified_realizability_ty(),
558 ),
559 ("BezemRealizability", bezem_realizability_ty()),
560 (
561 "modified_realizability_soundness",
562 modified_realizability_soundness_ty(),
563 ),
564 ("HowardMajorizability", howard_majorizability_ty()),
565 ("BezemMajorizability", bezem_majorizability_ty()),
566 ("majorizability_closure", majorizability_closure_ty()),
567 ("HerbrandBound", herbrand_bound_ty()),
568 ("MetastabilityBoundTy", metastability_bound_ty_axiom()),
569 ("CauchyRate", cauchy_rate_ty()),
570 ("FluctuationRate", fluctuation_rate_ty()),
571 (
572 "HerbrandBoundBound",
573 arrow(nat_ty(), arrow(nat_ty(), prop())),
574 ),
575 ("herbrand_bound_extraction", herbrand_bound_extraction_ty()),
576 (
577 "NoCounterexampleInterpretation",
578 no_counterexample_interp_ty(),
579 ),
580 ("dialectica_nci_equiv", dialectica_nci_equiv_ty()),
581 ("GodelFunctionalInterp", godel_functional_interp_ty()),
582 ("UniformContinuityModulus", uniform_continuity_modulus_ty()),
583 ("WeakCompact", arrow(arrow(nat_ty(), nat_ty()), prop())),
584 (
585 "IsModulus",
586 arrow(
587 arrow(nat_ty(), nat_ty()),
588 arrow(arrow(nat_ty(), nat_ty()), prop()),
589 ),
590 ),
591 ("weak_compactness_mining", weak_compactness_mining_ty()),
592 ("ergodic_theorem_mining", ergodic_theorem_mining_ty()),
593 (
594 "uniform_continuity_extraction",
595 uniform_continuity_extraction_ty(),
596 ),
597 ("HerbrandSequence", herbrand_sequence_ty()),
598 ("HerbrandSequenceObj", type0()),
599 ("Valid", arrow(cst("Formula"), prop())),
600 (
601 "HerbrandWitness",
602 arrow(cst("Formula"), arrow(cst("HerbrandSequenceObj"), prop())),
603 ),
604 ("TautologyGround", arrow(cst("HerbrandSequenceObj"), prop())),
605 ("herbrand_theorem", herbrand_theorem_ty()),
606 ("herbrand_complexity", herbrand_complexity_ty()),
607 ("ShoenfieldCompleteness", shoenfield_completeness_ty()),
608 ("BarwiseCompactness", barwise_compactness_ty()),
609 (
610 "ChoiceFunctionRealization",
611 choice_function_realization_ty(),
612 ),
613 ("Ordinal", ordinal_ty()),
614 ("Epsilon0", epsilon0_ty()),
615 ("Gamma0", gamma0_ty()),
616 ("VeblenFunction", veblen_function_ty()),
617 ("OrdinalAnalysis", ordinal_analysis_ty()),
618 ("PA", cst("ProofSystem")),
619 ("ATR0", cst("ProofSystem")),
620 ("pa_ordinal_epsilon0", pa_ordinal_epsilon0_ty()),
621 ("atr0_ordinal_gamma0", atr0_ordinal_gamma0_ty()),
622 ];
623 for (name, ty) in axioms {
624 env.add(Declaration::Axiom {
625 name: Name::str(*name),
626 univ_params: vec![],
627 ty: ty.clone(),
628 })
629 .ok();
630 }
631}
632#[cfg(test)]
633mod proof_mining_tests {
634 use super::*;
635 #[test]
636 fn test_build_env_extended() {
637 let mut env = oxilean_kernel::Environment::new();
638 build_env_extended(&mut env);
639 assert!(env.get(&Name::str("WE_HPCA")).is_some());
640 assert!(env.get(&Name::str("Epsilon0")).is_some());
641 assert!(env.get(&Name::str("VeblenFunction")).is_some());
642 }
643 #[test]
644 fn test_herbrand_sequence_builder() {
645 let mut hsb = HerbrandSequenceBuilder::new("βx, P(x)", 5);
646 assert!(hsb.add_instance("P(0)"));
647 assert!(hsb.add_instance("P(True)"));
648 assert_eq!(hsb.complexity(), 2);
649 assert!(hsb.is_tautology());
650 let disj = hsb.disjunction();
651 assert!(disj.contains("P(0)"));
652 }
653 #[test]
654 fn test_metastability_bound() {
655 let mb = MetastabilityBound::constant("ergodic", 100);
656 assert!(mb.is_finite());
657 assert_eq!(mb.evaluate(0, 0), 100);
658 assert_eq!(mb.evaluate(3, 5), 100);
659 }
660 #[test]
661 fn test_majorizability_checker_howard() {
662 let checker = MajorizabilityChecker::new(vec![10, 10, 10], vec![1, 2, 3]);
663 assert!(checker.howard_majorizes());
664 }
665 #[test]
666 fn test_majorizability_checker_bezem() {
667 let checker = MajorizabilityChecker::new(vec![5, 5, 5], vec![1, 2, 3]);
668 assert!(checker.bezem_majorizes());
669 }
670 #[test]
671 fn test_majorizability_checker_not_bezem() {
672 let checker = MajorizabilityChecker::new(vec![1, 2, 3], vec![0, 0, 5]);
673 assert!(!checker.howard_majorizes());
674 }
675 #[test]
676 fn test_cantor_normal_form() {
677 let zero = CantorNormalForm::zero();
678 let one = CantorNormalForm::one();
679 let omega = CantorNormalForm::omega();
680 assert!(zero.is_zero());
681 assert!(zero.less_than(&one));
682 assert!(one.less_than(&omega));
683 let sum = one.add(&omega);
684 assert_eq!(sum, omega);
685 }
686 #[test]
687 fn test_monotone_functional_interpretation() {
688 let interp = MonotoneFunctionalInterpretation::new("βx βy, P x y", "Ξ»f. f 0");
689 assert!(interp.is_bounded);
690 assert!(interp.check_bound());
691 }
692 #[test]
693 fn test_majorizability_pointwise_max() {
694 let checker = MajorizabilityChecker::new(vec![1, 5, 2], vec![3, 2, 4]);
695 let mx = checker.pointwise_max();
696 assert_eq!(mx, vec![3, 5, 4]);
697 }
698}
699#[allow(dead_code)]
701pub fn functional_interpretations() -> Vec<(&'static str, &'static str, &'static str)> {
702 vec![
703 (
704 "Godel Dialectica",
705 "System T",
706 "Realizes HA+AC by finite-type functionals",
707 ),
708 (
709 "Shoenfield",
710 "System T",
711 "Alternative to Dialectica for classical arithmetic",
712 ),
713 ("Diller-Nahm", "System T", "Non-deterministic Dialectica"),
714 (
715 "Refined A-translation",
716 "HA",
717 "Transforms classical to constructive arithmetic",
718 ),
719 (
720 "Modified realizability",
721 "HA",
722 "Sound for HA; extract witnesses",
723 ),
724 ("q-realizability", "HA", "Quantitative variant for bounds"),
725 (
726 "Monotone Dialectica",
727 "System T",
728 "Kohlenbach: for metric structures",
729 ),
730 (
731 "Bounded functional interp",
732 "T_0",
733 "Ferreira-Oliva: bounded type theory",
734 ),
735 ]
736}
737#[cfg(test)]
738mod proof_mining_ext_tests {
739 use super::*;
740 #[test]
741 fn test_effective_bound() {
742 let mut eb = EffectiveBound::new("Cauchy completeness", "O(n^2)", BoundType::Polynomial);
743 eb.add_dependency("metric space axioms");
744 assert!(eb.is_feasible());
745 }
746 #[test]
747 fn test_metric_fixed_point() {
748 let mfp = MetricFixedPointMining::new(0.5, 1.0);
749 let n = mfp.iterations_to_epsilon(0.001);
750 assert!(n > 0);
751 assert!(n >= 9);
752 }
753 #[test]
754 fn test_ramsey_bound() {
755 let r33 = RamseyBound::r33();
756 assert!(r33.is_exact());
757 assert_eq!(r33.lower_bound, 6);
758 }
759 #[test]
760 fn test_bar_recursion() {
761 let br = BarRecursion::spector();
762 assert!(br.models_comprehension);
763 assert!(!br.description().is_empty());
764 }
765 #[test]
766 fn test_functional_interpretations_nonempty() {
767 let interps = functional_interpretations();
768 assert!(!interps.is_empty());
769 }
770}
771#[cfg(test)]
772mod finitization_tests {
773 use super::*;
774 #[test]
775 fn test_finitization() {
776 let bw = Finitization::bolzano_weierstrass();
777 assert!(!bw.description().is_empty());
778 }
779 #[test]
780 fn test_ordinal_termination() {
781 let ot = OrdinalTermination::new("Knuth-Bendix", "omega^omega", true);
782 assert!(!ot.termination_proof().is_empty());
783 }
784}
785#[cfg(test)]
786mod quantitative_convergence_tests {
787 use super::*;
788 #[test]
789 fn test_uniform_convexity() {
790 let h = UniformConvexityModulus::hilbert_space();
791 assert!(!h.modulus.is_empty());
792 let lp = UniformConvexityModulus::l_p_space(2.0);
793 assert!(!lp.bound_on_iterations_for_mann(0.01).is_empty());
794 }
795 #[test]
796 fn test_quantitative_cauchy() {
797 let qc = QuantitativeCauchy::new("CAT(0)", "omega^omega");
798 assert!(!qc.leustean_bound_for_cat0().is_empty());
799 }
800}
801#[allow(dead_code)]
802pub fn saturation_strategy_name() -> &'static str {
803 "Saturation"
804}
805#[cfg(test)]
806mod tests_proof_mining_ext {
807 use super::*;
808 #[test]
809 fn test_dialectica_interpretation() {
810 let di = DialecticaInterp::new("βx.βy. x + y = 0", "f: NβN", "x: N");
811 let transl = di.godel_t_translation();
812 assert!(transl.contains("Dialectica"));
813 assert!(di.is_sound_for_classical());
814 let sound = di.soundness_theorem();
815 assert!(sound.contains("sound"));
816 }
817 #[test]
818 fn test_gentzen_normalization() {
819 let gn = GentzenNormalization::new(10, 3);
820 assert!(gn.reduction_terminates());
821 let desc = gn.cut_elimination_theorem();
822 assert!(desc.contains("Gentzen"));
823 let ord = gn.ordinal_analysis_connection();
824 assert!(ord.contains("Ξ΅β"));
825 }
826 #[test]
827 fn test_proof_system() {
828 let res = ProofSystemNew::resolution();
829 let sep = res.separating_tautologies();
830 assert!(sep.contains("Pigeonhole"));
831 let ef = ProofSystemNew::extended_frege();
832 let cook = ef.cook_reckhow_theorem();
833 assert!(cook.contains("Cook-Reckhow"));
834 }
835 #[test]
836 fn test_php_principle() {
837 let php = PhpPrinciple::new(5, 4);
838 assert!(php.is_valid_php());
839 let haken = php.haken_lower_bound_description();
840 assert!(haken.contains("Haken"));
841 let ba = php.bounded_arithmetic_connection();
842 assert!(ba.contains("S^1_2"));
843 }
844 #[test]
845 fn test_prover_data() {
846 let tab = ProverData::tableau_prover();
847 assert!(tab.is_complete && tab.is_sound);
848 let comp = tab.completeness_theorem();
849 assert!(comp.contains("complete"));
850 let heuristic = ProverData::new_heuristic("E prover", "FOL+Eq", "age+weight");
851 assert!(!heuristic.is_complete);
852 let super_desc = heuristic.superposition_calculus_description();
853 assert!(super_desc.contains("Superposition"));
854 }
855}
856#[allow(dead_code)]
858pub fn proof_mining_results_survey() -> Vec<(&'static str, &'static str, &'static str)> {
859 vec![
860 (
861 "Bolzano-Weierstrass",
862 "Omega(n, M) prim. rec.",
863 "Dialectica",
864 ),
865 ("Monotone convergence", "n * 2^(n*M)", "A-translation"),
866 ("Cauchy completeness", "O(1/eps)", "Bar recursion"),
867 ("Banach fixed point", "ceil(log_q(eps))", "Dialectica"),
868 (
869 "Mann iteration convergence",
870 "Omega(eps, lambda, k)",
871 "Monotone Dialectica",
872 ),
873 (
874 "Halpern iteration (Hilbert)",
875 "primitive recursive",
876 "Monotone bar recursion",
877 ),
878 (
879 "Ergodic theorem (Avigad-Rute)",
880 "f(eps, M)",
881 "A-translation",
882 ),
883 (
884 "Ramsey's theorem (RT^2_2)",
885 "Ackermannian",
886 "Weihrauch reduction",
887 ),
888 (
889 "KCF theorem",
890 "non-primitive recursive",
891 "Finite axioms of choice",
892 ),
893 (
894 "CAT(0) fixed points (Leustean)",
895 "omega^omega",
896 "Modified Dialectica",
897 ),
898 ]
899}
900#[cfg(test)]
901mod survey_test {
902 use super::*;
903 #[test]
904 fn test_survey_nonempty() {
905 let r = proof_mining_results_survey();
906 assert!(!r.is_empty());
907 }
908}