Lvc.Infra.LengthEq

Require Import Arith Coq.Lists.List Setoid Coq.Lists.SetoidList Omega.
Require Export Infra.Option EqDec AutoIndTac Util.

Set Implicit Arguments.

Inductive length_eq X Y : list Xlist YType :=
  | LenEq_nil : length_eq nil nil
  | LenEq_cons x XL y YL : length_eq XL YLlength_eq (x::XL) (y::YL).

Lemma length_eq_refl X (XL:list X)
  : length_eq XL XL.

Lemma length_eq_sym X Y (XL:list X) (YL:list Y)
  : length_eq XL YLlength_eq YL XL.

Lemma length_eq_trans X Y Z (XL:list X) (YL:list Y) (ZL:list Z)
  : length_eq XL YLlength_eq YL ZLlength_eq XL ZL.

Lemma length_length_eq X Y (L:list X) (:list Y)
  : length L = length length_eq L .

Lemma length_eq_length X Y (L:list X) (:list Y)
  : length_eq L length L = length .

Lemma length_eq_dec {X} (L : list X)
  : length_eq L + (length_eq L False).

Ltac length_equify :=
  repeat (match goal with
            | [ H : length ?A = length ?B |- _ ] ⇒
              eapply length_length_eq in H
          end).