Definition counter := Z.Record Config : Set := mkconfig {co : counter}.Record Config : Set := mkconfig {co : counter}.Record Config : Set := mkconfig {co : counter}.Definition mk_init_config := mkconfig x.Definition decrement_trans (c : Config) := mkconfig (co c - 1)%Z.Definition divide_trans (c : Config) := mkconfig (Zeven.Zdiv2 (co c)).Inductive transition (c : Config) : Set :=
  | decrement : (co c > 0)%Z -> Zeven.Zodd (co c) -> transition c
  | divide : (co c > 0)%Z -> Zeven.Zeven (co c) -> transition c.Inductive transition (c : Config) : Set :=
  | decrement : (co c > 0)%Z -> Zeven.Zodd (co c) -> transition c
  | divide : (co c > 0)%Z -> Zeven.Zeven (co c) -> transition c.Inductive transition (c : Config) : Set :=
  | decrement : (co c > 0)%Z -> Zeven.Zodd (co c) -> transition c
  | divide : (co c > 0)%Z -> Zeven.Zeven (co c) -> transition c.Definition next_config (c : Config) (t : transition c) :=
  match t with
  | decrement h1 h2 => decrement_trans c
  | divide h1 h2 => divide_trans c
  end.Inductive legal : Config -> Prop :=
  | begin : legal (mk_init_config x)
  | after :
      forall (c : Config) (t : transition c),
      legal c -> legal (next_config c t).Inductive legal : Config -> Prop :=
  | begin : legal (mk_init_config x)
  | after :
      forall (c : Config) (t : transition c),
      legal c -> legal (next_config c t).Inductive legal : Config -> Prop :=
  | begin : legal (mk_init_config x)
  | after :
      forall (c : Config) (t : transition c),
      legal c -> legal (next_config c t).

Lemma fin_O : forall x : Z, (x >= 0)%Z -> legal x (mkconfig 0%Z).