blob: 3915f07c851f9cbd83cf641ee8362f7dc70a5478 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
------------------------------------------------------------------------
-- Agda Helium
--
-- Algebraic properties of ordered division rings
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Helium.Algebra.Ordered.StrictTotal.Bundles
module Helium.Algebra.Ordered.StrictTotal.Properties.DivisionRing
{ℓ₁ ℓ₂ ℓ₃}
(divisionRing : DivisionRing ℓ₁ ℓ₂ ℓ₃)
where
open DivisionRing divisionRing
renaming
( trans to <-trans
; irrefl to <-irrefl
; asym to <-asym
; 0<a+0<b⇒0<ab to x>0∧y>0⇒x*y>0
)
open import Function using (_∘_)
open import Relation.Binary.Reasoning.StrictPartialOrder strictPartialOrder
open import Algebra.Properties.Ring Unordered.ring public
renaming (-0#≈0# to -0≈0)
open import Helium.Algebra.Properties.AlmostGroup *-almostGroup public
renaming
( x≉0⇒∙-cancelˡ to x≉0⇒*-cancelˡ
; x≉0⇒∙-cancelʳ to x≉0⇒*-cancelʳ
; ⁻¹-anti-homo-∙ to ⁻¹-anti-homo-*
; identityˡ-unique to *-identityˡ-unique
; identityʳ-unique to *-identityʳ-unique
; inverseˡ-unique to *-inverseˡ-unique
; inverseʳ-unique to *-inverseʳ-unique
)
open import Algebra.Properties.Semiring.Mult.TCOptimised Unordered.semiring public
open import Algebra.Properties.Semiring.Exp.TCOptimised Unordered.semiring public
open import Helium.Relation.Binary.Properties.StrictTotalOrder strictTotalOrder public
open import Helium.Algebra.Ordered.StrictTotal.Properties.Ring ring public
using
( +-mono-<; +-monoˡ-<; +-monoʳ-<
; +-mono-≤; +-monoˡ-≤; +-monoʳ-≤
; +-cancel-<; +-cancelˡ-<; +-cancelʳ-<
; +-cancel-≤; +-cancelˡ-≤; +-cancelʳ-≤
; x≥0∧y>0⇒x+y>0 ; x>0∧y≥0⇒x+y>0
; x≤0∧y<0⇒x+y<0 ; x<0∧y≤0⇒x+y<0
; x≥0∧y≥0⇒x+y≥0 ; x≤0∧y≤0⇒x+y≤0
; x≤0∧x+y>0⇒y>0 ; x≤0∧y+x>0⇒y>0 ; x<0∧x+y≥0⇒y>0 ; x<0∧y+x≥0⇒y>0
; x≥0∧x+y<0⇒y<0 ; x≥0∧y+x<0⇒y<0 ; x>0∧x+y≤0⇒y<0 ; x>0∧y+x≤0⇒y<0
; x≤0∧x+y≥0⇒y≥0 ; x≤0∧y+x≥0⇒y≥0
; x≥0∧x+y≤0⇒y≤0 ; x≥0∧y+x≤0⇒y≤0
; ×-zeroˡ; ×-zeroʳ
; ×-identityˡ
; n≢0⇒×-monoˡ-< ; x>0⇒×-monoʳ-< ; x<0⇒×-anti-monoʳ-<
; ×-monoˡ-≤; x≥0⇒×-monoʳ-≤; x≤0⇒×-anti-monoʳ-≤
; ×-cancelˡ-<; x≥0⇒×-cancelʳ-<; x≤0⇒×-anti-cancelʳ-<
; n≢0⇒×-cancelˡ-≤ ; x>0⇒×-cancelʳ-≤ ; x<0⇒×-anti-cancelʳ-≤
; n≢0∧x>0⇒n×x>0; n≢0∧x<0⇒n×x<0
; x≥0⇒n×x≥0; x≤0⇒n×x≤0
; n×x>0⇒x>0; n×x<0⇒x<0
; n≢0∧n×x≥0⇒x≥0; n≢0∧n×x≤0⇒x≤0
; -‿anti-mono-<; -‿anti-mono-≤
; -‿anti-cancel-<; -‿anti-cancel-≤
; x≈0⇒-x≈0 ; x<0⇒-x>0; x>0⇒-x<0; x≤0⇒-x≥0; x≥0⇒-x≤0
; -x≈0⇒x≈0 ; -x<0⇒x>0; -x>0⇒x<0; -x≤0⇒x≥0; -x≥0⇒x≤0
; x<y⇒0<y-x; 0<y-x⇒x<y
; x≤y⇒0≤y-x; 0≤y-x⇒x≤y
; x<y+z⇒x-z<y
; 0≤1; 1≈0⇒x≈y; x≉y⇒0<1; x<y⇒0<1
; x>0⇒*-monoˡ-<; x>0⇒*-monoʳ-<; x<0⇒*-anti-monoˡ-<; x<0⇒*-anti-monoʳ-<
; x≥0⇒*-monoˡ-≤; x≥0⇒*-monoʳ-≤; x≤0⇒*-anti-monoˡ-≤; x≤0⇒*-anti-monoʳ-≤
; x≥0⇒*-cancelˡ-<; x≥0⇒*-cancelʳ-<; x≤0⇒*-anti-cancelˡ-<; x≤0⇒*-anti-cancelʳ-<
; x>0⇒*-cancelˡ-≤; x>0⇒*-cancelʳ-≤; x<0⇒*-anti-cancelˡ-≤; x<0⇒*-anti-cancelʳ-≤
; x≈0⇒x*y≈0; x≈0⇒y*x≈0
; -x*-y≈x*y
; x>0∧y<0⇒x*y<0; x<0∧y>0⇒x*y<0; x<0∧y<0⇒x*y>0
; x≥0∧y≥0⇒x*y≥0; x≥0∧y≤0⇒x*y≤0; x≤0∧y≥0⇒x*y≤0; x≤0∧y≤0⇒x*y≥0
; x>1∧y≥1⇒x*y>1; x≥1∧y>1⇒x*y>1; 0≤x<1∧y≤1⇒x*y<1; x≤1∧0≤y<1⇒x*y<1
; x≥1∧y≥1⇒x*y≥1; 0≤x≤1∧y≤1⇒x*y≤1; x≤1∧0≤y≤1⇒x*y≤1
; x*x≥0; x*y≈0⇒x≈0⊎y≈0
; ^-zeroˡ; ^-zeroʳ
; ^-identityʳ
; n≢0⇒0^n≈0
; x>1⇒^-monoˡ-<; 0<x<1⇒^-anti-monoˡ-<
; x≥1⇒^-monoˡ-≤; 0≤x≤1⇒^-anti-monoˡ-≤
; x>0⇒x^n>0
; x≥0⇒x^n≥0
; x^n≈0⇒x≈0
; x>1∧n≢0⇒x^n>1; 0≤x<1∧n≢0⇒x^n<1
; x≥1⇒x^n≥1; 0≤x≤1⇒x^n≤1
)
--------------------------------------------------------------------------------
---- Properties of _⁻¹
---- Miscellaneous
x≉0⇒x⁻¹≉0 : ∀ {x} → (x≉0 : x ≉ 0#) → x≉0 ⁻¹ ≉ 0#
x≉0⇒x⁻¹≉0 {x} x≉0 x⁻¹≈0 = x≉0 (begin-equality
x ≈˘⟨ *-identityˡ x ⟩
1# * x ≈˘⟨ *-congʳ (⁻¹-inverseʳ x≉0) ⟩
x * x≉0 ⁻¹ * x ≈⟨ *-congʳ (*-congˡ x⁻¹≈0) ⟩
x * 0# * x ≈⟨ *-congʳ (zeroʳ x) ⟩
0# * x ≈⟨ zeroˡ x ⟩
0# ∎)
---- Preserves signs
x>0⇒x⁻¹>0 : ∀ {x} → (x>0 : x > 0#) → (<⇒≉ x>0 ∘ Eq.sym) ⁻¹ > 0#
x>0⇒x⁻¹>0 {x} x>0 = ≰⇒> (λ x⁻¹≤0 → <⇒≱ (x<y⇒0<1 x>0) (begin
1# ≈˘⟨ ⁻¹-inverseʳ (<⇒≉ x>0 ∘ Eq.sym) ⟩
x * (<⇒≉ x>0 ∘ Eq.sym) ⁻¹ ≤⟨ x≥0∧y≤0⇒x*y≤0 (<⇒≤ x>0) x⁻¹≤0 ⟩
0# ∎))
x<0⇒x⁻¹<0 : ∀ {x} → (x<0 : x < 0#) → (<⇒≉ x<0) ⁻¹ < 0#
x<0⇒x⁻¹<0 {x} x<0 = ≰⇒> (λ x⁻¹≥0 → <⇒≱ (x<y⇒0<1 x<0) (begin
1# ≈˘⟨ ⁻¹-inverseʳ (<⇒≉ x<0) ⟩
x * (<⇒≉ x<0) ⁻¹ ≤⟨ x≤0∧y≥0⇒x*y≤0 (<⇒≤ x<0) x⁻¹≥0 ⟩
0# ∎))
---- Respects signs
x⁻¹>0⇒x>0 : ∀ {x} {x≉0 : x ≉ 0#} → x≉0 ⁻¹ > 0# → x > 0#
x⁻¹>0⇒x>0 {x} {x≉0} x⁻¹>0 = begin-strict
0# <⟨ x>0⇒x⁻¹>0 x⁻¹>0 ⟩
(<⇒≉ x⁻¹>0 ∘ Eq.sym) ⁻¹ ≈⟨ ⁻¹-involutive x≉0 (<⇒≉ x⁻¹>0 ∘ Eq.sym) ⟩
x ∎
x⁻¹<0⇒x<0 : ∀ {x} {x≉0 : x ≉ 0#} → x≉0 ⁻¹ < 0# → x < 0#
x⁻¹<0⇒x<0 {x} {x≉0} x⁻¹<0 = begin-strict
x ≈˘⟨ ⁻¹-involutive x≉0 (<⇒≉ x⁻¹<0) ⟩
(<⇒≉ x⁻¹<0) ⁻¹ <⟨ x<0⇒x⁻¹<0 x⁻¹<0 ⟩
0# ∎
---- Preserves size
x>1⇒x⁻¹<1 : ∀ {x} → (x>1 : x > 1#) → (<⇒≉ (≤-<-trans 0≤1 x>1) ∘ Eq.sym) ⁻¹ < 1#
x>1⇒x⁻¹<1 {x} x>1 = ≰⇒>
( <-irrefl (Eq.sym (⁻¹-inverseʳ (<⇒≉ (≤-<-trans 0≤1 x>1) ∘ Eq.sym)))
∘ x>1∧y≥1⇒x*y>1 x>1
)
0<x<1⇒x⁻¹>1 : ∀ {x} (0<x : 0# < x) → x < 1# → (<⇒≉ 0<x ∘ Eq.sym) ⁻¹ > 1#
0<x<1⇒x⁻¹>1 {x} 0<x x<1 = ≰⇒>
( <-irrefl (⁻¹-inverseʳ (<⇒≉ 0<x ∘ Eq.sym))
∘ 0≤x<1∧y≤1⇒x*y<1 (<⇒≤ 0<x) x<1
)
---- Respects size
x⁻¹>1⇒x<1 : ∀ {x} {x≉0 : x ≉ 0#} → x≉0 ⁻¹ > 1# → x < 1#
x⁻¹>1⇒x<1 {x} {x≉0} x⁻¹>1 = ≰⇒>
( <-irrefl (Eq.sym (⁻¹-inverseˡ x≉0))
∘ x>1∧y≥1⇒x*y>1 x⁻¹>1
)
0<x⁻¹<1⇒x>1 : ∀ {x} {x≉0 : x ≉ 0#} → 0# < x≉0 ⁻¹ → x≉0 ⁻¹ < 1# → x > 1#
0<x⁻¹<1⇒x>1 {x} {x≉0} 0<x⁻¹ x⁻¹<1 = ≰⇒>
( <-irrefl (⁻¹-inverseˡ x≉0)
∘ 0≤x<1∧y≤1⇒x*y<1 (<⇒≤ 0<x⁻¹) x⁻¹<1
)
---- Miscellaneous
y>0∧x<y⇒x*y⁻¹<1 : ∀ {x y} (y>0 : y > 0#) → x < y → x * (<⇒≉ y>0 ∘ Eq.sym) ⁻¹ < 1#
y>0∧x<y⇒x*y⁻¹<1 {x} {y} y>0 x<y = x≥0⇒*-cancelʳ-< (<⇒≤ y>0) (begin-strict
x * y≉0 ⁻¹ * y ≈⟨ *-assoc x _ y ⟩
x * (y≉0 ⁻¹ * y) ≈⟨ *-congˡ (⁻¹-inverseˡ y≉0) ⟩
x * 1# ≈⟨ *-identityʳ x ⟩
x <⟨ x<y ⟩
y ≈˘⟨ *-identityˡ y ⟩
1# * y ∎)
where y≉0 = <⇒≉ y>0 ∘ Eq.sym
--------------------------------------------------------------------------------
---- Properties of -_ and _⁻¹
-‿⁻¹-comm : ∀ {x} (x≉0 : x ≉ 0#) → - x≉0 ⁻¹ ≈ (x≉0 ∘ -x≈0⇒x≈0) ⁻¹
-‿⁻¹-comm {x} x≉0 = *-inverseˡ-unique (x≉0 ∘ -x≈0⇒x≈0) (begin-equality
- x≉0 ⁻¹ * - x ≈⟨ -x*-y≈x*y (x≉0 ⁻¹) x ⟩
x≉0 ⁻¹ * x ≈⟨ ⁻¹-inverseˡ x≉0 ⟩
1# ∎)
-- ---- Congruences
-- -- _<_
-- ⁻¹-anti-mono-< : ∀ {x y} (x≉0 : x ≉ 0#) (y≉0 : y ≉ 0#) → x < y → x≉0 ⁻¹ > y≉0 ⁻¹
-- ⁻¹-anti-mono-< {x} {y} x≉0 y≉0 x<y = begin-strict
-- y≉0 ⁻¹ ≈˘⟨ *-identityˡ (y≉0 ⁻¹) ⟩
-- 1# * y≉0 ⁻¹ ≈˘⟨ *-congʳ (⁻¹-inverseˡ x≉0) ⟩
-- x≉0 ⁻¹ * x * y≉0 ⁻¹ <⟨ {!!} ⟩
-- x≉0 ⁻¹ * y * y≉0 ⁻¹ ≈⟨ *-assoc (x≉0 ⁻¹) y (y≉0 ⁻¹) ⟩
-- x≉0 ⁻¹ * (y * y≉0 ⁻¹) ≈⟨ *-congˡ (⁻¹-inverseʳ y≉0) ⟩
-- x≉0 ⁻¹ * 1# ≈⟨ *-identityʳ (x≉0 ⁻¹) ⟩
-- x≉0 ⁻¹ ∎
|