(* 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 value_as_p_term_assignment qic qif: forall v:value, (p_term_assignment qic qif (term_from_value v)) = Some (value_assignment qic v).