chore: upstream Inv notation typeclass (#8345)

This commit is contained in:
Kim Morrison 2025-05-15 11:56:23 +08:00 committed by GitHub
parent 06ef738aec
commit 83001213e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 11 additions and 34 deletions

View file

@ -294,6 +294,7 @@ recommended_spelling "PProd" for "×'" in [PProd, «term_×'_»]
@[inherit_doc] infixl:65 " ++ " => HAppend.hAppend
@[inherit_doc] prefix:75 "-" => Neg.neg
@[inherit_doc] prefix:100 "~~~" => Complement.complement
@[inherit_doc] postfix:max "⁻¹" => Inv.inv
/-!
Remark: the infix commands above ensure a delaborator is generated for each relations.
@ -311,6 +312,7 @@ macro_rules | `($x % $y) => `(binop% HMod.hMod $x $y)
macro_rules | `($x ^ $y) => `(rightact% HPow.hPow $x $y)
macro_rules | `($x ++ $y) => `(binop% HAppend.hAppend $x $y)
macro_rules | `(- $x) => `(unop% Neg.neg $x)
macro_rules | `($x ⁻¹) => `(unop% Inv.inv $x)
recommended_spelling "or" for "|||" in [HOr.hOr, «term_|||_»]
recommended_spelling "xor" for "^^^" in [HXor.hXor, «term_^^^_»]

View file

@ -1451,6 +1451,15 @@ class Div (α : Type u) where
/-- `a / b` computes the result of dividing `a` by `b`. See `HDiv`. -/
div : ααα
/--
The notation typeclass for inverses.
This enables the notation `a⁻¹ : α` where `a : α`.
-/
class Inv (α : Type u) where
/-- `a⁻¹` computes the inverse of `a`.
The meaning of this notation is type-dependent. -/
inv : αα
/-- The homogeneous version of `HMod`: `a % b : α` where `a b : α`. -/
class Mod (α : Type u) where
/-- `a % b` computes the remainder upon dividing `a` by `b`. See `HMod`. -/

View file

@ -14,11 +14,6 @@ set_option pp.all true
#check CommMonoid.mk
#print CommMonoid.toCommSemigroup
class Inv (α : Type u) where
inv : αα
postfix:100 "⁻¹" => Inv.inv
class Group (α : Type u) extends Monoid α, Inv α where
mul_left_inv (a : α) : a⁻¹ * a = 1

View file

@ -766,11 +766,6 @@ instance instHSMul {α β} [SMul α β] : HSMul α β β where
variable {G : Type _}
class Inv (α : Type u) where
inv : αα
postfix:max "⁻¹" => Inv.inv
class Semigroup (G : Type u) extends Mul G where
protected mul_assoc : ∀ a b c : G, a * b * c = a * (b * c)

View file

@ -9,11 +9,6 @@ class Add (α : Type u) where
add : ααα
-/
class Inv (α : Type u) where
inv : αα
postfix:max "⁻¹" => Inv.inv
export One (one)
export Zero (zero)

View file

@ -9,11 +9,6 @@ class Add (α : Type u) where
add : ααα
-/
class Inv (α : Type u) where
inv : αα
postfix:max "⁻¹" => Inv.inv
export Zero (zero)
instance [Zero α] : OfNat α (nat_lit 0) where

View file

@ -29,11 +29,6 @@ instance [CommMonoid α] : CommSemigroup α where
instance [CommMonoid α] : MulComm α where
mul_comm := CommSemigroup.mul_comm
class Inv (α : Type u) where
inv : αα
postfix:max "⁻¹" => Inv.inv
class Group (α : Type u) extends Monoid α, Inv α where
mul_left_inv (a : α) : a⁻¹ * a = 1

View file

@ -640,9 +640,6 @@ end
section
class Inv (α) where inv : αα
postfix:max "⁻¹" => Inv.inv
class Group (α) extends Mul α, One α, Inv α where
mul_assoc (a b c : α) : (a * b) * c = a * (b * c)
one_mul (a : α) : 1 * a = a

View file

@ -44,7 +44,6 @@ end Std.Classes.RatCast
section Mathlib.Algebra.Group.Defs
class Inv (α : Type u) where
class Semigroup (G : Type u) extends Mul G where
class AddSemigroup (G : Type u) extends Add G where
class CommSemigroup (G : Type u) extends Semigroup G where

View file

@ -112,11 +112,6 @@ infixr:73 " • " => HSMul.hSMul
instance instHSMul [SMul α β] : HSMul α β β where
hSMul := SMul.smul
class Inv (α : Type u) where
inv : αα
postfix:max "⁻¹" => Inv.inv
class Semigroup (G : Type u) extends Mul G where
mul_assoc : ∀ a b c : G, a * b * c = a * (b * c)