Section BD_Whnf.
Fixpoint whnf_bd (e : env) (t : term) {struct t} : Prop :=
match t with
| Ref n =>
match delta_reduce n e with
| inleft _ => False
| _ => True
end
| App u v => whnf_bd e u /\ (forall T t : term, u <> Abs T t)
| _ => True
end.
Hint Unfold whnf_bd: pts.
simple induction 1; simpl in |- *; intros; auto with arith pts.
generalize H1.
elim H0; simpl in |- *; auto with arith pts.
simple destruct 1.
simple induction 1; simpl in |- *; intros.
inversion_clear H4.
elim H6 with T M; auto with arith pts.
simple induction 1; simpl in |- *.
do 5 intro.
elim (delta_reduce n e1); intros.
elim H5.
elim b with (lift (S n) d).
apply delta_intro with T; auto with arith pts.
intros.
inversion_clear H4.
split; auto with arith pts.
red in |- *; intros.
clear H3.
inversion_clear H4 in H2.
generalize H5 H6.
clear H5 H6.
inversion_clear H2; simpl in |- *.
inversion_clear H3.
inversion_clear H2; simpl in |- *; intros.
inversion_clear H5.
elim H3 with T0 M; auto with arith pts.
inversion_clear H2.
simpl in |- *.
elim (delta_reduce n e0); intros.
auto with arith pts.
elim b with (lift (S n) d).
apply delta_intro with T0; auto with arith pts.
intros.
elim H6 with M t0; auto with arith pts.
intros.
elim H6 with T M; auto with arith pts.
Qed.

Lemma whnf_bd_head_normal :
forall (e : env) (t : term), whnf_bd e t -> head_normal beta_delta e t.