#![allow(clippy::items_after_test_module)]
use oxilean_kernel::{BinderInfo, Declaration, Environment, Expr, Level, Name};
use super::types::{
CoveringSpaceData, FibrationData, FundamentalGroupData, HomotopyGroupTable, PostnikovSection,
PostnikovSectionData,
};
pub fn app(f: Expr, a: Expr) -> Expr {
Expr::App(Box::new(f), Box::new(a))
}
pub fn app2(f: Expr, a: Expr, b: Expr) -> Expr {
app(app(f, a), b)
}
pub fn app3(f: Expr, a: Expr, b: Expr, c: Expr) -> Expr {
app(app2(f, a, b), c)
}
pub fn cst(s: &str) -> Expr {
Expr::Const(Name::str(s), vec![])
}
pub fn prop() -> Expr {
Expr::Sort(Level::zero())
}
pub fn type0() -> Expr {
Expr::Sort(Level::succ(Level::zero()))
}
pub fn pi(bi: BinderInfo, name: &str, dom: Expr, body: Expr) -> Expr {
Expr::Pi(bi, Name::str(name), Box::new(dom), Box::new(body))
}
pub fn arrow(a: Expr, b: Expr) -> Expr {
pi(BinderInfo::Default, "_", a, b)
}
pub fn impl_pi(name: &str, dom: Expr, body: Expr) -> Expr {
pi(BinderInfo::Implicit, name, dom, body)
}
pub fn bvar(n: u32) -> Expr {
Expr::BVar(n)
}
pub fn nat_ty() -> Expr {
cst("Nat")
}
pub fn path_ty() -> Expr {
impl_pi("α", type0(), arrow(bvar(0), arrow(bvar(1), type0())))
}
pub fn path_concat_ty() -> Expr {
impl_pi(
"α",
type0(),
arrow(
bvar(0),
arrow(
bvar(1),
arrow(
bvar(2),
arrow(
app3(cst("Path"), bvar(3), bvar(2), bvar(1)),
arrow(
app3(cst("Path"), bvar(4), bvar(2), bvar(1)),
app3(cst("Path"), bvar(5), bvar(4), bvar(2)),
),
),
),
),
),
)
}
pub fn path_inverse_ty() -> Expr {
impl_pi(
"α",
type0(),
arrow(
bvar(0),
arrow(
bvar(1),
arrow(
app3(cst("Path"), bvar(2), bvar(1), bvar(0)),
app3(cst("Path"), bvar(3), bvar(1), bvar(2)),
),
),
),
)
}
pub fn homotopy_ty() -> Expr {
impl_pi(
"α",
type0(),
impl_pi(
"β",
type0(),
arrow(
arrow(bvar(1), bvar(1)),
arrow(arrow(bvar(2), bvar(2)), type0()),
),
),
)
}
pub fn fib_seq_ty() -> Expr {
impl_pi(
"F",
type0(),
impl_pi(
"E",
type0(),
impl_pi(
"B",
type0(),
arrow(
arrow(bvar(2), bvar(1)),
arrow(arrow(bvar(2), bvar(1)), prop()),
),
),
),
)
}
pub fn loop_space_ty() -> Expr {
impl_pi("α", type0(), arrow(bvar(0), type0()))
}
pub fn suspension_type_ty() -> Expr {
arrow(type0(), type0())
}
pub fn freudenthal_suspension_ty() -> Expr {
impl_pi("X", type0(), arrow(nat_ty(), prop()))
}
pub fn homotopy_group_ty() -> Expr {
arrow(nat_ty(), impl_pi("α", type0(), arrow(bvar(0), type0())))
}
pub fn fundamental_groupoid_ty() -> Expr {
arrow(type0(), type0())
}
pub fn k_space_axiom_ty() -> Expr {
impl_pi("G", type0(), arrow(nat_ty(), prop()))
}
pub fn homotopy_equivalence_ty() -> Expr {
impl_pi("α", type0(), impl_pi("β", type0(), prop()))
}
pub fn fiber_bundle_ty() -> Expr {
impl_pi(
"E",
type0(),
impl_pi(
"B",
type0(),
impl_pi("F", type0(), arrow(arrow(bvar(2), bvar(1)), prop())),
),
)
}
pub fn fiber_bundle_section_ty() -> Expr {
impl_pi(
"E",
type0(),
impl_pi("B", type0(), arrow(arrow(bvar(1), bvar(0)), type0())),
)
}
pub fn principal_bundle_ty() -> Expr {
impl_pi(
"G",
type0(),
impl_pi(
"E",
type0(),
impl_pi("B", type0(), arrow(arrow(bvar(1), bvar(0)), prop())),
),
)
}
pub fn covering_space_ty() -> Expr {
impl_pi(
"E",
type0(),
impl_pi("B", type0(), arrow(arrow(bvar(1), bvar(0)), prop())),
)
}
pub fn fundamental_group_action_ty() -> Expr {
impl_pi("B", type0(), arrow(bvar(0), type0()))
}
pub fn universal_cover_ty() -> Expr {
impl_pi("B", type0(), arrow(bvar(0), type0()))
}
pub fn whitehead_theorem_ty() -> Expr {
impl_pi(
"X",
type0(),
impl_pi("Y", type0(), arrow(arrow(bvar(1), bvar(0)), prop())),
)
}
pub fn hurewicz_map_ty() -> Expr {
arrow(nat_ty(), impl_pi("X", type0(), arrow(bvar(0), type0())))
}
pub fn hurewicz_theorem_ty() -> Expr {
arrow(nat_ty(), impl_pi("X", type0(), arrow(bvar(0), prop())))
}
pub fn van_kampen_ty() -> Expr {
impl_pi(
"X",
type0(),
impl_pi(
"A",
type0(),
impl_pi(
"B",
type0(),
arrow(
arrow(bvar(1), bvar(2)),
arrow(arrow(bvar(1), bvar(3)), prop()),
),
),
),
)
}
pub fn long_exact_fibration_ty() -> Expr {
impl_pi(
"F",
type0(),
impl_pi("E", type0(), impl_pi("B", type0(), prop())),
)
}
pub fn homotopy_extension_property_ty() -> Expr {
impl_pi(
"A",
type0(),
impl_pi("X", type0(), arrow(arrow(bvar(1), bvar(0)), prop())),
)
}
pub fn stable_homotopy_group_ty() -> Expr {
arrow(nat_ty(), arrow(type0(), type0()))
}
pub fn suspension_stability_ty() -> Expr {
arrow(nat_ty(), arrow(nat_ty(), arrow(type0(), prop())))
}
pub fn reduced_suspension_ty() -> Expr {
arrow(type0(), type0())
}
pub fn postnikov_section_ty() -> Expr {
impl_pi("X", type0(), arrow(nat_ty(), type0()))
}
pub fn postnikov_tower_ty() -> Expr {
arrow(type0(), type0())
}
pub fn k_invariant_ty() -> Expr {
impl_pi("X", type0(), arrow(nat_ty(), type0()))
}
pub fn obstruction_class_ty() -> Expr {
impl_pi(
"X",
type0(),
impl_pi(
"B",
type0(),
arrow(nat_ty(), arrow(arrow(bvar(2), bvar(1)), type0())),
),
)
}
pub fn obstruction_theory_ty() -> Expr {
impl_pi("X", type0(), impl_pi("B", type0(), prop()))
}
pub fn model_category_ty() -> Expr {
arrow(type0(), prop())
}
pub fn weak_equivalence_ty() -> Expr {
impl_pi("C", type0(), arrow(bvar(0), arrow(bvar(1), prop())))
}
pub fn cofibration_morphism_ty() -> Expr {
impl_pi("C", type0(), arrow(bvar(0), arrow(bvar(1), prop())))
}
pub fn fibration_morphism_ty() -> Expr {
impl_pi("C", type0(), arrow(bvar(0), arrow(bvar(1), prop())))
}
pub fn quillen_adjunction_ty() -> Expr {
impl_pi(
"C",
type0(),
impl_pi(
"D",
type0(),
arrow(
arrow(bvar(1), bvar(0)),
arrow(arrow(bvar(1), bvar(2)), prop()),
),
),
)
}
pub fn quillen_equivalence_ty() -> Expr {
impl_pi(
"C",
type0(),
impl_pi(
"D",
type0(),
arrow(
arrow(bvar(1), bvar(0)),
arrow(arrow(bvar(1), bvar(2)), prop()),
),
),
)
}
pub fn derived_functor_ty() -> Expr {
impl_pi(
"C",
type0(),
impl_pi("D", type0(), arrow(arrow(bvar(1), bvar(0)), type0())),
)
}
pub fn serre_spectral_seq_ty() -> Expr {
impl_pi(
"F",
type0(),
impl_pi("E", type0(), impl_pi("B", type0(), prop())),
)
}
pub fn atiyah_hirzebruch_ty() -> Expr {
impl_pi("X", type0(), arrow(arrow(nat_ty(), type0()), prop()))
}
pub fn steenrod_algebra_ty() -> Expr {
arrow(nat_ty(), type0())
}
pub fn steenrod_square_ty() -> Expr {
arrow(
nat_ty(),
impl_pi(
"X",
type0(),
arrow(arrow(bvar(0), type0()), arrow(bvar(1), type0())),
),
)
}
pub fn adam_operations_ty() -> Expr {
arrow(nat_ty(), arrow(type0(), type0()))
}
pub fn brown_representability_ty() -> Expr {
arrow(arrow(type0(), type0()), prop())
}
pub fn infinity_groupoid_ty() -> Expr {
arrow(type0(), type0())
}
pub fn univalence_axiom_ty() -> Expr {
impl_pi("α", type0(), impl_pi("β", type0(), prop()))
}
pub fn higher_inductive_type_ty() -> Expr {
arrow(type0(), type0())
}
pub fn homotopy_pushout_ty() -> Expr {
impl_pi(
"A",
type0(),
impl_pi(
"B",
type0(),
impl_pi(
"C",
type0(),
arrow(
arrow(bvar(2), bvar(1)),
arrow(arrow(bvar(3), bvar(1)), type0()),
),
),
),
)
}
pub fn blakers_massey_ty() -> Expr {
impl_pi(
"A",
type0(),
impl_pi(
"B",
type0(),
impl_pi(
"C",
type0(),
arrow(
nat_ty(),
arrow(
nat_ty(),
arrow(
arrow(bvar(4), bvar(3)),
arrow(arrow(bvar(5), bvar(3)), prop()),
),
),
),
),
),
)
}
pub fn connectedness_degree_ty() -> Expr {
impl_pi("X", type0(), arrow(nat_ty(), prop()))
}
pub fn register_homotopy_theory(env: &mut Environment) {
let axioms: &[(&str, Expr)] = &[
("Path", path_ty()),
("PathConcat", path_concat_ty()),
("PathInverse", path_inverse_ty()),
("Homotopy", homotopy_ty()),
("FibSeq", fib_seq_ty()),
("LoopSpace", loop_space_ty()),
("SuspensionType", suspension_type_ty()),
("FreudenthalSuspension", freudenthal_suspension_ty()),
("HomotopyGroup", homotopy_group_ty()),
("FundamentalGroupoid", fundamental_groupoid_ty()),
("KSpaceAxiom", k_space_axiom_ty()),
("HomotopyEquivalence", homotopy_equivalence_ty()),
("FiberBundle", fiber_bundle_ty()),
("FiberBundleSection", fiber_bundle_section_ty()),
("PrincipalBundle", principal_bundle_ty()),
("CoveringSpace", covering_space_ty()),
("FundamentalGroupAction", fundamental_group_action_ty()),
("UniversalCover", universal_cover_ty()),
("WhiteheadTheorem", whitehead_theorem_ty()),
("HurewiczMap", hurewicz_map_ty()),
("HurewiczTheorem", hurewicz_theorem_ty()),
("VanKampen", van_kampen_ty()),
("LongExactFibration", long_exact_fibration_ty()),
(
"HomotopyExtensionProperty",
homotopy_extension_property_ty(),
),
("StableHomotopyGroup", stable_homotopy_group_ty()),
("SuspensionStability", suspension_stability_ty()),
("ReducedSuspension", reduced_suspension_ty()),
("PostnikovSection", postnikov_section_ty()),
("PostnikovTower", postnikov_tower_ty()),
("KInvariant", k_invariant_ty()),
("ObstructionClass", obstruction_class_ty()),
("ObstructionTheory", obstruction_theory_ty()),
("ModelCategory", model_category_ty()),
("WeakEquivalence", weak_equivalence_ty()),
("CofibrationMorphism", cofibration_morphism_ty()),
("FibrationMorphism", fibration_morphism_ty()),
("QuillenAdjunction", quillen_adjunction_ty()),
("QuillenEquivalence", quillen_equivalence_ty()),
("DerivedFunctor", derived_functor_ty()),
("SerreSpectralSeq", serre_spectral_seq_ty()),
("AtiyahHirzebruch", atiyah_hirzebruch_ty()),
("SteenrodAlgebra", steenrod_algebra_ty()),
("SteenrodSquare", steenrod_square_ty()),
("AdamOperations", adam_operations_ty()),
("BrownRepresentability", brown_representability_ty()),
("InfinityGroupoid", infinity_groupoid_ty()),
("UnivalenceAxiom", univalence_axiom_ty()),
("HigherInductiveType", higher_inductive_type_ty()),
("HomotopyPushout", homotopy_pushout_ty()),
("BlakersMassey", blakers_massey_ty()),
("ConnectednessDegree", connectedness_degree_ty()),
];
for (name, ty) in axioms {
env.add(Declaration::Axiom {
name: Name::str(*name),
univ_params: vec![],
ty: ty.clone(),
})
.ok();
}
}
pub fn product_connectivity(conn_a: i32, conn_b: i32) -> i32 {
conn_a.min(conn_b)
}
pub fn join_connectivity(conn_a: i32, conn_b: i32) -> i32 {
conn_a + conn_b + 2
}
pub fn blakers_massey_connectivity(m: i32, n: i32) -> i32 {
(m + n - 1).max(-1)
}
pub fn freudenthal_stable_range(n_connected: u32, k: u32) -> bool {
k <= 2 * n_connected
}
#[cfg(test)]
mod tests {
use super::*;
fn registered_env() -> Environment {
let mut env = Environment::new();
register_homotopy_theory(&mut env);
env
}
#[test]
fn test_path_registered() {
let env = registered_env();
assert!(env.get(&Name::str("Path")).is_some());
}
#[test]
fn test_path_concat_and_inverse_registered() {
let env = registered_env();
assert!(env.get(&Name::str("PathConcat")).is_some());
assert!(env.get(&Name::str("PathInverse")).is_some());
}
#[test]
fn test_homotopy_registered() {
let env = registered_env();
assert!(env.get(&Name::str("Homotopy")).is_some());
}
#[test]
fn test_fib_seq_registered() {
let env = registered_env();
assert!(env.get(&Name::str("FibSeq")).is_some());
}
#[test]
fn test_loop_space_registered() {
let env = registered_env();
assert!(env.get(&Name::str("LoopSpace")).is_some());
}
#[test]
fn test_suspension_and_freudenthal_registered() {
let env = registered_env();
assert!(env.get(&Name::str("SuspensionType")).is_some());
assert!(env.get(&Name::str("FreudenthalSuspension")).is_some());
}
#[test]
fn test_homotopy_group_and_groupoid_registered() {
let env = registered_env();
assert!(env.get(&Name::str("HomotopyGroup")).is_some());
assert!(env.get(&Name::str("FundamentalGroupoid")).is_some());
}
#[test]
fn test_k_space_and_homotopy_equivalence_registered() {
let env = registered_env();
assert!(env.get(&Name::str("KSpaceAxiom")).is_some());
assert!(env.get(&Name::str("HomotopyEquivalence")).is_some());
}
#[test]
fn test_fiber_bundle_registered() {
let env = registered_env();
assert!(env.get(&Name::str("FiberBundle")).is_some());
assert!(env.get(&Name::str("FiberBundleSection")).is_some());
assert!(env.get(&Name::str("PrincipalBundle")).is_some());
}
#[test]
fn test_covering_space_registered() {
let env = registered_env();
assert!(env.get(&Name::str("CoveringSpace")).is_some());
assert!(env.get(&Name::str("FundamentalGroupAction")).is_some());
assert!(env.get(&Name::str("UniversalCover")).is_some());
}
#[test]
fn test_whitehead_hurewicz_vankampen_registered() {
let env = registered_env();
assert!(env.get(&Name::str("WhiteheadTheorem")).is_some());
assert!(env.get(&Name::str("HurewiczMap")).is_some());
assert!(env.get(&Name::str("HurewiczTheorem")).is_some());
assert!(env.get(&Name::str("VanKampen")).is_some());
}
#[test]
fn test_les_and_hep_registered() {
let env = registered_env();
assert!(env.get(&Name::str("LongExactFibration")).is_some());
assert!(env.get(&Name::str("HomotopyExtensionProperty")).is_some());
}
#[test]
fn test_stable_homotopy_registered() {
let env = registered_env();
assert!(env.get(&Name::str("StableHomotopyGroup")).is_some());
assert!(env.get(&Name::str("SuspensionStability")).is_some());
assert!(env.get(&Name::str("ReducedSuspension")).is_some());
}
#[test]
fn test_postnikov_registered() {
let env = registered_env();
assert!(env.get(&Name::str("PostnikovSection")).is_some());
assert!(env.get(&Name::str("PostnikovTower")).is_some());
assert!(env.get(&Name::str("KInvariant")).is_some());
}
#[test]
fn test_obstruction_registered() {
let env = registered_env();
assert!(env.get(&Name::str("ObstructionClass")).is_some());
assert!(env.get(&Name::str("ObstructionTheory")).is_some());
}
#[test]
fn test_model_category_registered() {
let env = registered_env();
assert!(env.get(&Name::str("ModelCategory")).is_some());
assert!(env.get(&Name::str("WeakEquivalence")).is_some());
assert!(env.get(&Name::str("CofibrationMorphism")).is_some());
assert!(env.get(&Name::str("FibrationMorphism")).is_some());
assert!(env.get(&Name::str("QuillenAdjunction")).is_some());
assert!(env.get(&Name::str("QuillenEquivalence")).is_some());
assert!(env.get(&Name::str("DerivedFunctor")).is_some());
}
#[test]
fn test_spectral_sequences_registered() {
let env = registered_env();
assert!(env.get(&Name::str("SerreSpectralSeq")).is_some());
assert!(env.get(&Name::str("AtiyahHirzebruch")).is_some());
}
#[test]
fn test_steenrod_registered() {
let env = registered_env();
assert!(env.get(&Name::str("SteenrodAlgebra")).is_some());
assert!(env.get(&Name::str("SteenrodSquare")).is_some());
assert!(env.get(&Name::str("AdamOperations")).is_some());
}
#[test]
fn test_brown_infinity_hott_registered() {
let env = registered_env();
assert!(env.get(&Name::str("BrownRepresentability")).is_some());
assert!(env.get(&Name::str("InfinityGroupoid")).is_some());
assert!(env.get(&Name::str("UnivalenceAxiom")).is_some());
assert!(env.get(&Name::str("HigherInductiveType")).is_some());
assert!(env.get(&Name::str("HomotopyPushout")).is_some());
}
#[test]
fn test_blakers_massey_registered() {
let env = registered_env();
assert!(env.get(&Name::str("BlakersMassey")).is_some());
assert!(env.get(&Name::str("ConnectednessDegree")).is_some());
}
#[test]
fn test_fundamental_group_data() {
let g = FundamentalGroupData::circle();
assert_eq!(g.rank(), 1);
assert!(!g.is_trivial);
assert!(g.is_abelian);
let t = FundamentalGroupData::torus();
assert_eq!(t.rank(), 2);
assert_eq!(t.num_relations(), 1);
let trivial = FundamentalGroupData::trivial("S^2");
assert!(trivial.is_trivial);
assert_eq!(trivial.rank(), 0);
let rp2 = FundamentalGroupData::real_projective_plane();
assert_eq!(rp2.rank(), 1);
let surf = FundamentalGroupData::orientable_surface(2);
assert_eq!(surf.rank(), 4);
}
#[test]
fn test_covering_space_data() {
let cov = CoveringSpaceData::real_over_circle();
assert!(cov.is_universal);
assert!(cov.sheet_count.is_none());
let euler = cov.euler_characteristic_total(0);
assert_eq!(euler, None);
let sphere = CoveringSpaceData::sphere_over_projective(2);
assert_eq!(sphere.sheet_count, Some(2));
assert!(sphere.is_universal);
let winding = CoveringSpaceData::circle_winding(3);
assert_eq!(winding.sheet_count, Some(3));
assert_eq!(winding.euler_characteristic_total(0), Some(0));
}
#[test]
fn test_homotopy_group_table() {
let table = HomotopyGroupTable::classical();
assert_eq!(table.lookup(1, 2), Some("0"));
assert_eq!(table.lookup(2, 3), Some("0"));
assert_eq!(table.lookup(1, 1), Some("Z"));
assert_eq!(table.lookup(3, 3), Some("Z"));
assert_eq!(table.lookup(3, 2), Some("Z"));
assert_eq!(table.lookup(6, 3), Some("Z/12"));
assert!(table.lookup(20, 5).is_none());
assert!(table.num_nontrivial() > 0);
}
#[test]
fn test_fibration_data() {
let hopf = FibrationData::hopf_s1();
assert_eq!(hopf.fiber, "S^1");
assert_eq!(hopf.total, "S^3");
assert_eq!(hopf.base, "S^2");
assert!(hopf.is_principal);
let pl = FibrationData::path_loop("S^2");
assert_eq!(pl.base, "S^2");
assert!(!pl.is_principal);
let ub = FibrationData::universal_bundle("U(n)");
assert_eq!(ub.structure_group, Some("U(n)".to_string()));
}
#[test]
fn test_postnikov_section_data() {
let p2 = PostnikovSectionData::s2_p2();
assert_eq!(p2.truncation_level, 2);
assert!(p2.is_em_space);
assert_eq!(p2.num_groups(), 1);
let p3 = PostnikovSectionData::s2_p3();
assert_eq!(p3.truncation_level, 3);
assert!(!p3.is_em_space);
assert!(p3.k_invariant.is_some());
let custom = PostnikovSectionData::new(
"X",
4,
vec![(2, "Z".to_string()), (4, "Z/2".to_string())],
None,
);
assert_eq!(custom.num_groups(), 2);
}
#[test]
fn test_connectivity_utils() {
assert_eq!(product_connectivity(2, 3), 2);
assert_eq!(join_connectivity(1, 2), 5);
assert_eq!(blakers_massey_connectivity(3, 4), 6);
assert_eq!(blakers_massey_connectivity(0, 0), -1);
assert!(freudenthal_stable_range(2, 4));
assert!(!freudenthal_stable_range(2, 5));
}
#[test]
fn test_total_axiom_count() {
let env = registered_env();
let names = [
"Path",
"PathConcat",
"PathInverse",
"Homotopy",
"FibSeq",
"LoopSpace",
"SuspensionType",
"FreudenthalSuspension",
"HomotopyGroup",
"FundamentalGroupoid",
"KSpaceAxiom",
"HomotopyEquivalence",
"FiberBundle",
"FiberBundleSection",
"PrincipalBundle",
"CoveringSpace",
"FundamentalGroupAction",
"UniversalCover",
"WhiteheadTheorem",
"HurewiczMap",
"HurewiczTheorem",
"VanKampen",
"LongExactFibration",
"HomotopyExtensionProperty",
"StableHomotopyGroup",
"SuspensionStability",
"ReducedSuspension",
"PostnikovSection",
"PostnikovTower",
"KInvariant",
"ObstructionClass",
"ObstructionTheory",
"ModelCategory",
"WeakEquivalence",
"CofibrationMorphism",
"FibrationMorphism",
"QuillenAdjunction",
"QuillenEquivalence",
"DerivedFunctor",
"SerreSpectralSeq",
"AtiyahHirzebruch",
"SteenrodAlgebra",
"SteenrodSquare",
"AdamOperations",
"BrownRepresentability",
"InfinityGroupoid",
"UnivalenceAxiom",
"HigherInductiveType",
"HomotopyPushout",
"BlakersMassey",
"ConnectednessDegree",
];
for name in names {
assert!(
env.get(&Name::str(name)).is_some(),
"Missing axiom: {}",
name
);
}
assert_eq!(names.len(), 51);
}
}
pub fn htpy_ext_nat_ty() -> Expr {
cst("Nat")
}
pub fn htpy_ext_type0() -> Expr {
Expr::Sort(Level::succ(Level::zero()))
}
pub fn htpy_ext_prop() -> Expr {
Expr::Sort(Level::zero())
}
pub fn htpy_ext_arrow(a: Expr, b: Expr) -> Expr {
Expr::Pi(
BinderInfo::Default,
Name::str("_"),
Box::new(a),
Box::new(b),
)
}
pub fn htpy_ext_impl_pi(name: &str, dom: Expr, body: Expr) -> Expr {
Expr::Pi(
BinderInfo::Implicit,
Name::str(name),
Box::new(dom),
Box::new(body),
)
}
pub fn htpy_ext_cst(s: &str) -> Expr {
Expr::Const(Name::str(s), vec![])
}
pub fn htpy_ext_app(f: Expr, a: Expr) -> Expr {
Expr::App(Box::new(f), Box::new(a))
}
pub fn htpy_ext_app2(f: Expr, a: Expr, b: Expr) -> Expr {
htpy_ext_app(htpy_ext_app(f, a), b)
}
pub fn htpy_ext_bvar(n: u32) -> Expr {
Expr::BVar(n)
}
pub fn higher_homotopy_group_ty() -> Expr {
htpy_ext_arrow(
htpy_ext_nat_ty(),
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_arrow(htpy_ext_bvar(0), htpy_ext_type0()),
),
)
}
pub fn abelness_higher_groups_ty() -> Expr {
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_arrow(
htpy_ext_nat_ty(),
htpy_ext_arrow(
htpy_ext_app(htpy_ext_cst("GeTwo"), htpy_ext_bvar(0)),
htpy_ext_prop(),
),
),
)
}
pub fn homotopy_long_exact_seq_ty() -> Expr {
htpy_ext_impl_pi(
"F",
htpy_ext_type0(),
htpy_ext_impl_pi(
"E",
htpy_ext_type0(),
htpy_ext_impl_pi(
"B",
htpy_ext_type0(),
htpy_ext_arrow(
htpy_ext_app2(
htpy_ext_app(htpy_ext_cst("Fibration"), htpy_ext_bvar(2)),
htpy_ext_bvar(1),
htpy_ext_bvar(0),
),
htpy_ext_prop(),
),
),
),
)
}
pub fn freudenthal_susp_thm_ty() -> Expr {
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_arrow(
htpy_ext_nat_ty(),
htpy_ext_arrow(
htpy_ext_app2(
htpy_ext_cst("IsNConnected"),
htpy_ext_bvar(1),
htpy_ext_bvar(0),
),
htpy_ext_prop(),
),
),
)
}
pub fn hopf_fibration_ty() -> Expr {
htpy_ext_prop()
}
pub fn serre_spectral_sequence_ty() -> Expr {
htpy_ext_impl_pi(
"F",
htpy_ext_type0(),
htpy_ext_impl_pi(
"E",
htpy_ext_type0(),
htpy_ext_impl_pi(
"B",
htpy_ext_type0(),
htpy_ext_arrow(
htpy_ext_app2(
htpy_ext_app(htpy_ext_cst("Fibration"), htpy_ext_bvar(2)),
htpy_ext_bvar(1),
htpy_ext_bvar(0),
),
htpy_ext_arrow(
htpy_ext_nat_ty(),
htpy_ext_arrow(htpy_ext_nat_ty(), htpy_ext_type0()),
),
),
),
),
)
}
pub fn postnikov_truncation_ty() -> Expr {
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_arrow(htpy_ext_nat_ty(), htpy_ext_type0()),
)
}
pub fn whitehead_equiv_criteria_ty() -> Expr {
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_impl_pi(
"Y",
htpy_ext_type0(),
htpy_ext_arrow(
htpy_ext_arrow(htpy_ext_bvar(1), htpy_ext_bvar(0)),
htpy_ext_arrow(
htpy_ext_app(htpy_ext_cst("IsWeakEquiv"), htpy_ext_bvar(0)),
htpy_ext_app(htpy_ext_cst("IsHomotopyEquiv"), htpy_ext_bvar(1)),
),
),
),
)
}
pub fn cellular_approximation_ty() -> Expr {
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_impl_pi(
"Y",
htpy_ext_type0(),
htpy_ext_arrow(
htpy_ext_arrow(htpy_ext_bvar(1), htpy_ext_bvar(0)),
htpy_ext_prop(),
),
),
)
}
pub fn brown_representability_thm_ty() -> Expr {
htpy_ext_impl_pi(
"F",
htpy_ext_arrow(htpy_ext_type0(), htpy_ext_type0()),
htpy_ext_arrow(
htpy_ext_app(htpy_ext_cst("IsCohomological"), htpy_ext_bvar(0)),
htpy_ext_type0(),
),
)
}
pub fn eilenberg_maclane_space_ty() -> Expr {
htpy_ext_impl_pi(
"G",
htpy_ext_type0(),
htpy_ext_arrow(htpy_ext_nat_ty(), htpy_ext_type0()),
)
}
pub fn homotopy_excision_ty() -> Expr {
htpy_ext_impl_pi(
"A",
htpy_ext_type0(),
htpy_ext_impl_pi(
"B",
htpy_ext_type0(),
htpy_ext_impl_pi(
"C",
htpy_ext_type0(),
htpy_ext_arrow(
htpy_ext_nat_ty(),
htpy_ext_arrow(htpy_ext_nat_ty(), htpy_ext_prop()),
),
),
),
)
}
pub fn hurewicz_isomorphism_ty() -> Expr {
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_arrow(
htpy_ext_nat_ty(),
htpy_ext_arrow(
htpy_ext_app(htpy_ext_cst("IsHighlyConnected"), htpy_ext_bvar(1)),
htpy_ext_prop(),
),
),
)
}
pub fn j_homomorphism_ty() -> Expr {
htpy_ext_arrow(
htpy_ext_nat_ty(),
htpy_ext_arrow(
htpy_ext_arrow(
htpy_ext_app(htpy_ext_cst("PiN"), htpy_ext_cst("SO")),
htpy_ext_app(htpy_ext_cst("StablePi"), htpy_ext_bvar(1)),
),
htpy_ext_prop(),
),
)
}
pub fn stable_homotopy_spheres_ty() -> Expr {
htpy_ext_arrow(htpy_ext_nat_ty(), htpy_ext_type0())
}
pub fn adams_spectral_sequence_ty() -> Expr {
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_impl_pi(
"Y",
htpy_ext_type0(),
htpy_ext_arrow(
htpy_ext_nat_ty(),
htpy_ext_arrow(htpy_ext_nat_ty(), htpy_ext_type0()),
),
),
)
}
pub fn chromatic_layer_ty() -> Expr {
htpy_ext_arrow(
htpy_ext_nat_ty(),
htpy_ext_arrow(htpy_ext_nat_ty(), htpy_ext_type0()),
)
}
pub fn morava_k_theory_ty() -> Expr {
htpy_ext_arrow(
htpy_ext_nat_ty(),
htpy_ext_arrow(htpy_ext_nat_ty(), htpy_ext_type0()),
)
}
pub fn bott_periodicity_stable_ty() -> Expr {
htpy_ext_prop()
}
pub fn sullivan_minimal_model_axiom_ty() -> Expr {
htpy_ext_impl_pi("X", htpy_ext_type0(), htpy_ext_type0())
}
pub fn rational_homotopy_type_ty() -> Expr {
htpy_ext_impl_pi("X", htpy_ext_type0(), htpy_ext_type0())
}
pub fn localization_at_prime_ty() -> Expr {
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_arrow(htpy_ext_nat_ty(), htpy_ext_type0()),
)
}
pub fn p_completion_ty() -> Expr {
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_arrow(htpy_ext_nat_ty(), htpy_ext_type0()),
)
}
pub fn nilpotent_space_ty() -> Expr {
htpy_ext_impl_pi("X", htpy_ext_type0(), htpy_ext_prop())
}
pub fn rational_hurewicz_ty() -> Expr {
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_arrow(htpy_ext_nat_ty(), htpy_ext_prop()),
)
}
pub fn spectral_sequence_convergence_ty() -> Expr {
htpy_ext_impl_pi(
"E",
htpy_ext_arrow(
htpy_ext_nat_ty(),
htpy_ext_arrow(htpy_ext_nat_ty(), htpy_ext_type0()),
),
htpy_ext_prop(),
)
}
pub fn loop_space_delooping_ty() -> Expr {
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_app(
htpy_ext_cst("Exists"),
htpy_ext_arrow(htpy_ext_bvar(0), htpy_ext_prop()),
),
)
}
pub fn infinite_loop_space_ty() -> Expr {
htpy_ext_impl_pi("X", htpy_ext_type0(), htpy_ext_prop())
}
pub fn spectrum_type_ty() -> Expr {
htpy_ext_type0()
}
pub fn suspension_spectrum_of_ty() -> Expr {
htpy_ext_impl_pi("X", htpy_ext_type0(), htpy_ext_type0())
}
pub fn smash_product_ty() -> Expr {
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_impl_pi("Y", htpy_ext_type0(), htpy_ext_type0()),
)
}
pub fn tate_spectrum_ty() -> Expr {
htpy_ext_impl_pi(
"G",
htpy_ext_type0(),
htpy_ext_impl_pi("X", htpy_ext_type0(), htpy_ext_type0()),
)
}
pub fn k_theory_spectrum_ty() -> Expr {
htpy_ext_prop()
}
pub fn cobordism_spectrum_ty() -> Expr {
htpy_ext_prop()
}
pub fn thom_isomorphism_ty() -> Expr {
htpy_ext_impl_pi(
"E",
htpy_ext_type0(),
htpy_ext_impl_pi(
"B",
htpy_ext_type0(),
htpy_ext_arrow(
htpy_ext_app2(
htpy_ext_cst("VectorBundle"),
htpy_ext_bvar(1),
htpy_ext_bvar(0),
),
htpy_ext_prop(),
),
),
)
}
pub fn pontryagin_thom_ty() -> Expr {
htpy_ext_arrow(
htpy_ext_type0(),
htpy_ext_arrow(
htpy_ext_nat_ty(),
htpy_ext_arrow(htpy_ext_nat_ty(), htpy_ext_prop()),
),
)
}
pub fn einf_ring_spectrum_ty() -> Expr {
htpy_ext_impl_pi("R", htpy_ext_type0(), htpy_ext_prop())
}
pub fn equivariant_homotopy_ty() -> Expr {
htpy_ext_impl_pi(
"G",
htpy_ext_type0(),
htpy_ext_impl_pi(
"X",
htpy_ext_type0(),
htpy_ext_arrow(
htpy_ext_app2(htpy_ext_cst("GSpace"), htpy_ext_bvar(1), htpy_ext_bvar(0)),
htpy_ext_prop(),
),
),
)
}
pub fn register_homotopy_theory_ext(env: &mut Environment) {
let axioms: &[(&str, Expr)] = &[
("HigherHomotopyGroup", higher_homotopy_group_ty()),
("AbelnessHigherGroups", abelness_higher_groups_ty()),
("HomotopyLongExactSeq", homotopy_long_exact_seq_ty()),
("FreudenthalSuspThm", freudenthal_susp_thm_ty()),
("HopfFibration", hopf_fibration_ty()),
("SerreSpectralSequence", serre_spectral_sequence_ty()),
("PostnikovTruncation", postnikov_truncation_ty()),
("WhiteheadEquivCriteria", whitehead_equiv_criteria_ty()),
("CellularApproximation", cellular_approximation_ty()),
("BrownRepresentabilityThm", brown_representability_thm_ty()),
("EilenbergMacLaneSpace", eilenberg_maclane_space_ty()),
("HomotopyExcision", homotopy_excision_ty()),
("HurewiczIsomorphism", hurewicz_isomorphism_ty()),
("JHomomorphism", j_homomorphism_ty()),
("StableHomotopySpheres", stable_homotopy_spheres_ty()),
("AdamsSpectralSequence", adams_spectral_sequence_ty()),
("ChromaticLayer", chromatic_layer_ty()),
("MoravaKTheory", morava_k_theory_ty()),
("BottPeriodicityStable", bott_periodicity_stable_ty()),
(
"SullivanMinimalModelAxiom",
sullivan_minimal_model_axiom_ty(),
),
("RationalHomotopyType", rational_homotopy_type_ty()),
("LocalizationAtPrime", localization_at_prime_ty()),
("PCompletion", p_completion_ty()),
("NilpotentSpace", nilpotent_space_ty()),
("RationalHurewicz", rational_hurewicz_ty()),
(
"SpectralSequenceConvergence",
spectral_sequence_convergence_ty(),
),
("LoopSpaceDelooping", loop_space_delooping_ty()),
("InfiniteLoopSpace", infinite_loop_space_ty()),
("SpectrumType", spectrum_type_ty()),
("SuspensionSpectrumOf", suspension_spectrum_of_ty()),
("SmashProduct", smash_product_ty()),
("TateSpectrum", tate_spectrum_ty()),
("KTheorySpectrum", k_theory_spectrum_ty()),
("CobordismSpectrum", cobordism_spectrum_ty()),
("ThomIsomorphism", thom_isomorphism_ty()),
("PontryaginThom", pontryagin_thom_ty()),
("EinfRingSpectrum", einf_ring_spectrum_ty()),
("EquivariantHomotopy", equivariant_homotopy_ty()),
];
for (name, ty) in axioms {
env.add(Declaration::Axiom {
name: Name::str(*name),
univ_params: vec![],
ty: ty.clone(),
})
.ok();
}
}