-- 两横线后面是注释-- 计算#eval 12+12 -- 计算,结果是24
-- 类型检查
def f (x :ℕ) :=  x + 3
#check f -- 类型检查,结果是ℕ→ℕ
#check 2 + 2 = 4 -- 类型检查,结果是Prop,即命题
def FermatLastTheorem :=  ∀ x y z n : ℕ, n > 2 ∧ x * y * z ≠ 0 → x ^ n + y ^ n ≠ z ^ n
#check FermatLastTheorem --类型检查,结果是Prop,即命题
theorem easy : 2 + 2 = 4 :=  rfl
#check easy -- 类型检查,结果是2+2=4,即命题2+2=4的证明
theorem hard : FermatLastTheorem :=  sorry -- sorry表示暂时跳过证明
#check hard -- 类型检查,结果是FermatLastTheorem,即命题FermatLastTheorem的证明
-- 定理证明
import Mathlib.Data.Real.Basic-- An example.
example (a b c : ℝ) : a * b * c = b * (a * c) := by
  rw [mul_comm a b]  -- 用乘法交换律,把a * b改写为b*a
  rw [mul_assoc b a c] -- 用乘法结合律,把(b * a) * c改写为b * (a * c)
-- rw即“重写”,是一种证明策略,把一个表达式替换为相等的表达式