let match_message (name : string) (state : string) (m1 : string) (name2 : string) (state2 : string) (m2 : string) : bool =
         let rec adjust_pair m =
                let decomp = decompose m in
                if(decomp=[])
                then m
                else(
                        if((car decomp)="pair")
                        then((car decomp)^"("^(list2string ","
                                (List.map 
                                        (fun e -> 
                                                let tmp_decomp = decompose e in
                                                if(tmp_decomp=[]) then e
                                                else if((car tmp_decomp)="pair"then (list2string "," (List.map adjust_pair (cdr tmp_decomp)))
                                                else adjust_pair e
                        ) (cdr decomp)))^")")
                        else ((car decomp)^"("^(list2string "," (List.map adjust_pair (cdr decomp)))^")")
                )
        in
        let (exist_match,sub) = get_match_message_story name state m1 name2 state2 m2 (!untyped_variable) in
        if(exist_match<>(-1))
        then(
                        if (sub=[]) then false
                        else true
                )
        else(           
                let t1 = get_type_of_var_in_state name state m1 in
                let t2 = get_type_of_var_in_state name2 state2 m2 in
                if(not(compatible t1 t2))
                then (add_in_match_message_story name state m1 name2 state2 m2 (!untyped_variable) []; false)
                else(
                        let m01 = adjust_pair m1 in
                        let m02 = adjust_pair m2 in
                        let l_sub = unify name m01 name2 m02 !untyped_variable in
                        add_in_match_message_story name state m1 name2 state2 m2 (!untyped_variable) l_sub;
                        (l_sub<>[])
                )
        )