forked from leanprover-community/mathlib4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasic.lean
More file actions
135 lines (97 loc) · 4.75 KB
/
Basic.lean
File metadata and controls
135 lines (97 loc) · 4.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/-
Copyright (c) 2021 Floris van Doorn. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Floris van Doorn
-/
module
public import Mathlib.Logic.Function.Basic
public import Mathlib.Logic.IsEmpty.Defs
public import Mathlib.Logic.Relator
/-!
In this file we prove some basic properties about the typeclass `IsEmpty`.
-/
public section
variable {α β γ : Sort*}
@[simp, push]
theorem not_nonempty_iff : ¬Nonempty α ↔ IsEmpty α :=
⟨fun h ↦ ⟨fun x ↦ h ⟨x⟩⟩, fun h1 h2 ↦ h2.elim h1.elim⟩
@[simp, push]
theorem not_isEmpty_iff : ¬IsEmpty α ↔ Nonempty α :=
not_iff_comm.mp not_nonempty_iff
@[simp]
theorem isEmpty_Prop {p : Prop} : IsEmpty p ↔ ¬p := by
simp only [← not_nonempty_iff, nonempty_prop]
@[simp]
theorem isEmpty_pi {π : α → Sort*} : IsEmpty (∀ a, π a) ↔ ∃ a, IsEmpty (π a) := by
simp only [← not_nonempty_iff, Classical.nonempty_pi, not_forall]
theorem isEmpty_fun : IsEmpty (α → β) ↔ Nonempty α ∧ IsEmpty β := by
rw [isEmpty_pi, ← exists_true_iff_nonempty, ← exists_and_right, true_and]
@[simp]
theorem nonempty_fun : Nonempty (α → β) ↔ IsEmpty α ∨ Nonempty β :=
not_iff_not.mp <| by rw [not_or, not_nonempty_iff, not_nonempty_iff, isEmpty_fun, not_isEmpty_iff]
@[simp]
theorem isEmpty_sigma {α} {E : α → Type*} : IsEmpty (Sigma E) ↔ ∀ a, IsEmpty (E a) := by
simp only [← not_nonempty_iff, nonempty_sigma, not_exists]
@[simp]
theorem isEmpty_psigma {α} {E : α → Sort*} : IsEmpty (PSigma E) ↔ ∀ a, IsEmpty (E a) := by
simp only [← not_nonempty_iff, nonempty_psigma, not_exists]
theorem isEmpty_subtype (p : α → Prop) : IsEmpty (Subtype p) ↔ ∀ x, ¬p x := by
simp only [← not_nonempty_iff, nonempty_subtype, not_exists]
@[simp]
theorem isEmpty_prod {α β : Type*} : IsEmpty (α × β) ↔ IsEmpty α ∨ IsEmpty β := by
simp only [← not_nonempty_iff, nonempty_prod, not_and_or]
@[simp]
theorem isEmpty_pprod : IsEmpty (PProd α β) ↔ IsEmpty α ∨ IsEmpty β := by
simp only [← not_nonempty_iff, nonempty_pprod, not_and_or]
@[simp]
theorem isEmpty_sum {α β} : IsEmpty (α ⊕ β) ↔ IsEmpty α ∧ IsEmpty β := by
simp only [← not_nonempty_iff, nonempty_sum, not_or]
@[simp]
theorem isEmpty_psum {α β} : IsEmpty (α ⊕' β) ↔ IsEmpty α ∧ IsEmpty β := by
simp only [← not_nonempty_iff, nonempty_psum, not_or]
@[simp]
theorem isEmpty_ulift {α} : IsEmpty (ULift α) ↔ IsEmpty α := by
simp only [← not_nonempty_iff, nonempty_ulift]
@[simp]
theorem isEmpty_plift {α} : IsEmpty (PLift α) ↔ IsEmpty α := by
simp only [← not_nonempty_iff, nonempty_plift]
theorem wellFounded_of_isEmpty {α} [IsEmpty α] (r : α → α → Prop) : WellFounded r :=
⟨isEmptyElim⟩
variable (α)
theorem isEmpty_or_nonempty : IsEmpty α ∨ Nonempty α :=
(em <| IsEmpty α).elim Or.inl <| Or.inr ∘ not_isEmpty_iff.mp
@[simp]
theorem not_isEmpty_of_nonempty [h : Nonempty α] : ¬IsEmpty α :=
not_isEmpty_iff.mpr h
variable {α}
theorem Function.extend_of_isEmpty [IsEmpty α] (f : α → β) (g : α → γ) (h : β → γ) :
Function.extend f g h = h :=
funext fun _ ↦ (Function.extend_apply' _ _ _) fun ⟨a, _⟩ ↦ isEmptyElim a
open Relator
variable {α β : Type*} (R : α → β → Prop)
@[simp]
theorem leftTotal_empty [IsEmpty α] : LeftTotal R := by
simp only [LeftTotal, IsEmpty.forall_iff]
theorem leftTotal_iff_isEmpty_left [IsEmpty β] : LeftTotal R ↔ IsEmpty α := by
simp only [LeftTotal, IsEmpty.exists_iff, isEmpty_iff]
@[simp]
theorem rightTotal_empty [IsEmpty β] : RightTotal R := by
simp only [RightTotal, IsEmpty.forall_iff]
theorem rightTotal_iff_isEmpty_right [IsEmpty α] : RightTotal R ↔ IsEmpty β := by
simp only [RightTotal, IsEmpty.exists_iff, isEmpty_iff]
@[simp]
theorem biTotal_empty [IsEmpty α] [IsEmpty β] : BiTotal R :=
⟨leftTotal_empty R, rightTotal_empty R⟩
theorem biTotal_iff_isEmpty_right [IsEmpty α] : BiTotal R ↔ IsEmpty β := by
simp only [BiTotal, leftTotal_empty, rightTotal_iff_isEmpty_right, true_and]
theorem biTotal_iff_isEmpty_left [IsEmpty β] : BiTotal R ↔ IsEmpty α := by
simp only [BiTotal, leftTotal_iff_isEmpty_left, rightTotal_empty, and_true]
theorem Function.Surjective.of_isEmpty [IsEmpty β] (f : α → β) : f.Surjective := IsEmpty.elim ‹_›
theorem Function.surjective_iff_isEmpty [IsEmpty α] (f : α → β) : f.Surjective ↔ IsEmpty β :=
⟨Surjective.isEmpty, fun _ ↦ .of_isEmpty f⟩
theorem Function.Bijective.of_isEmpty (f : α → β) [IsEmpty β] : f.Bijective :=
have := f.isEmpty
⟨injective_of_subsingleton f, .of_isEmpty f⟩
theorem Function.not_surjective_of_isEmpty_of_nonempty [IsEmpty α] [Nonempty β] (f : α → β) :
¬f.Surjective :=
(not_isEmpty_of_nonempty β ·.isEmpty)