-
Notifications
You must be signed in to change notification settings - Fork 247
/
Copy pathCancellativeCommutativeSemiring.agda
47 lines (33 loc) · 1.57 KB
/
CancellativeCommutativeSemiring.agda
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
------------------------------------------------------------------------
-- The Agda standard library
--
-- Some properties of operations in CancellativeCommutativeSemiring.
------------------------------------------------------------------------
{-# OPTIONS --cubical-compatible --safe #-}
open import Algebra.Bundles using (CancellativeCommutativeSemiring)
module Algebra.Properties.CancellativeCommutativeSemiring
{a ℓ} (R : CancellativeCommutativeSemiring a ℓ)
where
open import Data.Sum.Base using (_⊎_; [_,_]′; map₂)
open import Relation.Binary.Definitions using (Decidable)
open CancellativeCommutativeSemiring R renaming (Carrier to A)
private
variable
x y : A
module _ (_≟_ : Decidable _≈_) where
xy≈0⇒x≈0∨y≈0 : x * y ≈ 0# → x ≈ 0# ⊎ y ≈ 0#
xy≈0⇒x≈0∨y≈0 {x} {y} xy≈0 =
map₂ (λ cancel → cancel _ _ (trans xy≈0 (sym (zeroʳ x)))) (*-cancelˡ-nonZero x)
x≉0∧y≉0⇒xy≉0 : x ≉ 0# → y ≉ 0# → x * y ≉ 0#
x≉0∧y≉0⇒xy≉0 x≉0 y≉0 xy≈0 = [ x≉0 , y≉0 ]′ (xy≈0⇒x≈0∨y≈0 xy≈0)
------------------------------------------------------------------------
-- DEPRECATED NAMES
------------------------------------------------------------------------
-- Please use the new names as continuing support for the old names is
-- not guaranteed.
-- Version 2.3
*-almostCancelʳ = *-cancelʳ-nonZero
{-# WARNING_ON_USAGE *-almostCancelʳ
"Warning: *-almostCancelʳ was deprecated in v2.3.
Please use Algebra.Structures.IsCancellativeCommutativeSemiring.*-cancelʳ-nonZero instead."
#-}