An executable partial inverse operation on a coefficient ring.
- inv? : R → Option R
Return a multiplicative inverse when one is available.
Instances
Soundness and completeness of executable unit detection.
- inv?_eq (a u : R) : UnitOps.inv? a = some u → a * u = 1
A returned inverse is a right inverse.
Every element admitting a right inverse is detected.
Instances
Inverses of the natural numbers 1 through m in R.
- invNat : Nat → R
A total lookup whose values are constrained on
1, ..., m. The lookup inverts every required natural number.
Instances
Restrict a family of natural inverses to a smaller precision. This is a definition rather than an instance to avoid instance-search loops.
Equations
- Hex.TSeries.NatInverses.mono h = { invNat := Hex.TSeries.NatInverses.invNat m, invNat_eq := ⋯ }
Instances For
Any two lawful choices of the inverse of a required natural agree.
No natural inverses are required at bound zero.
Equations
- Hex.TSeries.instNatInversesOfNatNat = { invNat := fun (x : Nat) => 0, invNat_eq := ⋯ }
A subtraction from zero still requests no inverses. Keeping this
syntactic instance is necessary across module boundaries, where instance
matching need not unfold Nat.sub before comparing the index.
Equations
- Hex.TSeries.instNatInversesHSubNatOfNat k = { invNat := fun (x : Nat) => 0, invNat_eq := ⋯ }
A self-difference still requests no inverses. This makes the
precision-one spelling NatInverses R (1 - 1) resolve without relying on
kernel reduction of subtraction during typeclass search.
Equations
- Hex.TSeries.instNatInversesHSubNat k = { invNat := fun (x : Nat) => 0, invNat_eq := ⋯ }
The precision-two algorithm spelling requests NatInverses R (2 - 1).
Keep that syntactic form available across module boundaries rather than relying
on typeclass search to reduce the subtraction to one.
Equations
- Hex.TSeries.instNatInversesHSubNatOfNat_1 = { invNat := fun (x : Nat) => 1, invNat_eq := ⋯ }
At bound one, the only required inverse is 1.
Equations
- Hex.TSeries.instNatInversesOfNatNat_1 = { invNat := fun (x : Nat) => 1, invNat_eq := ⋯ }
Rational unit detection is sound and complete.
Integer unit detection is sound and complete.
Rational numbers contain inverses of every positive natural number.