(* partial version of compatible QI *)

Definition p_assignment_function := function -> option(list nat -> nat).(* partial assignment of a term*)
Fixpoint p_term_assignment (qic:assignment_constructor) (qif:p_assignment_function)
(t:term) {struct t} : option nat:=
   match t with
  | var v=> Some 0 (* pas necessaire. Les QI sont toujours appliquées sur des termes clots. *)
  | capply c lt => option_map (qic c) (option_list_map(map (p_term_assignment qic qif) lt))
  | fapply f lt=> option_bind (fun g => option_map g (option_list_map(map (p_term_assignment qic qif)  lt)))
                              (qif f)
end.Definition complete_p_QI (qif : p_assignment_function) f := 
  complete_option maxl (qif f).

Lemma p_term_assignment_term_assignment qic qif t v: p_term_assignment qic qif t = Some v -> term_assignment qic (complete_p_QI qif) t = v.