1use oxilean_kernel::{BinderInfo, Declaration, Environment, Expr, Level, Name};
6
7use super::types::{
8 BigFiveStats, BigFiveSystem, ComputableFunction, ConservationResult, ConstructivePrinciple,
9 IndependenceResult, OmegaModel, Pi11Sentence, ProofSystem, RCA0AxiomKind, RMA0System,
10 RMHierarchy, RMPrinciple, RMScoreboard, RMStrength, RMTheorem, RamseyColoringFinder,
11 WeakKonigTree,
12};
13
14pub fn app(f: Expr, a: Expr) -> Expr {
15 Expr::App(Box::new(f), Box::new(a))
16}
17pub fn app2(f: Expr, a: Expr, b: Expr) -> Expr {
18 app(app(f, a), b)
19}
20pub fn app3(f: Expr, a: Expr, b: Expr, c: Expr) -> Expr {
21 app(app2(f, a, b), c)
22}
23pub fn cst(s: &str) -> Expr {
24 Expr::Const(Name::str(s), vec![])
25}
26pub fn prop() -> Expr {
27 Expr::Sort(Level::zero())
28}
29pub fn type0() -> Expr {
30 Expr::Sort(Level::succ(Level::zero()))
31}
32pub fn pi(bi: BinderInfo, name: &str, dom: Expr, body: Expr) -> Expr {
33 Expr::Pi(bi, Name::str(name), Box::new(dom), Box::new(body))
34}
35pub fn arrow(a: Expr, b: Expr) -> Expr {
36 pi(BinderInfo::Default, "_", a, b)
37}
38pub fn impl_pi(name: &str, dom: Expr, body: Expr) -> Expr {
39 pi(BinderInfo::Implicit, name, dom, body)
40}
41pub fn bvar(n: u32) -> Expr {
42 Expr::BVar(n)
43}
44pub fn nat_ty() -> Expr {
45 cst("Nat")
46}
47pub fn bool_ty() -> Expr {
48 cst("Bool")
49}
50pub fn second_order_arithmetic_ty() -> Expr {
53 type0()
54}
55pub fn arithmetical_formula_ty() -> Expr {
58 prop()
59}
60pub fn sigma01_formula_ty() -> Expr {
62 prop()
63}
64pub fn pi01_formula_ty() -> Expr {
66 prop()
67}
68pub fn delta01_formula_ty() -> Expr {
70 prop()
71}
72pub fn sigma11_formula_ty() -> Expr {
74 prop()
75}
76pub fn pi11_formula_ty() -> Expr {
78 prop()
79}
80pub fn rca0_ty() -> Expr {
83 prop()
84}
85pub fn provable_rca0_ty() -> Expr {
88 arrow(arithmetical_formula_ty(), prop())
89}
90pub fn wkl0_ty() -> Expr {
93 prop()
94}
95pub fn weak_konigs_lemma_ty() -> Expr {
98 arrow(
99 cst("BinaryTree"),
100 arrow(app(cst("IsInfinite"), cst("BinaryTree")), prop()),
101 )
102}
103pub fn aca0_ty() -> Expr {
106 prop()
107}
108pub fn arithmetical_comprehension_ty() -> Expr {
111 arrow(arithmetical_formula_ty(), prop())
112}
113pub fn atr0_ty() -> Expr {
116 prop()
117}
118pub fn arithmetical_transfinite_recursion_ty() -> Expr {
122 arrow(
123 cst("WellOrdering"),
124 arrow(arithmetical_formula_ty(), prop()),
125 )
126}
127pub fn pi11_ca0_ty() -> Expr {
130 prop()
131}
132pub fn pi11_comprehension_ty() -> Expr {
134 arrow(pi11_formula_ty(), prop())
135}
136pub fn conservative_ty() -> Expr {
139 arrow(
140 cst("System"),
141 arrow(cst("System"), arrow(cst("FormulaClass"), prop())),
142 )
143}
144pub fn wkl0_conservative_over_rca0_ty() -> Expr {
148 app3(
149 cst("Conservative"),
150 cst("WKL0"),
151 cst("RCA0"),
152 cst("Pi11FormulasClass"),
153 )
154}
155pub fn aca0_conservative_over_pa_ty() -> Expr {
159 app3(
160 cst("Conservative"),
161 cst("ACA0"),
162 cst("PeanoArithmetic"),
163 cst("FirstOrderFormulas"),
164 )
165}
166pub fn atr0_conservative_ty() -> Expr {
169 app3(
170 cst("Conservative"),
171 cst("ATR0"),
172 cst("ACA0"),
173 cst("Pi12FormulasClass"),
174 )
175}
176pub fn omega_model_wkl0_ty() -> Expr {
179 arrow(
180 app(cst("OmegaModel"), cst("RCA0")),
181 app(cst("OmegaModel"), cst("WKL0")),
182 )
183}
184pub fn subsystem_linear_order_ty() -> Expr {
187 arrow(cst("System"), arrow(cst("System"), prop()))
188}
189pub fn bolzano_weierstrass_ty() -> Expr {
192 arrow(
193 app(cst("BoundedSequence"), cst("Real")),
194 app(cst("HasConvergentSubsequence"), bvar(0)),
195 )
196}
197pub fn hahn_banach_ty() -> Expr {
199 arrow(cst("NormedSpace"), arrow(cst("LinearFunctional"), prop()))
200}
201pub fn brouwer_fixed_point_ty() -> Expr {
204 impl_pi(
205 "f",
206 arrow(cst("Disk"), cst("Disk")),
207 arrow(
208 app(cst("Continuous"), bvar(0)),
209 app(cst("HasFixedPoint"), bvar(1)),
210 ),
211 )
212}
213pub fn maximal_ideal_theorem_ty() -> Expr {
216 impl_pi("R", cst("CommRing"), app(cst("HasMaximalIdeal"), bvar(0)))
217}
218pub fn completeness_theorem_ty() -> Expr {
221 impl_pi(
222 "L",
223 cst("CountableLanguage"),
224 arrow(
225 app(cst("Consistent"), bvar(0)),
226 app(cst("HasModel"), bvar(1)),
227 ),
228 )
229}
230pub fn konig_lemma_ty() -> Expr {
233 arrow(
234 cst("FinBranchingTree"),
235 arrow(
236 app(cst("IsInfiniteTree"), bvar(0)),
237 app(cst("HasInfinitePath"), bvar(1)),
238 ),
239 )
240}
241pub fn ramsey_ty() -> Expr {
244 arrow(nat_ty(), arrow(nat_ty(), prop()))
245}
246pub fn rt22_ty() -> Expr {
249 prop()
250}
251pub fn rt21_ty() -> Expr {
253 prop()
254}
255pub fn srt22_ty() -> Expr {
257 prop()
258}
259pub fn cac_ty() -> Expr {
263 impl_pi(
264 "P",
265 cst("PartialOrder"),
266 arrow(
267 app(cst("IsInfinitePoset"), bvar(0)),
268 app2(cst("ChainOrAntichain"), bvar(1), bvar(0)),
269 ),
270 )
271}
272pub fn ads_ty() -> Expr {
275 impl_pi(
276 "L",
277 cst("LinearOrder"),
278 arrow(
279 app(cst("IsInfiniteOrder"), bvar(0)),
280 app2(cst("AscOrDescSeq"), bvar(1), bvar(0)),
281 ),
282 )
283}
284pub fn sads_ty() -> Expr {
286 impl_pi(
287 "L",
288 cst("LinearOrder"),
289 arrow(
290 app(cst("IsStableOrder"), bvar(0)),
291 app2(cst("AscOrDescSeq"), bvar(1), bvar(0)),
292 ),
293 )
294}
295pub fn dnr_ty() -> Expr {
298 app(cst("Exists"), cst("DiagonallyNonRecursive"))
299}
300pub fn fssets_ty() -> Expr {
303 arrow(arrow(nat_ty(), nat_ty()), app(cst("Set"), nat_ty()))
304}
305pub fn hindman_theorem_ty() -> Expr {
310 arrow(nat_ty(), prop())
311}
312pub fn idempotent_ultrafilter_ty() -> Expr {
315 type0()
316}
317pub fn hindman_from_idempotent_ty() -> Expr {
320 arrow(cst("IdempotentUltrafilter"), hindman_theorem_ty())
321}
322pub fn hindman_strength_ty() -> Expr {
325 app2(cst("ProvableIn"), cst("HindmanTheorem"), cst("ACA0Plus"))
326}
327pub fn ramsey_number_lower_bound(s: u32, t: u32) -> u32 {
331 match (s, t) {
332 (1, _) => 1,
333 (_, 1) => 1,
334 (2, k) | (k, 2) => k,
335 (3, 3) => 6,
336 (3, 4) | (4, 3) => 9,
337 (3, 5) | (5, 3) => 14,
338 (3, 6) | (6, 3) => 18,
339 (3, 7) | (7, 3) => 23,
340 (3, 8) | (8, 3) => 28,
341 (3, 9) | (9, 3) => 36,
342 (4, 4) => 18,
343 (4, 5) | (5, 4) => 25,
344 _ => {
345 let n = (s + t - 2) as u64;
346 let k = (s - 1) as u64;
347 let mut binom: u64 = 1;
348 for i in 0..k {
349 binom = binom.saturating_mul(n - i).saturating_div(i + 1);
350 }
351 binom.min(u32::MAX as u64) as u32
352 }
353 }
354}
355pub fn is_valid_coloring(n: usize, coloring: &[Vec<u32>], k: u32) -> bool {
358 for i in 0..n {
359 if coloring.len() <= i {
360 return false;
361 }
362 for j in (i + 1)..n {
363 if coloring[i].len() <= j {
364 return false;
365 }
366 if coloring[i][j] >= k {
367 return false;
368 }
369 }
370 }
371 true
372}
373pub fn greedy_homogeneous_set(n: usize, coloring: &[Vec<u32>]) -> (u32, Vec<usize>) {
377 let mut best: (u32, Vec<usize>) = (0, vec![]);
378 for start_color in 0..2u32 {
379 let mut hom_set = vec![0usize];
380 for v in 1..n {
381 let monochromatic = hom_set.iter().all(|&u| {
382 let (i, j) = (u.min(v), u.max(v));
383 coloring
384 .get(i)
385 .and_then(|row| row.get(j))
386 .copied()
387 .unwrap_or(2)
388 == start_color
389 });
390 if monochromatic {
391 hom_set.push(v);
392 }
393 }
394 if hom_set.len() > best.1.len() {
395 best = (start_color, hom_set);
396 }
397 }
398 best
399}
400pub fn computable_function_ty() -> Expr {
403 type0()
404}
405pub fn turing_degree_ty() -> Expr {
408 type0()
409}
410pub fn turing_reducible_ty() -> Expr {
413 arrow(
414 app(cst("Set"), nat_ty()),
415 arrow(app(cst("Set"), nat_ty()), prop()),
416 )
417}
418pub fn computably_enumerable_ty() -> Expr {
421 arrow(app(cst("Set"), nat_ty()), prop())
422}
423pub fn halting_problem_ty() -> Expr {
426 app(cst("Set"), nat_ty())
427}
428pub fn halting_problem_is_ce_ty() -> Expr {
430 app(cst("ComputablelyEnumerable"), cst("HaltingProblem"))
431}
432pub fn halting_problem_not_computable_ty() -> Expr {
434 app(cst("Not"), app(cst("Computable"), cst("HaltingProblem")))
435}
436pub fn post_theorem_ty() -> Expr {
439 arrow(
440 app(cst("Set"), nat_ty()),
441 arrow(
442 app(cst("ComputablelyEnumerable"), bvar(0)),
443 app(cst("Sigma01Definable"), bvar(1)),
444 ),
445 )
446}
447pub fn recursive_separation_ty() -> Expr {
450 arrow(
451 app(cst("Set"), nat_ty()),
452 arrow(
453 app(cst("Set"), nat_ty()),
454 arrow(
455 app(cst("Disjoint"), bvar(0)),
456 app2(cst("HasComputableSeparation"), bvar(2), bvar(1)),
457 ),
458 ),
459 )
460}
461pub fn oracle_computable_ty() -> Expr {
464 arrow(
465 app(cst("Set"), nat_ty()),
466 arrow(arrow(nat_ty(), nat_ty()), prop()),
467 )
468}
469pub fn infinite_binary_tree_ty() -> Expr {
472 type0()
473}
474pub fn konigs_lemma_binary_ty() -> Expr {
477 impl_pi(
478 "T",
479 cst("InfiniteBinaryTree"),
480 app(cst("HasInfiniteBranch"), bvar(0)),
481 )
482}
483pub fn has_infinite_branch_ty() -> Expr {
486 arrow(cst("InfiniteBinaryTree"), prop())
487}
488pub fn binary_tree_path_ty() -> Expr {
491 arrow(nat_ty(), type0())
492}
493pub fn wkl0_equiv_konig_ty() -> Expr {
495 app2(cst("Iff"), cst("WKL0"), cst("KonigsLemmaForBinaryTrees"))
496}
497pub fn hyperarithmetical_ty() -> Expr {
500 arrow(app(cst("Set"), nat_ty()), prop())
501}
502pub fn hyperarithmetical_hierarchy_ty() -> Expr {
505 arrow(
506 cst("RecursiveOrdinal"),
507 arrow(app(cst("Set"), nat_ty()), prop()),
508 )
509}
510pub fn pi11_ca0_set_existence_ty() -> Expr {
513 impl_pi(
514 "phi",
515 pi11_formula_ty(),
516 app(cst("Exists"), app(cst("SetOf"), bvar(0))),
517 )
518}
519pub fn bar_induction_ty() -> Expr {
523 arrow(cst("WellFoundedTree"), prop())
524}
525pub fn open_determinacy_ty() -> Expr {
528 impl_pi("G", cst("OpenGame"), app(cst("IsDetermined"), bvar(0)))
529}
530pub fn borel_determinacy_ty() -> Expr {
533 impl_pi("G", cst("BorelGame"), app(cst("IsDetermined"), bvar(0)))
534}
535pub fn projective_determinacy_ty() -> Expr {
538 impl_pi(
539 "G",
540 cst("ProjectiveGame"),
541 app(cst("IsDetermined"), bvar(0)),
542 )
543}
544pub fn sigma11_determinacy_ty() -> Expr {
547 impl_pi("G", cst("Sigma11Game"), app(cst("IsDetermined"), bvar(0)))
548}
549pub fn well_ordering_theorem_ty() -> Expr {
552 impl_pi("S", type0(), app(cst("CanBeWellOrdered"), bvar(0)))
553}
554pub fn comparison_of_well_orderings_ty() -> Expr {
557 arrow(
558 cst("WellOrdering"),
559 arrow(
560 cst("WellOrdering"),
561 app2(cst("ComparableOrders"), bvar(0), bvar(0)),
562 ),
563 )
564}
565pub fn well_ordering_is_linear_ty() -> Expr {
568 impl_pi("W", cst("WellOrdering"), app(cst("IsLinearOrder"), bvar(0)))
569}
570pub fn linear_order_omega_ty() -> Expr {
574 impl_pi(
575 "L",
576 cst("LinearOrder"),
577 arrow(
578 app(cst("IsInfiniteOrder"), bvar(0)),
579 app2(cst("ContainsOmegaOrOmegaStar"), bvar(1), bvar(0)),
580 ),
581 )
582}
583pub fn scattered_linear_ordering_ty() -> Expr {
586 arrow(cst("LinearOrder"), prop())
587}
588pub fn hausdorff_scattered_ty() -> Expr {
591 impl_pi(
592 "L",
593 cst("LinearOrder"),
594 arrow(
595 app(cst("ScatteredLinearOrdering"), bvar(0)),
596 app(cst("EmbedsFreeOfEta"), bvar(1)),
597 ),
598 )
599}
600pub fn thin_set_theorem_ty() -> Expr {
604 arrow(
605 nat_ty(),
606 impl_pi(
607 "f",
608 arrow(app(cst("Pairs"), nat_ty()), bvar(1)),
609 app(cst("HasThinInfiniteSet"), bvar(0)),
610 ),
611 )
612}
613pub fn free_set_theorem_ty() -> Expr {
617 impl_pi(
618 "f",
619 arrow(app(cst("Pairs"), nat_ty()), nat_ty()),
620 app(cst("HasFreeInfiniteSet"), bvar(0)),
621 )
622}
623pub fn cohesiveness_theorem_ty() -> Expr {
627 impl_pi(
628 "seq",
629 arrow(nat_ty(), app(cst("Set"), nat_ty())),
630 app(cst("HasCohesiveSet"), bvar(0)),
631 )
632}
633pub fn omitting_types_theorem_ty() -> Expr {
637 impl_pi(
638 "T",
639 cst("ConsistentTheory"),
640 arrow(
641 app(cst("HasNonPrincipalType"), bvar(0)),
642 app(cst("HasOmittingModel"), bvar(1)),
643 ),
644 )
645}
646pub fn low_basis_theorem_ty() -> Expr {
649 impl_pi(
650 "T",
651 cst("InfiniteBinaryTree"),
652 app(cst("HasLowBranch"), bvar(0)),
653 )
654}
655pub fn decidability_rca0_ty() -> Expr {
658 app(cst("IsDecidable"), cst("RCA0Provability"))
659}
660pub fn sigma0n_formula_ty() -> Expr {
663 arrow(nat_ty(), type0())
664}
665pub fn pi0n_formula_ty() -> Expr {
667 arrow(nat_ty(), type0())
668}
669pub fn delta11_formula_ty() -> Expr {
671 prop()
672}
673pub fn sigma0n_induction_ty() -> Expr {
676 arrow(nat_ty(), prop())
677}
678pub fn sigma01_comprehension_ty() -> Expr {
681 arrow(sigma01_formula_ty(), prop())
682}
683pub fn delta01_comprehension_ty() -> Expr {
686 arrow(delta01_formula_ty(), prop())
687}
688pub fn build_reverse_mathematics_env() -> Environment {
690 let mut env = Environment::new();
691 let axioms: &[(&str, Expr)] = &[
692 ("SecondOrderArithmetic", second_order_arithmetic_ty()),
693 ("ArithmeticalFormula", arithmetical_formula_ty()),
694 ("Sigma01Formula", sigma01_formula_ty()),
695 ("Pi01Formula", pi01_formula_ty()),
696 ("Delta01Formula", delta01_formula_ty()),
697 ("Sigma11Formula", sigma11_formula_ty()),
698 ("Pi11Formula", pi11_formula_ty()),
699 ("RCA0", rca0_ty()),
700 ("Provable_RCA0", provable_rca0_ty()),
701 ("WKL0", wkl0_ty()),
702 ("WeakKonigsLemma", weak_konigs_lemma_ty()),
703 ("ACA0", aca0_ty()),
704 ("ArithmeticalComprehension", arithmetical_comprehension_ty()),
705 ("ATR0", atr0_ty()),
706 (
707 "ArithmeticalTransfiniteRecursion",
708 arithmetical_transfinite_recursion_ty(),
709 ),
710 ("Pi11CA0", pi11_ca0_ty()),
711 ("Pi11Comprehension", pi11_comprehension_ty()),
712 ("Conservative", conservative_ty()),
713 ("WKL0ConservativeOverRCA0", wkl0_conservative_over_rca0_ty()),
714 ("ACA0ConservativeOverPA", aca0_conservative_over_pa_ty()),
715 ("ATR0ConservativeResult", atr0_conservative_ty()),
716 ("OmegaModelWKL0", omega_model_wkl0_ty()),
717 ("SubsystemLinearOrder", subsystem_linear_order_ty()),
718 ("BolzanoWeierstrass", bolzano_weierstrass_ty()),
719 ("HahnBanachTheorem", hahn_banach_ty()),
720 ("BrouwerFixedPoint", brouwer_fixed_point_ty()),
721 ("MaximalIdealTheorem", maximal_ideal_theorem_ty()),
722 ("CompletenessTheorem", completeness_theorem_ty()),
723 ("KonigLemma", konig_lemma_ty()),
724 ("Ramsey", ramsey_ty()),
725 ("RT22", rt22_ty()),
726 ("RT21", rt21_ty()),
727 ("SRT22", srt22_ty()),
728 ("CAC", cac_ty()),
729 ("ADS", ads_ty()),
730 ("SADS", sads_ty()),
731 ("DNR", dnr_ty()),
732 ("FSSets", fssets_ty()),
733 ("HindmanTheorem", hindman_theorem_ty()),
734 ("IdempotentUltrafilter", idempotent_ultrafilter_ty()),
735 ("HindmanFromIdempotent", hindman_from_idempotent_ty()),
736 ("HindmanStrength", hindman_strength_ty()),
737 ("ComputableFunction", computable_function_ty()),
738 ("TuringDegree", turing_degree_ty()),
739 ("TuringReducible", turing_reducible_ty()),
740 ("ComputablelyEnumerable", computably_enumerable_ty()),
741 ("HaltingProblem", halting_problem_ty()),
742 ("HaltingProblemIsCE", halting_problem_is_ce_ty()),
743 (
744 "HaltingProblemNotComputable",
745 halting_problem_not_computable_ty(),
746 ),
747 ("PostTheorem", post_theorem_ty()),
748 ("RecursiveSeparation", recursive_separation_ty()),
749 ("OracleComputable", oracle_computable_ty()),
750 ("InfiniteBinaryTree", infinite_binary_tree_ty()),
751 ("KonigsLemmaForBinaryTrees", konigs_lemma_binary_ty()),
752 ("HasInfiniteBranch", has_infinite_branch_ty()),
753 ("BinaryTreePath", binary_tree_path_ty()),
754 ("WKL0EquivalentToKonigsLemma", wkl0_equiv_konig_ty()),
755 ("HyperArithmetical", hyperarithmetical_ty()),
756 (
757 "HyperArithmeticalHierarchy",
758 hyperarithmetical_hierarchy_ty(),
759 ),
760 ("Pi11CA0SetExistence", pi11_ca0_set_existence_ty()),
761 ("BarInduction", bar_induction_ty()),
762 ("OpenDeterminacy", open_determinacy_ty()),
763 ("BorelDeterminacy", borel_determinacy_ty()),
764 ("ProjectiveDeterminacy", projective_determinacy_ty()),
765 ("Sigma11Determinacy", sigma11_determinacy_ty()),
766 ("WellOrderingTheorem", well_ordering_theorem_ty()),
767 (
768 "ComparisonOfWellOrderings",
769 comparison_of_well_orderings_ty(),
770 ),
771 ("WellOrderingIsLinear", well_ordering_is_linear_ty()),
772 (
773 "InfiniteLinearOrderHasOmegaOrOmegaStar",
774 linear_order_omega_ty(),
775 ),
776 ("ScatteredLinearOrdering", scattered_linear_ordering_ty()),
777 ("HausdorffScattered", hausdorff_scattered_ty()),
778 ("ThinSetTheorem", thin_set_theorem_ty()),
779 ("FreeSetTheorem", free_set_theorem_ty()),
780 ("CohesivenessTheorem", cohesiveness_theorem_ty()),
781 ("OmittingTypesTheorem", omitting_types_theorem_ty()),
782 ("LowBasisTheorem", low_basis_theorem_ty()),
783 ("DecidabilityOfRCA0", decidability_rca0_ty()),
784 ("Sigma0nFormula", sigma0n_formula_ty()),
785 ("Pi0nFormula", pi0n_formula_ty()),
786 ("Delta11Formula", delta11_formula_ty()),
787 ("Sigma0nInduction", sigma0n_induction_ty()),
788 ("Sigma01Comprehension", sigma01_comprehension_ty()),
789 ("Delta01Comprehension", delta01_comprehension_ty()),
790 ("System", type0()),
791 ("FormulaClass", type0()),
792 ("WellOrdering", type0()),
793 ("BinaryTree", type0()),
794 ("FinBranchingTree", type0()),
795 ("PartialOrder", type0()),
796 ("LinearOrder", type0()),
797 ("OmegaModel", arrow(type0(), type0())),
798 ("IsInfinite", arrow(type0(), prop())),
799 ("IsInfiniteTree", arrow(cst("BinaryTree"), prop())),
800 ("HasInfinitePath", arrow(cst("BinaryTree"), prop())),
801 ("IsInfinitePoset", arrow(cst("PartialOrder"), prop())),
802 ("IsInfiniteOrder", arrow(cst("LinearOrder"), prop())),
803 ("IsStableOrder", arrow(cst("LinearOrder"), prop())),
804 (
805 "ChainOrAntichain",
806 arrow(cst("PartialOrder"), arrow(type0(), prop())),
807 ),
808 (
809 "AscOrDescSeq",
810 arrow(cst("LinearOrder"), arrow(type0(), prop())),
811 ),
812 ("DiagonallyNonRecursive", type0()),
813 ("PeanoArithmetic", type0()),
814 ("FirstOrderFormulas", type0()),
815 ("Pi11FormulasClass", type0()),
816 ("Pi12FormulasClass", type0()),
817 ("ACA0Plus", type0()),
818 ("ProvableIn", arrow(type0(), arrow(type0(), prop()))),
819 ("Real", type0()),
820 ("BoundedSequence", arrow(type0(), type0())),
821 ("HasConvergentSubsequence", arrow(type0(), prop())),
822 ("NormedSpace", type0()),
823 ("LinearFunctional", type0()),
824 ("Disk", type0()),
825 ("CommRing", type0()),
826 ("CountableLanguage", type0()),
827 ("Continuous", arrow(arrow(cst("Disk"), cst("Disk")), prop())),
828 (
829 "HasFixedPoint",
830 arrow(arrow(cst("Disk"), cst("Disk")), prop()),
831 ),
832 ("HasMaximalIdeal", arrow(cst("CommRing"), prop())),
833 ("Consistent", arrow(cst("CountableLanguage"), prop())),
834 ("HasModel", arrow(cst("CountableLanguage"), prop())),
835 ("Set", arrow(type0(), type0())),
836 ("Not", arrow(prop(), prop())),
837 ("Computable", arrow(app(cst("Set"), nat_ty()), prop())),
838 ("Sigma01Definable", arrow(app(cst("Set"), nat_ty()), prop())),
839 ("Disjoint", arrow(app(cst("Set"), nat_ty()), prop())),
840 (
841 "HasComputableSeparation",
842 arrow(
843 app(cst("Set"), nat_ty()),
844 arrow(app(cst("Set"), nat_ty()), prop()),
845 ),
846 ),
847 ("RecursiveOrdinal", type0()),
848 ("WellFoundedTree", type0()),
849 ("OpenGame", type0()),
850 ("BorelGame", type0()),
851 ("ProjectiveGame", type0()),
852 ("Sigma11Game", type0()),
853 ("IsDetermined", arrow(type0(), prop())),
854 ("CanBeWellOrdered", arrow(type0(), prop())),
855 (
856 "ComparableOrders",
857 arrow(cst("WellOrdering"), arrow(cst("WellOrdering"), prop())),
858 ),
859 ("IsLinearOrder", arrow(cst("WellOrdering"), prop())),
860 (
861 "ContainsOmegaOrOmegaStar",
862 arrow(cst("LinearOrder"), arrow(type0(), prop())),
863 ),
864 ("EmbedsFreeOfEta", arrow(cst("LinearOrder"), prop())),
865 ("Pairs", arrow(type0(), type0())),
866 (
867 "HasThinInfiniteSet",
868 arrow(arrow(app(cst("Pairs"), nat_ty()), nat_ty()), prop()),
869 ),
870 (
871 "HasFreeInfiniteSet",
872 arrow(arrow(app(cst("Pairs"), nat_ty()), nat_ty()), prop()),
873 ),
874 (
875 "HasCohesiveSet",
876 arrow(arrow(nat_ty(), app(cst("Set"), nat_ty())), prop()),
877 ),
878 ("ConsistentTheory", type0()),
879 (
880 "HasNonPrincipalType",
881 arrow(cst("ConsistentTheory"), prop()),
882 ),
883 ("HasOmittingModel", arrow(cst("ConsistentTheory"), prop())),
884 ("HasLowBranch", arrow(cst("InfiniteBinaryTree"), prop())),
885 ("IsDecidable", arrow(prop(), prop())),
886 ("RCA0Provability", prop()),
887 ("Exists", arrow(type0(), prop())),
888 ("SetOf", arrow(type0(), type0())),
889 ("Iff", arrow(prop(), arrow(prop(), prop()))),
890 ];
891 for (name, ty) in axioms {
892 let _ = env.add(Declaration::Axiom {
893 name: Name::str(*name),
894 univ_params: vec![],
895 ty: ty.clone(),
896 });
897 }
898 env
899}
900#[cfg(test)]
901mod tests {
902 use super::*;
903 #[test]
904 fn test_build_reverse_mathematics_env() {
905 let env = build_reverse_mathematics_env();
906 assert!(env.get(&Name::str("RCA0")).is_some());
907 assert!(env.get(&Name::str("WKL0")).is_some());
908 assert!(env.get(&Name::str("ACA0")).is_some());
909 assert!(env.get(&Name::str("ATR0")).is_some());
910 assert!(env.get(&Name::str("Pi11CA0")).is_some());
911 assert!(env.get(&Name::str("WKL0ConservativeOverRCA0")).is_some());
912 assert!(env.get(&Name::str("RT22")).is_some());
913 assert!(env.get(&Name::str("HindmanTheorem")).is_some());
914 assert!(env.get(&Name::str("IdempotentUltrafilter")).is_some());
915 }
916 #[test]
917 fn test_big_five_ordering() {
918 assert!(BigFiveSystem::RCA0 < BigFiveSystem::WKL0);
919 assert!(BigFiveSystem::WKL0 < BigFiveSystem::ACA0);
920 assert!(BigFiveSystem::ACA0 < BigFiveSystem::ATR0);
921 assert!(BigFiveSystem::ATR0 < BigFiveSystem::Pi11CA0);
922 assert!(BigFiveSystem::Pi11CA0.at_least_as_strong_as(&BigFiveSystem::RCA0));
923 }
924 #[test]
925 fn test_big_five_names() {
926 assert_eq!(BigFiveSystem::RCA0.name(), "RCA₀");
927 assert_eq!(BigFiveSystem::WKL0.name(), "WKL₀");
928 assert_eq!(BigFiveSystem::ACA0.name(), "ACA₀");
929 assert_eq!(BigFiveSystem::ATR0.name(), "ATR₀");
930 assert_eq!(BigFiveSystem::Pi11CA0.name(), "Π¹₁-CA₀");
931 }
932 #[test]
933 fn test_proof_theoretic_ordinals() {
934 assert_eq!(BigFiveSystem::ACA0.proof_theoretic_ordinal(), "ε₀");
935 assert_eq!(BigFiveSystem::ATR0.proof_theoretic_ordinal(), "Γ₀");
936 }
937 #[test]
938 fn test_conservation_results() {
939 let c = ConservationResult::wkl0_over_rca0();
940 assert!(c.is_valid_direction());
941 assert_eq!(c.stronger, BigFiveSystem::WKL0);
942 assert_eq!(c.weaker, BigFiveSystem::RCA0);
943 let c2 = ConservationResult::atr0_over_aca0();
944 assert!(c2.is_valid_direction());
945 }
946 #[test]
947 fn test_rm_principles() {
948 let rt22 = RMPrinciple::rt22();
949 assert_eq!(rt22.strength, RMStrength::BetweenWKL0AndACA0);
950 assert!(!rt22.equivalent_to(&BigFiveSystem::ACA0));
951 let bw = RMPrinciple::bolzano_weierstrass();
952 assert!(bw.equivalent_to(&BigFiveSystem::ACA0));
953 let brouwer = RMPrinciple::brouwer();
954 assert!(brouwer.equivalent_to(&BigFiveSystem::WKL0));
955 }
956 #[test]
957 fn test_ramsey_number_lower_bound() {
958 assert_eq!(ramsey_number_lower_bound(2, 5), 5);
959 assert_eq!(ramsey_number_lower_bound(3, 3), 6);
960 assert_eq!(ramsey_number_lower_bound(3, 4), 9);
961 assert_eq!(ramsey_number_lower_bound(4, 4), 18);
962 assert_eq!(
963 ramsey_number_lower_bound(3, 5),
964 ramsey_number_lower_bound(5, 3)
965 );
966 }
967 #[test]
968 fn test_greedy_homogeneous_set() {
969 let n = 4;
970 let coloring = vec![
971 vec![0, 0, 0, 0],
972 vec![0, 0, 0, 0],
973 vec![0, 0, 0, 0],
974 vec![0, 0, 0, 0],
975 ];
976 let (color, set) = greedy_homogeneous_set(n, &coloring);
977 assert_eq!(color, 0);
978 assert_eq!(set.len(), 4);
979 }
980 #[test]
981 fn test_new_axioms_in_env() {
982 let env = build_reverse_mathematics_env();
983 assert!(env.get(&Name::str("ComputableFunction")).is_some());
984 assert!(env.get(&Name::str("TuringDegree")).is_some());
985 assert!(env.get(&Name::str("TuringReducible")).is_some());
986 assert!(env.get(&Name::str("ComputablelyEnumerable")).is_some());
987 assert!(env.get(&Name::str("HaltingProblem")).is_some());
988 assert!(env.get(&Name::str("HaltingProblemIsCE")).is_some());
989 assert!(env.get(&Name::str("HaltingProblemNotComputable")).is_some());
990 assert!(env.get(&Name::str("PostTheorem")).is_some());
991 assert!(env.get(&Name::str("OracleComputable")).is_some());
992 assert!(env.get(&Name::str("InfiniteBinaryTree")).is_some());
993 assert!(env.get(&Name::str("KonigsLemmaForBinaryTrees")).is_some());
994 assert!(env.get(&Name::str("HasInfiniteBranch")).is_some());
995 assert!(env.get(&Name::str("WKL0EquivalentToKonigsLemma")).is_some());
996 assert!(env.get(&Name::str("HyperArithmetical")).is_some());
997 assert!(env.get(&Name::str("BarInduction")).is_some());
998 assert!(env.get(&Name::str("OpenDeterminacy")).is_some());
999 assert!(env.get(&Name::str("BorelDeterminacy")).is_some());
1000 assert!(env.get(&Name::str("ProjectiveDeterminacy")).is_some());
1001 assert!(env.get(&Name::str("Sigma11Determinacy")).is_some());
1002 assert!(env.get(&Name::str("WellOrderingTheorem")).is_some());
1003 assert!(env.get(&Name::str("ComparisonOfWellOrderings")).is_some());
1004 assert!(env
1005 .get(&Name::str("InfiniteLinearOrderHasOmegaOrOmegaStar"))
1006 .is_some());
1007 assert!(env.get(&Name::str("HausdorffScattered")).is_some());
1008 assert!(env.get(&Name::str("ThinSetTheorem")).is_some());
1009 assert!(env.get(&Name::str("FreeSetTheorem")).is_some());
1010 assert!(env.get(&Name::str("CohesivenessTheorem")).is_some());
1011 assert!(env.get(&Name::str("OmittingTypesTheorem")).is_some());
1012 assert!(env.get(&Name::str("LowBasisTheorem")).is_some());
1013 assert!(env.get(&Name::str("Sigma0nFormula")).is_some());
1014 assert!(env.get(&Name::str("Delta11Formula")).is_some());
1015 assert!(env.get(&Name::str("Sigma0nInduction")).is_some());
1016 assert!(env.get(&Name::str("Delta01Comprehension")).is_some());
1017 }
1018 #[test]
1019 fn test_computable_function() {
1020 let f = ComputableFunction::indicator_below(5);
1021 assert_eq!(f.eval(0), Some(1));
1022 assert_eq!(f.eval(4), Some(1));
1023 assert_eq!(f.eval(5), Some(0));
1024 assert!(f.is_total_up_to(8));
1025 assert_eq!(f.oracle_query(3, 100), Some(1));
1026 }
1027 #[test]
1028 fn test_weak_konig_tree_complete() {
1029 let t = WeakKonigTree::complete(3);
1030 assert!(t.is_infinite());
1031 assert_eq!(t.count_at_depth(3), 8);
1032 let path = t.greedy_path();
1033 assert_eq!(path.len(), 3);
1034 assert_eq!(path, vec![0u8, 0u8, 0u8]);
1035 }
1036 #[test]
1037 fn test_weak_konig_tree_with_only_one_branch() {
1038 let mut t = WeakKonigTree {
1039 max_depth: 3,
1040 nodes: vec![],
1041 depths: vec![],
1042 };
1043 t.nodes.push(0);
1044 t.depths.push(0);
1045 t.nodes.push(1);
1046 t.depths.push(1);
1047 t.nodes.push(3);
1048 t.depths.push(2);
1049 t.nodes.push(7);
1050 t.depths.push(3);
1051 assert!(t.is_infinite());
1052 let path = t.greedy_path();
1053 assert_eq!(path, vec![1u8, 1u8, 1u8]);
1054 }
1055 #[test]
1056 fn test_ramsey_coloring_finder_uniform() {
1057 let mut finder = RamseyColoringFinder::new_uniform(5, 2);
1058 let (c, clique) = finder.best_monochromatic_clique();
1059 assert_eq!(c, 0);
1060 assert_eq!(clique.len(), 5);
1061 finder.set_color(0, 1, 1);
1062 finder.set_color(0, 2, 1);
1063 finder.set_color(1, 2, 1);
1064 let (c2, clique2) = finder.best_monochromatic_clique();
1065 assert!(clique2.len() >= 2);
1066 assert!(c2 < 2);
1067 }
1068 #[test]
1069 fn test_rma0_system() {
1070 let inst = RMA0System::sigma01_comprehension_for("phi_halting");
1071 assert!(inst.verify());
1072 assert_eq!(inst.kind, RCA0AxiomKind::Sigma01Comprehension);
1073 let summary = inst.summary();
1074 assert!(summary.contains("VALID"));
1075 assert!(summary.contains("phi_halting"));
1076 }
1077 #[test]
1078 fn test_rm_hierarchy_display() {
1079 let h = RMHierarchy::standard();
1080 let out = h.display();
1081 assert!(out.contains("RCA₀"));
1082 assert!(out.contains("WKL₀"));
1083 assert!(out.contains("ACA₀"));
1084 assert!(out.contains("ATR₀"));
1085 assert!(out.contains("Π¹₁-CA₀"));
1086 assert!(out.contains("König"));
1087 assert!(out.contains("Bolzano"));
1088 }
1089 #[test]
1090 fn test_rm_hierarchy_entry_lookup() {
1091 let h = RMHierarchy::standard();
1092 let entry = h
1093 .entry_for(&BigFiveSystem::ATR0)
1094 .expect("entry_for should succeed");
1095 assert_eq!(entry.system, BigFiveSystem::ATR0);
1096 assert!(entry.equivalents.contains(&"Open determinacy"));
1097 }
1098}
1099#[allow(dead_code)]
1101pub fn standard_rm_theorems() -> Vec<RMTheorem> {
1102 vec![
1103 RMTheorem::new(
1104 "BolzanoWeierstrass",
1105 "Every bounded sequence in ℝ has a convergent subsequence.",
1106 "ACA₀",
1107 vec![
1108 "Sequential compactness of [0,1]",
1109 "Monotone convergence theorem",
1110 ],
1111 false,
1112 ),
1113 RMTheorem::new(
1114 "HeineCantorUniformContinuity",
1115 "Every continuous function on a closed bounded interval is uniformly continuous.",
1116 "WKL₀",
1117 vec!["Heine-Borel theorem", "Fan theorem"],
1118 false,
1119 ),
1120 RMTheorem::new(
1121 "IntermediateValueTheorem",
1122 "If f: [0,1] → ℝ is continuous and f(0) < 0 < f(1), then ∃x, f(x) = 0.",
1123 "WKL₀",
1124 vec!["Brouwer's fixed point theorem (1D)"],
1125 false,
1126 ),
1127 RMTheorem::new(
1128 "MaximumMinimumTheorem",
1129 "Every continuous real function on [0,1] attains its maximum and minimum.",
1130 "WKL₀",
1131 vec!["Compact implies sequentially compact (metric)"],
1132 false,
1133 ),
1134 RMTheorem::new(
1135 "MonotoneConvergence",
1136 "Every bounded monotone sequence of reals converges.",
1137 "ACA₀",
1138 vec!["Bolzano-Weierstrass", "Sequential compactness"],
1139 false,
1140 ),
1141 RMTheorem::new(
1142 "CauchyCharacterization",
1143 "A sequence is convergent iff it is a Cauchy sequence.",
1144 "ACA₀",
1145 vec!["Completeness of ℝ"],
1146 false,
1147 ),
1148 RMTheorem::new(
1149 "KonigLemma",
1150 "Every infinite, finitely-branching tree has an infinite path.",
1151 "WKL₀",
1152 vec!["Heine-Borel theorem", "Weak König's Lemma"],
1153 false,
1154 ),
1155 RMTheorem::new(
1156 "RamseyFinite",
1157 "For all k, m, every k-coloring of [N]^2 has a monochromatic set of size m.",
1158 "RCA₀",
1159 Vec::<&str>::new(),
1160 true,
1161 ),
1162 RMTheorem::new(
1163 "RamseyInfinite",
1164 "For all k, every k-coloring of [N]^2 has an infinite monochromatic set.",
1165 "ACA₀",
1166 vec!["Ascending/Descending Sequence principle"],
1167 false,
1168 ),
1169 RMTheorem::new(
1170 "HilbertBasisTheorem",
1171 "Every ideal in a polynomial ring over a field is finitely generated.",
1172 "ATR₀",
1173 vec!["Open determinacy", "Comparability of well-orderings"],
1174 false,
1175 ),
1176 RMTheorem::new(
1177 "SilverTheorem",
1178 "Every Borel graph on a Polish space satisfies the Galvin-Prikry property.",
1179 "Π¹₁-CA₀",
1180 vec!["Analytic determinacy (weaker form)"],
1181 false,
1182 ),
1183 RMTheorem::new(
1184 "LindelofTheorem",
1185 "Every open cover of a separable metric space has a countable subcover.",
1186 "RCA₀",
1187 Vec::<&str>::new(),
1188 true,
1189 ),
1190 ]
1191}
1192#[allow(dead_code)]
1194pub fn known_pi11_sentences() -> Vec<Pi11Sentence> {
1195 vec![
1196 Pi11Sentence::new("Con(PA)", "Consistency of Peano Arithmetic", Some("ε₀")),
1197 Pi11Sentence::new("WO(ε₀)", "ε₀ is a well-ordering", Some("ε₀")),
1198 Pi11Sentence::new("Con(ATR₀)", "Consistency of ATR₀", Some("Γ₀")),
1199 Pi11Sentence::new("GoodmanTheorem", "The Goodman theorem for HA", Some("ε₀")),
1200 Pi11Sentence::new("Con(Z₂)", "Consistency of Z₂", Some("φ_ω(0)")),
1201 Pi11Sentence::new(
1202 "ParisHarrington",
1203 "The Paris-Harrington principle",
1204 Some("ε₀"),
1205 ),
1206 Pi11Sentence::new(
1207 "GoodsteinSeq",
1208 "Every Goodstein sequence terminates",
1209 Some("ε₀"),
1210 ),
1211 Pi11Sentence::new("KirbyParis", "Kirby-Paris Hydra theorem", Some("ε₀")),
1212 ]
1213}
1214#[allow(dead_code)]
1216pub fn subsystem_le(system_a: &str, system_b: &str) -> bool {
1217 let order = ["RCA₀", "WKL₀", "ACA₀", "ATR₀", "Π¹₁-CA₀"];
1218 let pos_a = order.iter().position(|&s| s == system_a);
1219 let pos_b = order.iter().position(|&s| s == system_b);
1220 match (pos_a, pos_b) {
1221 (Some(a), Some(b)) => a <= b,
1222 _ => false,
1223 }
1224}
1225#[allow(dead_code)]
1227pub fn standard_omega_models() -> Vec<OmegaModel> {
1228 vec![
1229 OmegaModel::rec_sets(),
1230 OmegaModel::standard_aca0(),
1231 OmegaModel::new("HYP", "ATR₀", false, "Hyperarithmetical sets: Δ¹₁ sets"),
1232 OmegaModel::new("∆¹₂", "Π¹₁-CA₀", false, "Second-order definable sets: ∆¹₂"),
1233 OmegaModel::new(
1234 "L_ω₁ᶜᵏ",
1235 "Π¹₁-CA₀",
1236 false,
1237 "Gödel's L up to the Church-Kleene ordinal",
1238 ),
1239 ]
1240}
1241#[cfg(test)]
1242mod rm_extended_tests {
1243 use super::*;
1244 #[test]
1245 fn test_proof_system_name() {
1246 assert_eq!(ProofSystem::PRA.name(), "PRA");
1247 assert_eq!(ProofSystem::Z2.name(), "Z₂");
1248 assert_eq!(ProofSystem::Custom("ZFC".into()).name(), "ZFC");
1249 }
1250 #[test]
1251 fn test_is_conservative_over() {
1252 assert!(ProofSystem::Z2.is_conservative_over(&ProofSystem::PeanoPA));
1253 assert!(ProofSystem::PeanoPA.is_conservative_over(&ProofSystem::RobinsonQ));
1254 assert!(!ProofSystem::PRA.is_conservative_over(&ProofSystem::Z2));
1255 }
1256 #[test]
1257 fn test_stronger_systems() {
1258 let s = ProofSystem::PRA.stronger_systems();
1259 assert_eq!(s.len(), 5);
1260 assert!(s.contains(&ProofSystem::Z2));
1261 }
1262 #[test]
1263 fn test_rm_theorem_summary() {
1264 let thm = RMTheorem::new("Test", "Some theorem", "ACA₀", vec!["Equiv1"], false);
1265 let s = thm.summary();
1266 assert!(s.contains("Test"));
1267 assert!(s.contains("ACA₀"));
1268 assert!(s.contains("Equiv1"));
1269 }
1270 #[test]
1271 fn test_standard_rm_theorems() {
1272 let thms = standard_rm_theorems();
1273 assert!(!thms.is_empty());
1274 assert!(thms.iter().any(|t| t.name == "BolzanoWeierstrass"));
1275 assert!(thms.iter().any(|t| t.name == "KonigLemma"));
1276 }
1277 #[test]
1278 fn test_subsystem_le() {
1279 assert!(subsystem_le("RCA₀", "ACA₀"));
1280 assert!(subsystem_le("ACA₀", "ACA₀"));
1281 assert!(!subsystem_le("ACA₀", "WKL₀"));
1282 assert!(subsystem_le("WKL₀", "Π¹₁-CA₀"));
1283 }
1284 #[test]
1285 fn test_pi11_sentences() {
1286 let sents = known_pi11_sentences();
1287 assert!(!sents.is_empty());
1288 assert!(sents.iter().any(|s| s.name == "Con(PA)"));
1289 let disp = sents[0].display();
1290 assert!(disp.contains("Con(PA)"));
1291 }
1292 #[test]
1293 fn test_omega_models() {
1294 let rec = OmegaModel::rec_sets();
1295 assert!(rec.is_minimal);
1296 assert_eq!(rec.satisfies, "RCA₀");
1297 let models = standard_omega_models();
1298 assert_eq!(models.len(), 5);
1299 assert!(models.iter().any(|m| m.name == "REC"));
1300 }
1301 #[test]
1302 fn test_rm_scoreboard() {
1303 let sb = RMScoreboard::standard();
1304 assert!(!sb.theorems.is_empty());
1305 let aca0_count = sb.count_in("ACA₀");
1306 assert!(aca0_count > 0);
1307 }
1308}
1309#[allow(dead_code)]
1311pub fn constructive_principles() -> Vec<ConstructivePrinciple> {
1312 vec![
1313 ConstructivePrinciple::new("MarkovPrinciple", "LLPO", false, Some("Markov's principle")),
1314 ConstructivePrinciple::new("LLPO", "Law of Excluded Middle", false, Some("LPO")),
1315 ConstructivePrinciple::new("LPO", "Law of Excluded Middle", false, Some("LEM")),
1316 ConstructivePrinciple::new("WLPO", "Weak LPO", false, Some("LPO")),
1317 ConstructivePrinciple::new("BishopFan", "Fan Theorem", true, None::<&str>),
1318 ConstructivePrinciple::new(
1319 "ChoiceSequences",
1320 "Axiom of Choice (Countable)",
1321 false,
1322 Some("Countable choice"),
1323 ),
1324 ConstructivePrinciple::new("DependentChoice", "Dependent Choice", false, Some("DC")),
1325 ConstructivePrinciple::new(
1326 "UniformContinuity",
1327 "Uniform Continuity on Cantor Space",
1328 true,
1329 None::<&str>,
1330 ),
1331 ConstructivePrinciple::new(
1332 "ContBar",
1333 "Continuous Functions on Baire Space",
1334 false,
1335 Some("Bar Induction"),
1336 ),
1337 ]
1338}
1339#[allow(dead_code)]
1341pub fn standard_independence_results() -> Vec<IndependenceResult> {
1342 vec![
1343 IndependenceResult::new("ContinuumHypothesis", "ZFC", true, "Cohen 1963"),
1344 IndependenceResult::new("GeneralizedContinuumHypothesis", "ZFC", true, "Cohen 1963"),
1345 IndependenceResult::new("AxiomOfChoice", "ZF", true, "Cohen 1963"),
1346 IndependenceResult::new("SuslinHypothesis", "ZFC", true, "Solovay-Tennenbaum 1971"),
1347 IndependenceResult::new("BorelConjecture", "ZFC", true, "Laver 1976"),
1348 IndependenceResult::new("MartinAxiom", "ZFC", true, "Independent from ZFC+¬CH"),
1349 IndependenceResult::new("WhiteheadProblem", "ZFC", true, "Shelah 1974"),
1350 IndependenceResult::new("KaplanProblem", "ZFC", true, "Independent from ZFC"),
1351 IndependenceResult::new("ProperForcingAxiom", "ZFC", true, "Baumgartner 1984"),
1352 IndependenceResult::new("VopenkaPrinciple", "ZFC", true, "Requires a large cardinal"),
1353 IndependenceResult::new("Goodstein", "PA", true, "Kirby-Paris 1982"),
1354 IndependenceResult::new("ParisHarrington", "PA", true, "Paris-Harrington 1977"),
1355 IndependenceResult::new("Consistency(PA)", "PA", true, "Gödel 1931"),
1356 ]
1357}
1358#[cfg(test)]
1359mod rm_extended2_tests {
1360 use super::*;
1361 #[test]
1362 fn test_constructive_principles() {
1363 let ps = constructive_principles();
1364 assert!(!ps.is_empty());
1365 let mp = ps
1366 .iter()
1367 .find(|p| p.name == "MarkovPrinciple")
1368 .expect("find should succeed");
1369 assert!(!mp.constructively_provable);
1370 assert!(mp.required_axiom.is_some());
1371 }
1372 #[test]
1373 fn test_independence_results() {
1374 let irs = standard_independence_results();
1375 assert!(!irs.is_empty());
1376 let ch = irs
1377 .iter()
1378 .find(|r| r.statement == "ContinuumHypothesis")
1379 .expect("find should succeed");
1380 assert!(ch.is_independent);
1381 assert_eq!(ch.base_theory, "ZFC");
1382 let disp = ch.display();
1383 assert!(disp.contains("INDEPENDENT"));
1384 }
1385 #[test]
1386 fn test_big_five_stats() {
1387 let sb = RMScoreboard::standard();
1388 let stats = BigFiveStats::from_scoreboard(&sb);
1389 assert!(stats.total() > 0);
1390 let disp = stats.display();
1391 assert!(disp.contains("RCA₀"));
1392 assert!(disp.contains("ACA₀"));
1393 }
1394 #[test]
1395 fn test_constructive_principle_display() {
1396 let p = ConstructivePrinciple::new("TestPrinciple", "LEM", false, Some("MP"));
1397 let d = p.display();
1398 assert!(d.contains("TestPrinciple"));
1399 assert!(d.contains("constructive=false"));
1400 }
1401}