MCPcopy Create free account
hub / github.com/argumentcomputer/ix / bad_induct_neg_reducible

Function bad_induct_neg_reducible

crates/kernel/src/tutorial/inductive.rs:812–919  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

810 level_params: vec![],
811 lvls: 0,
812 params: 0,
813 indices: 0,
814 is_unsafe: false,
815 block: block_id.clone(),
816 member_idx: 0,
817 ty: sort1(),
818 ctors: vec![ctor_id.clone()],
819 lean_all: vec![block_id.clone()],
820 },
821 );
822
823 // mk : (constType aType I → I) → I
824 // constType aType I = aType (first arg), so field type is (aType → I)
825 // But before reduction: constType aType I has I in head-normal form's first arg
826 // The kernel checks HNF and sees I in the function domain = negative occurrence
827 let ct_app =
828 app(app(cnst("constType", &[]), cnst("aType", &[])), cnst(n, &[]));
829 let field_ty = pi(ct_app, cnst(n, &[])); // (constType aType I) → I
830 env.insert(
831 ctor_id.clone(),
832 KConst::Ctor {
833 name: mk_name(&format!("{n}.mk")),
834 level_params: vec![],
835 is_unsafe: false,
836 lvls: 0,
837 induct: block_id.clone(),
838 cidx: 0,
839 params: 0,
840 fields: 1,
841 ty: pi(field_ty, cnst(n, &[])),
842 },
843 );
844
845 let rec_ty = npi(
846 "motive",
847 pi(cnst(n, &[]), sort(param(0))),
848 npi(
849 "mk",
850 pi(
851 pi(
852 pi(
853 app(
854 app(cnst("constType", &[]), cnst("aType", &[])),
855 cnst(n, &[]),
856 ),
857 cnst(n, &[]),
858 ),
859 cnst(n, &[]),
860 ),
861 app(var(1), cnst(n, &[])),
862 ),
863 npi("t", cnst(n, &[]), app(var(2), var(0))),
864 ),
865 );
866 env.insert(
867 rec_id.clone(),
868 KConst::Recr {
869 name: mk_name(&format!("{n}.rec")),

Callers

nothing calls this directly

Calls 15

mk_defnFunction · 0.85
nlamFunction · 0.85
mk_axiomFunction · 0.85
npiFunction · 0.85
sortFunction · 0.85
check_rejectsFunction · 0.85
piFunction · 0.50
sort1Function · 0.50
varFunction · 0.50
mk_idFunction · 0.50
mk_nameFunction · 0.50
appFunction · 0.50

Tested by

no test coverage detected