-
Notifications
You must be signed in to change notification settings - Fork 257
Add formalization of substructural logics in src #2825
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
base: master
Are you sure you want to change the base?
Conversation
Zeroth thought: this looks really nice! First thought: we might need to scratch out heads a while about opening up/committing the Second thought: could this be refactored to prune out a lot of the DRY repetition of eg the initial parameter telescopes of (most) of the definitions?
Third thought: everything is tied to ' Fourth thought: On the model of the various Fifth, nitpicky, thought: the fat semicolon is... annoying cf. #2303 |
I've got a detailed review incoming. Agree with thoughts 0-4. |
At the risk of being a dissenting opinion, is this something that might be better as a standalone library? My initial reaction is that this feels very similar to https://github.com/agda/agda-stdlib/blob/master/src/Data/Fin/Substitution.agda and its child modules which I think we agreed at some point probably shouldn't live in the standard library? |
@@ -0,0 +1 @@ | |||
* Added a folder "Logic" in src. This provides a formalization of several substructural logics based on chapter 2 of Greg Restall's "An Introduction to Substructural Logics". My hope is that this can provide a useful framework for anyone wanting to study a variety of logics in Agda. This was a master's research project done under Professor Stuart Kurtz, and I'm really happy with my work here - I would love to contribute to the standard library, and I am happy to make any appropriate modification to help with that. |
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.
We try not to have long lines - can you please cut these down to ~80 characters wide?
open import Logic.Logic | ||
|
||
record And-Logic | ||
{Lang : Set} {Struct : Set} (S : Lang → Struct) |
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.
It would probably make sense to bundle all these things up in a record?
Certainly it would make sense to explain (in the CHANGELOG? A README?) what the overall design is.
(_⨾_ : Struct → Struct → Struct) | ||
(_⇒_ _∧_ : Lang → Lang → Lang) : Set where | ||
field | ||
is-logic : Logic S _⊢_ C⟨_⟩ _⨾_ _⇒_ |
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.
Shouldn't this field be a parameter? You're building And-logic on top of implicational logic, right?
X ⊢ B → | ||
------------------- | ||
X ⊢ (A ∧ B) | ||
and-elimination-1 : |
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 think left
and right
would make more sense than -1 and -2. I know you're following Restall, but he chose bad names, we don't have to follow suit!
X ⊢ B | ||
|
||
if-and-distrib : | ||
∀ (Lang : Set) (Struct : Set) |
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.
This repetition of arguments screams for having module _ ...
encapsulating that.
open import Logic.Logics.BCK-Logic | ||
open import Logic.Structural-Rules.W-Logic | ||
|
||
record J-Logic |
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.
If you're going to call it J
, you need to explain why!
open import Logic.Connectives.Backif-Logic | ||
open import Logic.Connectives.Fusion-Logic | ||
|
||
record L-Logic |
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.
Lambek
instead of L
, unless there is precedent?
|
||
is-comma-logic : Comma-Logic S _⊢_ C⟨_⟩ _⨾_ _/_ _⇒_ | ||
|
||
comma-product-context-l : |
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.
surely a better name can be found?
|
||
open import Logic.Logic | ||
|
||
record B'-Logic |
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.
Is this a standard name for this logic? reference?
field | ||
is-logic : Logic S _⊢_ C⟨_⟩ _⨾_ _⇒_ | ||
|
||
converse-assoc : |
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.
sym-assoc
?
I certainly agree that the bar for introducing logics into |
Re: @MatthewDaggitt on So, to the 'dissenting' view, I agree to the extent that I wouldn't be happy to give top-level I'd be interested to see @JacquesCarette develop his argument from MathScheme. 'Algebra of logic' seems a very respectable kind of addition... not least given my own interests towards developing (universes for) proof-theoretic constructions such as those of Harrop and successors, towards internalising certain kinds of proof procedures around classical logic/ |
Thanks everyone for the detailed feedback. Jacques, I especially appreciate you taking the time to go through my code in such detail. I'll take some time to modify with these comments in mind and resubmit. |
Okay, that's fine! Just wanted to raise it as a possibility, if you're both happy with the addition, let's go for it. |
I've added a formalization of several substructural logics in the src folder, based on chapter 2 of Greg Restall's "An Introduction to Substructural Logics". This is work I did as part of a master's research project. My hope is that the work I've done here can be a useful resource for anyone wanting to study logics in Agda. Please let me know if there any changes I can make to help this fit the Agda standard library.