Skip to content

Commit 58e4d40

Browse files
committed
Examples for Set
1 parent ecf0b17 commit 58e4d40

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

Minimathlib/Set.lean

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ variable {α : Type u}
1010
-- This corresponds to the "axiom of specification".
1111
def Set (X : Type u) : Type u := X → Prop
1212

13+
example : Set Nat := fun n => n > 5
14+
15+
example : Set (Nat × Nat) := fun ⟨m, n⟩ => m + n = 10
16+
17+
example (α : Type u) : Set (List α) := fun xs => xs.length ≤ 3
18+
19+
example : Set (Set Nat) := fun s => ∃ n, s = fun k => k < n
20+
21+
example (P Q : Nat → Prop) : Set Nat := fun n => P n ∧ Q n
22+
1323
namespace Set
1424

1525
-- The empty set: no element satisfies the predicate
@@ -58,8 +68,6 @@ notation "⋂ " f => Set.iInter f
5868
notation "⋃[" i "] " f => Set.iUnion (fun i => f)
5969
notation "⋂[" i "] " f => Set.iInter (fun i => f)
6070

61-
#check Set.iUnion
62-
6371
-- Basic subset relation
6472
def subset (s t : Set X) : Prop := ∀ x, x ∈ s → x ∈ t
6573

0 commit comments

Comments
 (0)