You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lean4game/server/adam/Adam/Levels/SetTheory/T04_xx.lean

97 lines
1.9 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import Adam.Metadata
import Mathlib
import Duper.Tactic
import Mathlib.Order.Disjoint
set_option tactic.hygienic false
Game "Adam"
World "SetTheory"
Level 4
Title "Mengen"
Introduction
"
`∈ ∉ ⊆ ⊂ ⋂`
"
open Set
-- open_locale cardinal
variables {X : Type _} (x : X) (A B : Set X)
#check A.Nonempty
#check Nonempty A
#check insert x A -- {x} A
-- #check disjoint A B -- needs Mathlib.Order.Disjoint
#check A ∆ B
#check Nontrivial A
#check ({2} : Set )
example : ({2} : Set ) ⊆ {4, 2, 3} := by
simp only [mem_singleton_iff, mem_insert_iff, or_self, singleton_subset_iff, or_false, or_true]
example : ({2, 3, 5} : Set ) ⊆ {4, 2, 5, 7, 3} := by
intro n hn
simp only [mem_insert_iff, mem_singleton_iff] at *
tauto
example : {2, 3, 5} ⊆ (univ : Set ) := by
tauto
example : 3 ∈ ({4, 2, 5, 7, 3} : Set ) := by
tauto
example : ({4, 9} : Set ) = Set.insert 4 {9} := by
rfl
#check Finset.card
variable (A : Finset )
#check A.card
-- card_union_eq
example (A B : Finset ) (h : Disjoint A B) : (A B).card = A.card + B.card := by
-- Not a suitable proof for the course.
rw [← Finset.disjUnion_eq_union A B h, Finset.card_disjUnion _ _ _]
example : ¬Disjoint {n : | ∃ k, n = 2 * k} {3, 5, 6, 9, 11} := by
rw [not_disjoint_iff]
use 6
constructor
rw [mem_setOf_eq]
use 3
tauto
example : {n : | Even n Odd n} = univ := by
rw [setOf_or]
#check Set.eq_of_mem_singleton
#check {n : | ∃ k, n = 2 * k}
#check {n : // ∃ k, n = 2 * k}
#check
variables (C : Set )
#check {n ∈ C | ∃ (k : ), n = 2 * k}
#check {n : | n ∈ C ∧ ∃ (k : ), n = 2 * k}
#check {x ∈ A | x = x}
#check {y | y ∈ A}
#check setOf_and
#check setOf_or
#check Disjoint C univ
example : {n ∈ C | ∃ (k : ), n = 2 * k} = {n : | n ∈ C ∧ ∃ (k : ), n = 2 * k} := by
rfl