def nfa_union(nfa_1: dict, nfa_2: dict) ->dict:
    """ Returns a NFA that reads the union of the NFAs in input.

    Let :math:`A_1 = (Σ,S_1,S_1^0,ρ_1,F_1)` and :math:`A_2 =(Σ,
    S_2,S_2^0,ρ_2,F_2)` be two NFAs. here is a NFA
    :math:`A_∨` that nondeterministically chooses :math:`A_1` or
    :math:`A_2` and runs it on the input word.
    It is defined as:

    :math:`A_∨ = (Σ, S, S_0 , ρ, F )`

    where:

    • :math:`S = S_1 ∪ S_2`
    • :math:`S_0 = S_1^0 ∪ S_2^0`
    • :math:`F = F_1 ∪ F_2`
    • :math:`ρ = ρ_1 ∪ ρ_2` , that is :math:`(s, a, s' ) ∈ ρ` if
      :math:`[ s ∈ S_1\\ and\\ (s, a, s' ) ∈ ρ_1 ]` OR :math:`[ s ∈
      S_2\\ and\\ (s, a, s' ) ∈ ρ_2 ]`

    Pay attention to avoid having the NFAs with state names in common, in case
    use :mod:`PySimpleAutomata.NFA.rename_nfa_states` function.

    :param dict nfa_1: first input NFA;
    :param dict nfa_2: second input NFA.
    :return: *(dict)* representing the united NFA.
    """
    union = {'alphabet': nfa_1['alphabet'].union(nfa_2['alphabet']),
        'states': nfa_1['states'].union(nfa_2['states']), 'initial_states':
        nfa_1['initial_states'].union(nfa_2['initial_states']),
        'accepting_states': nfa_1['accepting_states'].union(nfa_2[
        'accepting_states']), 'transitions': nfa_1['transitions'].copy()}
    for trans in nfa_2['transitions']:
        for elem in nfa_2['transitions'][trans]:
            union['transitions'].setdefault(trans, set()).add(elem)
    return union
