Fixpoint term_from_pattern (p : pattern) : term :=
match p with
| p_var v => var v
| p_capply c lp => capply c (map term_from_pattern lp)
end.
Coercion term_from_pattern : pattern >-> term.

Lemma term_from_pattern_not_fapply : forall v f lt, ~ term_from_pattern v = fapply f lt.
Fixpoint term_value (t: term) : Prop :=
match t with
| capply _ lt => andl (map term_value lt)
| _ => False
end.