Skip to content

Commit

Permalink
feat(logic/basic): exists_eq simp lemmas without and.comm (#5694)
Browse files Browse the repository at this point in the history
  • Loading branch information
pechersky committed Jan 13, 2021
1 parent 6397e14 commit 71a3261
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/control/traversable/instances.lean
Expand Up @@ -111,7 +111,7 @@ lemma mem_traverse {f : α' → set β'} :
| [] (b::bs) := by simp
| (a::as) (b::bs) :=
suffices (b :: bs : list β') ∈ traverse f (a :: as) ↔ b ∈ f a ∧ bs ∈ traverse f as,
by simpa [mem_traverse as bs],
by simp [mem_traverse as bs],
iff.intro
(assume ⟨_, ⟨b, hb, rfl⟩, _, hl, rfl⟩, ⟨hb, hl⟩)
(assume ⟨hb, hl⟩, ⟨_, ⟨b, hb, rfl⟩, _, hl, rfl⟩)
Expand Down
6 changes: 0 additions & 6 deletions src/data/buffer/parser/basic.lean
Expand Up @@ -42,12 +42,6 @@ section lemmas

variables {α : Type*} {P Q : α → Prop} {Q' : Prop} {x : α}

@[simp] lemma exists_eq_right_right : (∃ (y : α), P y ∧ Q' ∧ y = x) ↔ P x ∧ Q' :=
⟨λ ⟨_, hp, hq, rfl⟩, ⟨hp, hq⟩, λ ⟨hp, hq⟩, ⟨x, hp, hq, rfl⟩⟩

@[simp] lemma exists_eq_right_right' : (∃ (y : α), P y ∧ Q' ∧ x = y) ↔ P x ∧ Q' :=
⟨λ ⟨_, hp, hq, rfl⟩, ⟨hp, hq⟩, λ ⟨hp, hq⟩, ⟨x, hp, hq, rfl⟩⟩

@[simp] lemma ne_iff_lt_iff_le {n m : ℕ} : (n ≠ m ↔ n < m) ↔ n ≤ m :=
begin
refine ⟨λ h, _, λ h, _⟩,
Expand Down
2 changes: 1 addition & 1 deletion src/data/list/perm.lean
Expand Up @@ -860,7 +860,7 @@ begin
{ simp at h, simp [h] },
{ rw [sublists'_cons, reverse_append, zip_append, ← map_reverse,
zip_map_right, zip_map_left] at h; [simp at h, simp],
rcases h with ⟨l₁, l₂', h, rfl, rfl⟩ | ⟨l₁', l₂, h, rfl, rfl⟩,
rcases h with ⟨l₁, l₂', h, rfl, rfl⟩ | ⟨l₁', h, rfl⟩,
{ exact perm_middle.trans ((IH _ _ h).cons _) },
{ exact (IH _ _ h).cons _ } }
end
Expand Down
8 changes: 8 additions & 0 deletions src/logic/basic.lean
Expand Up @@ -797,6 +797,14 @@ by simp only [or_imp_distrib, forall_and_distrib, forall_eq]
@[simp] theorem exists_eq_right {a' : α} : (∃ a, p a ∧ a = a') ↔ p a' :=
(exists_congr $ by exact λ a, and.comm).trans exists_eq_left

@[simp] theorem exists_eq_right_right {a' : α} :
(∃ (a : α), p a ∧ b ∧ a = a') ↔ p a' ∧ b :=
⟨λ ⟨_, hp, hq, rfl⟩, ⟨hp, hq⟩, λ ⟨hp, hq⟩, ⟨a', hp, hq, rfl⟩⟩

@[simp] theorem exists_eq_right_right' {a' : α} :
(∃ (a : α), p a ∧ b ∧ a' = a) ↔ p a' ∧ b :=
⟨λ ⟨_, hp, hq, rfl⟩, ⟨hp, hq⟩, λ ⟨hp, hq⟩, ⟨a', hp, hq, rfl⟩⟩

@[simp] theorem exists_apply_eq_apply {α β : Type*} (f : α → β) (a' : α) : ∃ a, f a = f a' :=
⟨a', rfl⟩

Expand Down

0 comments on commit 71a3261

Please sign in to comment.