Returns a AFW reading the complemented language read by
    input AFW.

    Let :math:`A = (Σ, S, s^0 , ρ, F )`. Define :math:`Ā = (Σ, S,
    s^0 , \overline{ρ}, S − F )`,
    where :math:`\overline{ρ}(s, a) = \overline{ρ(s, a)}` for all
    :math:`s ∈ S` and :math:`a ∈ Σ`.
    That is, :math:`\overline{ρ}` is the dualized transition
    function. It can be shown that :math:`L( Ā) = Σ^∗ − L(A)`.

    The input afw need to be completed i.e. each non existing
    transition must be added pointing to False.

    :param dict afw: input AFW.
    :return: *(dict)* representing a AFW.

def afw_complementation(afw: dict) -> dict:
    """ Returns a AFW reading the complemented language read by
    input AFW.

    Let :math:`A = (Σ, S, s^0 , ρ, F )`. Define :math:`Ā = (Σ, S,
    s^0 , \overline{ρ}, S − F )`,
    where :math:`\overline{ρ}(s, a) = \overline{ρ(s, a)}` for all
    :math:`s ∈ S` and :math:`a ∈ Σ`.
    That is, :math:`\overline{ρ}` is the dualized transition
    function. It can be shown that :math:`L( Ā) = Σ^∗ − L(A)`.

    The input afw need to be completed i.e. each non existing
    transition must be added pointing to False.

    :param dict afw: input AFW.
    :return: *(dict)* representing a AFW.
    """
    completed_input = afw_completion(deepcopy(afw))

    complemented_afw = {
        'alphabet': completed_input['alphabet'],
        'states': completed_input['states'],
        'initial_state': completed_input['initial_state'],
        'accepting_states':
            completed_input['states'].difference(afw['accepting_states']),
        'transitions': dict()
    }

    for transition in completed_input['transitions']:
        complemented_afw['transitions'][transition] = \
            formula_dual(completed_input['transitions'][transition])
    return complemented_afw