import MyNat.Definition
import MyNat.Power
import MyNat.Inequality -- LE
import InequalityWorld.Level4 -- zero_le
import InequalityWorld.Level5 -- le_trans
import InequalityWorld.Level17 -- lt, lt_iff_succ_le
import MultiplicationWorld.Level4 -- mul_add
import MultiplicationWorld.Level8 -- mul_comm
namespace MyNat
open MyNat

lemma 
lt_irrefl: ∀ (a : MyNat), ¬a < a
lt_irrefl
(
a: MyNat
a
:
MyNat: Type
MyNat
) : ¬ (
a: MyNat
a
<
a: MyNat
a
) :=
a: MyNat

¬a < a
a: MyNat
h: a < a

False
a: MyNat
h: a < a

False
a: MyNat
h1: a a
h2: ¬a a

intro
False
a: MyNat
h1: a a
h2: ¬a a

intro
a a

Goals accomplished! 🐙
lemma
ne_of_lt: ∀ (a b : MyNat), a < b → a ≠ b
ne_of_lt
(
a: MyNat
a
b: MyNat
b
:
MyNat: Type
MyNat
) :
a: MyNat
a
<
b: MyNat
b
a: MyNat
a
b: MyNat
b
:=
a, b: MyNat

a < b a b
a, b: MyNat
h: a < b

a b
a, b: MyNat
h: a < b
h1: a = b

False
a, b: MyNat
h: a < b
h1: a = b

False
a, b: MyNat
h1: a = b
h2: a b
h3: ¬b a

intro
False
a, b: MyNat
h1: a = b
h2: a b
h3: ¬b a

intro
b a
a, b: MyNat
h1: a = b
h2: a b
h3: ¬b a

intro
b a
a, b: MyNat
h1: a = b
h2: a b
h3: ¬b a

intro
b b

Goals accomplished! 🐙
theorem
not_lt_zero: ∀ (a : MyNat), ¬a < 0
not_lt_zero
(
a: MyNat
a
:
MyNat: Type
MyNat
) : ¬(
a: MyNat
a
<
0: MyNat
0
) :=
a: MyNat

¬a < 0
a: MyNat
h: a < 0

False
a: MyNat
h: a < 0

False
a: MyNat
ha: a 0
hna: ¬0 a

intro
False
a: MyNat
ha: a 0
hna: ¬0 a

intro
0 a

Goals accomplished! 🐙
theorem
lt_of_lt_of_le: ∀ (a b c : MyNat), a < b → b ≤ c → a < c
lt_of_lt_of_le
(
a: MyNat
a
b: MyNat
b
c: MyNat
c
:
MyNat: Type
MyNat
) :
a: MyNat
a
<
b: MyNat
b
b: MyNat
b
c: MyNat
c
a: MyNat
a
<
c: MyNat
c
:=
a, b, c: MyNat

a < b b c a < c
a, b, c: MyNat
hab: a < b

b c a < c
a, b, c: MyNat
hab: a < b
hbc: b c

a < c
a, b, c: MyNat
hab: a < b
hbc: b c

a < c
a, b, c: MyNat
hab: succ a b
hbc: b c

succ a c
a, b, c: MyNat
hab: succ a b
hbc: b c

succ a c
a, b, c: MyNat
hab: succ a b
hbc: b c

succ a c
a, b, c: MyNat
hab: succ a b
hbc: b c

succ a c
a, b, c: MyNat
hab: succ a b
x: MyNat
hx: c = b + x

intro
succ a c
a, b, c: MyNat
hab: succ a b
x: MyNat
hx: c = b + x

intro
succ a c
a, b, c, x: MyNat
hx: c = b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a c
a, b, c, x: MyNat
hx: c = b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a c
a, b, c, x: MyNat
hx: c = b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a b + x
a, b, c, x: MyNat
hx: c = b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a b + x
a, b, c, x: MyNat
hx: c = b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a b + x
a, b, c, x: MyNat
hx: c = b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a succ a + y + x
a, b, c, x: MyNat
hx: c = b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a succ a + y + x
a, b, c, x: MyNat
hx: c = b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a + y + x = succ a + (y + x)
a, b, c, x: MyNat
hx: c = b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a + y + x = succ a + (y + x)
a, b, c, x: MyNat
hx: c = b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a + (y + x) = succ a + (y + x)

Goals accomplished! 🐙
theorem
lt_of_le_of_lt: ∀ (a b c : MyNat), a ≤ b → b < c → a < c
lt_of_le_of_lt
(
a: MyNat
a
b: MyNat
b
c: MyNat
c
:
MyNat: Type
MyNat
) :
a: MyNat
a
b: MyNat
b
b: MyNat
b
<
c: MyNat
c
a: MyNat
a
<
c: MyNat
c
:=
a, b, c: MyNat

a b b < c a < c
a, b, c: MyNat
hab: a b

b < c a < c
a, b, c: MyNat
hab: a b
hbc: b < c

a < c
a, b, c: MyNat
hab: a b
hbc: b < c

a < c
a, b, c: MyNat
hab: a b
hbc: succ b c

succ a c
a, b, c: MyNat
hab: a b
hbc: succ b c

succ a c
a, b, c: MyNat
hab: a b
hbc: succ b c

succ a c
a, b, c: MyNat
hab: a b
hbc: succ b c

succ a c
a, b, c: MyNat
hab: a b
x: MyNat
hx: c = succ b + x

intro
succ a c
a, b, c: MyNat
hab: a b
x: MyNat
hx: c = succ b + x

intro
succ a c
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ a c
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ a c
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ a succ b + x
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ a succ b + x
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ a succ b + x
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ a succ (a + y) + x
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ a succ (a + y) + x
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ (a + y) + x = succ a + (y + x)
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ (a + y) + x = succ a + (y + x)
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ (a + y + x) = succ a + (y + x)
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ (a + y + x) = succ a + (y + x)
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ (a + y + x) = succ a + (y + x)
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ (a + y + x) = succ (a + (y + x))
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ (a + y + x) = succ (a + (y + x))
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ (a + y + x) = succ (a + (y + x))
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = a + y

intro.intro
succ (a + (y + x)) = succ (a + (y + x))

Goals accomplished! 🐙
theorem
lt_trans: ∀ (a b c : MyNat), a < b → b < c → a < c
lt_trans
(
a: MyNat
a
b: MyNat
b
c: MyNat
c
:
MyNat: Type
MyNat
) :
a: MyNat
a
<
b: MyNat
b
b: MyNat
b
<
c: MyNat
c
a: MyNat
a
<
c: MyNat
c
:=
a, b, c: MyNat

a < b b < c a < c
a, b, c: MyNat
hab: a < b

b < c a < c
a, b, c: MyNat
hab: a < b
hbc: b < c

a < c
a, b, c: MyNat
hab: a < b
hbc: b < c

a < c
a, b, c: MyNat
hab: succ a b
hbc: succ b c

succ a c
a, b, c: MyNat
hab: succ a b
hbc: succ b c

succ a c
a, b, c: MyNat
hab: succ a b
hbc: succ b c

succ a c
a, b, c: MyNat
hab: succ a b
hbc: succ b c

succ a c
a, b, c: MyNat
hab: succ a b
x: MyNat
hx: c = succ b + x

intro
succ a c
a, b, c: MyNat
hab: succ a b
x: MyNat
hx: c = succ b + x

intro
succ a c
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a c
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a c
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a succ b + x
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a succ b + x
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a succ b + x
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a succ (succ a + y) + x
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ a succ (succ a + y) + x
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ (succ a + y) + x = succ a + (y + x + 1)
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ (succ a + y) + x = succ a + (y + x + 1)
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ (succ a + y + x) = succ a + (y + x + 1)
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ (succ (a + y) + x) = succ a + (y + x + 1)
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ (succ (a + y + x)) = succ (a + (y + x + 1))
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
succ (succ (a + y + x)) = succ (a + (y + x + 1))
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
a + y + x + 1 + 1 = a + (y + x + 1) + 1
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
a + y + x + 1 + 1 = a + (y + x + 1) + 1
a, b, c, x: MyNat
hx: c = succ b + x
y: MyNat
hy: b = succ a + y

intro.intro
a + y + x + 1 + 1 = succ (a + (y + x + 1))

Goals accomplished! 🐙
theorem
lt_iff_le_and_ne: ∀ (a b : MyNat), a < b ↔ a ≤ b ∧ a ≠ b
lt_iff_le_and_ne
(
a: MyNat
a
b: MyNat
b
:
MyNat: Type
MyNat
) :
a: MyNat
a
<
b: MyNat
b
a: MyNat
a
b: MyNat
b
a: MyNat
a
b: MyNat
b
:=
a, b: MyNat

a < b a b a b
a, b: MyNat

mp
a < b a b a b
a, b: MyNat
a b a b a < b
a, b: MyNat

mp
a < b a b a b
a, b: MyNat
h: a < b

mp
a b a b
a, b: MyNat
h: a < b

mp
a b a b
a, b: MyNat
h1: a b
h2: ¬b a

mp.intro
a b a b
a, b: MyNat
h1: a b
h2: ¬b a

mp.intro.left
a b
a, b: MyNat
h1: a b
h2: ¬b a
a b
a, b: MyNat
h1: a b
h2: ¬b a

mp.intro.right
a b
a, b: MyNat
h1: a b
h2: ¬b a
h: a = b

mp.intro.right
False
a, b: MyNat
h1: a b
h2: ¬b a
h: a = b

mp.intro.right
b a
a, b: MyNat
h1: a b
h2: ¬b a
h: a = b

mp.intro.right
b a
a, b: MyNat
h1: a b
h2: ¬b a
h: a = b

mp.intro.right
b b

Goals accomplished! 🐙
a, b: MyNat

mpr
a b a b a < b
a, b: MyNat

mpr
a b a b a < b
a, b: MyNat
h: a b a b

mpr
a < b
a, b: MyNat
h: a b a b

mpr
a < b
a, b: MyNat
h1: a b
h2: a b

mpr.intro
a < b
a, b: MyNat
h1: a b
h2: a b

mpr.intro.left
a b
a, b: MyNat
h1: a b
h2: a b
¬b a
a, b: MyNat
h1: a b
h2: a b

mpr.intro.right
¬b a
a, b: MyNat
h1: a b
h2: a b
h: b a

mpr.intro.right
False
a, b: MyNat
h1: a b
h2: a b
h: b a

mpr.intro.right
a = b

Goals accomplished! 🐙

Goals accomplished! 🐙
theorem
lt_succ_self: ∀ (n : MyNat), n < succ n
lt_succ_self
(
n: MyNat
n
:
MyNat: Type
MyNat
) :
n: MyNat
n
<
succ: MyNat → MyNat
succ
n: MyNat
n
:=
n: MyNat

n < succ n
n: MyNat

n < succ n
n: MyNat

n succ n n succ n
n: MyNat

n succ n n succ n
n: MyNat

left
n succ n
n: MyNat
n succ n
n: MyNat

left
n succ n

Goals accomplished! 🐙
n: MyNat

right
n succ n
n: MyNat

right
n succ n
n: MyNat
h: n = succ n

right
False

Goals accomplished! 🐙

Goals accomplished! 🐙
lemma
succ_le_succ_iff: ∀ (m n : MyNat), succ m ≤ succ n ↔ m ≤ n
succ_le_succ_iff
(
m: MyNat
m
n: MyNat
n
:
MyNat: Type
MyNat
) :
succ: MyNat → MyNat
succ
m: MyNat
m
succ: MyNat → MyNat
succ
n: MyNat
n
m: MyNat
m
n: MyNat
n
:=
m, n: MyNat

succ m succ n m n
m, n: MyNat

mp
succ m succ n m n
m, n: MyNat
m n succ m succ n
m, n: MyNat

mp
succ m succ n m n
m, n: MyNat
h: succ m succ n

mp
m n
m, n: MyNat
h: succ m succ n

mp
m n
m, n, c: MyNat
hc: succ n = succ m + c

mp.intro
m n
m, n, c: MyNat
hc: succ n = succ m + c

mp.intro
n = m + c
m, n, c: MyNat
hc: succ n = succ m + c

mp.intro.a
succ n = succ (m + c)
m, n, c: MyNat
hc: succ n = succ m + c

mp.intro.a
succ n = succ (m + c)
m, n, c: MyNat
hc: succ n = succ m + c

mp.intro.a
succ m + c = succ (m + c)
m, n, c: MyNat
hc: succ n = succ m + c

mp.intro.a
succ m + c = succ (m + c)
m, n, c: MyNat
hc: succ n = succ m + c

mp.intro.a
succ m + c = succ (m + c)
m, n, c: MyNat
hc: succ n = succ m + c

mp.intro.a
succ (m + c) = succ (m + c)

Goals accomplished! 🐙
m, n: MyNat

mpr
m n succ m succ n
m, n: MyNat

mpr
m n succ m succ n
m, n: MyNat
h: m n

mpr
succ m succ n
m, n: MyNat
h: m n

mpr
succ m succ n
m, n, c: MyNat
hc: n = m + c

mpr.intro
succ m succ n
m, n, c: MyNat
hc: n = m + c

mpr.intro
succ n = succ m + c
m, n, c: MyNat
hc: n = m + c

mpr.intro
succ n = succ m + c
m, n, c: MyNat
hc: n = m + c

mpr.intro
succ (m + c) = succ m + c
m, n, c: MyNat
hc: n = m + c

mpr.intro
succ (m + c) = succ m + c
m, n, c: MyNat
hc: n = m + c

mpr.intro
succ (m + c) = succ m + c
m, n, c: MyNat
hc: n = m + c

mpr.intro
succ (m + c) = succ (m + c)

Goals accomplished! 🐙

Goals accomplished! 🐙
lemma
lt_succ_iff_le: ∀ (m n : MyNat), m < succ n ↔ m ≤ n
lt_succ_iff_le
(
m: MyNat
m
n: MyNat
n
:
MyNat: Type
MyNat
) :
m: MyNat
m
<
succ: MyNat → MyNat
succ
n: MyNat
n
m: MyNat
m
n: MyNat
n
:=
m, n: MyNat

m < succ n m n
m, n: MyNat

m < succ n m n
m, n: MyNat

succ m succ n m n
m, n: MyNat

succ m succ n m n

Goals accomplished! 🐙
lemma
le_of_add_le_add_left: ∀ (a b c : MyNat), a + b ≤ a + c → b ≤ c
le_of_add_le_add_left
(
a: MyNat
a
b: MyNat
b
c: MyNat
c
:
MyNat: Type
MyNat
) :
a: MyNat
a
+
b: MyNat
b
a: MyNat
a
+
c: MyNat
c
b: MyNat
b
c: MyNat
c
:=
a, b, c: MyNat

a + b a + c b c
a, b, c: MyNat
h: a + b a + c

b c
a, b, c: MyNat
h: a + b a + c

b c
a, b, c, d: MyNat
hd: a + c = a + b + d

intro
b c
a, b, c, d: MyNat
hd: a + c = a + b + d

intro
c = b + d
a, b, c, d: MyNat
hd: a + c = a + b + d

intro.a
a + c = a + (b + d)
a, b, c, d: MyNat
hd: a + c = a + b + d

intro.a
a + c = a + (b + d)
a, b, c, d: MyNat
hd: a + c = a + b + d

intro.a
a + b + d = a + (b + d)
a, b, c, d: MyNat
hd: a + c = a + b + d

intro.a
a + b + d = a + (b + d)
a, b, c, d: MyNat
hd: a + c = a + b + d

intro.a
a + b + d = a + (b + d)
a, b, c, d: MyNat
hd: a + c = a + b + d

intro.a
a + (b + d) = a + (b + d)

Goals accomplished! 🐙
lemma
lt_of_add_lt_add_left: ∀ (a b c : MyNat), a + b < a + c → b < c
lt_of_add_lt_add_left
(
a: MyNat
a
b: MyNat
b
c: MyNat
c
:
MyNat: Type
MyNat
) :
a: MyNat
a
+
b: MyNat
b
<
a: MyNat
a
+
c: MyNat
c
b: MyNat
b
<
c: MyNat
c
:=
a, b, c: MyNat

a + b < a + c b < c
a, b, c: MyNat

a + b < a + c b < c
a, b, c: MyNat

succ (a + b) a + c b < c
a, b, c: MyNat

succ (a + b) a + c b < c
a, b, c: MyNat

succ (a + b) a + c b < c
a, b, c: MyNat
h: succ (a + b) a + c

succ b c
a, b, c: MyNat
h: succ (a + b) a + c

a
a + succ b a + c
a, b, c: MyNat
h: succ (a + b) a + c

a
a + succ b a + c
a, b, c: MyNat
h: succ (a + b) a + c

a
succ (a + b) a + c
a, b, c: MyNat
h: succ (a + b) a + c

a
succ (a + b) a + c

Goals accomplished! 🐙
lemma
add_lt_add_right: ∀ (a b : MyNat), a < b → ∀ (c : MyNat), a + c < b + c
add_lt_add_right
(
a: MyNat
a
b: MyNat
b
:
MyNat: Type
MyNat
) :
a: MyNat
a
<
b: MyNat
b
c: MyNat
c
:
MyNat: Type
MyNat
,
a: MyNat
a
+
c: MyNat
c
<
b: MyNat
b
+
c: MyNat
c
:=
a, b: MyNat

a < b (c : MyNat), a + c < b + c
a, b: MyNat
h: a < b

(c : MyNat), a + c < b + c
a, b: MyNat
h: a < b
c: MyNat

a + c < b + c
a, b: MyNat
h: a < b
c: MyNat

a + c < b + c
a, b: MyNat
h: succ a b
c: MyNat

succ (a + c) b + c
a, b: MyNat
h: succ a b
c: MyNat

succ (a + c) b + c
a, b: MyNat
h: succ a b
c: MyNat

succ (a + c) b + c
a, b: MyNat
h: succ a b
c: MyNat

succ (a + c) b + c
a, b, c, d: MyNat
hd: b = succ a + d

intro
succ (a + c) b + c
a, b, c, d: MyNat
hd: b = succ a + d

intro
b + c = succ (a + c) + d
a, b, c, d: MyNat
hd: b = succ a + d

intro
b + c = succ (a + c) + d
a, b, c, d: MyNat
hd: b = succ a + d

intro
succ a + d + c = succ (a + c) + d
a, b, c, d: MyNat
hd: b = succ a + d

intro
succ a + d + c = succ (a + c) + d
a, b, c, d: MyNat
hd: b = succ a + d

intro
succ a + d + c = succ (a + c) + d
a, b, c, d: MyNat
hd: b = succ a + d

intro
succ a + d + c = succ (a + c) + d
a, b, c, d: MyNat
hd: b = succ a + d

intro
succ (a + d + c) = succ (a + c + d)
a, b, c, d: MyNat
hd: b = succ a + d

intro
succ (a + d + c) = succ (a + c) + d
a, b, c, d: MyNat
hd: b = succ a + d

intro
succ (a + d + c) = succ (a + c + d)
a, b, c, d: MyNat
hd: b = succ a + d

intro
succ (a + c + d) = succ (a + c + d)

Goals accomplished! 🐙
-- BUGBUG: collectibles -- and now we get three achievements! -- instance : ordered_comm_monoid MyNat := -- { add_le_add_left := λ _ _, add_le_add_left, -- lt_of_add_lt_add_left := lt_of_add_lt_add_left, -- ..MyNat.add_comm_monoid, ..MyNat.partial_order} -- instance : canonically_ordered_monoid MyNat := -- { le_iff_exists_add := le_iff_exists_add, -- bot := 0, -- bot_le := zero_le, -- ..MyNat.ordered_comm_monoid, -- } -- instance : ordered_cancel_comm_monoid MyNat := -- { add_left_cancel := add_left_cancel, -- add_right_cancel := add_right_cancel, -- le_of_add_le_add_left := le_of_add_le_add_left, -- ..MyNat.ordered_comm_monoid} def
succ_lt_succ_iff: ∀ (a b : MyNat), succ a < succ b ↔ a < b
succ_lt_succ_iff
(
a: MyNat
a
b: MyNat
b
:
MyNat: Type
MyNat
) :
succ: MyNat → MyNat
succ
a: MyNat
a
<
succ: MyNat → MyNat
succ
b: MyNat
b
a: MyNat
a
<
b: MyNat
b
:=
a, b: MyNat

succ a < succ b a < b
a, b: MyNat

succ a < succ b a < b
a, b: MyNat

succ a < succ b a < b
a, b: MyNat

succ (succ a) succ b succ a b
a, b: MyNat

succ (succ a) succ b a < b

Goals accomplished! 🐙
-- multiplication theorem
mul_le_mul_of_nonneg_left: ∀ (a b c : MyNat), a ≤ b → 0 ≤ c → c * a ≤ c * b
mul_le_mul_of_nonneg_left
(
a: MyNat
a
b: MyNat
b
c: MyNat
c
:
MyNat: Type
MyNat
) :
a: MyNat
a
b: MyNat
b
0: MyNat
0
c: MyNat
c
c: MyNat
c
*
a: MyNat
a
c: MyNat
c
*
b: MyNat
b
:=
a, b, c: MyNat

a b 0 c c * a c * b
a, b, c: MyNat
hab: a b

0 c c * a c * b
a, b, c: MyNat
hab: a b

0 c c * a c * b
Warning: unused variable `h0` [linter.unusedVariables]
a, b, c: MyNat
hab: a b
h0: 0 c

c * a c * b
a, b, c: MyNat
hab: a b
h0: 0 c

c * a c * b
a, b, c: MyNat
h0: 0 c
d: MyNat
hd: b = a + d

intro
c * a c * b
a, b, c: MyNat
h0: 0 c
d: MyNat
hd: b = a + d

intro
c * a c * b
a, b, c: MyNat
h0: 0 c
d: MyNat
hd: b = a + d

intro
c * a c * (a + d)
a, b, c: MyNat
h0: 0 c
d: MyNat
hd: b = a + d

intro
c * a c * (a + d)
a, b, c: MyNat
h0: 0 c
d: MyNat
hd: b = a + d

intro
c * a c * (a + d)
a, b, c: MyNat
h0: 0 c
d: MyNat
hd: b = a + d

intro
c * a c * a + c * d
a, b, c: MyNat
h0: 0 c
d: MyNat
hd: b = a + d

intro
c * a c * a + c * d

Goals accomplished! 🐙
theorem
mul_le_mul_of_nonneg_right: ∀ (a b c : MyNat), a ≤ b → 0 ≤ c → a * c ≤ b * c
mul_le_mul_of_nonneg_right
(
a: MyNat
a
b: MyNat
b
c: MyNat
c
:
MyNat: Type
MyNat
) :
a: MyNat
a
b: MyNat
b
0: MyNat
0
c: MyNat
c
a: MyNat
a
*
c: MyNat
c
b: MyNat
b
*
c: MyNat
c
:=
a, b, c: MyNat

a b 0 c a * c b * c
a, b, c: MyNat
hab: a b

0 c a * c b * c
a, b, c: MyNat
hab: a b
h0: 0 c

a * c b * c
a, b, c: MyNat
hab: a b
h0: 0 c

a * c b * c
a, b, c: MyNat
hab: a b
h0: 0 c

c * a b * c
a, b, c: MyNat
hab: a b
h0: 0 c

c * a b * c
a, b, c: MyNat
hab: a b
h0: 0 c

c * a b * c
a, b, c: MyNat
hab: a b
h0: 0 c

c * a c * b
a, b, c: MyNat
hab: a b
h0: 0 c

c * a c * b
a, b, c: MyNat
hab: a b
h0: 0 c

a
a b
a, b, c: MyNat
hab: a b
h0: 0 c
0 c
a, b, c: MyNat
hab: a b
h0: 0 c

a
0 c

Goals accomplished! 🐙
theorem
mul_lt_mul_of_pos_left: ∀ (a b c : MyNat), a < b → 0 < c → c * a < c * b
mul_lt_mul_of_pos_left
(
a: MyNat
a
b: MyNat
b
c: MyNat
c
:
MyNat: Type
MyNat
) :
a: MyNat
a
<
b: MyNat
b
0: MyNat
0
<
c: MyNat
c
c: MyNat
c
*
a: MyNat
a
<
c: MyNat
c
*
b: MyNat
b
:=
a, b, c: MyNat

a < b 0 < c c * a < c * b
a, b, c: MyNat
hab: a < b

0 < c c * a < c * b
a, b, c: MyNat
hab: a < b
hc: 0 < c

c * a < c * b
a, b, c: MyNat
hab: a < b
hc: 0 < c

c * a < c * b
a, b: MyNat
hab: a < b
hc: 0 < zero

zero
zero * a < zero * b
a, b: MyNat
hab: a < b
hc: 0 < zero

zero.h
False

Goals accomplished! 🐙
a, b: MyNat
hab: a < b
d: MyNat
hc: 0 < succ d

succ
succ d * a < succ d * b
a, b: MyNat
hab: a < b
d: MyNat

succ
succ d * a < succ d * b
a, b: MyNat
hab: a < b
d: MyNat

succ
succ d * a < succ d * b
a, b: MyNat
hab: a < b

succ.zero
succ zero * a < succ zero * b
a, b: MyNat
hab: a < b

succ.zero
succ zero * a < succ zero * b
a, b: MyNat
hab: a < b

succ.zero
zero * a + a < succ zero * b
a, b: MyNat
hab: a < b

succ.zero
0 * a + a < succ 0 * b
a, b: MyNat
hab: a < b

succ.zero
0 + a < succ 0 * b
a, b: MyNat
hab: a < b

succ.zero
0 + a < succ 0 * b
a, b: MyNat
hab: a < b

succ.zero
0 + a < succ 0 * b
a, b: MyNat
hab: a < b

succ.zero
a < succ 0 * b
a, b: MyNat
hab: a < b

succ.zero
a < 0 * b + b
a, b: MyNat
hab: a < b

succ.zero
a < 0 + b
a, b: MyNat
hab: a < b

succ.zero
a < b
a, b: MyNat
hab: a < b

succ.zero
a < b

Goals accomplished! 🐙
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b

succ.succ
succ (succ e) * a < succ (succ e) * b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b

succ.succ
succ (succ e) * a < succ (succ e) * b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b

succ.succ
succ e * a + a < succ (succ e) * b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b

succ.succ
succ e * a + a < succ (succ e) * b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b

succ.succ
succ e * a + a < succ (succ e) * b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b

succ.succ
succ e * a + a < succ e * b + b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b

succ.succ
succ e * a + a < succ e * b + b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b

succ.succ
succ e * a + a < succ e * b + b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b

succ e * a + a < succ e * b + a

Goals accomplished! 🐙
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b
h: succ e * a + a < succ e * b + a

succ.succ
succ e * b + a < succ e * b + b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b
h: succ e * a + a < succ e * b + a

succ.succ
succ e * b + a < succ e * b + b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b
h: succ e * a + a < succ e * b + a

succ.succ
a + succ e * b < succ e * b + b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b
h: succ e * a + a < succ e * b + a

succ.succ
a + succ e * b < succ e * b + b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b
h: succ e * a + a < succ e * b + a

succ.succ
a + succ e * b < succ e * b + b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b
h: succ e * a + a < succ e * b + a

succ.succ
a + succ e * b < b + succ e * b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b
h: succ e * a + a < succ e * b + a

succ.succ
a + succ e * b < b + succ e * b
a, b: MyNat
hab: a < b
e: MyNat
he: succ e * a < succ e * b
h: succ e * a + a < succ e * b + a

succ.succ.a
a < b

Goals accomplished! 🐙
theorem
mul_lt_mul_of_pos_right: ∀ (a b c : MyNat), a < b → 0 < c → a * c < b * c
mul_lt_mul_of_pos_right
(
a: MyNat
a
b: MyNat
b
c: MyNat
c
:
MyNat: Type
MyNat
) :
a: MyNat
a
<
b: MyNat
b
0: MyNat
0
<
c: MyNat
c
a: MyNat
a
*
c: MyNat
c
<
b: MyNat
b
*
c: MyNat
c
:=
a, b, c: MyNat

a < b 0 < c a * c < b * c
a, b, c: MyNat
ha: a < b
h0: 0 < c

a * c < b * c
a, b, c: MyNat
ha: a < b
h0: 0 < c

a * c < b * c
a, b, c: MyNat
ha: a < b
h0: 0 < c

c * a < b * c
a, b, c: MyNat
ha: a < b
h0: 0 < c

c * a < b * c
a, b, c: MyNat
ha: a < b
h0: 0 < c

c * a < b * c
a, b, c: MyNat
ha: a < b
h0: 0 < c

c * a < c * b
a, b, c: MyNat
ha: a < b
h0: 0 < c

c * a < c * b
a, b, c: MyNat
ha: a < b
h0: 0 < c

a
a < b
a, b, c: MyNat
ha: a < b
h0: 0 < c
0 < c
a, b, c: MyNat
ha: a < b
h0: 0 < c

a
0 < c

Goals accomplished! 🐙
-- BUGBUG todo -- And now another achievement! The naturals are an ordered semiring. -- instance : ordered_semiring MyNat := -- { mul_le_mul_of_nonneg_left := mul_le_mul_of_nonneg_left, -- mul_le_mul_of_nonneg_right := mul_le_mul_of_nonneg_right, -- mul_lt_mul_of_pos_left := mul_lt_mul_of_pos_left, -- mul_lt_mul_of_pos_right := mul_lt_mul_of_pos_right, -- ..MyNat.semiring, -- ..MyNat.ordered_cancel_comm_monoid -- } -- The Orderd semiring would give us this theorem, but we can do it manually instead. lemma
mul_le_mul: ∀ {a b c d : MyNat}, a ≤ c → b ≤ d → 0 ≤ b → 0 ≤ c → a * b ≤ c * d
mul_le_mul
{
a: MyNat
a
b: MyNat
b
c: MyNat
c
d: MyNat
d
:
MyNat: Type
MyNat
} (
hac: a ≤ c
hac
:
a: MyNat
a
c: MyNat
c
) (
hbd: b ≤ d
hbd
:
b: MyNat
b
d: MyNat
d
) (
nn_b: 0 ≤ b
nn_b
:
0: MyNat
0
b: MyNat
b
) (
nn_c: 0 ≤ c
nn_c
:
0: MyNat
0
c: MyNat
c
) :
a: MyNat
a
*
b: MyNat
b
c: MyNat
c
*
d: MyNat
d
:=
a, b, c, d: MyNat
hac: a c
hbd: b d
nn_b: 0 b
nn_c: 0 c

a * b c * d

Goals accomplished! 🐙
lemma
le_mul: ∀ (a b c d : MyNat), a ≤ b → c ≤ d → a * c ≤ b * d
le_mul
(
a: MyNat
a
b: MyNat
b
c: MyNat
c
d: MyNat
d
:
MyNat: Type
MyNat
) :
a: MyNat
a
b: MyNat
b
c: MyNat
c
d: MyNat
d
a: MyNat
a
*
c: MyNat
c
b: MyNat
b
*
d: MyNat
d
:=
a, b, c, d: MyNat

a b c d a * c b * d
a, b, c, d: MyNat
hab: a b
hcd: c d

a * c b * d
a, b, c, d: MyNat
hab: a b
hcd: c d

a * c b * d
b, c, d: MyNat
hcd: c d
hab: zero b

zero
zero * c b * d
b, c, d: MyNat
hcd: c d
hab: zero b

zero
zero * c b * d
b, c, d: MyNat
hcd: c d
hab: zero b

zero
0 * c b * d
b, c, d: MyNat
hcd: c d
hab: zero b

zero
0 b * d
b, c, d: MyNat
hcd: c d
hab: zero b

zero
0 b * d

Goals accomplished! 🐙
b, c, d: MyNat
hcd: c d
t: MyNat
Ht: t b t * c b * d
hab: succ t b

succ
succ t * c b * d
Warning: unused variable `Ht` [linter.unusedVariables]
b, c, d: MyNat
hcd: c d
t: MyNat
Ht: t b t * c b * d
hab: succ t b

succ
succ t * c b * d
b, c, d: MyNat
hcd: c d
t: MyNat
Ht: t b t * c b * d
hab: succ t b

succ
succ t * c b * d
b, c, d: MyNat
hcd: c d
t: MyNat
Ht: t b t * c b * d
hab: succ t b

succ
succ t * c b * d
b, c, d: MyNat
hcd: c d
t: MyNat
Ht: t b t * c b * d
hab: succ t b

0 c

Goals accomplished! 🐙
b, c, d: MyNat
hcd: c d
t: MyNat
Ht: t b t * c b * d
hab: succ t b
cz: 0 c

succ
succ t * c b * d
b, c, d: MyNat
hcd: c d
t: MyNat
Ht: t b t * c b * d
hab: succ t b
cz: 0 c

0 b

Goals accomplished! 🐙

Goals accomplished! 🐙
lemma
pow_le: ∀ (m n a : MyNat), m ≤ n → m ^ a ≤ n ^ a
pow_le
(
m: MyNat
m
n: MyNat
n
a: MyNat
a
:
MyNat: Type
MyNat
) :
m: MyNat
m
n: MyNat
n
m: MyNat
m
^
a: MyNat
a
n: MyNat
n
^
a: MyNat
a
:=
m, n, a: MyNat

m n m ^ a n ^ a
m, n, a: MyNat
h: m n

m ^ a n ^ a
m, n, a: MyNat
h: m n

m ^ a n ^ a
m, n: MyNat
h: m n

zero
m ^ zero n ^ zero
m, n: MyNat
h: m n

zero
m ^ zero n ^ zero
m, n: MyNat
h: m n

zero
m ^ 0 n ^ 0
m, n: MyNat
h: m n

zero
1 n ^ 0
m, n: MyNat
h: m n

zero
1 1

Goals accomplished! 🐙
m, n: MyNat
h: m n
t: MyNat
Ht: m ^ t n ^ t

succ
m ^ succ t n ^ succ t
m, n: MyNat
h: m n
t: MyNat
Ht: m ^ t n ^ t

succ
m ^ succ t n ^ succ t
m, n: MyNat
h: m n
t: MyNat
Ht: m ^ t n ^ t

succ
m ^ t * m n ^ succ t
m, n: MyNat
h: m n
t: MyNat
Ht: m ^ t n ^ t

succ
m ^ t * m n ^ t * n
m, n: MyNat
h: m n
t: MyNat
Ht: m ^ t n ^ t

succ
m ^ t * m n ^ t * n
m, n: MyNat
h: m n
t: MyNat
Ht: m ^ t n ^ t

succ.a
m ^ t n ^ t
m, n: MyNat
h: m n
t: MyNat
Ht: m ^ t n ^ t
m n
m, n: MyNat
h: m n
t: MyNat
Ht: m ^ t n ^ t

succ.a
m n

Goals accomplished! 🐙
lemma
strong_induction_aux: ∀ (P : MyNat → Prop), (∀ (m : MyNat), (∀ (b : MyNat), b < m → P b) → P m) → ∀ (n c : MyNat), c < n → P c
strong_induction_aux
(
P: MyNat → Prop
P
:
MyNat: Type
MyNat
Prop: Type
Prop
) (
IH: ∀ (m : MyNat), (∀ (b : MyNat), b < m → P b) → P m
IH
:
m: MyNat
m
:
MyNat: Type
MyNat
, (
b: MyNat
b
:
MyNat: Type
MyNat
,
b: MyNat
b
<
m: MyNat
m
P: MyNat → Prop
P
b: MyNat
b
)
P: MyNat → Prop
P
m: MyNat
m
) (
n: MyNat
n
:
MyNat: Type
MyNat
) :
c: MyNat
c
<
n: MyNat
n
,
P: MyNat → Prop
P
c: MyNat
c
:=
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
n: MyNat

(c : MyNat), c < n P c
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
n: MyNat

(c : MyNat), c < n P c
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m

zero
(c : MyNat), c < zero P c
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
c: MyNat

zero
c < zero P c
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
c: MyNat
hc: c < zero

zero
P c
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
c: MyNat
hc: c < zero

zero.h
False
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
c: MyNat

zero.h
c < zero False

Goals accomplished! 🐙
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
d: MyNat
hd: (c : MyNat), c < d P c

succ
(c : MyNat), c < succ d P c
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
d: MyNat
hd: (c : MyNat), c < d P c
e: MyNat
he: e < succ d

succ
P e
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
d: MyNat
hd: (c : MyNat), c < d P c
e: MyNat
he: e < succ d

succ
P e
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
d: MyNat
hd: (c : MyNat), c < d P c
e: MyNat
he: e d

succ
P e
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
d: MyNat
hd: (c : MyNat), c < d P c
e: MyNat
he: e d

succ
P e
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
d: MyNat
hd: (c : MyNat), c < d P c
e: MyNat
he: e d

succ
P e
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
d: MyNat
hd: (c : MyNat), c < d P c
e: MyNat
he: e d

succ.a
(b : MyNat), b < e P b
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
d: MyNat
hd: (c : MyNat), c < d P c
e: MyNat
he: e d
b: MyNat
hb: b < e

succ.a
P b
P: MyNat Prop
IH: (m : MyNat), ( (b : MyNat), b < m P b) P m
d: MyNat
hd: (c : MyNat), c < d P c
e: MyNat
he: e d
b: MyNat
hb: b < e

succ.a.a
b < d

Goals accomplished! 🐙
theorem
strong_induction: ∀ (P : MyNat → Prop), (∀ (m : MyNat), (∀ (d : MyNat), d < m → P d) → P m) → ∀ (n : MyNat), P n
strong_induction
(
P: MyNat → Prop
P
:
MyNat: Type
MyNat
Prop: Type
Prop
) (
IH: ∀ (m : MyNat), (∀ (d : MyNat), d < m → P d) → P m
IH
:
m: MyNat
m
:
MyNat: Type
MyNat
, (
d: MyNat
d
:
MyNat: Type
MyNat
,
d: MyNat
d
<
m: MyNat
m
P: MyNat → Prop
P
d: MyNat
d
)
P: MyNat → Prop
P
m: MyNat
m
) :
n: MyNat
n
,
P: MyNat → Prop
P
n: MyNat
n
:=
P: MyNat Prop
IH: (m : MyNat), ( (d : MyNat), d < m P d) P m

(n : MyNat), P n
P: MyNat Prop
IH: (m : MyNat), ( (d : MyNat), d < m P d) P m
n: MyNat

P n
P: MyNat Prop
IH: (m : MyNat), ( (d : MyNat), d < m P d) P m
n: MyNat

a
n < succ n

Goals accomplished! 🐙