Hello, I would like to provide modern logic classes, please see https://github.com/boostorg/logic/issues/30 What are your opinions/comments on this? thx Gero
On 4/25/24 10:57 AM, g.peterhoff--- via Boost wrote:
Hello, I would like to provide modern logic classes, please see https://github.com/boostorg/logic/issues/30 What are your opinions/comments on this?
Interesting idea. But rather than messing with tribool, I'd prefer to just see a new library quadbool. Robert Ramey
On 25/04/2024 22:55, Robert Ramey via Boost wrote:
Interesting idea.
But rather than messing with tribool, I'd prefer to just see a new library quadbool.
Robert Ramey
At this point I'd like to know if it's possible to thread mathematically the N-bool problem and create a library for generic multidimensional bool that works with templates allowing to determine N at compile time. Because in the future we should have a 8-bool implementation, and so on... Daniele Lupo
On Fri, May 17, 2024 at 2:53 AM Daniele Lupo via Boost < boost@lists.boost.org> wrote:
At this point I'd like to know if it's possible to thread mathematically the N-bool problem and create a library for generic multidimensional bool that works with templates allowing to determine N at compile time. Because in the future we should have a 8-bool implementation, and so on...
bool me once, shame on you. bool me twice? we won't get booled again...
On May 17, 2024, at 12:53, Daniele Lupo via Boost
wrote: On 25/04/2024 22:55, Robert Ramey via Boost wrote:
Interesting idea.
But rather than messing with tribool, I'd prefer to just see a new library quadbool.
Robert Ramey
At this point I'd like to know if it's possible to thread mathematically the N-bool problem and create a library for generic multidimensional bool that works with templates allowing to determine N at compile time.
The problem with all jokes is that some people don't get them...
On 5/17/24 2:53 AM, Daniele Lupo via Boost wrote:
On 25/04/2024 22:55, Robert Ramey via Boost wrote:
Interesting idea.
But rather than messing with tribool, I'd prefer to just see a new library quadbool.
Robert Ramey
At this point I'd like to know if it's possible to thread mathematically the N-bool problem and create a library for generic multidimensional bool that works with templates allowing to determine N at compile time. Because in the future we should have a 8-bool implementation, and so on...
actually, bool, tribool, quadbool, etc.... are just special cases of enum {...} Soo using bool enum{0, 1} // false, true using tribool enum {0, 1, 3} // false, true, indeterminant using quadbool enum {0, 1, 3, 4} // false, true, indeterminant ... with negation, conjunction, disjunction and whatever else is necessary. Robert Ramey
On Thu, Apr 25, 2024, 20:56 g.peterhoff--- via Boost
Hello, I would like to provide modern logic classes, please see https://github.com/boostorg/logic/issues/30 What are your opinions/comments on this?
Thanks for sharing. Could we have some motivating use cases for these types and functions? Regards, &rzej;
thx Gero
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thanks for sharing. Could we have some motivating use cases for these types and functions?
This is supposed to be a general library, but in my opinion with a better implementation for three-valued logic. tribool can be replaced by bool3. What bothers me about tribool is: * strange implementation of indeterminate * no support for weak negation https://de.wikipedia.org/wiki/Dreiwertige_Logik#Starke_und_schwache_Negation https://arxiv.org/pdf/cs/0511041.pdf * no support for - std::numeric_limits - std::to_(w)string - std::from/to_chars or boost::from/to_chars - std::formatter for std::format I would be grateful for any further ideas/criticism. regards Gero
sob., 4 maj 2024 o 09:47 g.peterhoff@t-online.de
Thanks for sharing. Could we have some motivating use cases for these types and functions?
This is supposed to be a general library, but in my opinion with a better implementation for three-valued logic. tribool can be replaced by bool3. What bothers me about tribool is: * strange implementation of indeterminate * no support for weak negation
https://de.wikipedia.org/wiki/Dreiwertige_Logik#Starke_und_schwache_Negation https://arxiv.org/pdf/cs/0511041.pdf * no support for - std::numeric_limits - std::to_(w)string - std::from/to_chars or boost::from/to_chars - std::formatter for std::format
I would be grateful for any further ideas/criticism.
Gero, Since you are asking this question on a Boost distribution list, I assume that you would like to get a Boost-like review of your library. One criterion for a Boost-quality library that I can offer is the quality of the documentation. A good documentation should: * Briefly (in five minutes or less) convince the reader that it is worth investing time in studying the library, * Describe what computational problems it helps solving, * Convince that it will be a good fit in users' programs, * Demonstrate the usage, * Provide enough information that I know how to use it in my programs. For now, having browsed the repo and read this thread, I do not know what I would need this library for. The only information that I got is that `bool3` is an "improved" version of Boost.Tribool. I do not know why anyone would use `bool2` or `bool4`. As a potential user I would like to know that. Could you show us some small programs, where using `bool4` actually helps? Similarly, can you show us the program example where using a weak negation makes the program cleaner or more efficient or less bug-prone? I think this is the necessary step to enable more useful feedback and criticism. Regards, &rzej;
Since you are asking this question on a Boost distribution list, I assume that you would like to get a Boost-like review of your library. One criterion for a Boost-quality library that I can offer is the quality of the documentation. A good documentation should:
* Briefly (in five minutes or less) convince the reader that it is worth investing time in studying the library, * Describe what computational problems it helps solving, * Convince that it will be a good fit in users' programs, * Demonstrate the usage, * Provide enough information that I know how to use it in my programs.
For now, having browsed the repo and read this thread, I do not know what I would need this library for. The only information that I got is that `bool3` is an "improved" version of Boost.Tribool. I do not know why anyone would use `bool2` or `bool4`. As a potential user I would like to know that. Could you show us some small programs, where using `bool4` actually helps? Similarly, can you show us the program example where using a weak negation makes the program cleaner or more efficient or less bug-prone?
I think this is the necessary step to enable more useful feedback and criticism.
Hello Andrzej, thank you for your comments. Here is a short answer. As I said, this library (like all boost libraries) is for general purposes. You could also ask why there is e.g. boost::math::quaternion/octonion. I don't know of a specific purpose for this either, but it makes sense to have them generally available. tribool is used in some booost libraries, which proves the usefulness of bool3. You can also provide bool4/2, since the implementation is quite simple. I think that a boost class - should be as complete as possible in terms of its operations/operators - should provide as many (if possible/useful) std operations as possible Unfortunately tribool does not do that. small documentation Because of the strange implementation of tribool::indeterminate, the classes are *not* compatible with tribool, as they should be in the same namespace. This is checked (static_assert). Compatibility could be achieved by: - bool4/3/2 in its own namespace (e.g. logic2) -> but I don't think that makes sense - typedef bool3 tribool; not checked implement bool4/3/2 - operator&& ooperator|| - operator! - operator~ weak negation; for bool2 this is identical to operator! - conversion constructors, where constructor(something) is deleted to prevent misuse - conversion operators for bool and unsigned - operator<< operator>> for streams, whereby boolalpha is taken into account; however, false is always returned for operator>> in the event of an error - to_(w)string like to_(w)string(bool) -> numeric result - numeric_limits - if available from/to_chars and/or boost::from/to_chars - if available formatter (but is still very simple) - the values are encapsulated and cannot be manipulated directly There is really nothing more to say. I have implemented the logical operators for bool4/3 using a table and for bool2 using bit operations. As already written, the tables should be checked again for correctness. https://github.com/boostorg/logic/issues/30 regards Gero
sob., 4 maj 2024 o 18:44 g.peterhoff@t-online.de
Since you are asking this question on a Boost distribution list, I assume that you would like to get a Boost-like review of your library. One criterion for a Boost-quality library that I can offer is the quality of the documentation. A good documentation should:
* Briefly (in five minutes or less) convince the reader that it is worth investing time in studying the library, * Describe what computational problems it helps solving, * Convince that it will be a good fit in users' programs, * Demonstrate the usage, * Provide enough information that I know how to use it in my programs.
For now, having browsed the repo and read this thread, I do not know what I would need this library for. The only information that I got is that `bool3` is an "improved" version of Boost.Tribool. I do not know why anyone would use `bool2` or `bool4`. As a potential user I would like to know that. Could you show us some small programs, where using `bool4` actually helps? Similarly, can you show us the program example where using a weak negation makes the program cleaner or more efficient or less bug-prone?
I think this is the necessary step to enable more useful feedback and criticism.
Hello Andrzej, thank you for your comments. Here is a short answer. As I said, this library (like all boost libraries) is for general purposes.
Boost libraries, like Boost.Optional are indeed general-purpose, but if you look at their docs they will demonstrate why and when people might want to use them.
You could also ask why there is e.g. boost::math::quaternion/octonion. I don't know of a specific purpose for this either, but it makes sense to have them generally available.
Interesting. It looks like we have two quaternion implementations in Boost. The other being in Boost.QVM. It is nicely documented there, along with its motivation (for representing rotations in 3D space. The following thread demonstrates that people want it: https://groups.google.com/g/boost-developers-archive/c/gl4GxscZ1OU tribool is used in some booost libraries, which proves the usefulness of
bool3. You can also provide bool4/2, since the implementation is quite simple.
I think that a boost class - should be as complete as possible in terms of its operations/operators - should provide as many (if possible/useful) std operations as possible
Unfortunately tribool does not do that.
small documentation Because of the strange implementation of tribool::indeterminate, the classes are *not* compatible with tribool, as they should be in the same namespace. This is checked (static_assert). Compatibility could be achieved by: - bool4/3/2 in its own namespace (e.g. logic2) -> but I don't think that makes sense - typedef bool3 tribool; not checked implement bool4/3/2 - operator&& ooperator|| - operator! - operator~ weak negation; for bool2 this is identical to operator! - conversion constructors, where constructor(something) is deleted to prevent misuse - conversion operators for bool and unsigned - operator<< operator>> for streams, whereby boolalpha is taken into account; however, false is always returned for operator>> in the event of an error - to_(w)string like to_(w)string(bool) -> numeric result - numeric_limits - if available from/to_chars and/or boost::from/to_chars - if available formatter (but is still very simple) - the values are encapsulated and cannot be manipulated directly
There is really nothing more to say.
I have implemented the logical operators for bool4/3 using a table and for bool2 using bit operations. As already written, the tables should be checked again for correctness.
So it looks like you are saying that you wanted to provide a better tribool and bool2 and bool4 are just a byproduct of this endeavour. Is that right? Well I do not know why I would ever prefer `bool2` over just `bool`. For bool3 I can at least imagine a use case (true false and "I don't know"), but the docs do not give us any example that would show how the third state would be called. For `bool4` I do not even imagine how fthe four states would be called. The literature that you provide (the part that is not in german) offers at least two different models for four-state bool logic. What nming did you choose? Can the documentation show it? https://philosophy.stackexchange.com/a/97379 The above description says that for a three-value logic there are three kinds of negation: the standard one, the weak, and the strong. Give the rationale (in the documentation) why you provide only two. You use the two operators for the two negations. But your choice of symbols is absolutely arbitrary. It would be less error-prone if the other negations were named functions. Also, the documentation should say why you decided to put all the negation operations in the same type rather than offering three different types with different negation semantics. It is not clear to me if any use case requires all of these negation types together. Regards, &rzej;
regards Gero
Hello Andrzej, thanks for your comments, but I think we should continue the discussion in the relevant repository https://github.com/boostorg/logic/issues/30 regards Gero
Since you are asking this question on a Boost distribution list, I assume that you would like to get a Boost-like review of your library. One criterion for a Boost-quality library that I can offer is the quality of the documentation. A good documentation should:
* Briefly (in five minutes or less) convince the reader that it is worth investing time in studying the library, * Describe what computational problems it helps solving, * Convince that it will be a good fit in users' programs, * Demonstrate the usage, * Provide enough information that I know how to use it in my programs.
I agree with this, but tribool's documentation could also be better in that regard. It addresses points 4 and 5, but I have to distill 1-3 myself from its tutorial. Apart from the more refined logical operators, tribool acts like a optional<bool>. I assume tribool has a size of 1 byte (that should be stated in the docs), while optional<bool> would have a size of 2 byte unless this case was specialised in the implementation. A motivation of bool3 could point out how it adds value compared to a generic template type like optional.
That three valued logic isn't actually Boolean bothers me the most. On Sat, May 4, 2024 at 3:47 AM g.peterhoff--- via Boost < boost@lists.boost.org> wrote:
Thanks for sharing. Could we have some motivating use cases for these types and functions?
This is supposed to be a general library, but in my opinion with a better implementation for three-valued logic. tribool can be replaced by bool3. What bothers me about tribool is: * strange implementation of indeterminate * no support for weak negation
https://de.wikipedia.org/wiki/Dreiwertige_Logik#Starke_und_schwache_Negation https://arxiv.org/pdf/cs/0511041.pdf * no support for - std::numeric_limits - std::to_(w)string - std::from/to_chars or boost::from/to_chars - std::formatter for std::format
I would be grateful for any further ideas/criticism.
regards Gero
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (8)
-
Andrzej Krzemienski
-
Daniele Lupo
-
g.peterhoff@t-online.de
-
Hans Dembinski
-
Kostas Savvidis
-
Robert Ramey
-
Steve Downey
-
Vinnie Falco