@@ -428,33 +428,6 @@ attribute [bound] norm_nonneg
428
428
@[to_additive (attr := simp) abs_norm]
429
429
theorem abs_norm' (z : E) : |‖z‖| = ‖z‖ := abs_of_nonneg <| norm_nonneg' _
430
430
431
- namespace Mathlib.Meta.Positivity
432
-
433
- open Lean Meta Qq Function
434
-
435
- /-- Extension for the `positivity` tactic: multiplicative norms are nonnegative, via
436
- `norm_nonneg'`. -/
437
- @[positivity Norm.norm _]
438
- def evalMulNorm : PositivityExt where eval {u α} _zα _pα e := do
439
- match u, α, e with
440
- | 0 , ~q(ℝ), ~q(@Norm.norm $β $instDist $a) =>
441
- let _inst ← synthInstanceQ q(SeminormedGroup $β)
442
- assertInstancesCommute
443
- pure (.nonnegative q(norm_nonneg' $a))
444
- | _, _, _ => throwError "not ‖ · ‖"
445
-
446
- /-- Extension for the `positivity` tactic: additive norms are nonnegative, via `norm_nonneg`. -/
447
- @[positivity Norm.norm _]
448
- def evalAddNorm : PositivityExt where eval {u α} _zα _pα e := do
449
- match u, α, e with
450
- | 0 , ~q(ℝ), ~q(@Norm.norm $β $instDist $a) =>
451
- let _inst ← synthInstanceQ q(SeminormedAddGroup $β)
452
- assertInstancesCommute
453
- pure (.nonnegative q(norm_nonneg $a))
454
- | _, _, _ => throwError "not ‖ · ‖"
455
-
456
- end Mathlib.Meta.Positivity
457
-
458
431
@[to_additive (attr := simp) norm_zero]
459
432
theorem norm_one' : ‖(1 : E)‖ = 0 := by rw [← dist_one_right, dist_self]
460
433
@@ -1436,6 +1409,58 @@ alias ⟨_, HasCompactSupport.norm⟩ := hasCompactSupport_norm_iff
1436
1409
1437
1410
end NormedAddGroup
1438
1411
1412
+ /-! ### `positivity` extensions -/
1413
+
1414
+ namespace Mathlib.Meta.Positivity
1415
+
1416
+ open Lean Meta Qq Function
1417
+
1418
+ /-- Extension for the `positivity` tactic: multiplicative norms are always nonnegative, and positive
1419
+ on non-one inputs. -/
1420
+ @[positivity ‖_‖]
1421
+ def evalMulNorm : PositivityExt where eval {u α} _ _ e := do
1422
+ match u, α, e with
1423
+ | 0 , ~q(ℝ), ~q(@Norm.norm $E $_n $a) =>
1424
+ let _seminormedGroup_E ← synthInstanceQ q(SeminormedGroup $E)
1425
+ assertInstancesCommute
1426
+ -- Check whether we are in a normed group and whether the context contains a `a ≠ 1` assumption
1427
+ let o : Option (Q(NormedGroup $E) × Q($a ≠ 1 )) := ← do
1428
+ let .some normedGroup_E ← trySynthInstanceQ q(NormedGroup $E) | return none
1429
+ let some pa ← findLocalDeclWithTypeQ? q($a ≠ 1 ) | return none
1430
+ return some (normedGroup_E, pa)
1431
+ match o with
1432
+ -- If so, return a proof of `0 < ‖a‖`
1433
+ | some (_normedGroup_E, pa) =>
1434
+ assertInstancesCommute
1435
+ return .positive q(norm_pos_iff'.2 $pa)
1436
+ -- Else, return a proof of `0 ≤ ‖a‖`
1437
+ | none => return .nonnegative q(norm_nonneg' $a)
1438
+ | _, _, _ => throwError "not `‖·‖`"
1439
+
1440
+ /-- Extension for the `positivity` tactic: additive norms are always nonnegative, and positive
1441
+ on non-zero inputs. -/
1442
+ @[positivity ‖_‖]
1443
+ def evalAddNorm : PositivityExt where eval {u α} _ _ e := do
1444
+ match u, α, e with
1445
+ | 0 , ~q(ℝ), ~q(@Norm.norm $E $_n $a) =>
1446
+ let _seminormedAddGroup_E ← synthInstanceQ q(SeminormedAddGroup $E)
1447
+ assertInstancesCommute
1448
+ -- Check whether we are in a normed group and whether the context contains a `a ≠ 0` assumption
1449
+ let o : Option (Q(NormedAddGroup $E) × Q($a ≠ 0 )) := ← do
1450
+ let .some normedAddGroup_E ← trySynthInstanceQ q(NormedAddGroup $E) | return none
1451
+ let some pa ← findLocalDeclWithTypeQ? q($a ≠ 0 ) | return none
1452
+ return some (normedAddGroup_E, pa)
1453
+ match o with
1454
+ -- If so, return a proof of `0 < ‖a‖`
1455
+ | some (_normedAddGroup_E, pa) =>
1456
+ assertInstancesCommute
1457
+ return .positive q(norm_pos_iff.2 $pa)
1458
+ -- Else, return a proof of `0 ≤ ‖a‖`
1459
+ | none => return .nonnegative q(norm_nonneg $a)
1460
+ | _, _, _ => throwError "not `‖·‖`"
1461
+
1462
+ end Mathlib.Meta.Positivity
1463
+
1439
1464
/-! ### Subgroups of normed groups -/
1440
1465
1441
1466
0 commit comments