Files
agdaproofs/Rings/Examples/Examples.agda
2019-08-22 08:37:41 +01:00

40 lines
1.8 KiB
Agda
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{-# OPTIONS --safe --warning=error #-}
open import LogicalFormulae
open import Groups.Groups
open import Functions
open import Numbers.Naturals.Naturals
open import Numbers.Integers.Integers
open import IntegersModN
open import Rings.Examples.Proofs
open import PrimeNumbers
module Rings.Examples.Examples where
nToZn : (n : ) (pr : 0 <N n) (x : ) n n pr
nToZn n pr x = nToZn' n pr x
mod : (n : ) (pr : 0 <N n) n n pr
mod n pr a = mod' n pr a
modNExampleSurjective : (n : ) (pr : 0 <N n) Surjection (mod n pr)
modNExampleSurjective n pr = modNExampleSurjective' n pr
{-
modNExampleGroupHom : (n : ) → (pr : 0 <N n) → GroupHom Group (nGroup n pr) (mod n pr)
modNExampleGroupHom n pr = modNExampleGroupHom' n pr
embedZnInZ : {n : } {pr : 0 <N n} → (a : n n pr) →
embedZnInZ record { x = x } = nonneg x
modNRoundTrip : (n : ) → (pr : 0 <N n) → (a : n n pr) → mod n pr (embedZnInZ a) ≡ a
modNRoundTrip zero ()
modNRoundTrip (succ n) pr record { x = x ; xLess = xLess } with divisionAlg (succ n) x
modNRoundTrip (succ n) _ record { x = x ; xLess = xLess } | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inl remIsSmall ; quotSmall = quotSmall } = equalityZn _ _ p
where
p : rem ≡ x
p = modIsUnique record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inl remIsSmall ; quotSmall = quotSmall } record { quot = 0 ; rem = x ; pr = identityOfIndiscernablesLeft _ _ _ _≡_ refl (applyEquality (λ i → i +N x) (multiplicationNIsCommutative 0 n)) ; remIsSmall = inl xLess ; quotSmall = inl (succIsPositive n) }
modNRoundTrip (succ n) _ record { x = x ; xLess = xLess } | record { quot = quot ; rem = rem ; pr = pr ; remIsSmall = inr () }
-}