nat.bend checks
raw source on the hub · import 0x1ee1b5d0c2a66817bf368b849f3117fc/nat.bend as MNat
Nat.add — the laws of Base's Nat.add, as a callable lemma set.
Base ships a term library and no reasoning library: not one fact about Nat.add is stated anywhere in it. These six defs are the facts every proof over Nat.add ends up writing by hand — zero, succ, assoc, comm — plus the two that fall out of the first two by one rewrite. (First written for the Life proofs of bend2-from-zero; extracted here so the next proof can import them.)
The rewrite rule, because it decides each statement's orientation:
%lem(args) : P P is the goal AFTER the rewrite, with _ at the
position the lemma's LEFT side was put in. So a lemma is written
{target == what-the-goal-holds-now}: its right side is the form being
eliminated, its left side replaces it.
add_zero {a + 0 == a} replaces a with a + 0
add_zero_r {a == a + 0} replaces a + 0 with a
add_succ {a + (1+p) == 1+(a+p)} replaces 1+(a+p) with a + (1+p)
add_succ_r {1+(a+p) == a + (1+p)} replaces a + (1+p) with 1+(a+p)
add_assoc {(a+b)+c == a+(b+c)} replaces a+(b+c) with (a+b)+c
add_comm {a + b == b + a} replaces b + a with a + b
1 import
import Base
Definitions
def add_zero source · line 25 · raw
@a:Nat -> {Nat.add(a, 0n) == a : Nat}
def add_zero_r source · line 33 · raw
@a:Nat -> {a == Nat.add(a, 0n) : Nat}
def add_succ source · line 37 · raw
@a:Nat -> @-p:Nat -> {Nat.add(a, 1n+p) == 1n+Nat.add(a, p) : Nat}
def add_succ_r source · line 45 · raw
@a:Nat -> @-p:Nat -> {1n+Nat.add(a, p) == Nat.add(a, 1n+p) : Nat}
def add_assoc source · line 49 · raw
@a:Nat -> @-b:Nat -> @-c:Nat -> {Nat.add(Nat.add(a, b), c) == Nat.add(a, Nat.add(b, c)) : Nat}
def add_comm source · line 57 · raw
@a:Nat -> @+b:Nat -> {Nat.add(a, b) == Nat.add(b, a) : Nat}