Skip to content

Commit fc6ef31

Browse files
committed
perf: fast_instance% in Mathlib.Order.Basic (leanprover-community#39795)
This PR adds some `fast_instance%` to tidy up some instance terms. We get a speedup in `Mathlib.Topology.Algebra.Valued.WithVal`.
1 parent 526b330 commit fc6ef31

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Mathlib/Order/Basic.lean

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public import Mathlib.Tactic.Convert
1313
public import Mathlib.Tactic.Inhabit
1414
public import Mathlib.Tactic.SimpRw
1515
public import Mathlib.Tactic.GCongr.Core
16+
public import Mathlib.Tactic.FastInstance
1617

1718
/-!
1819
# Basic definitions about `≤` and `<`
@@ -834,10 +835,10 @@ theorem coe_lt_coe [LT α] {p : α → Prop} {x y : Subtype p} : (x : α) < y
834835
Iff.rfl
835836

836837
instance preorder [Preorder α] (p : α → Prop) : Preorder (Subtype p) :=
837-
Preorder.lift (fun (a : Subtype p) ↦ (a : α))
838+
fast_instance% Preorder.lift (fun (a : Subtype p) ↦ (a : α))
838839

839840
instance partialOrder [PartialOrder α] (p : α → Prop) : PartialOrder (Subtype p) :=
840-
PartialOrder.lift (fun (a : Subtype p) ↦ (a : α)) Subtype.coe_injective
841+
fast_instance% PartialOrder.lift (fun (a : Subtype p) ↦ (a : α)) Subtype.coe_injective
841842

842843
instance decidableLE [Preorder α] [h : DecidableLE α] {p : α → Prop} :
843844
DecidableLE (Subtype p) := fun a b ↦ h a b
@@ -849,7 +850,7 @@ instance decidableLT [Preorder α] [h : DecidableLT α] {p : α → Prop} :
849850
equality and decidable order in order to ensure the decidability instances are all definitionally
850851
equal. -/
851852
instance instLinearOrder [LinearOrder α] (p : α → Prop) : LinearOrder (Subtype p) :=
852-
@LinearOrder.lift (Subtype p) _ _ ⟨fun x y ↦ ⟨max x y, max_rec' _ x.2 y.2⟩⟩
853+
fast_instance% @LinearOrder.lift (Subtype p) _ _ ⟨fun x y ↦ ⟨max x y, max_rec' _ x.2 y.2⟩⟩
853854
fun x y ↦ ⟨min x y, min_rec' _ x.2 y.2⟩⟩ (fun (a : Subtype p) ↦ (a : α))
854855
Subtype.coe_injective (fun _ _ ↦ rfl) fun _ _ ↦
855856
rfl

0 commit comments

Comments
 (0)