Module Sequences

A library of relation operators defining sequences of transitions and useful properties about them.

Set Implicit Arguments.

Section SEQUENCES.

Variable A: Type.

Zero, one or several transitions: reflexive, transitive closure of R.

Inductive star (R: A -> A -> Prop): A -> A -> Prop :=
  | star_refl: forall a,
      star R a a
  | star_step: forall a b c,
      R a b -> star R b c -> star R a c.

Lemma star_one:
  forall (R: A -> A -> Prop) (a b: A), R a b -> star R a b.
Proof.

Lemma star_trans:
  forall (R: A -> A -> Prop) (a b: A),
  star R a b -> forall c, star R b c -> star R a c.
Proof.

One or several transitions: transitive closure of R.

Inductive plus (R: A -> A -> Prop): A -> A -> Prop :=
  | plus_left: forall a b c,
      R a b -> star R b c -> plus R a c.

Lemma plus_one:
  forall (R: A -> A -> Prop) a b, R a b -> plus R a b.
Proof.

Lemma plus_star:
  forall (R: A -> A -> Prop) a b,
  plus R a b -> star R a b.
Proof.

Lemma plus_star_trans:
  forall (R: A -> A -> Prop) a b c, plus R a b -> star R b c -> plus R a c.
Proof.

Lemma star_plus_trans:
  forall (R: A -> A -> Prop) a b c, star R a b -> plus R b c -> plus R a c.
Proof.

Lemma plus_trans:
  forall (R: A -> A -> Prop) a b c, plus R a b -> plus R b c -> plus R a c.
Proof.

Lemma plus_right:
  forall (R: A -> A -> Prop) a b c, star R a b -> R b c -> plus R a c.
Proof.

Absence of transitions.

Definition irred (R: A -> A -> Prop) (a: A) : Prop := forall b, ~(R a b).

Infinitely many transitions.

CoInductive infseq (R: A -> A -> Prop): A -> Prop :=
  | infseq_step: forall a b,
      R a b -> infseq R b -> infseq R a.

Coinduction principles to show the existence of infinite sequences.

Lemma infseq_coinduction_principle:
  forall (R: A -> A -> Prop) (X: A -> Prop),
  (forall a, X a -> exists b, R a b /\ X b) ->
  forall a, X a -> infseq R a.
Proof.

Lemma infseq_coinduction_principle_2:
  forall (R: A -> A -> Prop) (X: A -> Prop),
  (forall a, X a -> exists b, plus R a b /\ X b) ->
  forall a, X a -> infseq R a.
Proof.

An example of use of infseq_coinduction_principle.

Lemma infseq_alternate_characterization:
  forall (R: A -> A -> Prop) a,
  (forall b, star R a b -> exists c, R b c) ->
  infseq R a.
Proof.

A sequence is either infinite or stops on an irreducible term. This property needs excluded middle from classical logic.

Require Import Classical.

Lemma infseq_or_finseq:
  forall (R: A -> A -> Prop) a, infseq R a \/ exists b, star R a b /\ irred R b.
Proof.

Additional properties for deterministic transition relations.

Section DETERMINISM.

Variable R: A -> A -> Prop.
Hypothesis R_determ: forall a b c, R a b -> R a c -> b = c.

Uniqueness of transition sequences.

Lemma star_star_inv:
  forall a b, star R a b -> forall c, star R a c -> star R b c \/ star R c b.
Proof.

Lemma finseq_unique:
  forall a b b',
  star R a b -> irred R b ->
  star R a b' -> irred R b' ->
  b = b'.
Proof.

Lemma infseq_star_inv:
  forall a b, star R a b -> infseq R a -> infseq R b.
Proof.

Lemma infseq_finseq_excl:
  forall a b,
  star R a b -> irred R b -> infseq R a -> False.
Proof.

End DETERMINISM.

End SEQUENCES.

Hint Resolve star_refl star_step star_one star_trans plus_left plus_one
             plus_star plus_star_trans star_plus_trans plus_right: sequences.