-
Notifications
You must be signed in to change notification settings - Fork 253
[ add ] BooleanRing
plus Properties
#2763
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
Open
jamesmckinna
wants to merge
29
commits into
agda:master
Choose a base branch
from
jamesmckinna:boolean-ring
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
7c198cc
add: `BooleanRing` plus `Properties`
jamesmckinna b219c5e
Update CHANGELOG.md
jamesmckinna 3e5cc88
refactor: more general API
jamesmckinna 9684d71
fix: added note to `CHANGELOG`
jamesmckinna 0f2f44e
refactor: make binomial expansion an explicit step
jamesmckinna 0aff0d9
rename: `*-isIdempotentMonoid`
jamesmckinna ca6aff1
add: `*-idempotentMonoid`
jamesmckinna a4b6010
refactor: use `Cancellative` properties only
jamesmckinna 9e3d63b
add: stub properties for `CommutativeRing`
jamesmckinna 0e26669
refactor: `BooleanRing` properties in terms of `CommutativeRing` and …
jamesmckinna 5792887
refactor: put everything together
jamesmckinna e355a3f
add: stub properties for `CommutativeRing`
jamesmckinna 81d140c
refactor: adjust re-exports
jamesmckinna a1b4086
add: `BooleanAlgebra` yields `BooleanRing` etc.
jamesmckinna 6a675c0
add: more re-exports
jamesmckinna a7f4c45
add: more inherited properties
jamesmckinna fa28407
add: more properties towards `IsBooleanAlgebra`
jamesmckinna 4c1fbc0
add: yet more properties towards `IsBooleanAlgebra`
jamesmckinna 763cac5
add: grinding towards `IsBooleanAlgebra`
jamesmckinna f10a36b
add: `deMorgan` laws
jamesmckinna e082ea7
add: `Semiring` properties as home for `binomial-expansion`
jamesmckinna 2d59a88
more fiddling
jamesmckinna bfc54b2
back to square one
jamesmckinna 94d1b19
fix: finally!
jamesmckinna 0414331
Merge branch 'master' into boolean-ring
jamesmckinna a9a28a9
fix: remove shadowing of `isBooleanRing` and `booleanRing`
jamesmckinna 05f07f9
reset: `CHANGELOG` for v2.4
jamesmckinna bccabf6
Merge branch 'master' into boolean-ring
jamesmckinna 79a4ca0
fix: whitespace
jamesmckinna 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
------------------------------------------------------------------------ | ||
-- The Agda standard library | ||
-- | ||
-- Some basic properties of Rings | ||
------------------------------------------------------------------------ | ||
|
||
{-# OPTIONS --cubical-compatible --safe #-} | ||
|
||
open import Algebra.Bundles | ||
using (BooleanRing; CommutativeMonoid; IdempotentCommutativeMonoid; CommutativeRing) | ||
|
||
module Algebra.Properties.BooleanRing {r₁ r₂} (R : BooleanRing r₁ r₂) where | ||
|
||
open import Function.Base using (_$_) | ||
|
||
open BooleanRing R | ||
open import Algebra.Definitions _≈_ | ||
open import Algebra.Structures _≈_ | ||
using (IsCommutativeMonoid; IsIdempotentCommutativeMonoid; IsCommutativeRing) | ||
open import Relation.Binary.Reasoning.Setoid setoid | ||
|
||
------------------------------------------------------------------------ | ||
-- Export properties of rings | ||
|
||
open import Algebra.Properties.Ring ring public | ||
|
||
------------------------------------------------------------------------ | ||
-- Extra properties of Boolean rings | ||
|
||
xy+yx≈0 : ∀ x y → x * y + y * x ≈ 0# | ||
xy+yx≈0 x y = +-cancelˡ (x * x) _ _ $ +-cancelʳ (y * y) _ _ $ begin | ||
x * x + ((x * y) + (y * x)) + y * y ≈⟨ +-congʳ (+-assoc _ _ _) ⟨ | ||
x * x + x * y + y * x + y * y ≈⟨ +-assoc _ _ _ ⟩ | ||
(x * x + x * y) + (y * x + y * y) ≈⟨ +-cong (distribˡ x x y) (distribˡ y x y) ⟨ | ||
x * (x + y) + y * (x + y) ≈⟨ distribʳ (x + y) x y ⟨ | ||
(x + y) * (x + y) ≈⟨ *-idem (x + y) ⟩ | ||
x + y ≈⟨ +-congˡ (*-idem y) ⟨ | ||
x + y * y ≈⟨ +-congʳ (*-idem x) ⟨ | ||
x * x + y * y ≈⟨ +-congʳ (+-identityʳ (x * x)) ⟨ | ||
x * x + 0# + y * y ∎ | ||
|
||
x+x≈0 : ∀ x → x + x ≈ 0# | ||
x+x≈0 x = begin | ||
x + x ≈⟨ +-cong (*-idem x) (*-idem x) ⟨ | ||
x * x + x * x ≈⟨ xy+yx≈0 x x ⟩ | ||
0# ∎ | ||
|
||
-x≈x : ∀ x → - x ≈ x | ||
-x≈x x = begin | ||
- x ≈⟨ +-inverseˡ-unique x x (x+x≈0 x) ⟨ | ||
x ∎ | ||
|
||
*-comm : Commutative _*_ | ||
*-comm x y = begin | ||
x * y ≈⟨ +-inverseˡ-unique _ _ (xy+yx≈0 x y) ⟩ | ||
- (y * x) ≈⟨ -x≈x _ ⟩ | ||
y * x ∎ | ||
|
||
------------------------------------------------------------------------ | ||
-- Additional structures | ||
|
||
*-isCommutativeMonoid : IsCommutativeMonoid _*_ 1# | ||
*-isCommutativeMonoid = record { isMonoid = *-isMonoid ; comm = *-comm } | ||
|
||
*-isIdempotentCommutativeMonoid : IsIdempotentCommutativeMonoid _*_ 1# | ||
*-isIdempotentCommutativeMonoid = record | ||
{ isCommutativeMonoid = *-isCommutativeMonoid | ||
; idem = *-idem | ||
} | ||
|
||
isCommutativeRing : IsCommutativeRing _+_ _*_ -_ 0# 1# | ||
isCommutativeRing = record { isRing = isRing ; *-comm = *-comm } | ||
|
||
------------------------------------------------------------------------ | ||
-- Additional bundles | ||
|
||
*-commutativeMonoid : CommutativeMonoid _ _ | ||
*-commutativeMonoid = record { isCommutativeMonoid = *-isCommutativeMonoid } | ||
|
||
*-idempotentCommutativeMonoid : IdempotentCommutativeMonoid _ _ | ||
*-idempotentCommutativeMonoid = record | ||
{ isIdempotentCommutativeMonoid = *-isIdempotentCommutativeMonoid } | ||
|
||
commutativeRing : CommutativeRing _ _ | ||
commutativeRing = record { isCommutativeRing = isCommutativeRing } |
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.