Skip to content

feat(Logic): logical operators#607

Open
fmontesi wants to merge 7 commits into
mainfrom
fmontesi/connectives
Open

feat(Logic): logical operators#607
fmontesi wants to merge 7 commits into
mainfrom
fmontesi/connectives

Conversation

@fmontesi
Copy link
Copy Markdown
Collaborator

This PR introduces typeclasses for logical operators (connectives and modalities) and refactors modal and propositional logics with appropriate instances to these.

@fmontesi fmontesi requested a review from chenson2018 as a code owner May 29, 2026 12:56
@fmontesi fmontesi changed the title feat (Logic): logical operators feat(Logic): logical operators May 29, 2026
· grind
· grind only [→ satisfies_theory, usr Set.mem_setOf_eq, = impl_iff_impl, = derivation_def,
= neg_satisfies, Satisfies, = box_iff_forall, = Set.setOf_true]
constructor <;> grind
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should not be undone, grind? still fails here.

public import Cslib.Foundations.Logic.Operators.Not
public import Cslib.Foundations.Logic.Operators.Box
public import Cslib.Foundations.Logic.Operators.Diamond
public import Cslib.Foundations.Logic.Operators.Iff
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would it be better to just have one file for these? If they're just notation typeclasses it seems unlikely to be heavyweight and they're likely to be used together.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't know yet. We will expand these files with extended classes for expected properties about these operators, but you're right that some will require importing more than one.. I think we'll know more once we get there.

instance : HasDiamond (Proposition Atom) := {diamond := Proposition.diamond}

@[simp, scoped grind =]
lemma Proposition.not_def (φ : Proposition Atom) : (¬φ) = φ.neg := rfl
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are these simp/grind = lemmas all backwards? I thought they should simplify into the notation like List.append_eq, Nat.add_eq, etc. If this causes failures, I think it means some lemmas are not properly using the notation.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this was my sense as well, but i couldn't make the grind see through the notation / typeclass correctly in the proofs of Satisfies.or_iff_or & relatives without explicitly rewriting back to φ.neg or whatever (undoubtedly due to my not understanding transparency / notation / grind / something properly)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I spent some time with this. I think that if you add lemmas that make sure to use the notation for judgements, e.g. ⇓Modal[m,w ⊨ φ₁ ∧ φ₂] = (⇓Modal[m,w ⊨ φ₁] ∧ ⇓Modal[m,w ⊨ φ₂]) that this becomes a lot easier. As it is the grind annotation being on Satisfies means unfolding this is always required.

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.

3 participants