Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: restoring Option simp confluence #5307

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion src/Init/Data/Option/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Option

theorem mem_iff {a : α} {b : Option α} : a ∈ b ↔ b = some a := .rfl

@[simp] theorem mem_some {a b : α} : a ∈ some b ↔ a = b := by simp [mem_iff, eq_comm]
@[simp] theorem mem_some {a b : α} : a ∈ some b ↔ b = a := by simp [mem_iff]

theorem mem_some_self (a : α) : a ∈ some a := mem_some.2 rfl

Expand Down Expand Up @@ -432,6 +432,38 @@ section ite
(x ∈ if p then l else none) ↔ p ∧ x ∈ l := by
split <;> simp_all

@[simp] theorem dite_none_left_eq_some {p : Prop} [Decidable p] {b : ¬p → Option β} :
(if h : p then none else b h) = some a ↔ ∃ h, b h = some a := by
split <;> simp_all

@[simp] theorem dite_none_right_eq_some {p : Prop} [Decidable p] {b : p → Option α} :
(if h : p then b h else none) = some a ↔ ∃ h, b h = some a := by
split <;> simp_all

@[simp] theorem some_eq_dite_none_left {p : Prop} [Decidable p] {b : ¬p → Option β} :
some a = (if h : p then none else b h) ↔ ∃ h, some a = b h := by
split <;> simp_all

@[simp] theorem some_eq_dite_none_right {p : Prop} [Decidable p] {b : p → Option α} :
some a = (if h : p then b h else none) ↔ ∃ h, some a = b h := by
split <;> simp_all

@[simp] theorem ite_none_left_eq_some {p : Prop} [Decidable p] {b : Option β} :
(if p then none else b) = some a ↔ ¬ p ∧ b = some a := by
split <;> simp_all

@[simp] theorem ite_none_right_eq_some {p : Prop} [Decidable p] {b : Option α} :
(if p then b else none) = some a ↔ p ∧ b = some a := by
split <;> simp_all

@[simp] theorem some_eq_ite_none_left {p : Prop} [Decidable p] {b : Option β} :
some a = (if p then none else b) ↔ ¬ p ∧ some a = b := by
split <;> simp_all

@[simp] theorem some_eq_ite_none_right {p : Prop} [Decidable p] {b : Option α} :
some a = (if p then b else none) ↔ p ∧ some a = b := by
split <;> simp_all

@[simp] theorem isSome_dite {p : Prop} [Decidable p] {b : p → β} :
(if h : p then some (b h) else none).isSome = true ↔ p := by
split <;> simpa
Expand Down
Loading