Skip to content

Commit e4a30b5

Browse files
authored
Merge branch 'master' into info-theory/entropy
2 parents 14a398f + a786f33 commit e4a30b5

3 files changed

Lines changed: 49 additions & 21 deletions

File tree

Mathlib/Order/Notation.lean

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,27 +113,33 @@ private meta def hasLinearOrder (u : Level) (α : Q(Type u)) (cls : Q(Type u →
113113

114114
/-- Delaborate `max x y` into `x ⊔ y` if the type is not a linear order. -/
115115
@[delab app.Max.max]
116-
meta def delabSup : Delab := whenNotPPOption getPPExplicit <| whenPPOption getPPNotation do
117-
let_expr f@Max.max α inst _ _ := ← getExpr | failure
118-
have u := f.constLevels![0]!
119-
if ← hasLinearOrder u α q(Max) q($(linearOrderToMax u)) inst then
120-
failure -- use the default delaborator
121-
let x ← withNaryArg 2 delab
122-
let y ← withNaryArg 3 delab
123-
let stx ← `($x ⊔ $y)
124-
annotateGoToSyntaxDef stx
116+
meta def delabSup : Delab :=
117+
whenNotPPOption getPPExplicit <|
118+
whenPPOption getPPNotation <|
119+
withOverApp 4 do
120+
let_expr f@Max.max α inst _ _ := ← getExpr | failure
121+
have u := f.constLevels![0]!
122+
if ← hasLinearOrder u α q(Max) q($(linearOrderToMax u)) inst then
123+
failure -- use the default delaborator
124+
let x ← withNaryArg 2 delab
125+
let y ← withNaryArg 3 delab
126+
let stx ← `($x ⊔ $y)
127+
annotateGoToSyntaxDef stx
125128

126129
/-- Delaborate `min x y` into `x ⊓ y` if the type is not a linear order. -/
127130
@[delab app.Min.min]
128-
meta def delabInf : Delab := whenNotPPOption getPPExplicit <| whenPPOption getPPNotation do
129-
let_expr f@Min.min α inst _ _ := ← getExpr | failure
130-
have u := f.constLevels![0]!
131-
if ← hasLinearOrder u α q(Min) q($(linearOrderToMin u)) inst then
132-
failure -- use the default delaborator
133-
let x ← withNaryArg 2 delab
134-
let y ← withNaryArg 3 delab
135-
let stx ← `($x ⊓ $y)
136-
annotateGoToSyntaxDef stx
131+
meta def delabInf : Delab :=
132+
whenNotPPOption getPPExplicit <|
133+
whenPPOption getPPNotation <|
134+
withOverApp 4 do
135+
let_expr f@Min.min α inst _ _ := ← getExpr | failure
136+
have u := f.constLevels![0]!
137+
if ← hasLinearOrder u α q(Min) q($(linearOrderToMin u)) inst then
138+
failure -- use the default delaborator
139+
let x ← withNaryArg 2 delab
140+
let y ← withNaryArg 3 delab
141+
let stx ← `($x ⊓ $y)
142+
annotateGoToSyntaxDef stx
137143

138144
end Mathlib.Meta
139145

MathlibTest/Delab/SupInf.lean

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Mathlib
2-
1+
module
2+
import Mathlib.Data.Real.Archimedean
33

44
/-- info: max 1 2 : ℕ -/
55
#guard_msgs in
@@ -82,3 +82,25 @@ set_option pp.explicit true in
8282
#check min (max a b) c
8383

8484
end
85+
86+
section Apply
87+
88+
variable {ι α : Type*} [Lattice α] (f g : ι → α) (i : ι)
89+
90+
/-- info: (f ⊔ g) i : α -/
91+
#guard_msgs in
92+
#check (f ⊔ g) i
93+
94+
/-- info: (f ⊔ g) i : α -/
95+
#guard_msgs in
96+
#check max f g i
97+
98+
/-- info: (f ⊓ g) i : α -/
99+
#guard_msgs in
100+
#check (f ⊓ g) i
101+
102+
/-- info: (f ⊓ g) i : α -/
103+
#guard_msgs in
104+
#check min f g i
105+
106+
end Apply

lake-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"type": "git",
6666
"subDir": null,
6767
"scope": "leanprover-community",
68-
"rev": "1f22a4f44c1726b61fab3c2c75e0651f35c795dc",
68+
"rev": "f0440aecee888582922e892d573b8726c09a1f6f",
6969
"name": "batteries",
7070
"manifestFile": "lake-manifest.json",
7171
"inputRev": "main",

0 commit comments

Comments
 (0)