Search code examples
logical-operatorslibreofficelibreoffice-calc

Truth tables in libreoffice calc: existence of the implies and equivalence functions?


I'm trying to construct a truth table in Libreoffice Calc and can't seem too find the implies- nor equivalence functions in the documentation. Do they exist and if so, what are they called?


Solution

  • You could write your own functions. From the menu choose "Tools" -> "Macros" -> "Organize Macros" -> "LibreOffice Basic...". In the new window choose "Tools" -> "Select Module". Create a new module or select and existing and click the "Edit" button. In the code pane you can now define your functions, for example:

    Function IMPLIES (A As Boolean, B As Boolean) As Boolean
      IMPLIES = (NOT A) OR B
    End Function
    
    Function EQUIVALENT (A As Boolean, B As Boolean) As Boolean
      EQUIVALENT = (A AND B) OR ((NOT A) AND (NOT B))
    End Function
    

    Save and you can use the functions like regular functions in your sheet, e.g. =IMPLIES(TRUE, FALSE) or =EQUIVALENT(FALSE, TRUE).