Returns the dual of the input formula.

    The dual operation on formulas in :math:`B^+(X)` is defined as:
    the dual :math:`\overline{θ}` of a formula :math:`θ` is obtained from θ by
    switching :math:`∧` and :math:`∨`, and
    by switching :math:`true` and :math:`false`.

    :param str input_formula: original string.
    :return: *(str)*, dual of input formula.

def formula_dual(input_formula: str) -> str:
    """ Returns the dual of the input formula.

    The dual operation on formulas in :math:`B^+(X)` is defined as:
    the dual :math:`\overline{θ}` of a formula :math:`θ` is obtained from θ by
    switching :math:`∧` and :math:`∨`, and
    by switching :math:`true` and :math:`false`.

    :param str input_formula: original string.
    :return: *(str)*, dual of input formula.
    """
    conversion_dictionary = {
        'and': 'or',
        'or': 'and',
        'True': 'False',
        'False': 'True'
    }

    return re.sub(
        '|'.join(re.escape(key) for key in conversion_dictionary.keys()),
        lambda k: conversion_dictionary[k.group(0)], input_formula)