Fixpoint weight (a : form) : nat :=
  match a with
  | Falsum => 1
  | Atom _ => 1
  | AndF a b => S (weight a + weight b)
  | OrF Falsum b => S (weight b)
  | OrF (Atom _) b => S (weight b)
  | OrF a b => S (S (weight b + weight a))
  | Imp a b => weight_neg a + weight b
  end
 
 with weight_neg (a : form) : nat :=
  match a with
  | Falsum => 0
  | Atom _ => 0
  | AndF a b => S (weight_neg a + weight_neg b)
  | OrF a b => S (S (S (weight_neg a + weight_neg b)))
  | Imp Falsum b => 1
  | Imp (Atom _) Falsum => 2
  | Imp (Atom _) (Atom _) => 1
  | Imp (Atom _) b => S (S (S (weight_neg b)))
  | Imp a b => S (S (S (S (weight_neg b + weight a))))
  end.Fixpoint weight_goal (a : form) : nat :=
  match a with
  | Falsum => 0
  | Atom _ => 0
  | AndF _ _ => 1
  | OrF _ _ => 1
  | Imp _ b => S (weight_goal b)
  end.Definition weight_gamma :=
  fold_right (fun (a : form) (n : nat) => weight a + n) 0.

Lemma weight_gamma_weak3 : forall (a b c d : form) (gamma : flist) (n : nat), weight a + weight b + weight c < weight d -> weight_gamma (d :: gamma) < S n -> weight_gamma (a :: b :: c :: gamma) < n.