Material Conditional and Equivalence in Programming

88 views Asked by At

I have just started reading into propositional calculus/logic, and have realised that a lot of the foundational concepts in this area are similar to those encountered in programming. That is, propositions/sentences in logic (due to the fact that they have truth-values), are similar to Booleans in programming. Furthermore, most of the sentential connectives are reflected in the logical operators adopted in programming. For instance, in C++, !, &&, and || behave in the same way that ¬, ∧, and ∨ behave, respectively, in logic.

My question is whether there are (say, C++) "equivalents" for the logical operators of implication (->) and equivalence (<->)? If so, what are they? If not, what is the reason they have they not been adopted? So, although I cannot think of any reason why they would be adopted, I would like to know if there is a specific reason that they are omitted.

1

There are 1 answers

3
HolyBlackCat On

Implication can be replaced with <=, and equivalence is ==.

However, unlike && and ||, those don't convert their arguments to bool (since they're not inherently boolean operators).