Built with Alectryon, running Coq+SerAPI v8.13.0+0.13.0. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use instead of Ctrl.
Notation "[ rel _ _ | _ ]" was already used in scope fun_scope. [notation-overridden,parsing]
Notation "[ rel _ _ : _ | _ ]" was already used in scope fun_scope. [notation-overridden,parsing]
Notation "[ rel _ _ in _ & _ | _ ]" was already used in scope fun_scope. [notation-overridden,parsing]
Notation "[ rel _ _ in _ & _ ]" was already used in scope fun_scope. [notation-overridden,parsing]
Notation "[ rel _ _ in _ | _ ]" was already used in scope fun_scope. [notation-overridden,parsing]
Notation "[ rel _ _ in _ ]" was already used in scope fun_scope. [notation-overridden,parsing]
Notation "_ + _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ - _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ <= _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ < _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ >= _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ > _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ <= _ <= _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ < _ <= _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ <= _ < _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ < _ < _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ * _" was already used in scope nat_scope. [notation-overridden,parsing]
(******************************************************************************) (* Definition of a distance on graph *) (* connectn r n x == the set of all the elements connected to x in n steps *) (* *) (* `d[t1, t2]_r == the distance between t1 and t2 in r *) (* if they are not connected returns the cardinal of the *) (* the subtype *) (******************************************************************************) Set Implicit Arguments. Unset Strict Implicit. Unset Printing Implicit Defensive. Section gdist. Variable T : finType. Variable r : rel T. Fixpoint connectn n x := if n is n1.+1 then \bigcup_(y in (rgraph r x)) connectn n1 y else [set x].
T:finType
r:rel T
n:nat
x, y:T

reflect (exists p : seq T, [/\ path r x p, last x p = y & size p = n]) (y \in connectn n x)
2
568

reflect (exists p : seq T, [/\ path r x p, last x p = y & size p = 0]) (y \in connectn 0 x)
567
IH:forall x y : T, reflect (exists p : seq T, [/\ path r x p, last x p = y & size p = n]) (y \in connectn n x)
8
reflect (exists p : seq T, [/\ path r x p, last x p = y & size p = n.+1]) (y \in \bigcup_(y in rgraph r x) connectn n y)
e
exists p : seq T, [/\ path r x p, last x p = x & size p = 0]
10
12
14
56713
x, y, i:T

i \in rgraph r x -> y \in connectn n i -> exists p0 : seq T, [/\ path r x p0, last x p0 = y & size p0 = n.+1]
567138
H1:true
H2:x = y
H3:0 = n.+1
y \in \bigcup_(y in rgraph r x) connectn n y
5671320
p:seq T
H1:r x i && path r i p
H2:last i p = y
H3:(size p).+1 = n.+1
28
1d
5671320
iRk:r x i
2b
H1:path r i p
2d
H3:size p = n

exists p : seq T, [/\ path r x p, last x p = y & size p = n.+1]
22
24
28
29
39
2a
28
56713202b2d2e
H11:r x i
H12:path r i p

28
56713202b2d2e4445
F:i \in rgraph r x

28
49
y \in connectn n i
by apply/IH; exists p; split => //; case: H3. Qed. Definition gdist t1 t2 := find (fun n => t2 \in connectn n t1) (iota 0 #|T|). Local Notation " `d[ t1 , t2 ] " := (gdist t1 t2) (format " `d[ t1 , t2 ] ").
56
t1, t2:T

( `d[t1, t2] == 0) = (t1 == t2)
50
5653
tG:0 < #|T|

54
59
(find (fun n : nat => t2 \in connectn n t1) (iota 0 #|T|) == 0) = (t1 == t2)
56537

(find (fun n : nat => t2 \in connectn n t1) (iota 0 n.+1) == 0) = (t1 == t2)
62
((if t1 == t2 then 0 else (find (fun n : nat => t2 \in connectn n t1) (iota (0 + 1) n)).+1) == 0) = (t1 == t2)
by case: (t1 =P t2). Qed.
52
(0 < `d[t1, t2] ) = (t1 != t2)
69
by rewrite ltnNge leqn0 gdist_eq0. Qed.
56
t:T

`d[t, t] = 0
6e
by apply/eqP; rewrite gdist_eq0. Qed.
52
`d[t1, t2] <= #|T|
75
52
`d[t1, t2] <= size (iota 0 #|T|)
apply: find_size. Qed.
56532b

path r t1 p -> last t1 p = t2 -> `d[t1, t2] <= size p
7e
56532b
Hp:path r t1 p
Hl:last t1 p = t2

`d[t1, t2] <= size p
56532b8788
tLp:#|T| <= size p

89
56532b8788
pLt:size p < #|T|
89
86
77
8f
91
89
91
t2 \in connectn (size p) t1
56532b878892
F:t2 \in connectn (size p) t1
89
9f
89
9f
(t2 \in connectn (nth 0 (iota 0 #|T|) (size p)) t1) = false -> false
by rewrite seq.nth_iota // F. Qed.
52
connect r t1 t2 = ( `d[t1, t2] < #|T|)
a9
5653
p, p':seq T
Hp':path r t1 p'
Hu:uniq (t1 :: p')
Ht:t2 = last t1 p'

`d[t1, t2] < #|T|
52
`d[t1, t2] < #|T| -> exists2 p : seq T, path r t1 p & t2 = last t1 p
b0
`d[t1, t2] < (size p').+1
b0
size p' < #|T|
b7
b0
bf
b6
b0
size (t1 :: p') <= size (enum T)
b6
5653b1b2b3b4
i:T

i \in t1 :: p' -> i \in enum T
b6
52
b8
52
has (fun n : nat => t2 \in connectn n t1) (iota 0 #|T|) -> exists2 p : seq T, path r t1 p & t2 = last t1 p
5653
n:nat_eqType
2b
H1p:path r t1 p
H2p:last t1 p = t2
H3p:size p = n

exists2 p : seq T, path r t1 p & t2 = last t1 p
by exists p. Qed.
52
~~ connect r t1 t2 -> `d[t1, t2] = #|T|
de
5653
H:~~ connect r t1 t2

`d[t1, t2] == #|T|
e5
`d[t1, t2] <= #|T| -> `d[t1, t2] == #|T|
by rewrite leq_eqVlt -gdist_connect (negPf H) orbF. Qed. (* geodesic path *) Definition gpath t1 t2 p := [&& path r t1 p, last t1 p == t2 & `d[t1, t2] == size p].
80
reflect [/\ path r t1 p, last t1 p = t2 & `d[t1, t2] = size p] (gpath t1 t2 p)
ed
56532b
t1Pp:path r t1 p
t1pLt2:last t1 p = t2
t1t2D: `d[t1, t2] = size p

[/\ path r t1 p, last t1 p == t2 & `d[t1, t2] == size p]
by split => //; apply/eqP. Qed.
52
connect r t1 t2 -> {p : seq T | gpath t1 t2 p}
fa
5653
t1Ct2:connect r t1 t2

{p : seq T | gpath t1 t2 p}
5653102
p:tuple_finType `d[t1, t2] T
Hp:[pred p | gpath t1 t2 p] p

103
5653102
HC:[pred p | gpath t1 t2 p] =1 xpred0
103
10c
103
565310210d
dLT: `d[t1, t2] < #|T|

103
114
False
114
has (fun n : nat => t2 \in connectn n t1) (iota 0 #|T|) -> False
114
t2 \in connectn (nth 0 (iota 0 #|T|) (find (fun n : nat => t2 \in connectn n t1) (iota 0 #|T|))) t1 -> False
114
t2 \in connectn (nth 0 (iota 0 #|T|) `d[t1, t2] ) t1 -> False
565310210d1152bd9da
H3p:size p == `d[t1, t2]

119
129
[pred p | gpath t1 t2 p] (Tuple H3p)
by apply/and3P; split=> //=; apply/eqP=> //; rewrite (eqP H3p). Qed.
80
gpath t1 t2 p -> last t1 p = t2
130
by case/gpathP. Qed.
80
gpath t1 t2 p -> `d[t1, t2] = size p
135
by case/gpathP. Qed.
80
gpath t1 t2 p -> path r t1 p
13a
by case/gpathP. Qed.
56
A:Type
p:seq A
t, t1:A
j:nat

j <= size p -> last t1 (take j p) = nth t (t1 :: p) j
13f
56142
t, a:A
l:seq A
IH:forall (t1 : A) (j : nat), j <= size l -> last t1 (take j l) = nth t (t1 :: l) j
t1:A
145
H:j < (size l).+1

last a (take j l) = nth t (a :: l) j
by apply: IH. Qed. (* ugly proof !! *)
80
gpath t1 t2 p -> uniq (t1 :: p)
153
56532b
gH:gpath t1 t2 p
i, j:nat
iH:i \in gtn (size (t1 :: p))
jH:j \in gtn (size (t1 :: p))

nth t1 (t1 :: p) i = nth t1 (t1 :: p) j -> i = j
15a
(forall i j : nat, i \in gtn (size (t1 :: p)) -> j \in gtn (size (t1 :: p)) -> i <= j -> nth t1 (t1 :: p) i = nth t1 (t1 :: p) j -> i = j) -> nth t1 (t1 :: p) i = nth t1 (t1 :: p) j -> i = j
15a
i <= j -> nth t1 (t1 :: p) i = nth t1 (t1 :: p) j -> i = j
56532b15b15c15d15e
H:forall i j : nat, i \in gtn (size (t1 :: p)) -> j \in gtn (size (t1 :: p)) -> i <= j -> nth t1 (t1 :: p) i = nth t1 (t1 :: p) j -> i = j
jLi:j < i

15f
164
15a
166
56532b15b15c15d15e
iLj:i < j

15f
56532b15c15d15e174f5f6
dt1t2E: `d[t1, t2] = size p

15f
56532b
i:nat
15df5f6179145
jH:j.+1 \in gtn (size (t1 :: p))
iLj:i < j.+1

nth t1 (t1 :: p) i = nth t1 (t1 :: p) j.+1 -> i = j.+1
56532bf5f617914517f
t1E:nth t1 (t1 :: p) 0 = nth t1 (t1 :: p) j.+1

0 = j.+1
56532bf5f617914517f
forall n : nat, n.+1 \in gtn (size (t1 :: p)) -> n.+1 < j.+1 -> nth t1 (t1 :: p) n.+1 = nth t1 (t1 :: p) j.+1 -> n.+1 = j.+1
56532bf5f617914517f186
p1:=drop j.+1 p:seq T

187
188
18f
path r t1 p1
56532bf5f617914517f186190
t1Pp1:path r t1 p1
187
189
18f
path r t1 (take j.+1 p) && path r (last t1 (take j.+1 p)) (drop j.+1 p) -> path r t1 p1
195
56532bf5f617914517f190
t1E:t1 = nth t1 p j

19c
195
197
187
188
197
last t1 p1 = t2
56532bf5f617914517f186190198
t1p1L:last t1 p1 = t2
187
189
197
last (last t1 (take j.+1 p)) (drop j.+1 p) = t2 -> last t1 p1 = t2
1a9
56532bf5f617914517f1901981a1

1b0
1a9
1ab
187
188
1ab
`d[t1, t2] <= size p1
1ab
`d[t1, t2] <= size p1 -> 0 = j.+1
189
1ab
1be
188
1ab
size p1 < `d[t1, t2]
188
1ab
size p - j.+1 < size p
188
56532bf5f617914517f1901981ac1a1

1c9
188
18a
18b
56532bf5f617914517f17e
iH:i.+1 \in gtn (size (t1 :: p))
174
nE:nth t1 (t1 :: p) i.+1 = nth t1 (t1 :: p) j.+1

i.+1 = j.+1
56532bf5f617914517f17e1d51741d6
p1:=take i.+1 p ++ drop j.+1 p:seq T

1d7
1db
`d[t1, t2] <= size p1 -> i.+1 = j.+1
1db1bb
1db
1c5
1e1
1db
i.+1 < size p
1db
i.+1 + (size p - j.+1) < `d[t1, t2]
1e2
1db
1ec
1e1
1db
i.+1 + (size p - j.+1) < size p - j.+1 + j.+1
1e1
1db
1bb
1db
194
1db1a8
56532bf617914517f17e1d51741d61dc

path r t1 (take i.+1 p ++ drop i.+1 p) -> path r t1 p1
1fa
1ff
[&& path r t1 (take i.+1 p), path r (last t1 (take i.+1 p)) (take (j - i) (drop i.+1 p)) & path r (last (last t1 (take i.+1 p)) (take (j - i) (drop i.+1 p))) (drop (j - i) (drop i.+1 p))] -> path r t1 (take i.+1 p) && path r (last t1 (take i.+1 p)) (drop j.+1 p)
1fa
1ff
path r (last (last t1 (take i.+1 p)) (take (j - i) (drop i.+1 p))) (drop (j - i) (drop i.+1 p)) -> path r (last t1 (take i.+1 p)) (drop j.+1 p)
1fa
1ff
j - i <= size (drop i.+1 p)
1ff
i < size p
1ff
path r (nth t1 (nth t1 p i :: drop i.+1 p) (j - i)) (drop (j - i) (drop i.+1 p)) -> path r (nth t1 p i) (drop j.+1 p)
1fb
20a
1ff
j.+1 - i.+1 <= size p - i.+1
20d
1ff
20f
2101fb
218
1ff
211
1fa
1ff
path r (nth t1 (nth t1 p i :: drop i.+1 p) (j - i)) (drop j.+1 p) -> path r (nth t1 p i) (drop j.+1 p)
1fa
1ff
nth t1 (nth t1 p i :: drop i.+1 p) (j - i) = nth t1 p i
1fa
1ff
nth t1 (nth t1 p j :: drop i.+1 p) (j - i) = nth t1 p j
1fa
1ff
nth t1 (nth t1 p j :: drop i.+1 p) (j - i).-1.+1 = nth t1 p j
1ff
0 < j - i
1fb
1ff
231
1fa
1db
1a8
1db
last (nth t1 (t1 :: p) j.+1) (drop j.+1 p) = t2
by rewrite -t1pLt2 -{3}[p](cat_take_drop j.+1) last_cat (last_take t1). Qed.
5653
p1, p2:seq T

gpath t1 t2 (p1 ++ p2) -> gpath t1 (last t1 p1) p1
23d
23f
path r t1 (p1 ++ p2) -> last t1 (p1 ++ p2) = t2 -> `d[t1, t2] = size (p1 ++ p2) -> gpath t1 (last t1 p1) p1
5653240198
t1p1LPp2:path r (last t1 p1) p2
t1p1Lp2Lt2:last (last t1 p1) p2 = t2
dt1t2E: `d[t1, t2] = size (p1 ++ p2)

gpath t1 (last t1 p1) p1
24a
`d[t1, last t1 p1] = size p1
24a
`d[t1, last t1 p1] <= size p1 -> `d[t1, last t1 p1] = size p1
565324019824b24c24d
dLSp1: `d[t1, last t1 p1] < size p1

252
565324019824b24c24d25b
p3:seq T
H1:path r t1 p3
H2:last t1 p3 = last t1 p1
H3: `d[t1, last t1 p1] = size p3

252
25f
size (p3 ++ p2) < `d[t1, t2] -> `d[t1, last t1 p1] = size p1
25f
`d[t1, t2] <= size (p3 ++ p2)
25f
last t1 (p3 ++ p2) = t2
by rewrite last_cat H2. Qed.
23f
gpath t1 t2 (p1 ++ p2) -> gpath (last t1 p1) t2 p2
271
23f
path r t1 (p1 ++ p2) -> last t1 (p1 ++ p2) = t2 -> `d[t1, t2] = size (p1 ++ p2) -> gpath (last t1 p1) t2 p2
24a
gpath (last t1 p1) t2 p2
24a
`d[last t1 p1, t2] = size p2
24a
`d[last t1 p1, t2] <= size p2 -> `d[last t1 p1, t2] = size p2
565324019824b24c24d
dLSp1: `d[last t1 p1, t2] < size p2

280
565324019824b24c24d289260
H1:path r (last t1 p1) p3
H2:last (last t1 p1) p3 = t2
H3: `d[last t1 p1, t2] = size p3

280
28d
size (p1 ++ p3) < `d[t1, t2] -> `d[last t1 p1, t2] = size p2
28d
`d[t1, t2] <= size (p1 ++ p3)
28d
last t1 (p1 ++ p3) = t2
by rewrite last_cat. Qed.
23f
gpath t1 t2 (p1 ++ p2) -> `d[t1, t2] = `d[t1, last t1 p1] + `d[last t1 p1, t2]
29e
5653240
gH:gpath t1 t2 (p1 ++ p2)

`d[t1, t2] = `d[t1, last t1 p1] + `d[last t1 p1, t2]
2a5
size (p1 ++ p2) = `d[t1, last t1 p1] + `d[last t1 p1, t2]
2a5
size (p1 ++ p2) = size p1 + size p2
by rewrite size_cat. Qed.
56
t1, t2, t3:T
2b

gpath t1 t2 (t3 :: p) -> `d[t1, t3] = 1
2b1
by move=> /(@gpath_catl _ _ [::t3]) /= /gpathP[]. Qed.
2b3
gpath t1 t2 (t3 :: p) -> gpath t3 t2 p
2b8
by move=> /(@gpath_catr _ _ [::t3]). Qed.
2b3
gpath t1 t2 (t3 :: p) -> `d[t1, t2] = `d[t3, t2] .+1
2bd
562b42b
gH:gpath t1 t2 (t3 :: p)

`d[t1, t2] = `d[t3, t2] .+1
by rewrite (@gdist_cat _ _ [::t3] p) // (gpath_consl gH). Qed.
562b4

`d[t1, t2] <= `d[t1, t3] + `d[t3, t2]
2c8
2ca
`d[t1, t2] <= #|T| + `d[t3, t2]
562b42b
pH:gpath t1 t3 p
2cb
2d3
2cb
2d3
`d[t1, t2] <= `d[t1, t3] + #|T|
562b42b2d4
p2:seq T
p2H:gpath t3 t2 p2
2cb
2de
2cb
2de
`d[t1, t2] <= size (p ++ p2)
2de
path r t1 (p ++ p2)
2de
last t1 (p ++ p2) = t2
2de
true && path r (last t1 p) p2
2ec
2de
2ee
by rewrite last_cat (gpath_last pH) (gpath_last p2H). Qed.
52
r t1 t2 -> `d[t1, t2] = (t1 != t2)
2f7
5653
Hr:r t1 t2

`d[t1, t2] == (t1 != t2)
56532ff
HE:t1 != t2

`d[t1, t2] == ~~ false
304
0 < `d[t1, t2]
by case: gdist (gdist_eq0 t1 t2); rewrite (negPf HE) . Qed.
52
0 < `d[t1, t2] < #|T| -> {t3 : T | r t1 t3 /\ `d[t3, t2] = `d[t1, t2] .-1}
30c
5653
dP:0 < `d[t1, t2]
dT: `d[t1, t2] < #|T|

{t3 : T | r t1 t3 /\ `d[t3, t2] = `d[t1, t2] .-1}
52
`d[t1, t2] < #|T| -> 0 < `d[t1, t2] -> {t3 : T | r t1 t3 /\ `d[t3, t2] = `d[t1, t2] .-1}
5653
pH:gpath t1 t2 [::]

0 < `d[t1, t2] -> {t3 : T | r t1 t3 /\ `d[t3, t2] = `d[t1, t2] .-1}
562b42b
pH:gpath t1 t2 (t3 :: p)
320
323
320
562b42b324314

r t1 t3
32b
`d[t3, t2] = `d[t1, t2] .-1
32b
32f
by rewrite (gdist_cons pH). Qed.
2ca
r t1 t2 -> r t2 t1 -> [|| `d[t2, t3] == `d[t1, t3] .-1, `d[t2, t3] == `d[t1, t3] | `d[t2, t3] == `d[t1, t3] .+1]
334
562b4
t1Rt2:r t1 t2
t2Rt1:r t2 t1

[|| `d[t2, t3] == `d[t1, t3] .-1, `d[t2, t3] == `d[t1, t3] | `d[t2, t3] == `d[t1, t3] .+1]
33b
`d[t1, t3] - `d[t1, t2] <= `d[t2, t3] <= `d[t2, t1] + `d[t1, t3]
33b
`d[t1, t3] - `d[t1, t2] <= `d[t2, t3] <= `d[t2, t1] + `d[t1, t3] -> [|| `d[t2, t3] == `d[t1, t3] .-1, `d[t2, t3] == `d[t1, t3] | `d[t2, t3] == `d[t1, t3] .+1]
33b
345
33b
`d[t1, t3] - (t1 != t2) <= `d[t2, t3] <= (t2 != t1) + `d[t1, t3] -> [|| `d[t2, t3] == `d[t1, t3] .-1, `d[t2, t3] == `d[t1, t3] | `d[t2, t3] == `d[t1, t3] .+1]
562b433c33d
E1:t2 = t1
E2:t1 = t2

`d[t1, t3] <= `d[t2, t3] <= 0 + `d[t1, t3] -> [|| `d[t2, t3] == `d[t1, t3] .-1, `d[t2, t3] == `d[t1, t3] | `d[t2, t3] == `d[t1, t3] .+1]
562b433c33d
E1:t2 <> t1
352
`d[t1, t3] <= `d[t2, t3] <= 1 + `d[t1, t3] -> [|| `d[t2, t3] == `d[t1, t3] .-1, `d[t2, t3] == `d[t1, t3] | `d[t2, t3] == `d[t1, t3] .+1]
562b433c33d351
E2:t1 <> t2
`d[t1, t3] - 1 <= `d[t2, t3] <= 0 + `d[t1, t3] -> [|| `d[t2, t3] == `d[t1, t3] .-1, `d[t2, t3] == `d[t1, t3] | `d[t2, t3] == `d[t1, t3] .+1]
562b433c33d35735b
`d[t1, t3] - 1 <= `d[t2, t3] <= 1 + `d[t1, t3] -> [|| `d[t2, t3] == `d[t1, t3] .-1, `d[t2, t3] == `d[t1, t3] | `d[t2, t3] == `d[t1, t3] .+1]
34e
356
358
35935d
362
562b433c33d357352
E3: `d[t1, t3] <= `d[t2, t3]

`d[t2, t3] <= 1 + `d[t1, t3] -> [|| `d[t2, t3] == `d[t1, t3] .-1, `d[t2, t3] == `d[t1, t3] | `d[t2, t3] == `d[t1, t3] .+1]
364
369
[|| 1 + `d[t1, t3] == `d[t1, t3] .-1, 1 + `d[t1, t3] == `d[t1, t3] | 1 + `d[t1, t3] == `d[t1, t3] .+1]
369
`d[t2, t3] < 1 + `d[t1, t3] -> [|| `d[t2, t3] == `d[t1, t3] .-1, `d[t2, t3] == `d[t1, t3] | `d[t2, t3] == `d[t1, t3] .+1]
35935d
369
372
364
562b433c33d35735236a
E4: `d[t2, t3] <= `d[t1, t3]

33e
364
35a
35c
35d
37c
562b433c33d35135b
E3: `d[t1, t3] - 1 <= `d[t2, t3]

`d[t2, t3] <= 0 + `d[t1, t3] -> [|| `d[t2, t3] == `d[t1, t3] .-1, `d[t2, t3] == `d[t1, t3] | `d[t2, t3] == `d[t1, t3] .+1]
37e
383
[|| 0 + `d[t1, t3] == `d[t1, t3] .-1, 0 + `d[t1, t3] == `d[t1, t3] | 0 + `d[t1, t3] == `d[t1, t3] .+1]
383
`d[t2, t3] < 0 + `d[t1, t3] -> [|| `d[t2, t3] == `d[t1, t3] .-1, `d[t2, t3] == `d[t1, t3] | `d[t2, t3] == `d[t1, t3] .+1]
35d
383
38c
37e
562b433c33d35135b
d:nat

d.+1 - 1 <= `d[t2, t3] -> `d[t2, t3] < 0 + d.+1 -> [|| `d[t2, t3] == d, `d[t2, t3] == d.+1 | `d[t2, t3] == d.+2]
37e
562b433c33d35135b394
E3:d <= `d[t2, t3]
E4: `d[t2, t3] <= d

[|| `d[t2, t3] == d, `d[t2, t3] == d.+1 | `d[t2, t3] == d.+2]
37e
35e
35f
562b433c33d35735b384

36b
3a3
36f
3a3372
3a3
372
3a3
[|| `d[t1, t3] == `d[t1, t3] .-1, `d[t1, t3] == `d[t1, t3] | `d[t1, t3] == `d[t1, t3] .+1]
3a3
`d[t2, t3] < `d[t1, t3] -> [|| `d[t2, t3] == `d[t1, t3] .-1, `d[t2, t3] == `d[t1, t3] | `d[t2, t3] == `d[t1, t3] .+1]
3a3
3b2
562b433c33d35735b394

d.+1 - 1 <= `d[t2, t3] -> `d[t2, t3] < d.+1 -> [|| `d[t2, t3] == d, `d[t2, t3] == d.+1 | `d[t2, t3] == d.+2]
562b433c33d35735b39439a39b

39c
by rewrite [_ == d]eqn_leq E3 E4. Qed. End gdist. Notation " `d[ t1 , t2 ]_ r " := (gdist r t1 t2) (at level 10, format "`d[ t1 , t2 ]_ r"). Section gdistProp. Variable T : finType. Variable r : rel T.
5
r, r1, r2:rel T

r1 =2 r2 -> connectn r1 =2 connectn r2
3c0
53c3
r1Er2:r1 =2 r2

connectn r1 =2 connectn r2
53c33ca7
IH:forall y : T, connectn r1 n y = connectn r2 n y
y, i:T

(i \in rgraph r1 y) = (i \in rgraph r2 y)
by rewrite ![_ \in _]rgraphK r1Er2. Qed.
3c2
r1 =2 r2 -> gdist r1 =2 gdist r2
3d4
53c33ca53

`d[t1, t2]_r1 = `d[t1, t2]_r2
53c33ca537

(t2 \in connectn r1 n t1) = (t2 \in connectn r2 n t1)
by rewrite (eq_connectn r1Er2). Qed.
52
`d[t1, t2]_r = `d[t2, t1]_(fun z : T => r^~ z)
3e3
565317e

(t2 \in connectn r i t1) = (t1 \in connectn (fun z : T => r^~ z) i t2)
565317e2bd9da
H3p:size p = i

exists p : seq T, [/\ path (fun z : T => r^~ z) t2 p, last t2 p = t1 & size p = i]
565317e2b
H1p:path (fun z : T => r^~ z) t2 p
H2p:last t2 p = t1
3f0
exists p : seq T, [/\ path r t1 p, last t1 p = t2 & size p = i]
3ef
path (fun z : T => r^~ z) t2 (rev (belast t1 p))
3ef
last t2 (rev (belast t1 p)) = t1
3ef
size (rev (belast t1 p)) = i
3f3
3f9
3ef
3fe
3ff3f3
403
565317e2bd9da3f0
a:T
p1:seq T

last (last a p1) (rev (t1 :: belast a p1)) = t1
405
3ef
400
3f2
3f4
3f7
3f4
path r t1 (rev (belast t2 p))
3f4
last t1 (rev (belast t2 p)) = t2
3f4
size (rev (belast t2 p)) = i
415
3f4
41a
41b
41f
565317e2b3f53f63f040b40c

last (last a p1) (rev (t2 :: belast a p1)) = t2
421
3f4
41c
by rewrite size_rev size_belast. Qed.
80
gpath r t1 t2 p -> gpath (fun z : T => r^~ z) t2 t1 (rev (belast t1 p))
42c
56532b
H1:path r t1 p
H2:last t1 p = t2
H3:`d[t1, t2]_r = size p

gpath (fun z : T => r^~ z) t2 t1 (rev (belast t1 p))
433
3fb
4333fe
433
`d[t2, t1]_(fun z : T => r^~ z) = size (rev (belast t1 p))
439
433
3fe
43d
441
56532b43443640b40c

last a p1 = t2 -> last t2 (rev (t1 :: belast a p1)) = t1
443
433
43e
by rewrite size_rev size_belast -gdist_sym. Qed.
52
symmetric r -> `d[t1, t2]_r = `d[t2, t1]_r
44e
5653
rSym:symmetric r

`d[t2, t1]_(fun z : T => r^~ z) = `d[t2, t1]_r
by apply: eq_dist. Qed.
5
r, e1, e2:rel T
53
c:seq T

e1 =2 e2 -> gpath e1 t1 t2 c = gpath e2 t1 t2 c
459
by move=> e1Ee2; apply/gpathP/gpathP; rewrite (eq_path e1Ee2) (eq_dist e1Ee2). Qed.
80
symmetric r -> gpath r t1 t2 p -> gpath r t2 t1 (rev (belast t1 p))
461
56532b
hIrr:symmetric r

gpath (fun z : T => r^~ z) t2 t1 (rev (belast t1 p)) -> gpath r t2 t1 (rev (belast t1 p))
by rewrite (@eq_gpath _ _ _ _ _ (_ : _ =2 r)). Qed. End gdistProp.