import MyNat.Definition
import MyNat.Inequality -- le_iff_exists_add
import Mathlib.Tactic.Use -- use tactic
import AdditionWorld.Level2 -- add_assoc
import InequalityWorld.Level2 -- le_refl_mynat
import Mathlib.Init.Algebra.Order
namespace MyNat
open MyNat
Inequality world.
Level 5: le_trans
Another straightforward one.
Lemma : le_trans
≤ is transitive. In other words, if a ≤ b
and b ≤ c
then a ≤ c
.
theoremle_trans (le_trans: ∀ (a b c : MyNat), a ≤ b → b ≤ c → a ≤ caa: MyNatbb: MyNatc :c: MyNatMyNat) (MyNat: Typehab :hab: a ≤ ba ≤a: MyNatb) (b: MyNathbc :hbc: b ≤ cb ≤b: MyNatc) :c: MyNata ≤a: MyNatc :=c: MyNata, b, c: MyNat
hab: a ≤ b
hbc: b ≤ ca ≤ ca, b, c: MyNat
hab: a ≤ b
hbc: b ≤ ca ≤ ca, b, c: MyNat
hbc: b ≤ c
d: MyNat
hd: b = a + d
introa ≤ ca, b, c: MyNat
hbc: b ≤ c
d: MyNat
hd: b = a + d
introa ≤ ca, b, c, d: MyNat
hd: b = a + d
e: MyNat
he: c = b + e
intro.introa ≤ ca, b, c, d: MyNat
hd: b = a + d
e: MyNat
he: c = b + e
intro.introc = a + (d + e)a, b, c, d: MyNat
hd: b = a + d
e: MyNat
he: c = b + e
intro.introc = a + (d + e)a, b, c, d: MyNat
hd: b = a + d
e: MyNat
he: c = b + e
intro.introc = a + d + ea, b, c, d: MyNat
hd: b = a + d
e: MyNat
he: c = b + e
intro.introc = a + d + ea, b, c, d: MyNat
hd: b = a + d
e: MyNat
he: c = b + e
intro.introc = a + d + ea, b, c, d: MyNat
hd: b = a + d
e: MyNat
he: c = b + e
intro.introc = b + ea, b, c, d: MyNat
hd: b = a + d
e: MyNat
he: c = b + e
intro.introc = b + eGoals accomplished! 🐙
This proved that the natural numbers are a preorder.
instance: Preorder MyNat
instance : Preorder: Type → Type
Preorder MyNat: Type
MyNat :=
⟨le_refl_mynat: ∀ (x : MyNat), x ≤ x
le_refl_mynat, le_trans: ∀ (a b c : MyNat), a ≤ b → b ≤ c → a ≤ c
le_trans, lt: ∀ (a b : MyNat), a < b ↔ a ≤ b ∧ ¬b ≤ a
lt⟩
Next up Level 6