Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit dc732a3

Browse files
committed
feat(logic/basic): When an If-Then-Else is not one of its arguments (#10800)
Conditions for `ite P a b ≠ a` and `ite P a b ≠ b`.
1 parent 7130d75 commit dc732a3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/logic/basic.lean

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ iff_true_intro $ λ_, trivial
248248
theorem imp_iff_right (ha : a) : (a → b) ↔ b :=
249249
⟨λf, f ha, imp_intro⟩
250250

251+
lemma imp_iff_not (hb : ¬ b) : a → b ↔ ¬ a := imp_congr_right $ λ _, iff_false_intro hb
252+
251253
theorem decidable.imp_iff_right_iff [decidable a] : ((a → b) ↔ b) ↔ (a ∨ b) :=
252254
⟨λ H, (decidable.em a).imp_right $ λ ha', H.1 $ λ ha, (ha' ha).elim,
253255
λ H, H.elim imp_iff_right $ λ hb, ⟨λ hab, hb, λ _ _, hb⟩⟩
@@ -1423,6 +1425,23 @@ lemma ite_eq_iff : ite P a b = c ↔ P ∧ a = c ∨ ¬ P ∧ b = c := by by_cas
14231425
@[simp] lemma ite_eq_left_iff : ite P a b = a ↔ (¬ P → b = a) := by by_cases P; simp *
14241426
@[simp] lemma ite_eq_right_iff : ite P a b = b ↔ (P → a = b) := by by_cases P; simp *
14251427

1428+
lemma ite_ne_left_iff : ite P a b ≠ a ↔ ¬ P ∧ a ≠ b :=
1429+
by rw [ne.def, ite_eq_left_iff, ne_comm, not_imp]
1430+
1431+
lemma ite_ne_right_iff : ite P a b ≠ b ↔ P ∧ a ≠ b := by rw [ne.def, ite_eq_right_iff, not_imp]
1432+
1433+
protected lemma ne.ite_eq_left_iff (h : a ≠ b) : ite P a b = a ↔ P :=
1434+
ite_eq_left_iff.trans $ not_imp_comm.trans $ imp_iff_right h.symm
1435+
1436+
protected lemma ne.ite_eq_right_iff (h : a ≠ b) : ite P a b = b ↔ ¬ P :=
1437+
ite_eq_right_iff.trans $ imp_iff_not h
1438+
1439+
protected lemma ne.ite_ne_left_iff (h : a ≠ b) : ite P a b ≠ a ↔ ¬ P :=
1440+
ite_ne_left_iff.trans $ and_iff_left h
1441+
1442+
protected lemma ne.ite_ne_right_iff (h : a ≠ b) : ite P a b ≠ b ↔ P :=
1443+
ite_ne_right_iff.trans $ and_iff_left h
1444+
14261445
variables (P Q) (a b)
14271446

14281447
lemma ite_eq_or_eq : ite P a b = a ∨ ite P a b = b :=

0 commit comments

Comments
 (0)