-
Notifications
You must be signed in to change notification settings - Fork 159
feat(Logic): logical operators #607
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
fmontesi
wants to merge
15
commits into
main
Choose a base branch
from
fmontesi/connectives
base: main
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 all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
31fb1ca
Logical operators
fmontesi 31dcc0e
PL connectives, start modal
060954e
fix not_def
fmontesi 2f4b4c9
fix modal connectives
1024345
Merge branch 'main' into fmontesi/connectives
fmontesi d4410e3
indirection in _def lemmas
fmontesi 63918a2
update cslib.lean
fmontesi 500a9d9
merge main
fmontesi 9669f24
merge main again
fmontesi 604ba15
fix compilationg
fmontesi 20b4a92
fix some proofs
fmontesi c7e5a4c
fix simp lints
fmontesi abf73e5
merge main
fmontesi 059a85c
parametrised logical equivalence
fmontesi c2ec296
grind annotation for not
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,24 @@ | ||
| /- | ||
| Copyright (c) 2026 Fabrizio Montesi. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Fabrizio Montesi | ||
| -/ | ||
|
|
||
| module | ||
|
|
||
| public import Cslib.Init | ||
|
|
||
| /-! # And connective (∧) -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| namespace Cslib.Logic | ||
|
|
||
| /-- The type `α` has an and connective (`∧`). -/ | ||
| class HasAnd (α : Type*) where | ||
| /-- `a ∧ b` is the conjunction of `a` and `b`. -/ | ||
| and (a b : α) : α | ||
|
|
||
| @[inherit_doc] scoped infixr:36 " ∧ " => HasAnd.and | ||
|
|
||
| end Cslib.Logic |
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,24 @@ | ||
| /- | ||
| Copyright (c) 2026 Fabrizio Montesi. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Fabrizio Montesi | ||
| -/ | ||
|
|
||
| module | ||
|
|
||
| public import Cslib.Init | ||
|
|
||
| /-! # Box modality (□) -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| namespace Cslib.Logic | ||
|
|
||
| /-- The type `α` has a box modality (`□`). -/ | ||
| class HasBox (α : Type*) where | ||
| /-- `a` is valid in all immediately reachable states. -/ | ||
| box (a : α) : α | ||
|
|
||
| @[inherit_doc] scoped prefix:40 "□" => HasBox.box | ||
|
|
||
| end Cslib.Logic |
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,24 @@ | ||
| /- | ||
| Copyright (c) 2026 Fabrizio Montesi. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Fabrizio Montesi | ||
| -/ | ||
|
|
||
| module | ||
|
|
||
| public import Cslib.Init | ||
|
|
||
| /-! # Diamond modality (◇) -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| namespace Cslib.Logic | ||
|
|
||
| /-- The type `α` has a diamond modality (`◇`). -/ | ||
| class HasDiamond (α : Type*) where | ||
| /-- `a` is valid in a reachable state. -/ | ||
| diamond (a : α) : α | ||
|
|
||
| @[inherit_doc] scoped prefix:40 "◇" => HasDiamond.diamond | ||
|
|
||
| end Cslib.Logic |
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,24 @@ | ||
| /- | ||
| Copyright (c) 2026 Fabrizio Montesi. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Fabrizio Montesi, Thomas Waring | ||
| -/ | ||
|
|
||
| module | ||
|
|
||
| public import Cslib.Init | ||
|
|
||
| /-! # Iff connective (↔) -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| namespace Cslib.Logic | ||
|
|
||
| /-- The type `α` has a bi-implication connective (`↔`). -/ | ||
| class HasIff (α : Type*) where | ||
| /-- `a ↔ b` denotes `a` implies `b` and vice-versa. -/ | ||
| iff (a b : α) : α | ||
|
|
||
| @[inherit_doc] scoped infixr:20 " ↔ " => HasIff.iff | ||
|
|
||
| end Cslib.Logic |
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,24 @@ | ||
| /- | ||
| Copyright (c) 2026 Fabrizio Montesi. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Fabrizio Montesi, Thomas Waring | ||
| -/ | ||
|
|
||
| module | ||
|
|
||
| public import Cslib.Init | ||
|
|
||
| /-! # Impl connective (→) -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| namespace Cslib.Logic | ||
|
|
||
| /-- The type `α` has an implication connective (`→`). -/ | ||
| class HasImpl (α : Type*) where | ||
| /-- `a → b` denotes `a` implies `b`. -/ | ||
| impl (a b : α) : α | ||
|
|
||
| @[inherit_doc] scoped infixr:25 " → " => HasImpl.impl | ||
|
|
||
| end Cslib.Logic |
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,24 @@ | ||
| /- | ||
| Copyright (c) 2026 Fabrizio Montesi. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Fabrizio Montesi | ||
| -/ | ||
|
|
||
| module | ||
|
|
||
| public import Cslib.Init | ||
|
|
||
| /-! # Negation connective (¬) -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| namespace Cslib.Logic | ||
|
|
||
| /-- The type `α` has a negation connective (`¬`). -/ | ||
| class HasNot (α : Type*) where | ||
| /-- `¬a` is the negation of `a`. -/ | ||
| not (a : α) : α | ||
|
|
||
| @[inherit_doc] scoped notation:max "¬" p:40 => HasNot.not p | ||
|
|
||
| end Cslib.Logic |
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,24 @@ | ||
| /- | ||
| Copyright (c) 2026 Fabrizio Montesi. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Fabrizio Montesi, Thomas Waring | ||
| -/ | ||
|
|
||
| module | ||
|
|
||
| public import Cslib.Init | ||
|
|
||
| /-! # Or connective (∨) -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| namespace Cslib.Logic | ||
|
|
||
| /-- The type `α` has an or connective (`∨`). -/ | ||
| class HasOr (α : Type*) where | ||
| /-- `a ∨ b` is the disjunction of `a` and `b`. -/ | ||
| or (a b : α) : α | ||
|
|
||
| @[inherit_doc] scoped infixr:30 " ∨ " => HasOr.or | ||
|
|
||
| end Cslib.Logic |
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,24 @@ | ||
| /- | ||
| Copyright (c) 2026 Fabrizio Montesi. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Fabrizio Montesi | ||
| -/ | ||
|
|
||
| module | ||
|
|
||
| public import Cslib.Init | ||
|
|
||
| /-! # Tensor connective (⊗) -/ | ||
|
|
||
| @[expose] public section | ||
|
|
||
| namespace Cslib.Logic | ||
|
|
||
| /-- The type `α` has a tensor connective (⊗). -/ | ||
| class HasTensor (α : Type*) where | ||
| /-- `a ⊗ b` is the multiplicative conjunction of `a` and `b`. -/ | ||
| tensor (a b : α) : α | ||
|
|
||
| @[inherit_doc] scoped infixr:35 " ⊗ " => HasTensor.tensor | ||
|
|
||
| end Cslib.Logic |
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 |
|---|---|---|
|
|
@@ -650,7 +650,7 @@ instance : Congruence (Proposition Atom) Proposition.Equiv where | |
| intro ctx a b hab | ||
| induction ctx <;> grind [= Context.fill] | ||
|
|
||
| noncomputable instance : LogicalEquivalence (Proposition Atom) (Sequent Atom) Proof where | ||
| noncomputable instance : HasLogicalEquivalence (Proposition Atom) (Sequent Atom) where | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that the |
||
| eqv := Proposition.Equiv | ||
| eqvFillValid {a b : Proposition Atom} (heqv : a.Equiv b) | ||
| (c : HasHContext.Context (Sequent Atom) (Proposition Atom)) | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest merging all these operators into a single
LogicOperatorsfile, since then you can give one docstring that summarizes the conventions of their meanings.