Lots of speedups (#116)

This commit is contained in:
Patrick Stevens
2020-04-16 13:41:51 +01:00
committed by GitHub
parent 1bcb3f8537
commit 9b80058157
63 changed files with 1082 additions and 564 deletions

View File

@@ -8,6 +8,9 @@ module Numbers.Integers.Definition where
data : Set where
nonneg :
negSucc :
{-# BUILTIN INTEGER #-}
{-# BUILTIN INTEGERPOS nonneg #-}
{-# BUILTIN INTEGERNEGSUC negSucc #-}
nonnegInjective : {a b : } nonneg a nonneg b a b
nonnegInjective refl = refl

View File

@@ -7,9 +7,9 @@ open import Numbers.Integers.RingStructure.Ring
open import Semirings.Definition
open import Rings.Orders.Partial.Definition
open import Rings.Orders.Total.Definition
open import Setoids.Orders
open import Orders.Total.Definition
open import Orders.Partial.Definition
open import Setoids.Orders.Total.Definition
module Numbers.Integers.Order where

View File

@@ -0,0 +1,30 @@
{-# OPTIONS --safe --warning=error --without-K #-}
open import Semirings.Definition
open import LogicalFormulae
open import Numbers.Naturals.Semiring
open import Numbers.Naturals.Order
open import Numbers.Integers.RingStructure.Ring
open import Groups.Orders.Archimedean
open import Rings.Orders.Partial.Definition
open import Numbers.Integers.Order
module Numbers.Integers.RingStructure.Archimedean where
open import Groups.Cyclic.Definition Group
open import Semirings.Solver Semiring multiplicationNIsCommutative
private
lemma : (x y : ) positiveEltPower (nonneg x) y nonneg (x *N y)
lemma x zero rewrite Semiring.productZeroRight Semiring x = refl
lemma x (succ y) rewrite lemma x y | multiplicationNIsCommutative x (succ y) | multiplicationNIsCommutative y x = equalityCommutative (+Zinherits x (x *N y))
Archimedean : Archimedean (toGroup Ring POrderedRing)
Archimedean (nonneg (succ a)) (nonneg (succ b)) 0<a 0<b = succ (succ b) , t
where
v : b +N (a +N (a +N a *N b)) a +N (a +N (b +N a *N b))
v rewrite Semiring.+Associative Semiring a a (a *N b) | Semiring.+Associative Semiring b (a +N a) (a *N b) | Semiring.+Associative Semiring a b (a *N b) | Semiring.+Associative Semiring a (a +N b) (a *N b) | Semiring.commutative Semiring b (a +N a) | Semiring.+Associative Semiring a a b = refl
u : succ ((a +N (a +N a *N b)) +N b) a +N succ (a +N (b +N a *N b))
u = from (succ (plus (plus (const a) (plus (const a) (times (const a) (const b)))) (const b))) to (plus (const a) (succ (plus (const a) (plus (const b) (times (const a) (const b)))))) by applyEquality succ v
t : nonneg (succ b) <Z nonneg (succ a) +Z (nonneg (succ a) +Z positiveEltPower (nonneg (succ a)) b)
t rewrite lemma (succ a) b = lessInherits (succPreservesInequality (le (a +N (a +N a *N b)) u))