Inductive letter : Set :=
  | A : letter
  | B : letter.Inductive letter : Set :=
  | A : letter
  | B : letter.Inductive letter : Set :=
  | A : letter
  | B : letter.Definition word := list letter.Inductive emb : word -> word -> Prop :=
  | emb0 : forall ys : word, emb nil ys
  | emb1 :
      forall (xs ys : list letter) (y : letter),
      emb xs ys -> emb xs (y :: ys)
  | emb2 :
      forall (xs ys : list letter) (x : letter),
      emb xs ys -> emb (x :: xs) (x :: ys).Inductive emb : word -> word -> Prop :=
  | emb0 : forall ys : word, emb nil ys
  | emb1 :
      forall (xs ys : list letter) (y : letter),
      emb xs ys -> emb xs (y :: ys)
  | emb2 :
      forall (xs ys : list letter) (x : letter),
      emb xs ys -> emb (x :: xs) (x :: ys).Inductive emb : word -> word -> Prop :=
  | emb0 : forall ys : word, emb nil ys
  | emb1 :
      forall (xs ys : list letter) (y : letter),
      emb xs ys -> emb xs (y :: ys)
  | emb2 :
      forall (xs ys : list letter) (x : letter),
      emb xs ys -> emb (x :: xs) (x :: ys).Inductive emb : word -> word -> Prop :=
  | emb0 : forall ys : word, emb nil ys
  | emb1 :
      forall (xs ys : list letter) (y : letter),
      emb xs ys -> emb xs (y :: ys)
  | emb2 :
      forall (xs ys : list letter) (x : letter),
      emb xs ys -> emb (x :: xs) (x :: ys).Inductive L (v : word) : list word -> Prop :=
  | L0 : forall (w : word) (ws : list word), emb w v -> L v (w :: ws)
  | L1 : forall (w : word) (ws : list word), L v ws -> L v (w :: ws).Inductive L (v : word) : list word -> Prop :=
  | L0 : forall (w : word) (ws : list word), emb w v -> L v (w :: ws)
  | L1 : forall (w : word) (ws : list word), L v ws -> L v (w :: ws).Inductive L (v : word) : list word -> Prop :=
  | L0 : forall (w : word) (ws : list word), emb w v -> L v (w :: ws)
  | L1 : forall (w : word) (ws : list word), L v ws -> L v (w :: ws).Inductive good : list word -> Prop :=
  | good0 : forall (ws : list word) (w : word), L w ws -> good (w :: ws)
  | good1 : forall (ws : list word) (w : word), good ws -> good (w :: ws).Inductive good : list word -> Prop :=
  | good0 : forall (ws : list word) (w : word), L w ws -> good (w :: ws)
  | good1 : forall (ws : list word) (w : word), good ws -> good (w :: ws).Inductive good : list word -> Prop :=
  | good0 : forall (ws : list word) (w : word), L w ws -> good (w :: ws)
  | good1 : forall (ws : list word) (w : word), good ws -> good (w :: ws).Inductive R (a : letter) : list word -> list word -> Prop :=
  | R0 : R a nil nil
  | R1 :
      forall (vs ws : list word) (w : word),
      R a vs ws -> R a (w :: vs) ((a :: w) :: ws).Inductive R (a : letter) : list word -> list word -> Prop :=
  | R0 : R a nil nil
  | R1 :
      forall (vs ws : list word) (w : word),
      R a vs ws -> R a (w :: vs) ((a :: w) :: ws).Inductive R (a : letter) : list word -> list word -> Prop :=
  | R0 : R a nil nil
  | R1 :
      forall (vs ws : list word) (w : word),
      R a vs ws -> R a (w :: vs) ((a :: w) :: ws).Inductive T (a : letter) : list word -> list word -> Prop :=
  | T0 :
      forall (b : letter) (w : word) (ws zs : list word),
      a <> b -> R b ws zs -> T a (w :: zs) ((a :: w) :: zs)
  | T1 :
      forall (w : word) (ws zs : list word),
      T a ws zs -> T a (w :: ws) ((a :: w) :: zs)
  | T2 :
      forall (b : letter) (w : word) (ws zs : list word),
      a <> b -> T a ws zs -> T a ws ((b :: w) :: zs).Inductive T (a : letter) : list word -> list word -> Prop :=
  | T0 :
      forall (b : letter) (w : word) (ws zs : list word),
      a <> b -> R b ws zs -> T a (w :: zs) ((a :: w) :: zs)
  | T1 :
      forall (w : word) (ws zs : list word),
      T a ws zs -> T a (w :: ws) ((a :: w) :: zs)
  | T2 :
      forall (b : letter) (w : word) (ws zs : list word),
      a <> b -> T a ws zs -> T a ws ((b :: w) :: zs).Inductive T (a : letter) : list word -> list word -> Prop :=
  | T0 :
      forall (b : letter) (w : word) (ws zs : list word),
      a <> b -> R b ws zs -> T a (w :: zs) ((a :: w) :: zs)
  | T1 :
      forall (w : word) (ws zs : list word),
      T a ws zs -> T a (w :: ws) ((a :: w) :: zs)
  | T2 :
      forall (b : letter) (w : word) (ws zs : list word),
      a <> b -> T a ws zs -> T a ws ((b :: w) :: zs).Inductive T (a : letter) : list word -> list word -> Prop :=
  | T0 :
      forall (b : letter) (w : word) (ws zs : list word),
      a <> b -> R b ws zs -> T a (w :: zs) ((a :: w) :: zs)
  | T1 :
      forall (w : word) (ws zs : list word),
      T a ws zs -> T a (w :: ws) ((a :: w) :: zs)
  | T2 :
      forall (b : letter) (w : word) (ws zs : list word),
      a <> b -> T a ws zs -> T a ws ((b :: w) :: zs).Inductive bar : list word -> Set :=
  | bar1 : forall ws : list word, good ws -> bar ws
  | bar2 : forall ws : list word, (forall w : word, bar (w :: ws)) -> bar ws.Inductive bar : list word -> Set :=
  | bar1 : forall ws : list word, good ws -> bar ws
  | bar2 : forall ws : list word, (forall w : word, bar (w :: ws)) -> bar ws.Inductive bar : list word -> Set :=
  | bar1 : forall ws : list word, good ws -> bar ws
  | bar2 : forall ws : list word, (forall w : word, bar (w :: ws)) -> bar ws.Hint Extern 5 (?X1 <> ?X2) => intro; discriminate.

Theorem lemma4 : forall (ws zs : list word) (a : letter), R a ws zs -> ws <> nil -> T a ws zs.