import Mathlib
open Real
#check π
#check rexp 1
#check Irrational (rexp 1 + π) : Prop Irrational ( rexp 1 + π )
example : ∀ (a b c : ℕ), a + b * c = c * b + a
example ( a b c : ℕ ) : a + b * c = c * b + a := by ring
example : ∀ (a b c : ℕ), a + b * c = c * b + a
example ( a b c : ℕ ) : a + b * c = c * b + a := by show_term Try this: exact Mathlib.Tactic.Ring.of_eq
(Mathlib.Tactic.Ring.add_congr (Mathlib.Tactic.Ring.atom_pf a)
(Mathlib.Tactic.Ring.mul_congr (Mathlib.Tactic.Ring.atom_pf b) (Mathlib.Tactic.Ring.atom_pf c)
(Mathlib.Tactic.Ring.add_mul
(Mathlib.Tactic.Ring.mul_add
(Mathlib.Tactic.Ring.mul_pf_left b (Nat.rawCast 1 )
(Mathlib.Tactic.Ring.mul_pf_right c (Nat.rawCast 1 ) (Mathlib.Tactic.Ring.one_mul (Nat.rawCast 1 ))))
(Mathlib.Tactic.Ring.mul_zero (b ^ Nat.rawCast 1 * Nat.rawCast 1 ))
(Mathlib.Tactic.Ring.add_pf_add_zero (b ^ Nat.rawCast 1 * (c ^ Nat.rawCast 1 * Nat.rawCast 1 ) + 0 )))
(Mathlib.Tactic.Ring.zero_mul (c ^ Nat.rawCast 1 * Nat.rawCast 1 + 0 ))
(Mathlib.Tactic.Ring.add_pf_add_zero (b ^ Nat.rawCast 1 * (c ^ Nat.rawCast 1 * Nat.rawCast 1 ) + 0 ))))
(Mathlib.Tactic.Ring.add_pf_add_lt (a ^ Nat.rawCast 1 * Nat.rawCast 1 )
(Mathlib.Tactic.Ring.add_pf_zero_add (b ^ Nat.rawCast 1 * (c ^ Nat.rawCast 1 * Nat.rawCast 1 ) + 0 ))))
(Mathlib.Tactic.Ring.add_congr
(Mathlib.Tactic.Ring.mul_congr (Mathlib.Tactic.Ring.atom_pf c) (Mathlib.Tactic.Ring.atom_pf b)
(Mathlib.Tactic.Ring.add_mul
(Mathlib.Tactic.Ring.mul_add
(Mathlib.Tactic.Ring.mul_pf_right b (Nat.rawCast 1 )
(Mathlib.Tactic.Ring.mul_pf_left c (Nat.rawCast 1 ) (Mathlib.Tactic.Ring.one_mul (Nat.rawCast 1 ))))
(Mathlib.Tactic.Ring.mul_zero (c ^ Nat.rawCast 1 * Nat.rawCast 1 ))
(Mathlib.Tactic.Ring.add_pf_add_zero (b ^ Nat.rawCast 1 * (c ^ Nat.rawCast 1 * Nat.rawCast 1 ) + 0 )))
(Mathlib.Tactic.Ring.zero_mul (b ^ Nat.rawCast 1 * Nat.rawCast 1 + 0 ))
(Mathlib.Tactic.Ring.add_pf_add_zero (b ^ Nat.rawCast 1 * (c ^ Nat.rawCast 1 * Nat.rawCast 1 ) + 0 ))))
(Mathlib.Tactic.Ring.atom_pf a)
(Mathlib.Tactic.Ring.add_pf_add_gt (a ^ Nat.rawCast 1 * Nat.rawCast 1 )
(Mathlib.Tactic.Ring.add_pf_add_zero (b ^ Nat.rawCast 1 * (c ^ Nat.rawCast 1 * Nat.rawCast 1 ) + 0 )))) a, b, c : ℕ
a + b * c = c * b + a
ring
example : 24 ^ 9 < 9 ^ 25 := by show_term Try this: exact of_eq_true
(eq_true
(Mathlib.Meta.NormNum.isNat_lt_true
(Mathlib.Meta.NormNum.isNat_pow (Eq.refl HPow.hPow) (Mathlib.Meta.NormNum.isNat_ofNat ℕ (Eq.refl 24 ))
(Mathlib.Meta.NormNum.isNat_ofNat ℕ (Eq.refl 9 ))
(Mathlib.Meta.NormNum.IsNatPowT.run
(Mathlib.Meta.NormNum.IsNatPowT.trans
(Mathlib.Meta.NormNum.IsNatPowT.trans Mathlib.Meta.NormNum.IsNatPowT.bit0
Mathlib.Meta.NormNum.IsNatPowT.bit0)
Mathlib.Meta.NormNum.IsNatPowT.bit1)))
(Mathlib.Meta.NormNum.isNat_pow (Eq.refl HPow.hPow) (Mathlib.Meta.NormNum.isNat_ofNat ℕ (Eq.refl 9 ))
(Mathlib.Meta.NormNum.isNat_ofNat ℕ (Eq.refl 25 ))
(Mathlib.Meta.NormNum.IsNatPowT.run
(Mathlib.Meta.NormNum.IsNatPowT.trans
(Mathlib.Meta.NormNum.IsNatPowT.trans Mathlib.Meta.NormNum.IsNatPowT.bit1
Mathlib.Meta.NormNum.IsNatPowT.bit0)
(Mathlib.Meta.NormNum.IsNatPowT.trans Mathlib.Meta.NormNum.IsNatPowT.bit0
Mathlib.Meta.NormNum.IsNatPowT.bit1))))
(Eq.refl false))) norm_num
example : ∀ (a b c : ℕ), a + b * c = c * b + a
example ( a b c : ℕ ) : a + b * c = c * b + a := by
rw [ a, b, c : ℕ
a + b * c = c * b + a
Nat.add_comm : ∀ (n m : ℕ), n + m = m + n
Nat.add_comm, a, b, c : ℕ
b * c + a = c * b + a
@ Nat.add_right_cancel_iff : ∀ {m k n : ℕ}, m + n = k + n ↔ m = k
Nat.add_right_cancel_iff, Nat.mul_comm : ∀ (n m : ℕ), n * m = m * n
Nat.mul_comm]
example : ∀ {b : ℤ}, 0 ≤ max (-3) (b ^ 2)
example { b : ℤ } : 0 ≤ max : {α : Type} → [self : Max α] → α → α → α
max (- 3 ) ( b ^ 2 ) := by positivity
noncomputable def chooseNat : (∃ x, x > 4) → ℕ
chooseNat ( h : ∃ ( x : ℕ ), x > 4 ) : ℕ := Nat.find : {p : ℕ → Prop} → [inst : DecidablePred p] → (∃ n, p n) → ℕ
Nat.find h
noncomputable def chooseNat' : (∃ x, x > 4) → ℕ
chooseNat' ( h : ∃ ( x : ℕ ), x > 4 ) : ℕ := Exists.choose : {α : Type} → {p : α → Prop} → (∃ a, p a) → α
Exists.choose h
variable { f : ℝ → ℝ }
def fnUB ( f : ℝ → ℝ ) ( a : ℝ ) := ∀ x , f x ≤ a
def fnHasUB ( f : ℝ → ℝ ) := ∃ a , fnUB f a
example : ∀ {f : ℝ → ℝ}, (∀ (a : ℝ), ∃ x, f x > a) → ¬fnHasUB f
example ( h : ∀ (a : ℝ), ∃ x, f x > a
h : ∀ a , ∃ x , f x > a ) : ¬ fnHasUB f := by
simp only [ fnHasUB , fnUB ] at * f : ℝ → ℝ h : ∀ (a : ℝ), ∃ x, f x > a
¬∃ a, ∀ (x : ℝ), f x ≤ a
-- intro hh
-- obtain ⟨a, ha⟩ := hh
rintro ⟨a, ha⟩ : ∃ a, ∀ (x : ℝ), f x ≤ a
⟨a ⟨a, ha⟩ : ∃ a, ∀ (x : ℝ), f x ≤ a
, ha ⟨a, ha⟩ : ∃ a, ∀ (x : ℝ), f x ≤ a
⟩f : ℝ → ℝ h : ∀ (a : ℝ), ∃ x, f x > aa : ℝ ha : ∀ (x : ℝ), f x ≤ a
intro False
specialize h : ∀ (a : ℝ), ∃ x, f x > a
h a f : ℝ → ℝ a : ℝ ha : ∀ (x : ℝ), f x ≤ ah : ∃ x, f x > a
intro False
obtain ⟨ b , hb ⟩ := h f : ℝ → ℝ a : ℝ ha : ∀ (x : ℝ), f x ≤ ab : ℝ hb : f b > a
intro.intro False
specialize ha b f : ℝ → ℝ a, b : ℝ hb : f b > a ha : f b ≤ a
intro.intro False
rw [ f : ℝ → ℝ a, b : ℝ hb : f b > a ha : f b ≤ a
intro.intro False
<- not_lt : ∀ {α : Type ?u.6077} [inst : LinearOrder α] {a b : α}, ¬a < b ↔ b ≤ a
not_ltf : ℝ → ℝ a, b : ℝ hb : f b > a ha : ¬ a < f b
intro.intro False
] f : ℝ → ℝ a, b : ℝ hb : f b > a ha : ¬ a < f b
intro.intro False
at ha f : ℝ → ℝ a, b : ℝ hb : f b > a ha : ¬ a < f b
intro.intro False
contradiction
example : ∀ {f : ℝ → ℝ}, ¬fnHasUB f → ∀ (a : ℝ), ∃ x, f x > a
example ( h : ¬ fnHasUB f ) : ∀ a , ∃ x , f x > a := by
simp only [ fnHasUB , fnUB ] at * f : ℝ → ℝ h : ¬∃ a, ∀ (x : ℝ), f x ≤ a
∀ (a : ℝ), ∃ x, f x > a
contrapose! h : ∃ a, ∀ (x : ℝ), f x ≤ a
h f : ℝ → ℝ h : ∃ a, ∀ (x : ℝ), f x ≤ a
∃ a, ∀ (x : ℝ), f x ≤ a
obtain ⟨a, ha⟩ : ∃ a, ∀ (x : ℝ), f x ≤ a
⟨a ⟨a, ha⟩ : ∃ a, ∀ (x : ℝ), f x ≤ a
, ha ⟨a, ha⟩ : ∃ a, ∀ (x : ℝ), f x ≤ a
⟩ := h : ∃ a, ∀ (x : ℝ), f x ≤ a
h f : ℝ → ℝ a : ℝ ha : ∀ (x : ℝ), f x ≤ a
intro ∃ a, ∀ (x : ℝ), f x ≤ a
use a
-- this file seems to be following https://github.com/lftcm2023/lftcm2023/blob/master/LftCM/C02_Logic/Logic.lean