Library Relation
Copyright (c) 2018 by Karl Crary
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
reflexive, transitive closure
Inductive star {T : Type} (R : T -> T -> Prop) : T -> T -> Prop :=
| star_refl {x}
: star R x x
| star_step {x y z}
: R x y
-> star R y z
-> star R x z.
Inductive starr {T : Type} (R : T -> T -> Prop) : T -> T -> Prop :=
| starr_refl {x}
: starr R x x
| starr_step {x y z}
: starr R x y
-> R y z
-> starr R x z.
Lemma star_trans :
forall (T : Type) (R : T -> T -> Prop) x y z,
star R x y
-> star R y z
-> star R x z.
Lemma star_transitive :
forall (T : Type) (R : T -> T -> Prop),
transitive T (star R).
Lemma star_one :
forall (T : Type) (R : T -> T -> Prop) x y,
R x y -> star R x y.
Lemma star_stepr :
forall (T : Type) (R : T -> T -> Prop) x y z,
star R x y
-> R y z
-> star R x z.
Lemma star_mono :
forall (T : Type) (R R' : T -> T -> Prop),
(forall x y, R x y -> R' x y)
-> forall x y, star R x y -> star R' x y.
| star_refl {x}
: star R x x
| star_step {x y z}
: R x y
-> star R y z
-> star R x z.
Inductive starr {T : Type} (R : T -> T -> Prop) : T -> T -> Prop :=
| starr_refl {x}
: starr R x x
| starr_step {x y z}
: starr R x y
-> R y z
-> starr R x z.
Lemma star_trans :
forall (T : Type) (R : T -> T -> Prop) x y z,
star R x y
-> star R y z
-> star R x z.
Lemma star_transitive :
forall (T : Type) (R : T -> T -> Prop),
transitive T (star R).
Lemma star_one :
forall (T : Type) (R : T -> T -> Prop) x y,
R x y -> star R x y.
Lemma star_stepr :
forall (T : Type) (R : T -> T -> Prop) x y z,
star R x y
-> R y z
-> star R x z.
Lemma star_mono :
forall (T : Type) (R R' : T -> T -> Prop),
(forall x y, R x y -> R' x y)
-> forall x y, star R x y -> star R' x y.
refl
Lemma star_map :
forall (S T : Type) (R : S -> S -> Prop) (R' : T -> T -> Prop) (f : S -> T),
(forall x y, R x y -> R' (f x) (f y))
-> forall x y, star R x y -> star R' (f x) (f y).
forall (S T : Type) (R : S -> S -> Prop) (R' : T -> T -> Prop) (f : S -> T),
(forall x y, R x y -> R' (f x) (f y))
-> forall x y, star R x y -> star R' (f x) (f y).
refl
refl
refl
Definition compose {T : Type} (R R' : T -> T -> Prop) (x x' : T) : Prop :=
exists x'', R x x'' /\ R' x'' x'.
exists x'', R x x'' /\ R' x'' x'.
transitive closure
Definition plus {T : Type} (R : T -> T -> Prop) : T -> T -> Prop :=
compose R (star R).
Definition plusr {T : Type} (R : T -> T -> Prop) : T -> T -> Prop :=
compose (star R) R.
Inductive plusi {T : Type} (R : T -> T -> Prop) : T -> T -> Prop :=
| plusi_one {x y}
: R x y
-> plusi R x y
| plusi_step {x y z}
: R x y
-> plusi R y z
-> plusi R x z.
Inductive plusri {T : Type} (R : T -> T -> Prop) : T -> T -> Prop :=
| plusri_one {x y}
: R x y
-> plusri R x y
| plusri_step {x y z}
: plusri R x y
-> R y z
-> plusri R x z.
Lemma plus_star :
forall (T : Type) (R : T -> T -> Prop) x y,
plus R x y -> star R x y.
Lemma star_plus :
forall (T : Type) (R : T -> T -> Prop) x y,
star R x y -> x = y \/ plus R x y.
Lemma star_neq_plus :
forall (T : Type) (R : T -> T -> Prop) x y,
star R x y -> x <> y -> plus R x y.
Lemma plus_one :
forall (T : Type) (R : T -> T -> Prop) x y,
R x y -> plus R x y.
Lemma plusr_plus :
forall (T : Type) (R : T -> T -> Prop) x y,
plusr R x y -> plus R x y.
Lemma plus_plusr :
forall (T : Type) (R : T -> T -> Prop) x y,
plus R x y -> plusr R x y.
compose R (star R).
Definition plusr {T : Type} (R : T -> T -> Prop) : T -> T -> Prop :=
compose (star R) R.
Inductive plusi {T : Type} (R : T -> T -> Prop) : T -> T -> Prop :=
| plusi_one {x y}
: R x y
-> plusi R x y
| plusi_step {x y z}
: R x y
-> plusi R y z
-> plusi R x z.
Inductive plusri {T : Type} (R : T -> T -> Prop) : T -> T -> Prop :=
| plusri_one {x y}
: R x y
-> plusri R x y
| plusri_step {x y z}
: plusri R x y
-> R y z
-> plusri R x z.
Lemma plus_star :
forall (T : Type) (R : T -> T -> Prop) x y,
plus R x y -> star R x y.
Lemma star_plus :
forall (T : Type) (R : T -> T -> Prop) x y,
star R x y -> x = y \/ plus R x y.
Lemma star_neq_plus :
forall (T : Type) (R : T -> T -> Prop) x y,
star R x y -> x <> y -> plus R x y.
Lemma plus_one :
forall (T : Type) (R : T -> T -> Prop) x y,
R x y -> plus R x y.
Lemma plusr_plus :
forall (T : Type) (R : T -> T -> Prop) x y,
plusr R x y -> plus R x y.
Lemma plus_plusr :
forall (T : Type) (R : T -> T -> Prop) x y,
plus R x y -> plusr R x y.
refl
Lemma plus_trans :
forall (T : Type) (R : T -> T -> Prop) x y z,
plus R x y -> plus R y z -> plus R x z.
Lemma plus_transitive :
forall (T : Type) (R : T -> T -> Prop),
transitive T (plus R).
Lemma plus_star_trans :
forall (T : Type) (R : T -> T -> Prop) x y z,
plus R x y -> star R y z -> plus R x z.
Lemma star_plus_trans :
forall (T : Type) (R : T -> T -> Prop) x y z,
star R x y -> plus R y z -> plus R x z.
Lemma plus_plusi :
forall (T : Type) (R : T -> T -> Prop) x y,
plus R x y -> plusi R x y.
Lemma plusi_plus :
forall (T : Type) (R : T -> T -> Prop) x y,
plusi R x y -> plus R x y.
Lemma plus_plusri :
forall (T : Type) (R : T -> T -> Prop) x y,
plus R x y -> plusri R x y.
Lemma plusri_plus :
forall (T : Type) (R : T -> T -> Prop) x y,
plusri R x y -> plus R x y.
forall (T : Type) (R : T -> T -> Prop) x y z,
plus R x y -> plus R y z -> plus R x z.
Lemma plus_transitive :
forall (T : Type) (R : T -> T -> Prop),
transitive T (plus R).
Lemma plus_star_trans :
forall (T : Type) (R : T -> T -> Prop) x y z,
plus R x y -> star R y z -> plus R x z.
Lemma star_plus_trans :
forall (T : Type) (R : T -> T -> Prop) x y z,
star R x y -> plus R y z -> plus R x z.
Lemma plus_plusi :
forall (T : Type) (R : T -> T -> Prop) x y,
plus R x y -> plusi R x y.
Lemma plusi_plus :
forall (T : Type) (R : T -> T -> Prop) x y,
plusi R x y -> plus R x y.
Lemma plus_plusri :
forall (T : Type) (R : T -> T -> Prop) x y,
plus R x y -> plusri R x y.
Lemma plusri_plus :
forall (T : Type) (R : T -> T -> Prop) x y,
plusri R x y -> plus R x y.
one
Lemma plus_step :
forall (T : Type) (R : T -> T -> Prop) x y z,
R x y -> plus R y z -> plus R x z.
Lemma plus_mono :
forall (T : Type) (R R' : T -> T -> Prop),
(forall x y, R x y -> R' x y)
-> forall x y, plus R x y -> plus R' x y.
Lemma star_map' :
forall (T : Type) (R : T -> T -> Prop) f,
(forall x y, R x y -> R (f x) (f y))
-> forall x y, star R x y -> star R (f x) (f y).
forall (T : Type) (R : T -> T -> Prop) x y z,
R x y -> plus R y z -> plus R x z.
Lemma plus_mono :
forall (T : Type) (R R' : T -> T -> Prop),
(forall x y, R x y -> R' x y)
-> forall x y, plus R x y -> plus R' x y.
Lemma star_map' :
forall (T : Type) (R : T -> T -> Prop) f,
(forall x y, R x y -> R (f x) (f y))
-> forall x y, star R x y -> star R (f x) (f y).
refl
Lemma plus_map' :
forall (T : Type) (R : T -> T -> Prop) f,
(forall x y, R x y -> R (f x) (f y))
-> forall x y, plus R x y -> plus R (f x) (f y).
Lemma star_mono_map :
forall (T : Type) (R R' : T -> T -> Prop) f,
(forall x y, R x y -> R' (f x) (f y))
-> forall x y, star R x y -> star R' (f x) (f y).
forall (T : Type) (R : T -> T -> Prop) f,
(forall x y, R x y -> R (f x) (f y))
-> forall x y, plus R x y -> plus R (f x) (f y).
Lemma star_mono_map :
forall (T : Type) (R R' : T -> T -> Prop) f,
(forall x y, R x y -> R' (f x) (f y))
-> forall x y, star R x y -> star R' (f x) (f y).
refl
Lemma plus_mono_map :
forall (T : Type) (R R' : T -> T -> Prop) f,
(forall x y, R x y -> R' (f x) (f y))
-> forall x y, plus R x y -> plus R' (f x) (f y).
Lemma plus_idem :
forall (T : Type) (R : T -> T -> Prop) x y,
plus R x y <-> plus (plus R) x y.
Lemma plus_of_transitive :
forall (T : Type) (R : T -> T -> Prop),
transitive T R
-> forall x y, plus R x y -> R x y.
Lemma plus_well_founded :
forall (T : Type) (R : T -> T -> Prop),
well_founded R
-> well_founded (plus R).
Lemma plus_ind :
forall (T : Type) (R P : T -> T -> Prop),
(forall x y z, R x y -> (y = z \/ (plus R y z /\ P y z)) -> P x z)
-> forall x y, plus R x y -> P x y.
forall (T : Type) (R R' : T -> T -> Prop) f,
(forall x y, R x y -> R' (f x) (f y))
-> forall x y, plus R x y -> plus R' (f x) (f y).
Lemma plus_idem :
forall (T : Type) (R : T -> T -> Prop) x y,
plus R x y <-> plus (plus R) x y.
Lemma plus_of_transitive :
forall (T : Type) (R : T -> T -> Prop),
transitive T R
-> forall x y, plus R x y -> R x y.
Lemma plus_well_founded :
forall (T : Type) (R : T -> T -> Prop),
well_founded R
-> well_founded (plus R).
Lemma plus_ind :
forall (T : Type) (R P : T -> T -> Prop),
(forall x y z, R x y -> (y = z \/ (plus R y z /\ P y z)) -> P x z)
-> forall x y, plus R x y -> P x y.
one
Lemma plus_ind_r :
forall (T : Type) (R P : T -> T -> Prop),
(forall x y z, (x = y \/ (plus R x y /\ P x y)) -> R y z -> P x z)
-> forall x y, plus R x y -> P x y.
forall (T : Type) (R P : T -> T -> Prop),
(forall x y z, (x = y \/ (plus R x y /\ P x y)) -> R y z -> P x z)
-> forall x y, plus R x y -> P x y.
one