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

Function good_proof_irrelevance

crates/kernel/src/tutorial/defeq.rs:18–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16 /// proofIrrelevance : ∀ (p : Prop) (h1 h2 : p), h1 = h2 := fun _ _ _ => rfl
17 #[test]
18 fn good_proof_irrelevance() {
19 let mut env = KEnv::<Meta>::new();
20 add_eq_axioms(&mut env);
21
22 // ∀ (p : Prop) (h1 h2 : p), Eq.{0} p h1 h2
23 // depth 3: p=var(2), h1=var(1), h2=var(0)
24 let ty = npi(
25 "p",
26 sort0(),
27 npi(
28 "h1",
29 var(0),
30 npi("h2", var(1), eq_expr(uzero(), var(2), var(1), var(0))),
31 ),
32 );
33
34 // fun p h1 h2 => Eq.refl.{0} p h1
35 // Eq.refl h1 : Eq h1 h1, but declared type says Eq h1 h2.
36 // Proof irrelevance makes h1 = h2 since both : p (a Prop).
37 let val = nlam(
38 "p",
39 sort0(),
40 nlam(
41 "h1",
42 var(0),
43 nlam("h2", var(1), eq_refl_expr(uzero(), var(2), var(1))),
44 ),
45 );
46
47 let (id, c) = mk_defn(
48 "proofIrrelevance",
49 0,
50 vec![],
51 ty,
52 val,
53 ix_common::env::ReducibilityHints::Abbrev,
54 );
55 env.insert(id.clone(), c);
56 check_accepts(&mut env, &id);
57 }
58
59 /// funEta : ∀ (α β : Type) (f : α → β), (fun x => f x) = f := fun _ _ f => rfl
60 #[test]

Callers

nothing calls this directly

Calls 12

add_eq_axiomsFunction · 0.85
npiFunction · 0.85
eq_exprFunction · 0.85
uzeroFunction · 0.85
nlamFunction · 0.85
eq_refl_exprFunction · 0.85
mk_defnFunction · 0.85
check_acceptsFunction · 0.85
sort0Function · 0.50
varFunction · 0.50
insertMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected