Skip to content

Commit

Permalink
feat(logic/basic): exists_or_eq_{left,right} (#7224)
Browse files Browse the repository at this point in the history
  • Loading branch information
pechersky committed Apr 20, 2021
1 parent bf22ab3 commit 39d23b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/data/list/sigma.lean
Expand Up @@ -224,7 +224,7 @@ theorem lookup_all_eq_nil {a : α} : ∀ {l : list (sigma β)},
| [] := by simp
| (⟨a', b⟩ :: l) := begin
by_cases h : a = a',
{ subst a', simp, exact ⟨_, or.inl rfl⟩ },
{ subst a', simp },
{ simp [h, lookup_all_eq_nil] },
end

Expand Down
12 changes: 12 additions & 0 deletions src/logic/basic.lean
Expand Up @@ -884,6 +884,18 @@ by simp only [or_imp_distrib, forall_and_distrib, forall_eq]
(∃ b, (∃ a, f a = b) ∧ p b) ↔ ∃ a, p (f a) :=
⟨λ ⟨b, ⟨a, ha⟩, hb⟩, ⟨a, ha.symm ▸ hb⟩, λ ⟨a, ha⟩, ⟨f a, ⟨a, rfl⟩, ha⟩⟩

@[simp] lemma exists_or_eq_left (y : α) (p : α → Prop) : ∃ (x : α), x = y ∨ p x :=
⟨y, or.inl rfl⟩

@[simp] lemma exists_or_eq_right (y : α) (p : α → Prop) : ∃ (x : α), p x ∨ x = y :=
⟨y, or.inr rfl⟩

@[simp] lemma exists_or_eq_left' (y : α) (p : α → Prop) : ∃ (x : α), y = x ∨ p x :=
⟨y, or.inl rfl⟩

@[simp] lemma exists_or_eq_right' (y : α) (p : α → Prop) : ∃ (x : α), p x ∨ y = x :=
⟨y, or.inr rfl⟩

@[simp] theorem forall_apply_eq_imp_iff {f : α → β} {p : β → Prop} :
(∀ a, ∀ b, f a = b → p b) ↔ (∀ a, p (f a)) :=
⟨λ h a, h a (f a) rfl, λ h a b hab, hab ▸ h a⟩
Expand Down

0 comments on commit 39d23b8

Please sign in to comment.