1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 set "baseuri" "cic:/matita/excedence/".
17 include "higher_order_defs/relations.ma".
18 include "nat/plus.ma".
19 include "constructive_connectives.ma".
20 include "constructive_higher_order_relations.ma".
22 record excedence : Type ≝ {
24 exc_relation: exc_carr → exc_carr → Prop;
25 exc_coreflexive: coreflexive ? exc_relation;
26 exc_cotransitive: cotransitive ? exc_relation
29 interpretation "excedence" 'nleq a b =
30 (cic:/matita/excedence/exc_relation.con _ a b).
32 definition le ≝ λE:excedence.λa,b:E. ¬ (a ≰ b).
34 interpretation "ordered sets less or equal than" 'leq a b =
35 (cic:/matita/excedence/le.con _ a b).
37 lemma le_reflexive: ∀E.reflexive ? (le E).
38 intros (E); unfold; cases E; simplify; intros (x); apply (H x);
41 lemma le_transitive: ∀E.transitive ? (le E).
42 intros (E); unfold; cases E; simplify; unfold Not; intros (x y z Rxy Ryz H2);
43 cases (c x z y H2) (H4 H5); clear H2; [exact (Rxy H4)|exact (Ryz H5)]
46 definition apart ≝ λE:excedence.λa,b:E. a ≰ b ∨ b ≰ a.
48 notation "a # b" non associative with precedence 50 for @{ 'apart $a $b}.
49 interpretation "apartness" 'apart a b = (cic:/matita/excedence/apart.con _ a b).
51 lemma apart_coreflexive: ∀E.coreflexive ? (apart E).
52 intros (E); unfold; cases E; simplify; clear E; intros (x); unfold;
53 intros (H1); apply (H x); cases H1; assumption;
56 lemma apart_symmetric: ∀E.symmetric ? (apart E).
57 intros (E); unfold; intros(x y H); cases H; clear H; [right|left] assumption;
60 lemma apart_cotrans: ∀E. cotransitive ? (apart E).
61 intros (E); unfold; cases E (T f _ cTf); simplify; intros (x y z Axy);
62 cases Axy (H); lapply (cTf ? ? z H) as H1; cases H1; clear Axy H1;
63 [left; left|right; left|right; right|left; right] assumption.
66 definition eq ≝ λE:excedence.λa,b:E. ¬ (a # b).
68 notation "a ≈ b" non associative with precedence 50 for @{ 'napart $a $b}.
69 interpretation "alikeness" 'napart a b =
70 (cic:/matita/excedence/eq.con _ a b).
72 lemma eq_reflexive:∀E. reflexive ? (eq E).
73 intros (E); unfold; cases E (T f cRf _); simplify; unfold Not; intros (x H);
74 apply (cRf x); cases H; assumption;
77 lemma eq_symmetric:∀E.symmetric ? (eq E).
78 intros (E); unfold; unfold eq; unfold Not;
79 intros (x y H1 H2); apply H1; cases H2; [right|left] assumption;
82 lemma eq_transitive: ∀E.transitive ? (eq E).
83 intros (E); unfold; cases E (T f _ cTf); simplify; unfold Not;
84 intros (x y z H1 H2 H3); cases H3 (H4 H4); clear E H3; lapply (cTf ? ? y H4) as H5;
85 cases H5; clear H5 H4 cTf; [1,4: apply H1|*:apply H2] clear H1 H2;
86 [1,3:left|*:right] assumption;
89 lemma le_antisymmetric: ∀E.antisymmetric ? (le E) (eq E).
90 intros (E); unfold; intros (x y Lxy Lyx); unfold; unfold; intros (H);
91 cases H; [apply Lxy;|apply Lyx] assumption;
94 definition lt ≝ λE:excedence.λa,b:E. a ≤ b ∧ a # b.
96 interpretation "ordered sets less than" 'lt a b =
97 (cic:/matita/excedence/lt.con _ a b).
99 lemma lt_coreflexive: ∀E.coreflexive ? (lt E).
100 intros (E); unfold; unfold Not; intros (x H); cases H (_ ABS);
101 apply (apart_coreflexive ? x ABS);
104 lemma lt_transitive: ∀E.transitive ? (lt E).
105 intros (E); unfold; intros (x y z H1 H2); cases H1 (Lxy Axy); cases H2 (Lyz Ayz);
106 split; [apply (le_transitive ???? Lxy Lyz)] clear H1 H2;
107 cases Axy (H1 H1); cases Ayz (H2 H2); [1:cases (Lxy H1)|3:cases (Lyz H2)]
108 clear Axy Ayz;lapply (exc_cotransitive E) as c; unfold cotransitive in c;
109 lapply (exc_coreflexive E) as r; unfold coreflexive in r;
110 [1: lapply (c ?? y H1) as H3; cases H3 (H4 H4); [cases (Lxy H4)|cases (r ? H4)]
111 |2: lapply (c ?? x H2) as H3; cases H3 (H4 H4); [right; assumption|cases (Lxy H4)]]
114 theorem lt_to_excede: ∀E:excedence.∀a,b:E. (a < b) → (b ≰ a).
115 intros (E a b Lab); cases Lab (LEab Aab);
116 cases Aab (H H); [cases (LEab H)] fold normalize (b ≰ a); assumption; (* BUG *)