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

Function bad_induct_in_index

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

Source from the content-addressed store, hash-verified

1206 lvls: 0,
1207 induct: block_id.clone(),
1208 cidx: 0,
1209 params: 0,
1210 fields: 0,
1211 ty: i_i_aprop,
1212 },
1213 );
1214
1215 let rec_ty = ipi(
1216 "motive",
1217 npi("x", sort0(), pi(app(cnst(n, &[]), var(0)), sort0())),
1218 npi(
1219 "x",
1220 sort0(),
1221 npi("t", app(cnst(n, &[]), var(0)), app(app(var(2), var(1)), var(0))),
1222 ),
1223 );
1224 env.insert(
1225 rec_id.clone(),
1226 KConst::Recr {
1227 name: mk_name(&format!("{n}.rec")),
1228 level_params: vec![],
1229 k: false,
1230 is_unsafe: false,
1231 lvls: 0,
1232 params: 0,
1233 indices: 1,
1234 motives: 1,
1235 minors: 0,
1236 block: block_id.clone(),
1237 member_idx: 0,
1238 ty: rec_ty,
1239 rules: vec![],
1240 lean_all: vec![block_id.clone()],
1241 },
1242 );
1243 env
1244 .blocks
1245 .insert(block_id.clone(), vec![block_id.clone(), ctor_id, rec_id]);
1246 check_rejects(&mut env, &block_id);
1247 }
1248
1249 // ==========================================================================
1250 // Batch 14: Inductive with dup level params (Tutorial.lean 282–296)
1251 // ==========================================================================
1252
1253 /// inductLevelParam: inductive with duplicate level params [u, u]
1254 #[test]
1255 fn bad_induct_dup_level_params() {
1256 let mut env = KEnv::<Meta>::new();
1257 let id = mk_simple_indc(
1258 &mut env,
1259 "inductLevelParam",
1260 2, // 2 level params
1261 &[mk_name("u"), mk_name("u")], // duplicate!
1262 &sort1(),
1263 );
1264 check_rejects(&mut env, &id);
1265 }

Callers

nothing calls this directly

Calls 13

mk_axiomFunction · 0.85
ipiFunction · 0.85
npiFunction · 0.85
check_rejectsFunction · 0.85
sort0Function · 0.50
mk_idFunction · 0.50
mk_nameFunction · 0.50
piFunction · 0.50
appFunction · 0.50
cnstFunction · 0.50
varFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected