0

I know that "if a then b" is represented as $a \implies b$, but how is "if a then b else c" represented?

I know in most programming languages there's a way to write this, but is there a way to write it in logic notation? Thanks in advance :]

The_Animator
  • 772
  • 3
  • 23

1 Answers1

2

The expression you want is $(a \implies b) \wedge ((\neg a) \implies c)$.

(This was previously a comment; posting it as an answer as requested)

Chris Eagle
  • 5,558
  • Quick follow-up — would we need the parenthesis around the ¬a if they were close enough that is just implied that the a was negated and not the (a => c)? – The_Animator Jan 03 '24 at 17:19
  • 1
    This is a matter of convention. I think the most common convention is that $\neg$ has priority over any of the binary connectives, so that $\neg a \implies c$ should be read as $(\neg a) \implies c$ anyway, but I also think that it is just clearer to put the parentheses in and leave nothing to chance. – Chris Eagle Jan 03 '24 at 20:12