Definition unify_list
  (s : list (variable * value)) (lv : list value) (lp : list pattern) :
  option (variable -> value) :=
  option_map (assoc_default (variable_beq variable_eq_dec) value_default) (unify_list_aux s lv lp).

Lemma psubst_app p v (s s' : list (variable * value)) : (forall x : variable, assoc (variable_beq variable_eq_dec) x s <> None -> assoc (variable_beq variable_eq_dec) x s' = None) -> (forall x, In x (vars_of_pattern p) -> assoc (variable_beq variable_eq_dec) x s <> None) -> psubst (assoc_default (variable_beq variable_eq_dec) value_default s ) p = v -> psubst (assoc_default (variable_beq variable_eq_dec) value_default (s' ++ s)) p = v.