Skip to content

Commit 180240a

Browse files
authored
Revert "perf: inline decidable instances (#10934)"
This reverts commit 12750d2.
1 parent d427423 commit 180240a

File tree

5 files changed

+17
-94
lines changed

5 files changed

+17
-94
lines changed

src/Init/Core.lean

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,21 +1140,12 @@ variable {p q : Prop}
11401140
decidable_of_decidable_of_iff (p := p) (h ▸ Iff.rfl)
11411141
end
11421142

1143-
@[inline]
1144-
instance exists_prop_decidable {p} (P : p → Prop)
1145-
[Decidable p] [∀ h, Decidable (P h)] : Decidable (Exists P) :=
1146-
if h : p then
1147-
decidable_of_decidable_of_iff ⟨fun h2 => ⟨h, h2⟩, fun ⟨_, h2⟩ => h2⟩
1148-
else isFalse fun ⟨h', _⟩ => h h'
1149-
1150-
@[inline]
1151-
instance forall_prop_decidable {p} (P : p → Prop)
1152-
[Decidable p] [∀ h, Decidable (P h)] : Decidable (∀ h, P h) :=
1153-
if h : p then
1154-
decidable_of_decidable_of_iff ⟨fun h2 _ => h2, fun al => al h⟩
1155-
else isTrue fun h2 => absurd h2 h
1143+
@[macro_inline] instance {p q} [Decidable p] [Decidable q] : Decidable (p → q) :=
1144+
if hp : p then
1145+
if hq : q then isTrue (fun _ => hq)
1146+
else isFalse (fun h => absurd (h hp) hq)
1147+
else isTrue (fun h => absurd h hp)
11561148

1157-
@[inline]
11581149
instance {p q} [Decidable p] [Decidable q] : Decidable (p ↔ q) :=
11591150
if hp : p then
11601151
if hq : q then
@@ -1202,13 +1193,11 @@ theorem dif_eq_if (c : Prop) {h : Decidable c} {α : Sort u} (t : α) (e : α) :
12021193
| isTrue _ => rfl
12031194
| isFalse _ => rfl
12041195

1205-
@[macro_inline]
12061196
instance {c t e : Prop} [dC : Decidable c] [dT : Decidable t] [dE : Decidable e] : Decidable (if c then t else e) :=
12071197
match dC with
12081198
| isTrue _ => dT
12091199
| isFalse _ => dE
12101200

1211-
@[inline]
12121201
instance {c : Prop} {t : c → Prop} {e : ¬c → Prop} [dC : Decidable c] [dT : ∀ h, Decidable (t h)] [dE : ∀ h, Decidable (e h)] : Decidable (if h : c then t h else e h) :=
12131202
match dC with
12141203
| isTrue hc => dT hc

src/Init/Prelude.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,6 @@ until `c` is known.
10991099
| Or.inl h => hp h
11001100
| Or.inr h => hq h
11011101

1102-
@[inline]
11031102
instance [dp : Decidable p] : Decidable (Not p) :=
11041103
match dp with
11051104
| isTrue hp => isFalse (absurd hp)

src/Init/PropLemmas.lean

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,18 @@ theorem Decidable.by_contra [Decidable p] : (¬p → False) → p := of_not_not
447447
@[expose] protected def Or.by_cases' [Decidable q] {α : Sort u} (h : p ∨ q) (h₁ : p → α) (h₂ : q → α) : α :=
448448
if hq : q then h₂ hq else h₁ (h.resolve_right hq)
449449

450+
instance exists_prop_decidable {p} (P : p → Prop)
451+
[Decidable p] [∀ h, Decidable (P h)] : Decidable (∃ h, P h) :=
452+
if h : p then
453+
decidable_of_decidable_of_iff ⟨fun h2 => ⟨h, h2⟩, fun ⟨_, h2⟩ => h2⟩
454+
else isFalse fun ⟨h', _⟩ => h h'
455+
456+
instance forall_prop_decidable {p} (P : p → Prop)
457+
[Decidable p] [∀ h, Decidable (P h)] : Decidable (∀ h, P h) :=
458+
if h : p then
459+
decidable_of_decidable_of_iff ⟨fun h2 _ => h2, fun al => al h⟩
460+
else isTrue fun h2 => absurd h2 h
461+
450462
@[bool_to_prop] theorem decide_eq_true_iff {p : Prop} [Decidable p] : (decide p = true) ↔ p := by simp
451463

452464
@[simp, bool_to_prop] theorem decide_eq_decide {p q : Prop} {_ : Decidable p} {_ : Decidable q} :

tests/lean/run/10934.lean

Lines changed: 0 additions & 74 deletions
This file was deleted.

tests/lean/run/grind_cutsat_tests.lean

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ set_option trace.grind.lia.model true in
2828
example (a b c d e : Int) : test1 a b c d e := by
2929
(fail_if_success cutsat); sorry
3030

31-
-- TODO: this should not be necessary (compare to 20 before)
32-
set_option synthInstance.maxSize 400 in
33-
3431
/-- info: false -/
3532
#guard_msgs (info) in
3633
#eval test1 101 0 5335 0 0

0 commit comments

Comments
 (0)