-
Notifications
You must be signed in to change notification settings - Fork 104
feat: Linear Temporal Logic #413
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: main
Are you sure you want to change the base?
Changes from 1 commit
7c9a141
b3d7f5c
8d26805
00fa8a4
f8229e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,167 @@ | ||||||||||||||
| /- | ||||||||||||||
| Copyright (c) 2026 Fabrizio Montesi. All rights reserved. | ||||||||||||||
| Released under Apache 2.0 license as described in the file LICENSE. | ||||||||||||||
| Authors: Lorenzo Pace | ||||||||||||||
| -/ | ||||||||||||||
|
|
||||||||||||||
| module | ||||||||||||||
|
|
||||||||||||||
| public import Cslib.Foundations.Semantics.LTS.Bisimulation | ||||||||||||||
| public import Cslib.Foundations.Data.OmegaSequence.Defs | ||||||||||||||
|
|
||||||||||||||
| @[expose] public section | ||||||||||||||
|
|
||||||||||||||
| /-! # Linear Temporal Logic | ||||||||||||||
|
|
||||||||||||||
| Linear Temporal Logic (LTL) is a logic for reasoning about the validity of propositional atoms | ||||||||||||||
| in non-branching time. | ||||||||||||||
|
||||||||||||||
|
|
||||||||||||||
| ## Main definitions | ||||||||||||||
|
|
||||||||||||||
| - `Proposition`: the language of propositions, parametrized on the type of atoms. | ||||||||||||||
| - `Satisfies ls φ`: the ω-sequence `ls` satisfies proposition `p`. | ||||||||||||||
| - `Proposition.equiv`: equivalence of two propositions modulo `Satisfies`. | ||||||||||||||
|
|
||||||||||||||
| ## Main statements | ||||||||||||||
|
|
||||||||||||||
| - `next_self_dual`: Negation can be brought inside the `next` operator. | ||||||||||||||
| - `distrib_eventually_or`: the `eventually` operator distributes on disjunction. | ||||||||||||||
| - `expansion_until`: expansion rule for the `until` operator | ||||||||||||||
| - `expansion_eventually`: expansion rule for the `eventually` operator | ||||||||||||||
|
|
||||||||||||||
| ## References | ||||||||||||||
| Course slides, University of Pisa: https://pages.di.unipi.it/gadducci/SVV-24/slideB/svv_b_01.pdf | ||||||||||||||
mell-o-tron marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| -/ | ||||||||||||||
|
|
||||||||||||||
| namespace Cslib.Logic.LTL | ||||||||||||||
|
|
||||||||||||||
| /-- Propositions, where `T` is the type of atoms. -/ | ||||||||||||||
| inductive Proposition (T : Type) : Type u where | ||||||||||||||
|
||||||||||||||
| inductive Proposition (T : Type) : Type u where | |
| inductive Proposition (T : Type u) : Type u where |
Outdated
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.
Any reason implies and leads_to are not among the operators? Alternatively, can we take seriously the idea that (for example) always and eventuallycan be defined as derived operators and reduce this inductive definition to a minimal set of operators?
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.
Are you sure until doesn't work here? I played with it a little bit and it seems to work. These operators are never used "nakedly" and always appears as part of dot-notations.
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.
Instead of trying to anticipate and enumerate all propositional operators you will ever need, I wonder if it is better to limit yourself to a minimal set of operators in terms of which other operators can be defined. For example, even with the expanded set of operators given above, you still miss one important operator:
def Proposition.leadsTo (φ₁ φ₂ : Proposition T) : Proposition T :=
(φ₁.implies φ₂.eventually).always
variable (φ₁ φ₂ : Proposition T)
#check (φ₁.leadsTo φ₂)
As you can see, the dot-notation enables the new operator to be written and used pretty much like those in the original inductive definition. By limiting yourself to a minimal set of core operators which will likely stay stable, you will have fewer operators to deal with if you ever want to develop any proof theory for LTL.
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.
Makes a lot of sense. On it 👍
Outdated
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.
| def Satisfies (ls : ωSequence (Set T)) (φ : Proposition T) := match φ with | |
| def Satisfies (ls : ωSequence (Set T)) : Proposition T → Prop |
Outdated
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.
| | .next φ => Satisfies (ωSequence.drop 1 ls) φ | |
| | .next φ => Satisfies (ls.drop 1) φ |
etc
Outdated
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.
| def Proposition.equiv (φ₁ : Proposition T) (φ₂ : Proposition T) := | |
| def Proposition.equiv (φ₁ : Proposition T) (φ₂ : Proposition T) : Prop := |
Outdated
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.
Instead of Proposition.equiv φ₁ φ₂, I think you should define Proposition.valid φ to mean that φ is true over all models ls. This is more general, because Proposition.equiv φ₁ φ₂ is simply Proposition.valid (φ₁.iff φ₂). (You didn't define Proposition.iff, but there is no reason why you shouldn't.). Also, Proposition.equiv φ₁ φ₂ biases you toward equational reasoning. But sometimes it is more natural to reason about implications.
Outdated
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.
Would it be possible to give \models a higher precedence than \iff, so that we can get rid of the parentheses on the LHS of \iff?
Outdated
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.
style should be
| theorem next_self_dual {T} : ∀ (φ : Proposition T), φ.next.not ≈ φ.not.next := | |
| by simp | |
| theorem next_self_dual {T} : ∀ (φ : Proposition T), φ.next.not ≈ φ.not.next := by | |
| simp |
(throughout)
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.
| theorem expansion_until {T} : ∀ (φ : Proposition T) (ψ : Proposition T) , | |
| Proposition.until_op φ ψ ≈ Proposition.or ψ (Proposition.and φ ((Proposition.until_op φ ψ).next)) := | |
| by | |
| intros | |
| theorem expansion_until {T} (φ : Proposition T) (ψ : Proposition T) : | |
| φ.until_op ψ ≈ ψ.or (φ.and ((φ.until_op ψ).next)) := by |
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.
You can put your name here.