The nontriviality needed to use 1 as a fraction denominator. Brown's
nonzero input hypothesis supplies this locally even though the lightweight
commutative-ring hierarchy itself permits the trivial ring.
Instances
Any nonzero element of a commutative ring witnesses its nontriviality.
Cross-multiplication is reflexive.
Cross-multiplication is symmetric.
Cross-multiplication is transitive; cancellation by the nonzero middle
denominator is where ExactDivLaws enters.
Fraction representatives form a setoid under cross multiplication.
Equations
- Hex.Fraction.Rep.instSetoid = { r := Hex.Fraction.Rep.Rel, iseqv := ⋯ }
Cross-multiplication equivalence is decidable when coefficient equality is.
Equations
Representative products respect cross-multiplication equivalence.
Representative sums respect cross-multiplication equivalence.
Representative negation respects cross-multiplication equivalence.
The quotient field of a commutative exact-division domain.
Equations
Instances For
Decidable equality inherited from cross multiplication of representatives.
Equations
- q₁.instDecidableEq q₂ = Quotient.recOnSubsingleton₂ q₁ q₂ fun (a b : Hex.Fraction.Rep R) => if h : a.Rel b then isTrue ⋯ else isFalse ⋯
Inject a representative into its quotient.
Equations
Instances For
Embed a coefficient as a fraction with denominator one.
Equations
- Hex.Fraction.ofCoeff a = Hex.Fraction.ofRep { num := a, den := 1, den_ne := ⋯ }
Instances For
Multiplication of fractions.
Equations
- Hex.Fraction.mul = Quotient.lift₂ (fun (a b : Hex.Fraction.Rep R) => Hex.Fraction.ofRep (a.mul b)) ⋯
Instances For
Addition of fractions.
Equations
- Hex.Fraction.add = Quotient.lift₂ (fun (a b : Hex.Fraction.Rep R) => Hex.Fraction.ofRep (a.add b)) ⋯
Instances For
Negation of fractions.
Equations
- Hex.Fraction.neg = Quotient.lift (fun (a : Hex.Fraction.Rep R) => Hex.Fraction.ofRep a.neg) ⋯
Instances For
Zero is the embedded coefficient zero.
Equations
- Hex.Fraction.instZero = { zero := Hex.Fraction.ofCoeff 0 }
One is the embedded coefficient one.
Equations
- Hex.Fraction.instOne = { one := Hex.Fraction.ofCoeff 1 }
Addition of fractions.
Equations
- Hex.Fraction.instAdd = { add := Hex.Fraction.add }
Multiplication of fractions.
Equations
- Hex.Fraction.instMul = { mul := Hex.Fraction.mul }
Negation of fractions.
Equations
- Hex.Fraction.instNeg = { neg := Hex.Fraction.neg }
Subtraction of fractions, defined as addition of the negation.
Equations
- Hex.Fraction.instSub = { sub := fun (a b : Hex.Fraction R) => a + -b }
Zero is a right additive identity.
Fraction addition is commutative.
Fraction addition is associative.
Fraction multiplication is associative.
One is a right multiplicative identity.
One is a left multiplicative identity.
Fraction multiplication distributes over addition on the left.
Fraction multiplication distributes over addition on the right.
Zero is a left multiplicative absorber.
Zero is a right multiplicative absorber.
Every fraction cancels with its negation.
Fraction negation is involutive.
Fraction multiplication is commutative.
Negation moves out of the left factor of a product.
The coefficient embedding preserves zero.
The coefficient embedding preserves one.
The coefficient embedding preserves addition.
The coefficient embedding preserves multiplication.
The coefficient embedding preserves negation.
The coefficient embedding preserves subtraction.
The coefficient embedding is injective.
Natural powers of fractions.
Instances For
Natural-number casts factor through the coefficient embedding.
Equations
- Hex.Fraction.instNatCast = { natCast := fun (n : Nat) => Hex.Fraction.ofCoeff ↑n }
Numerals factor through the coefficient embedding, reusing the canonical zero and one.
Equations
- Hex.Fraction.instOfNat 0 = { ofNat := Zero.zero }
- Hex.Fraction.instOfNat 1 = { ofNat := One.one }
- Hex.Fraction.instOfNat n_2.succ.succ = { ofNat := Hex.Fraction.ofCoeff (OfNat.ofNat (n_2 + 2)) }
Fraction numerals agree with embedded coefficient numerals.
Natural scalar multiplication is multiplication by the cast scalar.
Equations
- Hex.Fraction.instSMulNat = { smul := fun (n : Nat) (a : Hex.Fraction R) => ↑n * a }
Natural powers of fractions via natPow.
Equations
- Hex.Fraction.instHPowNat = { hPow := Hex.Fraction.natPow }
Integer casts factor through the coefficient embedding.
Equations
- Hex.Fraction.instIntCast = { intCast := fun (i : Int) => Hex.Fraction.ofCoeff ↑i }
Integer scalar multiplication is multiplication by the cast scalar.
Equations
- Hex.Fraction.instSMulInt = { smul := fun (i : Int) (a : Hex.Fraction R) => ↑i * a }
The quotient construction is a lightweight semiring.
Equations
- One or more equations did not get rendered due to their size.
The quotient construction is a lightweight ring.
Equations
- One or more equations did not get rendered due to their size.
The quotient construction is a lightweight commutative ring.
Equations
- Hex.Fraction.instCommRing = { toRing := Hex.Fraction.instRing, mul_comm := ⋯ }
Reciprocal of a fraction representative, with zero sent to zero.
Equations
- Hex.Fraction.invRep a = if h : a.num = 0 then 0 else Hex.Fraction.ofRep { num := a.den, den := a.num, den_ne := h }
Instances For
Multiplicative inverse in the fraction field.
Equations
Instances For
Total inversion of fractions, with zero sent to zero.
Equations
- Hex.Fraction.instInv = { inv := Hex.Fraction.inv }
Division of fractions is multiplication by the total inverse.
Equations
- Hex.Fraction.instDiv = { div := fun (a b : Hex.Fraction R) => a * b⁻¹ }
Products of embedded representatives multiply representatives.
Multiplying a represented fraction by its embedded denominator recovers its embedded numerator.
Inverting an embedded representative applies invRep.
A representative is zero exactly when its numerator is zero.
The coefficient embedding reflects zero.
Fraction inversion uses the stable zero branch.
Every nonzero fraction has the expected multiplicative inverse.
Zero and one are distinct in the fraction field.
Inversion is involutive.
The inverse of one is one.
Integer powers of fractions use natural powers and total inversion.
Instances For
Integer powers of fractions via intPow.
Equations
- Hex.Fraction.instHPowInt = { hPow := Hex.Fraction.intPow }
Division is multiplication by the fraction inverse.
A nonzero denominator cancels on the right of fraction division.
Fraction division satisfies the exact-division law.
The quotient construction is a field in the lightweight Grind hierarchy.
Equations
- One or more equations did not get rendered due to their size.
The coefficient embedding preserves natural powers.
Pull an exact scalar quotient back through the coefficient embedding.
The hypothesis that the fraction quotient lies in the image is the integrality fact supplied by generalized subresultants.
An integral fraction quotient reconstructs its numerator in the original coefficient ring.
The total exact-division wrapper reconstructs a nonzero-denominator numerator whenever its fraction quotient is integral.
A Brown scalar quotient in the embedding image satisfies the exact scale
recurrence used by BrownLaw.