feat: logical equivalence for modal logic#535
Open
fmontesi wants to merge 18 commits into
Open
Conversation
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Collaborator
thomaskwaring
left a comment
There was a problem hiding this comment.
some minor comments but lgtm on the whole!
Collaborator
Author
|
Thanks, @thomaskwaring. All done! |
chenson2018
requested changes
Jun 1, 2026
| theorem Satisfies.iff_iff_iff {m : Model World Atom} : | ||
| ⇓Modal[m,w ⊨ φ₁ ↔ φ₂] ↔ (⇓Modal[m,w ⊨ φ₁] ↔ ⇓Modal[m,w ⊨ φ₂]) := by | ||
| simp only [Proposition.iff] | ||
| grind [=_ derivation_def] |
Collaborator
There was a problem hiding this comment.
Out of scope for this PR, but derivation_def is written backwards.
Comment on lines
+85
to
+96
| instance (S : Set (Model World Atom)) : | ||
| IsEquiv (Proposition Atom) (Proposition.Equiv (Atom := Atom) S) where | ||
| refl := by grind | ||
| symm := by | ||
| intro φ₁ φ₂ h m hₘ w | ||
| specialize h m hₘ w | ||
| grind | ||
| trans := by | ||
| intro φ₁ φ₂ φ₃ h₁ h₂ m hₘ w | ||
| specialize h₁ m hₘ w | ||
| specialize h₂ m hₘ w | ||
| grind |
Collaborator
There was a problem hiding this comment.
Suggested change
| instance (S : Set (Model World Atom)) : | |
| IsEquiv (Proposition Atom) (Proposition.Equiv (Atom := Atom) S) where | |
| refl := by grind | |
| symm := by | |
| intro φ₁ φ₂ h m hₘ w | |
| specialize h m hₘ w | |
| grind | |
| trans := by | |
| intro φ₁ φ₂ φ₃ h₁ h₂ m hₘ w | |
| specialize h₁ m hₘ w | |
| specialize h₂ m hₘ w | |
| grind | |
| instance {World Atom} (S : Set (Model World Atom)) : IsEquiv (Proposition Atom) (Proposition.Equiv S) := by | |
| rw [← equivalence_iff_isEquiv] | |
| grind [Equivalence] |
Comment on lines
+52
to
+60
| apply Iff.intro <;> intro h' | ||
| · simp_all only [valid] | ||
| intro m hin w | ||
| specialize h m hin w | ||
| grind | ||
| · simp_all only [valid] | ||
| intro m hin w | ||
| specialize h m hin w | ||
| grind |
Collaborator
There was a problem hiding this comment.
Suggested change
| apply Iff.intro <;> intro h' | |
| · simp_all only [valid] | |
| intro m hin w | |
| specialize h m hin w | |
| grind | |
| · simp_all only [valid] | |
| intro m hin w | |
| specialize h m hin w | |
| grind | |
| grind |
Comment on lines
+99
to
+100
| instance (S : Set (Model World Atom)) : | ||
| Congruence (Proposition Atom) (Proposition.Equiv (Atom := Atom) S) where |
Collaborator
There was a problem hiding this comment.
Suggested change
| instance (S : Set (Model World Atom)) : | |
| Congruence (Proposition Atom) (Proposition.Equiv (Atom := Atom) S) where | |
| instance {World Atom} (S : Set (Model World Atom)) : Congruence (Proposition Atom) (Proposition.Equiv S) where |
Comment on lines
+101
to
+118
| elim : | ||
| Covariant (Proposition.Context Atom) (Proposition Atom) (Proposition.Context.fill) | ||
| (Proposition.Equiv S) := by | ||
| intro ctx φ₁ φ₂ heqv m hₘ w | ||
| specialize heqv m hₘ | ||
| induction ctx generalizing w | ||
| case hole => grind | ||
| case not c ih | andL c ih | andR c ih => | ||
| specialize ih w | ||
| grind | ||
| case diamond c ih => | ||
| simp only [Satisfies.iff_iff_iff] | ||
| apply Iff.intro | ||
| all_goals | ||
| intro h | ||
| rcases h with ⟨w', h⟩ | ||
| specialize ih w' | ||
| grind |
Collaborator
There was a problem hiding this comment.
The fill notation is fighting against grind here. See how this works:
Suggested change
| elim : | |
| Covariant (Proposition.Context Atom) (Proposition Atom) (Proposition.Context.fill) | |
| (Proposition.Equiv S) := by | |
| intro ctx φ₁ φ₂ heqv m hₘ w | |
| specialize heqv m hₘ | |
| induction ctx generalizing w | |
| case hole => grind | |
| case not c ih | andL c ih | andR c ih => | |
| specialize ih w | |
| grind | |
| case diamond c ih => | |
| simp only [Satisfies.iff_iff_iff] | |
| apply Iff.intro | |
| all_goals | |
| intro h | |
| rcases h with ⟨w', h⟩ | |
| specialize ih w' | |
| grind | |
| elim ctx φ₁ φ₂ heqv m hₘ w := by | |
| have (Γ : HasContext.Context (Proposition Atom)) (φ) : Γ.fill φ = Γ<[φ] := rfl | |
| induction ctx generalizing w | |
| case hole => grind | |
| case not c ih | andL c ih | andR c ih => | |
| specialize ih w | |
| grind | |
| case diamond c ih => | |
| rw [Satisfies.iff_iff_iff] | |
| apply Iff.intro | |
| all_goals | |
| rintro ⟨w', h⟩ | |
| specialize ih w' | |
| grind |
(The first have should be a grind lemma somewhere.)
Comment on lines
+142
to
+147
| eqvFillValid {φ₁ φ₂ : Proposition Atom} (heqv : φ₁ ≡[Set.univ] φ₂) | ||
| (c : HasHContext.Context (Judgement World Atom) (Proposition Atom)) | ||
| (h : ⇓c<[φ₁]) : ⇓c<[φ₂] := by | ||
| simp only [HasHContext.fill, Satisfies.Context.fill] at ⊢ h | ||
| specialize heqv c.m | ||
| grind |
Collaborator
There was a problem hiding this comment.
We don't usually provide types like this in an instance, right? There's also another notation lemma that needs to be extracted. See how:
Suggested change
| eqvFillValid {φ₁ φ₂ : Proposition Atom} (heqv : φ₁ ≡[Set.univ] φ₂) | |
| (c : HasHContext.Context (Judgement World Atom) (Proposition Atom)) | |
| (h : ⇓c<[φ₁]) : ⇓c<[φ₂] := by | |
| simp only [HasHContext.fill, Satisfies.Context.fill] at ⊢ h | |
| specialize heqv c.m | |
| grind | |
| eqvFillValid heqv c h := by | |
| have (φ : Proposition Atom) : Modal[c.m,c.w ⊨ φ] = c<[φ] := rfl | |
| specialize heqv c.m | |
| grind |
works
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds logical equivalence for modal logic, proving that it is a
Congruence(for any modal logic, regardless of the class of models considered) and aLogicalEquivalence(for logic K, i.e., when considering the class of all models).The PR also renames
Proposition.negtoProposition.notand adds a useful lemma onProposition.iff.Depends on #528.