kernel-Nat.add_eq_two_iff
- Kind
- kernel-term
- Status
- checked
Supports: ∀ {m n : ℕ}, m + n = 2 ↔ m = 0 ∧ n = 2 ∨ m = 1 ∧ n = 1 ∨ m = 2 ∧ n = 0
test "$(cargo run -q -p axeyum-lean-kernel --example nat_theorem_inventory -- add_eq_two_iff 2>/dev/null | grep -Ec '^Nat\.add_eq_two_iff[[:space:]]')" -ge 1 Evidence notes
`build_nat_prelude` admits `Nat.add_eq_two_iff` through the trusted `Kernel::add_declaration` gate, declared in `nat_prelude/add_basics.rs`. Declared by `declare_add_eq_lit_iff(d, p, p.add_eq_two_iff, 2)`, the shared helper for the whole `add_eq_{one,two,three}_iff` group (`nat_prelude/add_basics.rs`). `mp` bounds `m <= 2` (`le_add_right` transported along the hypothesis), then walks `lt_or_eq_of_le` / `le_of_lt_succ` from bound 2 down to 0, closing each `Eq` leaf by recovering `n` via `add_left_cancel` and placing the resulting `And` into the right-associated `Or` at the matching position; the final `Lt m 0` leaf is a contradiction via `not_lt_zero`. `mpr` walks the same `Or` shape via a private `or_elim` and closes each branch's concrete arithmetic identity by `Eq.refl` (small numerals fully reduce by defeq). `nat_theorem_inventory`'s rendered type is `(x0,x1:AxNat)->Iff (Eq (add x0 x1) 2) (Or (And 0 2) (Or (And 1 1) (And 2 0)))`, matching this fact's `formal.statement`. `nat_theorem_inventory` exits non-zero for a name that does not exist, and the `grep -c` count (tested `-ge 1`, not piped into `grep -q`) requires the admitted declaration to actually be printed. Verified both ways: the real name greps to a count `-ge 1`; grepping a made-up name (`Nat.add_eq_two_iff_bogus`) greps to `0`.