Skip to main content

oxilean_std/proof_mining/
functions.rs

1//! Auto-generated module
2//!
3//! πŸ€– Generated with [SplitRS](https://github.com/cool-japan/splitrs)
4
5use 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}
56/// WitnessExtractor: extracts computational content from a proof
57pub fn witness_extractor_ty() -> Expr {
58    type0()
59}
60/// RealizedFormula: realizability type for a formula
61pub fn realized_formula_ty() -> Expr {
62    type0()
63}
64/// RealizabilityInterpretation: Kleene's or Kreisel's modified realizability
65pub fn realizability_interpretation_ty() -> Expr {
66    arrow(cst("Formula"), type0())
67}
68/// HerbrandTerm: explicit witness extracted from βˆƒx.P(x)
69pub fn herbrand_term_ty() -> Expr {
70    type0()
71}
72/// extract_witness: given a proof of βˆƒx.P(x), produce a term
73/// extract_witness : βˆ€ (P : Nat β†’ Prop), (βˆƒ x, P x) β†’ HerbrandTerm
74pub 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}
81/// compute_bound: extract a uniform bound from a proof
82/// compute_bound : WitnessExtractor β†’ Nat
83pub fn compute_bound_ty() -> Expr {
84    arrow(cst("WitnessExtractor"), nat_ty())
85}
86/// is_realizable: check realizability of a formula
87/// is_realizable : Formula β†’ Prop
88pub fn is_realizable_ty() -> Expr {
89    arrow(cst("Formula"), prop())
90}
91/// DialecticaFormula: GΓΆdel's Dialectica translation A^D as (βˆƒu.βˆ€x. A_D(u,x))
92pub fn dialectica_formula_ty() -> Expr {
93    type0()
94}
95/// FunctionalInterpretation: computable functional realizing βˆ€βˆƒ statements
96pub fn functional_interpretation_ty() -> Expr {
97    arrow(cst("DialecticaFormula"), type0())
98}
99/// WeakKoenigsLemma: WKL and its Dialectica interpretation
100pub fn weak_koenighs_lemma_ty() -> Expr {
101    prop()
102}
103/// BoundedArithmetic: PA^Ο‰ conservativity results
104pub fn bounded_arithmetic_ty() -> Expr {
105    type0()
106}
107/// dialectica_soundness: if PA proves A then A^D is realized
108/// dialectica_soundness : βˆ€ (A : Formula), Provable A β†’ Realized (Dialectica A)
109pub 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}
119/// ProofSystem enum type
120pub fn proof_system_ty() -> Expr {
121    type0()
122}
123/// ProofComplexityMeasure: size, depth, width, degree
124pub fn proof_complexity_measure_ty() -> Expr {
125    type0()
126}
127/// PropositionalProof: sequence of lines with justifications
128pub fn propositional_proof_ty() -> Expr {
129    type0()
130}
131/// ResolutionProof: DAG of resolution steps
132pub fn resolution_proof_ty() -> Expr {
133    type0()
134}
135/// CookReckhowThm: NP-completeness ↔ no efficient proof system
136/// CookReckhow : (βˆƒ sys : ProofSystem, Efficient sys) ↔ NP_equals_CoNP
137pub 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}
148/// Clause: disjunction of literals
149pub fn clause_ty() -> Expr {
150    type0()
151}
152/// ResolutionStep: C_1 ∨ x, C_2 ∨ ¬x ⊒ C_1 ∨ C_2
153pub fn resolution_step_ty() -> Expr {
154    arrow(
155        cst("Clause"),
156        arrow(cst("Clause"), arrow(cst("Clause"), prop())),
157    )
158}
159/// EmptyClause: βŠ₯ (contradiction)
160pub fn empty_clause_ty() -> Expr {
161    prop()
162}
163/// ResolutionRefutation: proof of unsatisfiability
164pub fn resolution_refutation_ty() -> Expr {
165    arrow(app(cst("List"), cst("Clause")), prop())
166}
167/// resolution_completeness: unsatisfiable CNF has a resolution refutation
168/// resolution_completeness : βˆ€ (F : CNFFormula), Β¬Satisfiable F β†’ ResolutionRefutation F
169pub 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}
179/// SearchStrategy type
180pub fn search_strategy_ty() -> Expr {
181    type0()
182}
183/// ProofState: current goals, applied tactics, remaining budget
184pub fn proof_state_ty() -> Expr {
185    type0()
186}
187/// HeuristicFn: estimate distance to proof
188pub fn heuristic_fn_ty() -> Expr {
189    arrow(cst("ProofState"), nat_ty())
190}
191/// ProofSearcher: systematic proof search with backtracking
192pub fn proof_searcher_ty() -> Expr {
193    type0()
194}
195/// ModelCheckingBound: bounded model checking with BMC encoding
196pub fn model_checking_bound_ty() -> Expr {
197    type0()
198}
199/// CurryHoward: proof-as-program correspondence
200pub fn curry_howard_ty() -> Expr {
201    impl_pi(
202        "P",
203        prop(),
204        arrow(app(cst("Proof"), bvar(0)), cst("Program")),
205    )
206}
207/// ExtractedProgram: ML-like program extracted from constructive proof
208pub fn extracted_program_ty() -> Expr {
209    type0()
210}
211/// TerminationProof: well-founded induction certificate
212pub fn termination_proof_ty() -> Expr {
213    type0()
214}
215/// ComplexityBound: polynomial/exponential bound extracted
216pub fn complexity_bound_ty() -> Expr {
217    type0()
218}
219/// program_extraction_soundness: extracted program computes the right function
220/// program_extraction_soundness : βˆ€ (P : Prop), Proof P β†’ Realizes (Extract P) P
221pub 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}
231/// Register all proof mining and realizability axioms into the kernel environment.
232pub 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}
298/// `MonotoneFunctionalInterp : DialecticaFormula β†’ Type`
299/// Kohlenbach's bounded / monotone functional interpretation.
300pub fn monotone_functional_interp_ty() -> Expr {
301    arrow(cst("DialecticaFormula"), type0())
302}
303/// `BoundedPrimitiveRecursor : (Nat β†’ Nat β†’ Nat) β†’ Nat β†’ Nat`
304/// Bounded primitive recursion (Kohlenbach's T^Ο‰_b).
305pub 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}
311/// `WE_HPCA : Prop` β€” WE-HPCA metatheorem (Kohlenbach): uniform bound extraction in metric spaces.
312pub fn we_hpca_ty() -> Expr {
313    prop()
314}
315/// `WE_HRCA : Prop` β€” WE-HRCA metatheorem: system for real-closed arithmetic.
316pub fn we_hrca_ty() -> Expr {
317    prop()
318}
319/// `ModelTheoreticMining : Prop` β€” model-theoretic metatheorem for proof mining.
320pub fn model_theoretic_mining_ty() -> Expr {
321    prop()
322}
323/// `KreiselModifiedRealizability : Formula β†’ Type`
324/// Kreisel's modified realizability interpretation.
325pub fn kreisel_modified_realizability_ty() -> Expr {
326    arrow(cst("Formula"), type0())
327}
328/// `TroelstraModifiedRealizability : Formula β†’ Type`
329/// Troelstra's variant of modified realizability.
330pub fn troelstra_modified_realizability_ty() -> Expr {
331    arrow(cst("Formula"), type0())
332}
333/// `BezemRealizability : Formula β†’ Type`
334/// Bezem's strong computability realizability.
335pub fn bezem_realizability_ty() -> Expr {
336    arrow(cst("Formula"), type0())
337}
338/// `modified_realizability_soundness : βˆ€ A, Provable A β†’ KreiselMR A`
339pub 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}
349/// `HowardMajorizability : (Nat β†’ Nat) β†’ (Nat β†’ Nat) β†’ Prop`
350/// Howard's majorizability: f majorizes g if βˆ€n, g n ≀ f n.
351pub fn howard_majorizability_ty() -> Expr {
352    arrow(
353        arrow(nat_ty(), nat_ty()),
354        arrow(arrow(nat_ty(), nat_ty()), prop()),
355    )
356}
357/// `BezemMajorizability : (Nat β†’ Nat) β†’ (Nat β†’ Nat) β†’ Prop`
358/// Bezem's strong majorizability.
359pub fn bezem_majorizability_ty() -> Expr {
360    arrow(
361        arrow(nat_ty(), nat_ty()),
362        arrow(arrow(nat_ty(), nat_ty()), prop()),
363    )
364}
365/// `majorizability_closure : βˆ€ f g h, HowardMaj f g β†’ HowardMaj g h β†’ HowardMaj f h`
366pub 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}
387/// `HerbrandBound : Nat β†’ Nat`
388/// A Herbrand-style bound on the number of instances needed.
389pub fn herbrand_bound_ty() -> Expr {
390    arrow(nat_ty(), nat_ty())
391}
392/// `MetastabilityBoundTy : (Nat β†’ Nat) β†’ Prop`
393/// Terence Tao's metastability: βˆ€ Ξ΅ k, βˆƒ n ≀ Ξ¦(Ξ΅,k), ...
394pub fn metastability_bound_ty_axiom() -> Expr {
395    arrow(arrow(nat_ty(), nat_ty()), prop())
396}
397/// `CauchyRate : (Nat β†’ Nat) β†’ Prop`
398/// A modulus of convergence (Cauchy rate) for a sequence.
399pub fn cauchy_rate_ty() -> Expr {
400    arrow(arrow(nat_ty(), nat_ty()), prop())
401}
402/// `FluctuationRate : Nat β†’ Nat`
403/// Upper bound on the number of Ξ΅-fluctuations of a sequence.
404pub fn fluctuation_rate_ty() -> Expr {
405    arrow(nat_ty(), nat_ty())
406}
407/// `herbrand_bound_extraction : βˆ€ (f : Nat β†’ Nat), MetastabilityBound f β†’ βˆƒ n, Ξ¦ n ≀ HerbrandBound n`
408pub 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}
421/// `NoCounterexampleInterpretation : Formula β†’ Type`
422/// Kreisel's no-counterexample interpretation (nci) of PA.
423pub fn no_counterexample_interp_ty() -> Expr {
424    arrow(cst("Formula"), type0())
425}
426/// `dialectica_no_counterexample_equiv : βˆ€ A, Dialectica A ↔ NCI A`
427pub 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}
438/// `GodelFunctionalInterp : Formula β†’ Type`
439/// Full GΓΆdel functional interpretation (combining Dialectica with T).
440pub fn godel_functional_interp_ty() -> Expr {
441    arrow(cst("Formula"), type0())
442}
443/// `UniformContinuityModulus : (Nat β†’ Nat) β†’ Nat β†’ Nat`
444/// Ο‰(f, Ξ΅) = modulus of uniform continuity of f at precision Ξ΅.
445pub fn uniform_continuity_modulus_ty() -> Expr {
446    arrow(arrow(nat_ty(), nat_ty()), arrow(nat_ty(), nat_ty()))
447}
448/// `weak_compactness_mining : Prop`
449/// Mining uniform bounds from weak compactness arguments.
450pub fn weak_compactness_mining_ty() -> Expr {
451    prop()
452}
453/// `ergodic_theorem_mining : Prop`
454/// Quantitative bounds extracted from the ergodic theorem (Avigad-Rute).
455pub fn ergodic_theorem_mining_ty() -> Expr {
456    prop()
457}
458/// `uniform_continuity_extraction :
459///   βˆ€ (f : Nat β†’ Nat), WeakCompact f β†’ βˆƒ Ο‰, UniformContinuityModulus f Ο‰`
460pub 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}
473/// `HerbrandSequence : Formula β†’ Type`
474/// A Herbrand sequence (finite disjunction of ground instances).
475pub fn herbrand_sequence_ty() -> Expr {
476    arrow(cst("Formula"), type0())
477}
478/// `herbrand_theorem : βˆ€ (A : Formula), Valid A β†’ βˆƒ H, HerbrandSequence A H ∧ TautologyGround H`
479pub 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}
492/// `herbrand_complexity : HerbrandSequence F β†’ Nat`
493/// The size (number of ground instances) in a Herbrand sequence.
494pub fn herbrand_complexity_ty() -> Expr {
495    arrow(cst("HerbrandSequenceObj"), nat_ty())
496}
497/// `ShoenfieldCompleteness : Prop`
498/// Shoenfield's completeness theorem for realizability.
499pub fn shoenfield_completeness_ty() -> Expr {
500    prop()
501}
502/// `BarwiseCompactness : Prop`
503/// Barwise compactness for admissible sets.
504pub fn barwise_compactness_ty() -> Expr {
505    prop()
506}
507/// `ChoiceFunctionRealization : (Nat β†’ Prop) β†’ (Nat β†’ Nat)`
508/// Realizing a choice function from a provability assumption.
509pub fn choice_function_realization_ty() -> Expr {
510    arrow(arrow(nat_ty(), prop()), arrow(nat_ty(), nat_ty()))
511}
512/// `Ordinal : Type` β€” the type of proof-theoretic ordinals.
513pub fn ordinal_ty() -> Expr {
514    type0()
515}
516/// `Epsilon0 : Ordinal` β€” Ξ΅_0, the proof-theoretic ordinal of PA.
517pub fn epsilon0_ty() -> Expr {
518    cst("Ordinal")
519}
520/// `Gamma0 : Ordinal` β€” Ξ“_0, the Feferman-SchΓΌtte ordinal (ATR_0).
521pub fn gamma0_ty() -> Expr {
522    cst("Ordinal")
523}
524/// `VeblenFunction : Ordinal β†’ Ordinal β†’ Ordinal`
525/// Ο†(Ξ±, Ξ²) β€” the Veblen Ο†-function for ordinal analysis.
526pub fn veblen_function_ty() -> Expr {
527    arrow(cst("Ordinal"), arrow(cst("Ordinal"), cst("Ordinal")))
528}
529/// `OrdinalAnalysis : ProofSystem β†’ Ordinal β†’ Prop`
530/// The proof-theoretic ordinal of a system S is Ξ±.
531pub fn ordinal_analysis_ty() -> Expr {
532    arrow(cst("ProofSystem"), arrow(cst("Ordinal"), prop()))
533}
534/// `pa_ordinal_epsilon0 : OrdinalAnalysis PA Epsilon0`
535pub fn pa_ordinal_epsilon0_ty() -> Expr {
536    app2(cst("OrdinalAnalysis"), cst("PA"), cst("Epsilon0"))
537}
538/// `atr0_ordinal_gamma0 : OrdinalAnalysis ATR0 Gamma0`
539pub fn atr0_ordinal_gamma0_ty() -> Expr {
540    app2(cst("OrdinalAnalysis"), cst("ATR0"), cst("Gamma0"))
541}
542/// Extend the proof mining environment with the new Β§7–§15 axioms.
543pub 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/// Functional interpretation of arithmetic.
700#[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/// Survey of proof mining results in analysis.
857#[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}