Add smart constructors for terms, and other improvements to fly/src/syntax.rs#131
Conversation
1a72dff to
bfbbaee
Compare
| /// all the functions in the signature at each point in time). | ||
| /// A Term is an FO-LTL (first-order linear temporal logic) term or formula. The | ||
| /// temporal operators supported are: Prime, Next, Prev, Until, Since, Always, | ||
| /// Eventually (see [`UOp`] and [`BinOp`]). |
There was a problem hiding this comment.
I don't like this change to the documentation. I'd like to have some basic explanation of LTL here, and I don't think it's important to list the operators here (leave that for the language reference).
There was a problem hiding this comment.
I didn't like the previous explanation, and I'm not sure the basic semantics of LTL should be explained in the documentation of Term. At some point, I think the language manual or other documentation should explain the semantics of FO-LTL. And I did find it helpful (even for myself) to list all the temporal operators here.
What do you think about the following compromise:
/// A Term is an FO-LTL (first-order linear temporal logic) term or formula. The
/// temporal operators supported are: Prime, Next, Prev, Until, Since, Always,
/// Eventually (see [`UOp`] and [`BinOp`]).
///
/// FO-LTL is an extension of first-order logic where the semantics is given in
/// terms of infinite sequences of models (over a shared universe). A term is
/// interpreted at a particular point (time) in the sequence, and using
/// temporal operators it can also query the past or future. For example
/// exists x. p(x) & (previous !p(x)) & always r(x) means that there exists
/// some element x for which p now holds, but it didn't hold a moment ago,
/// and from this point onwards r keeps holding for x.
There was a problem hiding this comment.
Sure, that looks good to me.
There was a problem hiding this comment.
Great. I pushed a slightly edited version of this.
|
@odedp, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
This comment was marked as duplicate.
This comment was marked as duplicate.
f790c06 to
af08d3e
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
af08d3e to
b15d890
Compare
e18a80b to
69b674f
Compare
Signed-off-by: Tej Chajed <tchajed@vmware.com>
Signed-off-by: Tej Chajed <tchajed@vmware.com>
TODO: Use the smart constructors everywhere. I think Terms should not be constructed without them (except for some unusual cases perhaps). Signed-off-by: Oded Padon <oded.padon@gmail.com>
…e for Term Signed-off-by: Oded Padon <oded.padon@gmail.com>
Signed-off-by: Oded Padon <oded.padon@gmail.com>
Signed-off-by: Oded Padon <oded.padon@gmail.com>
Signed-off-by: Tej Chajed <tchajed@vmware.com>
Signed-off-by: Tej Chajed <tchajed@vmware.com>
Signed-off-by: Tej Chajed <tchajed@vmware.com>
…rt::Uninterpreted) Signed-off-by: Oded Padon <oded.padon@gmail.com>
Signed-off-by: Oded Padon <oded.padon@gmail.com>
Co-authored-by: Tej Chajed <tchajed@vmware.com> Signed-off-by: Oded Padon <oded.padon@gmail.com>
Co-authored-by: Tej Chajed <tchajed@vmware.com> Signed-off-by: Oded Padon <oded.padon@gmail.com>
…ifier Signed-off-by: Oded Padon <oded.padon@gmail.com>
Signed-off-by: Oded Padon <oded.padon@gmail.com>
…nknown Signed-off-by: Oded Padon <oded.padon@gmail.com>
Signed-off-by: Oded Padon <oded.padon@gmail.com>
7bfb07b to
7873ebb
Compare
Add smart constructors for
Sort,Binder, and allTermcases. The smart constructors can take either something owned, and then they don't clone, or a reference, and then they clone. This is meant to make code for programmatically constructing Terms nicer, without a bunch of.cloneeverywhere. In a few (documented) cases, the smart constructors do a bit more normalization (e.g.,Term::and([])returns true and not an actualTerm::And).For now, these smart constructors are only used in code I still haven't pushed (in the liveness to safety), but I think they should be used everywhere. Basically, there's no reason to directly construct a
Term.To convert existing code, change the constructor to a smart constructor, and try to replace
arg.clone()by&argto make calling code look nicer.Other small changes:
Sort::IdtoSort::UninterpretedUOp::PreviouslytoUOp::Previous, which I think is more standard ("previously" is sometimes used for the past version of eventually)Minor issues and future TODOs:
forallandexiststill need to be owned. We can change this by havingimpl From<&Binder> for <Binder>similarly to what we do forSortandTerm.Term::andandTerm::ortake anIntoIteratorwhich forces uniformity. So you cannot doTerm::and([&t1, t2])(where you can doTerm::iff(&t1, t2), and must instead doTerm::and([&t1, &t2])which introduces an unnecessary clone. I don't think this clone gets optimized away. If we think this is a concern, we can implement variadicandandor, either with specialized functions (say for 2-9 arguments) or perhaps with a macro.