(** * Arity

  - [arity e] returns the arity (i.e., the number variables)
    of the expression [e] if it is well formed, or an error including the arity of the subterms.
*)

Inductive Arity : Set :=
| error_Rec : Arity -> Arity -> Arity -> Arity -> Arity
| error_Comp : Arity -> list Arity -> Arity
| error_Proj : nat -> nat -> Arity
| ok_arity : nat -> Arity.(** * Arity

  - [arity e] returns the arity (i.e., the number variables)
    of the expression [e] if it is well formed, or an error including the arity of the subterms.
*)

Inductive Arity : Set :=
| error_Rec : Arity -> Arity -> Arity -> Arity -> Arity
| error_Comp : Arity -> list Arity -> Arity
| error_Proj : nat -> nat -> Arity
| ok_arity : nat -> Arity.(** * Arity

  - [arity e] returns the arity (i.e., the number variables)
    of the expression [e] if it is well formed, or an error including the arity of the subterms.
*)

Inductive Arity : Set :=
| error_Rec : Arity -> Arity -> Arity -> Arity -> Arity
| error_Comp : Arity -> list Arity -> Arity
| error_Proj : nat -> nat -> Arity
| ok_arity : nat -> Arity.(** * Arity

  - [arity e] returns the arity (i.e., the number variables)
    of the expression [e] if it is well formed, or an error including the arity of the subterms.
*)

Inductive Arity : Set :=
| error_Rec : Arity -> Arity -> Arity -> Arity -> Arity
| error_Comp : Arity -> list Arity -> Arity
| error_Proj : nat -> nat -> Arity
| ok_arity : nat -> Arity.(** * Arity

  - [arity e] returns the arity (i.e., the number variables)
    of the expression [e] if it is well formed, or an error including the arity of the subterms.
*)

Inductive Arity : Set :=
| error_Rec : Arity -> Arity -> Arity -> Arity -> Arity
| error_Comp : Arity -> list Arity -> Arity
| error_Proj : nat -> nat -> Arity
| ok_arity : nat -> Arity.Definition arity_eq (a1 a2 : Arity) :=
  match a1, a2 with
    | ok_arity n1, ok_arity n2 => beq_nat n1 n2
    | _, _ => false
  end.

(* Specifications: *)
Lemma arity_eq_true x1 x2 : arity_eq x1 x2 = true -> x1 = x2.
Lemma arity_eq_refl : forall n, arity_eq (ok_arity n) (ok_arity n) = true.