Skip to content

Initial Boolean Algebra#1239

Merged
mortberg merged 7 commits intoagda:masterfrom
Freek98:InitialBA
Aug 4, 2025
Merged

Initial Boolean Algebra#1239
mortberg merged 7 commits intoagda:masterfrom
Freek98:InitialBA

Conversation

@Freek98
Copy link
Contributor

@Freek98 Freek98 commented Jul 29, 2025

Replaces #1234

  • Add an easy constructor for Boolean algebras
  • Add Boolean morphisms
  • Show the standard Booleans form a Boolean algebra
  • Show that the above Boolean algebra is initial

Copy link
Collaborator

@mortberg mortberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small comments to fix and then we can merge

isIdemRing R = ∀ (r : ⟨ R ⟩) → (str R) .CommRingStr._·_ r r ≡ r

idemCommRing→BR : {ℓ : Level} (R : CommRing ℓ) → isIdemRing R → BooleanRing ℓ
idemCommRing→BR R idem = ⟨ R ⟩ ,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use copattern-matching instead? (C-c C-c is your friend)

BoolBRStr ._+_ = _⊕_
BoolBRStr ._·_ = _and_
BoolBRStr .-_ x = x
BoolBRStr .isBooleanRing = record
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copattern-match

BoolBR = Bool , BoolBRStr

BoolCR : CommRing ℓ-zero
BoolCR = BooleanRing→CommRing BoolBR
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

BoolBR : BooleanRing ℓ-zero
BoolBR = Bool , BoolBRStr
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe have a specific BooleanRing.Instances folder and put this and BoolBRStr in a dedicated file there? (Then you can remove the anonymous module as well and just open BooleanStr (which should maybe be called BooleanRingStr?))

Copy link
Collaborator

@mortberg mortberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tiny comment and then I'll merge

BooleanStr→CommRingStr : { A : Type ℓ } → BooleanStr A → CommRingStr A
BooleanStr→CommRingStr x = record { isCommRing = IsBooleanRing.isCommRing (BooleanStr.isBooleanRing x) }
BooleanRingStr→CommRingStr : { A : Type ℓ } → BooleanRingStr A → CommRingStr A
BooleanRingStr→CommRingStr x = record { isCommRing = IsBooleanRing.isCommRing (BooleanRingStr.isBooleanRing x) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I had missed this use of record. Can you please change it just for consistency with the rest of the library?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course! I think you only missed it because it comes from an earlier PR (#1146), and was only changed now because of the name change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, @dwarn wrote large parts of the code (the same holds for PR #1238) , but I'm not sure whether and where I should mention this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you can put it in a header at the top of the file if you want?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! He wrote these parts in order to write about presentable Boolean algebras. I hope to soon make a PR on presentable Boolean algebras, and will give the credits in a file where these parts come together. That feels more manageable then putting headers in each part.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, great. Then I'll merge!

@mortberg mortberg merged commit cfc6d45 into agda:master Aug 4, 2025
1 check passed
@Freek98 Freek98 deleted the InitialBA branch August 18, 2025 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants