Skip to content

Commit 4c2ba07

Browse files
committed
feat(Logic/Basic): forall_and_index (#27737)
1 parent c0a057e commit 4c2ba07

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

Mathlib/Logic/Basic.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,15 @@ protected theorem Decidable.forall_or_right {q} {p : α → Prop} [Decidable q]
641641
theorem forall_or_right {q} {p : α → Prop} : (∀ x, p x ∨ q) ↔ (∀ x, p x) ∨ q :=
642642
open scoped Classical in Decidable.forall_or_right
643643

644+
@[simp]
645+
theorem forall_and_index {p q : Prop} {r : p ∧ q → Prop} :
646+
(∀ h : p ∧ q, r h) ↔ ∀ (hp : p) (hq : q), r ⟨hp, hq⟩ :=
647+
fun h hp hq ↦ h ⟨hp, hq⟩, fun h h1 ↦ h h1.1 h1.2
648+
649+
theorem forall_and_index' {p q : Prop} {r : p → q → Prop} :
650+
(∀ (hp : p) (hq : q), r hp hq) ↔ ∀ h : p ∧ q, r h.1 h.2 :=
651+
(forall_and_index (r := fun h => r h.1 h.2)).symm
652+
644653
theorem Exists.fst {b : Prop} {p : b → Prop} : Exists p → b
645654
| ⟨h, _⟩ => h
646655

MathlibTest/LibraryRewrite.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Pattern a → b → c
1717
· p ∧ p → q
1818
and_imp
1919
20+
Pattern ∀ (hp : p) (hq : q), r hp hq
21+
· p ∧ p → q
22+
forall_and_index'
23+
2024
Pattern ∀ (x : α), p x → b
2125
· (∃ x, p) → q
2226
exists_imp

0 commit comments

Comments
 (0)