-
Notifications
You must be signed in to change notification settings - Fork 259
Continuing with generic GCD. #1392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
08d1270
Continuing with generic GCD.
mechvel 9f88991
Continuing with the generic GCD project.
mechvel e9d7b03
Merge remote-tracking branch 'upstream/master'
MatthewDaggitt 3315368
Fix
MatthewDaggitt 8bdb3ab
Merge remote-tracking branch 'upstream/master'
MatthewDaggitt bf0e128
Continuing general GCD project.
mechvel e308865
Fixing the beginning of the generic GCD project.
mechvel 062054c
Merge branch 'master' into master
MatthewDaggitt 19226dc
Removed GCD content of PR
MatthewDaggitt 1938536
Fixed whitespace
MatthewDaggitt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,4 +71,3 @@ record Prime (p : A) : Set (a ⊔ ℓ) where | |
| field | ||
| p≉0 : p ≉ 0# | ||
| split-∣ : ∀ {x y} → p ∣ x * y → p ∣ x ⊎ p ∣ y | ||
|
|
||
39 changes: 39 additions & 0 deletions
39
src/Algebra/Properties/CancellativeCommutativeSemiring.agda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| ------------------------------------------------------------------------ | ||
| -- The Agda standard library | ||
| -- | ||
| -- Some properties of operations in CancellativeCommutativeSemiring. | ||
| ------------------------------------------------------------------------ | ||
|
|
||
| {-# OPTIONS --without-K --safe #-} | ||
|
|
||
| open import Algebra using (CancellativeCommutativeSemiring) | ||
| open import Algebra.Definitions using (AlmostRightCancellative) | ||
| open import Data.Sum.Base using (_⊎_; inj₁; inj₂) | ||
| open import Relation.Binary using (Decidable) | ||
| open import Relation.Nullary using (yes; no) | ||
| open import Relation.Nullary.Negation using (contradiction) | ||
|
|
||
| module Algebra.Properties.CancellativeCommutativeSemiring | ||
| {a ℓ} (R : CancellativeCommutativeSemiring a ℓ) | ||
| where | ||
|
|
||
| open CancellativeCommutativeSemiring R | ||
| open import Algebra.Consequences.Setoid setoid | ||
| open import Relation.Binary.Reasoning.Setoid setoid | ||
|
|
||
| *-almostCancelʳ : AlmostRightCancellative _≈_ 0# _*_ | ||
| *-almostCancelʳ = comm+almostCancelˡ⇒almostCancelʳ *-comm *-cancelˡ-nonZero | ||
|
|
||
| xy≈0⇒x≈0∨y≈0 : Decidable _≈_ → ∀ {x y} → x * y ≈ 0# → x ≈ 0# ⊎ y ≈ 0# | ||
| xy≈0⇒x≈0∨y≈0 _≟_ {x} {y} xy≈0 with x ≟ 0# | y ≟ 0# | ||
| ... | yes x≈0 | _ = inj₁ x≈0 | ||
| ... | no _ | yes y≈0 = inj₂ y≈0 | ||
| ... | no x≉0 | no y≉0 = contradiction y≈0 y≉0 | ||
| where | ||
| xy≈x*0 = trans xy≈0 (sym (zeroʳ x)) | ||
| y≈0 = *-cancelˡ-nonZero y 0# x≉0 xy≈x*0 | ||
|
|
||
| x≉0∧y≉0⇒xy≉0 : Decidable _≈_ → ∀ {x y} → x ≉ 0# → y ≉ 0# → x * y ≉ 0# | ||
| x≉0∧y≉0⇒xy≉0 _≟_ x≉0 y≉0 xy≈0 with xy≈0⇒x≈0∨y≈0 _≟_ xy≈0 | ||
| ... | inj₁ x≈0 = x≉0 x≈0 | ||
| ... | inj₂ y≈0 = y≉0 y≈0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.