Move things around, add more to fields (#16)

This commit is contained in:
Patrick Stevens
2019-01-10 22:36:55 +00:00
committed by GitHub
parent 02434c01f9
commit 9e22ba78f5
31 changed files with 288 additions and 102 deletions

39
Rings/RingExamples.agda Normal file
View File

@@ -0,0 +1,39 @@
{-# OPTIONS --safe --warning=error #-}
open import LogicalFormulae
open import Groups
open import Functions
open import Naturals
open import Integers
open import IntegersModN
open import RingExamplesProofs
open import PrimeNumbers
module RingExamples 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 () }
-}