Skip to content

Commit 2193fd8

Browse files
committed
feat: positivity extension for Simplex.height (#25029)
1 parent d86ef35 commit 2193fd8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Mathlib/Geometry/Euclidean/Altitude.lean

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,19 @@ def height {n : ℕ} [NeZero n] (s : Simplex ℝ P n) (i : Fin (n + 1)) : ℝ :=
171171
lemma height_pos {n : ℕ} [NeZero n] (s : Simplex ℝ P n) (i : Fin (n + 1)) : 0 < s.height i := by
172172
simp [height]
173173

174+
open Qq Mathlib.Meta.Positivity in
175+
/-- Extension for the `positivity` tactic: the height of a simplex is always positive. -/
176+
@[positivity height _ _]
177+
def evalHeight : PositivityExt where eval {u α} _ _ e := do
178+
match u, α, e with
179+
| 0, ~q(ℝ), ~q(@height $V $P $i1 $i2 $i3 $i4 $n $hn $s $i) =>
180+
assertInstancesCommute
181+
return .positive q(height_pos $s $i)
182+
| _, _, _ => throwError "not Simplex.height"
183+
184+
example {n : ℕ} [NeZero n] (s : Simplex ℝ P n) (i : Fin (n + 1)) : 0 < s.height i := by
185+
positivity
186+
174187
end Simplex
175188

176189
end Affine

0 commit comments

Comments
 (0)