new: Some more basic examples

This commit is contained in:
Sayantan Santra 2024-02-07 14:18:25 -06:00
parent 5e9f400cba
commit 522424f97f
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F

View file

@ -9,12 +9,37 @@ theorem sum_first_n {n : } : 2 * (range (n + 1)).sum id = n * (n + 1) := by
linarith linarith
open Set open Set
variable {α : Type _}
variable {s t u : Set α}
example : s s ∩ t = s := by example {α : Type _} {s t : Set α} : s s ∩ t = s := by
ext x; constructor ext x; constructor
rintro (xs | xsti) rintro (xs | xsti)
· trivial · trivial
· exact And.left xsti · exact And.left xsti
exact Or.inl exact Or.inl
-- Examples of definitions
def IsEven (n : ) : Bool := (n%2) = 0
def IsOdd (n : ) : Bool := ¬IsEven n
#eval IsEven 9
#eval IsOdd 9
example {n : } : IsOdd n = ((n%2) = 1) := by
apply iff_iff_eq.mp
constructor
-- <;>
· intro h
unfold IsOdd IsEven at h
simp at h
trivial
· intro h
unfold IsOdd IsEven
simp
trivial
theorem nat_odd_or_even {n : } : (IsEven n)(IsOdd n):= by
apply or_iff_not_imp_left.mpr
intro h
unfold IsOdd
simp at *
trivial