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]
From hanoi Require Import gdist ghanoi ghanoi3. (******************************************************************************) (* *) (* Linear Hanoi Problem with 3 pegs *) (* *) (******************************************************************************) Set Implicit Arguments. Unset Strict Implicit. Unset Printing Implicit Defensive. Section LHanoi3.
p1, p2:peg 3

p1 != p2 -> lrel p1 p2 || lrel p1 `p[p1, p2]
2
5
p1Dp2:p1 != p2

lrel p1 p2 || lrel p1 `p[p1, p2]
5c
_t_:eqType
_p_:pred _t_
_s_:subType _p_
p3, p4:sub_eqType _s_

(p3 == p4) = (val p3 == val p4)
5c
D:forall (t : eqType) (p : pred t) (s : subType p) (p3 p4 : sub_eqType s), (p3 == p4) = (val p3 == val p4)
d
19
d
5
D:forall (t : eqType) (p : pred t) (s : subType p) (p3 p4 : sub_eqType s), (p3 == p4) = (val p3 == val p4)

p1 != p2 -> `p[p1, p2] != p1 -> `p[p1, p2] != p2 -> lrel p1 p2 || lrel p1 `p[p1, p2]
by case: (peg3E `p[p1, p2]) => ->; case: (peg3E p1) => ->; case: (peg3E p2) => ->; rewrite !D /lrel /= ?inordK. Qed.
4
p1 != p2 -> ~~ [&& lrel p1 p2, lrel p1 `p[p1, p2] & lrel p2 `p[p1, p2]]
25
512131415

16
2127
21
27
21
`p[p1, p2] != p1 -> `p[p1, p2] != p2 -> p1 != p2 -> ~~ [&& lrel p1 p2, lrel p1 `p[p1, p2] & lrel p2 `p[p1, p2]]
by case: (peg3E `p[p1, p2]) => ->; case: (peg3E p1) => ->; case: (peg3E p2) => ->; rewrite !D /lrel /= ?inordK. Qed.
4
p1 != p2 -> ~~ lrel p1 p2 -> lrel p1 `p[p1, p2]
37
by move/lrel3D; case: lrel. Qed.
4
p1 != p2 -> lrel p1 p2 -> ~~ lrel p1 `p[p1, p2] -> lrel p2 `p[p1, p2]
3c
2b
213e
21
3e
21
`p[p1, p2] != p1 -> `p[p1, p2] != p2 -> p1 != p2 -> lrel p1 p2 -> ~~ lrel p1 `p[p1, p2] -> lrel p2 `p[p1, p2]
by case: (peg3E `p[p1, p2]) => ->; case: (peg3E p1) => ->; case: (peg3E p2) => ->; rewrite !D /lrel /= ?inordK. Qed.
p1, p2, p3, p4:peg 3

p1 != p2 -> p1 != p3 -> p2 != p3 -> lrel p1 p2 -> lrel p1 p3 -> lrel p3 p4 -> p4 = p1
4c
4f121314
p5, p6:sub_eqType _s_

(p5 == p6) = (val p5 == val p6)
4f
D:forall (t : eqType) (p : pred t) (s : subType p) (p5 p6 : sub_eqType s), (p5 == p6) = (val p5 == val p6)
50
5a
50
by case: (peg3E p1) => ->; case: (peg3E p2) => ->; case: (peg3E p3) => ->; case: (peg3E p4) => ->; rewrite !D /lrel /= ?inordK. Qed. Local Notation "c1 `-->_r c2" := (lmove c1 c2) (format "c1 `-->_r c2", at level 60). Local Notation "c1 `-->*_r c2" := (connect lmove c1 c2) (format "c1 `-->*_r c2", at level 60). (******************************************************************************) (* Function that builds a path from a configuration to a peg *) (******************************************************************************) Fixpoint lhanoi3 {n : nat} : configuration 3 n -> configuration _ n -> _ := match n with | 0 => fun _ _ => [::] : seq (configuration _ 0) | _.+1 => fun c1 c2 => let p1 := c1 ldisk in let p2 := c2 ldisk in if p1 == p2 then [seq ↑[i]_p2 | i <- lhanoi3 ↓[c1] ↓[c2]] else let p3 := `p[p1, p2] in if lrel p1 p2 then [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ [seq ↑[i]_p2 | i <- `c[p3] :: lhanoi3 `c[p3] ↓[c2]] else [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p2]] ++ [seq ↑[i]_p3 | i <- `c[p2] :: lhanoi3 `c[p2] `c[p1]] ++ [seq ↑[i]_p2 | i <- `c[p1] :: lhanoi3 `c[p1] ↓[c2]] end.
n:nat
c1, c2:configuration 3 n

lhanoi3 c1 c2 = [::] -> c1 = c2
60
63
IH:forall c1 c2 : configuration 3 n, lhanoi3 c1 c2 = [::] -> c1 = c2
c1, c2:configuration 3 n.+1

(if c1 ldisk == c2 ldisk then [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 ↓[c1] ↓[c2]] else if lrel (c1 ldisk) (c2 ldisk) then [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, c2 ldisk]]] ++ ↑[`c[`p[c1 ldisk, c2 ldisk]]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[`p[c1 ldisk, c2 ldisk]] ↓[c2]] else [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[c2 ldisk]] ++ ↑[`c[c2 ldisk]]_(`p[c1 ldisk, c2 ldisk]) :: [seq ↑[i]_(`p[c1 ldisk, c2 ldisk]) | i <- lhanoi3 `c[c2 ldisk] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[c1 ldisk] ↓[c2]]) = [::] -> c1 = c2
636b6c
H:c1 ldisk = c2 ldisk

[seq ↑[i]_(c2 ldisk) | i <- lhanoi3 ↓[c1] ↓[c2]] = [::] -> c1 = c2
71
[seq ↑[i]_(c2 ldisk) | i <- lhanoi3 ↓[c1] ↓[c2]] = [::] -> ↑[↓[c1]]_(c1 ldisk) = ↑[↓[c2]]_(c2 ldisk)
71
↑[↓[c2]]_(c1 ldisk) = ↑[↓[c2]]_(c2 ldisk)
by rewrite H. Qed.
6364
cs:=lhanoi3 c1 c2:seq (configuration 3 n)

last c1 cs = c2
7d
636480
HH:irreflexive (lrel (n:=3))

81
87
c1, c2:configuration 3 0

c1 = c2
8763
IH:forall c1 c2 : configuration 3 n, last c1 (lhanoi3 c1 c2) = c2
6c
last c1 (if c1 ldisk == c2 ldisk then [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 ↓[c1] ↓[c2]] else if lrel (c1 ldisk) (c2 ldisk) then [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, c2 ldisk]]] ++ ↑[`c[`p[c1 ldisk, c2 ldisk]]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[`p[c1 ldisk, c2 ldisk]] ↓[c2]] else [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[c2 ldisk]] ++ ↑[`c[c2 ldisk]]_(`p[c1 ldisk, c2 ldisk]) :: [seq ↑[i]_(`p[c1 ldisk, c2 ldisk]) | i <- lhanoi3 `c[c2 ldisk] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[c1 ldisk] ↓[c2]]) = c2
90
92
8763916c
Ho:c1 ldisk = c2 ldisk

last c1 [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 ↓[c1] ↓[c2]] = c2
8763916c
Do:c1 ldisk != c2 ldisk
last c1 (if lrel (c1 ldisk) (c2 ldisk) then [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, c2 ldisk]]] ++ ↑[`c[`p[c1 ldisk, c2 ldisk]]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[`p[c1 ldisk, c2 ldisk]] ↓[c2]] else [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[c2 ldisk]] ++ ↑[`c[c2 ldisk]]_(`p[c1 ldisk, c2 ldisk]) :: [seq ↑[i]_(`p[c1 ldisk, c2 ldisk]) | i <- lhanoi3 `c[c2 ldisk] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[c1 ldisk] ↓[c2]]) = c2
9e
a0
8763916c9f
p1:=c1 ldisk:(fun=> peg 3) ldisk
p2:=`p[p1, c2 ldisk]:peg 3

last c1 (if lrel p1 (c2 ldisk) then [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p2]] ++ ↑[`c[p2]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[p2] ↓[c2]] else [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[c2 ldisk]] ++ ↑[`c[c2 ldisk]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[c2 ldisk] `c[p1]] ++ ↑[`c[p1]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[p1] ↓[c2]]) = c2
8763916c9fa8a9
cp2:=`c[p2]:configuration 3 n
cp:=`c[c2 ldisk]:configuration 3 n
cp1:=`c[p1]:configuration 3 n

last c1 (if lrel p1 (c2 ldisk) then [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] cp2] ++ ↑[cp2]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 cp2 ↓[c2]] else [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] cp] ++ ↑[cp]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 cp cp1] ++ ↑[cp1]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 cp1 ↓[c2]]) = c2
8763916c9fa8a9afb0b1
Hrel:lrel p1 (c2 ldisk)

last c1 ([seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] cp2] ++ ↑[cp2]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 cp2 ↓[c2]]) = c2
8763916c9fa8a9afb0b1
Hrel:~~ lrel p1 (c2 ldisk)
last c1 ([seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] cp] ++ ↑[cp]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 cp cp1] ++ ↑[cp1]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 cp1 ↓[c2]]) = c2
bb
bd
by rewrite last_cat /= last_cat /= last_map IH cunliftrK. Qed.
7f
path lmove c1 cs
c2
86
c4
8763
IH:forall c1 c2 : configuration 3 n, path lmove c1 (lhanoi3 c1 c2)
6c

path lmove c1 (if c1 ldisk == c2 ldisk then [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 ↓[c1] ↓[c2]] else if lrel (c1 ldisk) (c2 ldisk) then [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, c2 ldisk]]] ++ ↑[`c[`p[c1 ldisk, c2 ldisk]]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[`p[c1 ldisk, c2 ldisk]] ↓[c2]] else [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[c2 ldisk]] ++ ↑[`c[c2 ldisk]]_(`p[c1 ldisk, c2 ldisk]) :: [seq ↑[i]_(`p[c1 ldisk, c2 ldisk]) | i <- lhanoi3 `c[c2 ldisk] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[c1 ldisk] ↓[c2]])
8763cd6c9a

path lmove c1 [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 ↓[c1] ↓[c2]]
8763cd6c9f
path lmove c1 (if lrel (c1 ldisk) (c2 ldisk) then [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, c2 ldisk]]] ++ ↑[`c[`p[c1 ldisk, c2 ldisk]]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[`p[c1 ldisk, c2 ldisk]] ↓[c2]] else [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[c2 ldisk]] ++ ↑[`c[c2 ldisk]]_(`p[c1 ldisk, c2 ldisk]) :: [seq ↑[i]_(`p[c1 ldisk, c2 ldisk]) | i <- lhanoi3 `c[c2 ldisk] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[c1 ldisk] ↓[c2]])
d6
d7
8763cd6c9fa8a9

path lmove c1 (if lrel p1 (c2 ldisk) then [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p2]] ++ ↑[`c[p2]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[p2] ↓[c2]] else [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[c2 ldisk]] ++ ↑[`c[c2 ldisk]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[c2 ldisk] `c[p1]] ++ ↑[`c[p1]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[p1] ↓[c2]])
8763cd6c9fa8a9afb0b1

path lmove c1 (if lrel p1 (c2 ldisk) then [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] cp2] ++ ↑[cp2]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 cp2 ↓[c2]] else [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] cp] ++ ↑[cp]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 cp cp1] ++ ↑[cp1]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 cp1 ↓[c2]])
8763cd6c9fa8a9afb0b1b7

path lmove c1 ([seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] cp2] ++ ↑[cp2]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 cp2 ↓[c2]])
8763cd6c9fa8a9afb0b1bc
path lmove c1 ([seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] cp] ++ ↑[cp]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 cp cp1] ++ ↑[cp1]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 cp1 ↓[c2]])
e8
path lmove c1 [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] cp2]
e8
last c1 [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] cp2] `-->_r ↑[cp2]_ (c2 ldisk)
e8
path lmove ↑[cp2]_(c2 ldisk) [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 cp2 ↓[c2]]
eb
ef
e8
f4
f5eb
f9
e8
↑[cp2]_(c1 ldisk) `-->_r ↑[cp2]_(c2 ldisk)
fb
e8
f6
ea
ec
ed
ec
path lmove c1 [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] cp]
ec
last c1 [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] cp] `-->_r ↑[cp]_p2
ec
path lmove ↑[cp]_p2 [seq ↑[i]_p2 | i <- lhanoi3 cp cp1]
ec
last ↑[cp]_p2 [seq ↑[i]_p2 | i <- lhanoi3 cp cp1] `-->_r ↑[cp1]_ (c2 ldisk)
ec
path lmove ↑[cp1]_(c2 ldisk) [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 cp1 ↓[c2]]
108
ec
10d
10e110112
116
ec
↑[cp]_(c1 ldisk) `-->_r ↑[cp]_p2
118
11b
ec
p2 != c2 ldisk
118
ec
10f
110112
124
ec
111
112
129
ec
↑[cp1]_p2 `-->_r ↑[cp1]_(c2 ldisk)
12b
ec
lrel p2 (c2 ldisk)
ec
p2 != p1
ec
c2 ldisk != p1
112
132
ec
~~ lrel (c2 ldisk) p1
135
ec
137
138112
140
ec
139
12b
ec
113
by rewrite path_liftr. Qed. (* Two configurations are always connected *)
62
c1 `-->*_r c2
14b
62
c2 = last c1 (lhanoi3 c1 c2)
by rewrite last_lhanoi3. Qed. (* lhanoi gives the smallest path connecting c1 to c2 *) (* This path is unique *)
6364
cs:seq (configuration 3 n)

path lmove c1 cs -> last c1 cs = c2 -> size (lhanoi3 c1 c2) <= size cs ?= iff (cs == lhanoi3 c1 c2)
154
(* we adapt the proof for the standard ha noi problem surely a shorter proof exists *)
m:nat
IHm:forall (n : nat) (c1 c2 : configuration 3 n) (cs : seq (configuration 3 n)), size cs < m -> path lmove c1 cs -> last c1 cs = c2 -> size (lhanoi3 c1 c2) <= size cs ?= iff (cs == lhanoi3 c1 c2)
6364157
sLm:size cs < m.+1

158
(* The usual induction on the number of disks *)
15e15f63
IH:forall (c1 c2 : configuration 3 n) (cs : seq (configuration 3 n)), size cs < m.+1 -> path lmove c1 cs -> last c1 cs = c2 -> size (lhanoi3 c1 c2) <= size cs ?= iff (cs == lhanoi3 c1 c2)
c1, c:configuration 3 n.+1
cs:seq (configuration 3 n.+1)
Scs:size cs < m.+1
c1Pcs:path lmove c1 cs
lc1csEp:last c1 cs = c

size (if c1 ldisk == c ldisk then [seq ↑[i]_(c ldisk) | i <- lhanoi3 ↓[c1] ↓[c]] else if lrel (c1 ldisk) (c ldisk) then [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, c ldisk]]] ++ ↑[`c[`p[c1 ldisk, c ldisk]]]_(c ldisk) :: [seq ↑[i]_(c ldisk) | i <- lhanoi3 `c[`p[c1 ldisk, c ldisk]] ↓[c]] else [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[c ldisk]] ++ ↑[`c[c ldisk]]_(`p[c1 ldisk, c ldisk]) :: [seq ↑[i]_(`p[c1 ldisk, c ldisk]) | i <- lhanoi3 `c[c ldisk] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_(c ldisk) :: [seq ↑[i]_(c ldisk) | i <- lhanoi3 `c[c1 ldisk] ↓[c]]) <= size cs ?= iff (cs == (if c1 ldisk == c ldisk then [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 ↓[c1] ↓[c]] else if lrel (c1 ldisk) (c ldisk) then [ seq ↑[i]_ (c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[ c1 ldisk, c ldisk]]] ++ ↑[`c[`p[ c1 ldisk, c ldisk]]]_ (c ldisk) :: [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 `c[`p[ c1 ldisk, c ldisk]] ↓[c]] else [ seq ↑[i]_ (c1 ldisk) | i <- lhanoi3 ↓[c1] `c[ c ldisk]] ++ ↑[`c[ c ldisk]]_ (`p[ c1 ldisk, c ldisk]) :: [ seq ↑[i]_ (`p[ c1 ldisk, c ldisk]) | i <- lhanoi3 `c[ c ldisk] `c[ c1 ldisk]] ++ ↑[`c[ c1 ldisk]]_ (c ldisk) :: [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 `c[ c1 ldisk] ↓[c]]))
15e15f6316516616716816916a
p:=c ldisk:(fun=> peg 3) ldisk

size (if c1 ldisk == p then [seq ↑[i]_p | i <- lhanoi3 ↓[c1] ↓[c]] else if lrel (c1 ldisk) p then [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, p]]] ++ ↑[`c[`p[c1 ldisk, p]]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[`p[c1 ldisk, p]] ↓[c]] else [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_(`p[c1 ldisk, p]) :: [seq ↑[i]_(`p[c1 ldisk, p]) | i <- lhanoi3 `c[p] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[c1 ldisk] ↓[c]]) <= size cs ?= iff (cs == (if c1 ldisk == p then [ seq ↑[i]_p | i <- lhanoi3 ↓[c1] ↓[c]] else if lrel (c1 ldisk) p then [ seq ↑[i]_ (c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[ c1 ldisk, p]]] ++ ↑[`c[`p[ c1 ldisk, p]]]_p :: [ seq ↑[i]_p | i <- lhanoi3 `c[`p[ c1 ldisk, p]] ↓[c]] else [ seq ↑[i]_ (c1 ldisk) | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_ (`p[ c1 ldisk, p]) :: [ seq ↑[i]_ (`p[ c1 ldisk, p]) | i <- lhanoi3 `c[p] `c[ c1 ldisk]] ++ ↑[`c[ c1 ldisk]]_p :: [ seq ↑[i]_p | i <- lhanoi3 `c[ c1 ldisk] ↓[c]]))
16f
if c1 ldisk == p then (if c1 ldisk == p then leqif (size (lhanoi3 ↓[c1] ↓[c])) else if lrel (c1 ldisk) p then leqif (size (lhanoi3 ↓[c1] `c[`p[c1 ldisk, p]]) + (size (lhanoi3 `c[`p[c1 ldisk, p]] ↓[c])).+1) else leqif (size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[c1 ldisk]) + (size (lhanoi3 `c[c1 ldisk] ↓[c])).+1).+1)) (size cs) (cs == [seq ↑[i]_p | i <- lhanoi3 ↓[c1] ↓[c]]) else if lrel (c1 ldisk) p then (if c1 ldisk == p then leqif (size (lhanoi3 ↓[c1] ↓[c])) else if lrel (c1 ldisk) p then leqif (size (lhanoi3 ↓[c1] `c[`p[c1 ldisk, p]]) + (size (lhanoi3 `c[`p[c1 ldisk, p]] ↓[c])).+1) else leqif (size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[c1 ldisk]) + (size (lhanoi3 `c[c1 ldisk] ↓[c])).+1).+1)) (size cs) (cs == [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, p]]] ++ ↑[`c[`p[c1 ldisk, p]]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[`p[c1 ldisk, p]] ↓[c]]) else (if c1 ldisk == p then leqif (size (lhanoi3 ↓[c1] ↓[c])) else if lrel (c1 ldisk) p then leqif (size (lhanoi3 ↓[c1] `c[`p[c1 ldisk, p]]) + (size (lhanoi3 `c[`p[c1 ldisk, p]] ↓[c])).+1) else leqif (size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[c1 ldisk]) + (size (lhanoi3 `c[c1 ldisk] ↓[c])).+1).+1)) (size cs) (cs == [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_(`p[c1 ldisk, p]) :: [seq ↑[i]_(`p[c1 ldisk, p]) | i <- lhanoi3 `c[p] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[c1 ldisk] ↓[c]])
15e15f6316516616716816916a170
lc1Ep:c1 ldisk = p

size (lhanoi3 ↓[c1] ↓[c]) <= size cs ?= iff (cs == [seq ↑[i]_p | i <- lhanoi3 ↓[c1] ↓[c]])
15e
IHm:forall (n : nat) (c1 c2 : configuration 3 n) (cs : seq (configuration 3 n)), size cs < m -> path lmove c1 cs -> last c1 cs = c2 -> size (lhanoi3 c1 c2) <= size cs ?= iff (cs == lhanoi3 c1 c2)
63
IH:forall (c1 c2 : configuration 3 n) (cs : seq (configuration 3 n)), size cs < m.+1 -> path lmove c1 cs -> last c1 cs = c2 -> size (lhanoi3 c1 c2) <= size cs ?= iff (cs == lhanoi3 c1 c2)
16616716816916a170
lc1Dp:c1 ldisk != p
if lrel (c1 ldisk) p then (if lrel (c1 ldisk) p then leqif (size (lhanoi3 ↓[c1] `c[`p[c1 ldisk, p]]) + (size (lhanoi3 `c[`p[c1 ldisk, p]] ↓[c])).+1) else leqif (size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[c1 ldisk]) + (size (lhanoi3 `c[c1 ldisk] ↓[c])).+1).+1)) (size cs) (cs == [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, p]]] ++ ↑[`c[`p[c1 ldisk, p]]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[`p[c1 ldisk, p]] ↓[c]]) else (if lrel (c1 ldisk) p then leqif (size (lhanoi3 ↓[c1] `c[`p[c1 ldisk, p]]) + (size (lhanoi3 `c[`p[c1 ldisk, p]] ↓[c])).+1) else leqif (size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[c1 ldisk]) + (size (lhanoi3 `c[c1 ldisk] ↓[c])).+1).+1)) (size cs) (cs == [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_(`p[c1 ldisk, p]) :: [seq ↑[i]_(`p[c1 ldisk, p]) | i <- lhanoi3 `c[p] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[c1 ldisk] ↓[c]])
(* the largest disk is already well-placed *)
15e15f6316516616716816916a17017a
cs1:seq (configuration 3 n)
c1'Pcs1:path (move (lrel (n:=3))) ↓[c1] cs1
lc1'csElc1cs':last ↓[c1] cs1 = ↓[last c1 cs]

(if cs == [seq ↑[i]_(c1 ldisk) | i <- cs1] then size cs1 == size cs else size cs1 < size cs) -> size (lhanoi3 ↓[c1] ↓[c]) <= size cs ?= iff (cs == [seq ↑[i]_p | i <- lhanoi3 ↓[c1] ↓[c]])
17c
186
last ↓[c1] cs1 = ↓[c]
15e17f6318016616716816916a17017a187188189
lc1'cs1E:last ↓[c1] cs1 = ↓[c]
(if cs == [seq ↑[i]_(c1 ldisk) | i <- cs1] then size cs1 == size cs else size cs1 < size cs) -> size (lhanoi3 ↓[c1] ↓[c]) <= size cs ?= iff (cs == [seq ↑[i]_p | i <- lhanoi3 ↓[c1] ↓[c]])
17d
15e15f6316516616716816916a17017a187188189192

18a
17c
15e15f6316516616716816916a17017a187188189192
csEcs1:cs = [seq ↑[i]_(c1 ldisk) | i <- cs1]

size (lhanoi3 ↓[c1] ↓[c]) <= size cs1 ?= iff (cs == [seq ↑[i]_p | i <- lhanoi3 ↓[c1] ↓[c]])
15e17f6318016616716816916a17017a187188189192
csDcs1:cs != [seq ↑[i]_(c1 ldisk) | i <- cs1]
scs1L:size cs1 < size cs
size (lhanoi3 ↓[c1] ↓[c]) <= size cs ?= iff (cs == [seq ↑[i]_p | i <- lhanoi3 ↓[c1] ↓[c]])
17d
19b
size (lhanoi3 ↓[c1] ↓[c]) <= size cs1 ?= iff (cs1 == lhanoi3 ↓[c1] ↓[c])
19e
15e15f6316616716816916a17017a18718818919219c

size cs1 < m.+1
19e
15e15f6316516616716816916a17017a1871881891921a11a2

17b
17c
1b0
size (lhanoi3 ↓[c1] ↓[c]) == size [seq ↑[i]_p | i <- lhanoi3 ↓[c1] ↓[c]]
1a0
size (lhanoi3 ↓[c1] ↓[c]) < size cs
17d
1b0
1b7
17c
1b0
size (lhanoi3 ↓[c1] ↓[c]) <= size cs1
17c
15e15f6316616716816916a17017a1871881891921a11a2

1ac
17c
15e15f6316516616716816916a170181

182
15e15f6316516616716816916a170181
f:=fun_of_fin^~ ldisk:configuration 3 n.+1 -> (fun=> peg 3) ldisk

182
15e15f6316516616716816916a1701811cb
HHr:irreflexive (lrel (n:=3))

182
15e15f6316516616716816916a1701811cb1d0
HHs:symmetric (lrel (n:=3))

182
(* We need to move the largest disk *)
15e15f6316516616716816a1701811cb1d01d5
c1':=↓[c1]:configuration 3 n
cs':=[seq ↓[i] | i <- cs]:seq (configuration 3 n)
p1:=c1 ldisk:peg 3
csE:cs = [seq ↑[i]_p1 | i <- cs']
c1'Ecs1':path (move (lrel (n:=3))) c1' cs'

true -> if lrel (c1 ldisk) p then (if lrel (c1 ldisk) p then leqif (size (lhanoi3 ↓[c1] `c[`p[c1 ldisk, p]]) + (size (lhanoi3 `c[`p[c1 ldisk, p]] ↓[c])).+1) else leqif (size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[c1 ldisk]) + (size (lhanoi3 `c[c1 ldisk] ↓[c])).+1).+1)) (size cs) (cs == [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, p]]] ++ ↑[`c[`p[c1 ldisk, p]]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[`p[c1 ldisk, p]] ↓[c]]) else (if lrel (c1 ldisk) p then leqif (size (lhanoi3 ↓[c1] `c[`p[c1 ldisk, p]]) + (size (lhanoi3 `c[`p[c1 ldisk, p]] ↓[c])).+1) else leqif (size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[c1 ldisk]) + (size (lhanoi3 `c[c1 ldisk] ↓[c])).+1).+1)) (size cs) (cs == [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_(`p[c1 ldisk, p]) :: [seq ↑[i]_(`p[c1 ldisk, p]) | i <- lhanoi3 `c[p] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[c1 ldisk] ↓[c]])
15e17f6318016616716816a1701811cb1d01d5187
cs2:seq (configuration 3 n.+1)
1dc
p2:peg 3
p3:=`p[p1, p2]:peg 3
1da
c2:=↑[`c[p3]]_p2:configuration 3 n.+1
c
p1Rp2:lrel p1 p2
lc1'cs1Epp3:last c1' cs1 = `c[p3]
csE:cs = [seq ↑[i]_p1 | i <- cs1] ++ c2 :: cs2
c1'Pcs1:path (move (lrel (n:=3))) c1' cs1
c2Pcs2:path (move (lrel (n:=3))) c2 cs2
182
(* this case is impossible the largest disk has to move *)
15e15f6316516616716816a1701cb1d01d51da1db1dc1dd1de

c1 ldisk = p
1e0
15e15f631651661671681701cb1d01d51da1db1dc1dd1de

f (last c1 cs) = f c -> c1 ldisk = p
1e0
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb

182
(* c4 is the first configuration when the largest disk has moved *)
1f9
if lrel p1 p then (if lrel p1 p then leqif (size (lhanoi3 ↓[c1] `c[`p[p1, p]]) + (size (lhanoi3 `c[`p[p1, p]] ↓[c])).+1) else leqif (size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1)) (size [seq ↑[i]_p1 | i <- cs1] + size (c2 :: cs2)) ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: cs2 == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[`p[p1, p]]] ++ ↑[`c[`p[p1, p]]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[`p[p1, p]] ↓[c]]) else (if lrel p1 p then leqif (size (lhanoi3 ↓[c1] `c[`p[p1, p]]) + (size (lhanoi3 `c[`p[p1, p]] ↓[c])).+1) else leqif (size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1)) (size [seq ↑[i]_p1 | i <- cs1] + size (c2 :: cs2)) ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: cs2 == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_(`p[p1, p]) :: [seq ↑[i]_(`p[p1, p]) | i <- lhanoi3 `c[p] `c[p1]] ++ ↑[`c[p1]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[p1] ↓[c]])
1f9
1ac
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb
Scs1:size cs1 < m.+1
1fd
15e15f6316516616716a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb

size cs1 < size cs
201
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb204

1fd
20d
size cs2 < m.+1
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb204
Scs2:size cs2 < m.+1
1fd
15e15f6316516616716a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb204

size cs2 < size cs
212
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb204215

1fd
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb204215
p1Rp:lrel p1 p

size (lhanoi3 ↓[c1] `c[`p[p1, p]]) + (size (lhanoi3 `c[`p[p1, p]] ↓[c])).+1 <= size [seq ↑[i]_p1 | i <- cs1] + size (c2 :: cs2) ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: cs2 == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[`p[p1, p]]] ++ ↑[`c[`p[p1, p]]]_p :: [ seq ↑[i]_p | i <- lhanoi3 `c[`p[p1, p]] ↓[c]])
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb204215
p1NRp:~~ lrel p1 p
size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 <= size [seq ↑[i]_p1 | i <- cs1] + size (c2 :: cs2) ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: cs2 == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_(`p[p1, p]) :: [seq ↑[i]_(`p[p1, p]) | i <- lhanoi3 `c[p] `c[p1]] ++ ↑[`c[p1]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[p1] ↓[c]])
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb204215223
p2Ep:p2 = p

224
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb204215223
p2Dp:p2 != p
size (lhanoi3 ↓[c1] `c[`p[p1, p]]) + (size (lhanoi3 `c[`p[p1, p]] ↓[c])).+1 <= size [seq ↑[i]_p1 | i <- cs1] + size (c2 :: cs2) ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: cs2 == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[`p[p1, p]]] ++ ↑[`c[`p[p1, p]]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[`p[p1, p]] ↓[c]])
226
(* the first moves of largest disk of cs is the right one *)
22d
size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 <= size cs1 + (size cs2).+1 ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: cs2 == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ ↑[`c[p3]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]])
22f
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e
cs2':seq (configuration 3 n)
c2'Pcs2':path (move (lrel (n:=3))) ↓[c2] cs2'
lc2'cs2'E:last ↓[c2] cs2' = ↓[last c2 cs2]
cs2'L:size cs2' <= size cs2 ?= iff (cs2 == [seq ↑[i]_ (c2 ldisk) | i <- cs2'])

237
22f
23b
size cs2' < m.+1
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e23f
Scs2':size cs2' < m.+1
size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 <= size cs1 + (size cs2).+1 ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: cs2 == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ ↑[`c[p3]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]])
230226
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e23f247

237
22f
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e23f247
IHc1:size (lhanoi3 c1' `c[p3]) <= size cs1 ?= iff (cs1 == lhanoi3 c1' `c[p3])

237
22f
250
last ↓[c2] cs2' = ↓[c]
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e23f247251
IHc2:size (lhanoi3 ↓[c2] ↓[c]) <= size cs2' ?= iff (cs2' == lhanoi3 ↓[c2] ↓[c])
248
230226
250
last c2 cs2 = c
256
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e23f247251259

237
22f
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e23f247251
IHc2:size (lhanoi3 `c[p3] ↓[c]) <= size cs2' ?= iff (cs2' == lhanoi3 `c[p3] ↓[c])

237
22f
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e247251266

(if cs2 == [seq ↑[i]_(c2 ldisk) | i <- cs2'] then size cs2' == size cs2 else size cs2' < size cs2) -> size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 <= size cs1 + (size cs2).+1 ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: cs2 == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ ↑[`c[p3]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]])
22f
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e247251266
cs2E:cs2 = [seq ↑[i]_(c2 ldisk) | i <- cs2']

237
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e247251266
cs2D:cs2 != [seq ↑[i]_(c2 ldisk) | i <- cs2']
Lcs2:size cs2' < size cs2
248
230226
(* there is only one move of the largest disk in cs *)
26f
size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 <= size cs1 + (size cs2').+1 ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p2 | i <- cs2'] == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ ↑[`c[p3]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]])
271
26f
size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 <= size (lhanoi3 c1' `c[p3]) + (size cs2').+1 ?= iff ([seq ↑[i]_p1 | i <- lhanoi3 c1' `c[p3]] ++ c2 :: [seq ↑[i]_p2 | i <- cs2'] == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ ↑[`c[p3]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]])
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e247251266270
Lc1:size (lhanoi3 c1' `c[p3]) < size cs1
size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 <= size cs1 + (size cs2').+1 ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p2 | i <- cs2'] == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ ↑[`c[p3]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]])
272230226
(* the first part of cs is perfect *)
26f
size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 <= size (lhanoi3 c1' `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 ?= iff ([seq ↑[i]_p1 | i <- lhanoi3 c1' `c[p3]] ++ c2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]] == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ ↑[`c[p3]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]])
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e247251266270
Lc2:size (lhanoi3 `c[p3] ↓[c]) < size cs2'
size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 <= size (lhanoi3 c1' `c[p3]) + (size cs2').+1 ?= iff ([seq ↑[i]_p1 | i <- lhanoi3 c1' `c[p3]] ++ c2 :: [seq ↑[i]_p2 | i <- cs2'] == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ ↑[`c[p3]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]])
27f272230226
(* the second part of cs is perfect, only case of equality *)
26f
size ([seq ↑[i]_p1 | i <- lhanoi3 c1' `c[p3]] ++ c2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]]) = size ([seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ ↑[`c[p3]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]]) -> size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 == size (lhanoi3 c1' `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e247251266270
[seq ↑[i]_p1 | i <- lhanoi3 c1' `c[p3]] ++ c2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]] = [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ ↑[`c[p3]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]]
28827f272230226
26f
293
287
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e24725126627028a

27d
27e
29a
size ([seq ↑[i]_p1 | i <- lhanoi3 c1' `c[p3]] ++ c2 :: [seq ↑[i]_p2 | i <- cs2']) = size ([seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ ↑[`c[p3]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]]) -> size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 == size (lhanoi3 c1' `c[p3]) + (size cs2').+1
289
size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 < size (lhanoi3 c1' `c[p3]) + (size cs2').+1
27f272230226
29a
2a1
27e
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e247251266270281

279
271
2a8
size ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p2 | i <- cs2']) = size ([seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ ↑[`c[p3]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]]) -> size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 == size cs1 + (size cs2').+1
280
size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 < size cs1 + (size cs2').+1
272230226
2a8
2af
271
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb20421522322e23c23d23e247251266274275

237
22f
2b6
size ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: cs2) = size ([seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p3]] ++ ↑[`c[p3]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p3] ↓[c]]) -> size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 == size cs1 + (size cs2).+1
273
size (lhanoi3 ↓[c1] `c[p3]) + (size (lhanoi3 `c[p3] ↓[c])).+1 < size cs1 + (size cs2).+1
230226
2b6
2bd
22f
2b6
size (lhanoi3 ↓[c1] `c[p3]) <= size cs1
273
size (lhanoi3 `c[p3] ↓[c]) < size cs2
230226
2b6
2c7
22f
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb204215223232

224
225
(* The largest disk jumped to an intermediate peg *)
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb204215223232
p3Ep:p3 = p

224
225
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb2042152232322d3
p1Dp:p1 != p

224
225
(* cs cannot be optimal *)
2d7
size ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: cs2) = size ([seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[`p[p1, p]]] ++ ↑[`c[`p[p1, p]]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[`p[p1, p]] ↓[c]]) -> size (lhanoi3 ↓[c1] `c[`p[p1, p]]) + (size (lhanoi3 `c[`p[p1, p]] ↓[c])).+1 == size [seq ↑[i]_p1 | i <- cs1] + size (c2 :: cs2)
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb2042152232322d32d8
size (lhanoi3 ↓[c1] `c[`p[p1, p]]) + (size (lhanoi3 `c[`p[p1, p]] ↓[c])).+1 < size [seq ↑[i]_p1 | i <- cs1] + size (c2 :: cs2)
226
2d7
2e0
225
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d8
c2':=↓[c2]:configuration 3 n
cs2':=[seq ↓[i] | i <- cs2]:seq (configuration 3 n)
p2':=c2 ldisk:peg 3
cs2E:cs2 = [seq ↑[i]_p2' | i <- cs2']
c2'Pcs2':path (move (lrel (n:=3))) c2' cs2'

2e0
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d8
cs3:seq (configuration 3 n)
cs4:seq (configuration 3 n.+1)
p4:=c2 ldisk:peg 3
p5:peg 3
p6:=`p[p4, p5]:peg 3
2e8
c3:=↑[`c[p6]]_p5:configuration 3 n.+1
p4Dp5:p4 != p5
p4Rp5:lrel p4 p5
lc2'cs3Epp6:last c2' cs3 = `c[p6]
cs2E:cs2 = [seq ↑[i]_p4 | i <- cs3] ++ c3 :: cs4
c2'Pcs3:path (move (lrel (n:=3))) c2' cs3
c3Pcs4:path (move (lrel (n:=3))) c3 cs4
2e0
226
(* this is impossible we need another move of the largest disk *)
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232d32d82e82e92ea2eb2ec

p2 = p
2ed
2ff
last c1 cs = c -> p2 = p
2ed
2ff
f ↑[last ↓[c2] cs2']_(c2 ldisk) = f c -> p2 = p
2ed
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d82f02f12f22f32f42e82f52f62f72f82f92fa2fb

2e0
225
(* cs has a duplicate *)
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d82f02f12f22f32f42e82f52f62f72f82f92fa2fb
p4Ep2:p4 = p2

2e0
225
310
p5 = p1
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d82f02f12f22f32f42e82f52f62f72f82f92fa2fb311
p5Ep1:p5 = p1
2e0
226
310
lrel p2 p5
316
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d82f02f12f22f32f42e82f52f62f72f82f92fa2fb311319

2e0
225
321
p6 = p3
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d82f02f12f22f32f42e82f52f62f72f82f92fa2fb311319
p6Ep3:p6 = p3
2e0
226
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d82f02f12f22f32f42e82f52f62f72f82f92fa2fb311319329

2e0
225
(* exhibit a shortest path *)
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d82f02f12f22f32f42e82f52f62f72f82f92fa2fb311319329
cs5:=[seq ↑[i]_p1 | i <- cs1] ++ cs4:seq (configuration 3 n.+1)

2e0
225
331
size cs5 < size cs
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d82f02f12f22f32f42e82f52f62f72f82f92fa2fb311319329332
scs5Lscs:size cs5 < size cs
2e0
226
331
size cs1 + size cs4 < size cs1 + (size cs3 + (size cs4).+1).+1
337
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d82f02f12f22f32f42e82f52f62f72f82f92fa2fb31131932933233a

2e0
225
342
path lmove c1 cs5
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d82f02f12f22f32f42e82f52f62f72f82f92fa2fb31131932933233a
c1Mcs5:path lmove c1 cs5
2e0
226
342
path (move (lrel (n:=3))) ↓[c1] cs1 && path lmove (last c1 [seq ↑[i]_p1 | i <- cs1]) cs4
347
342
true && path lmove (last c1 [seq ↑[i]_p1 | i <- cs1]) cs4
347
342
true && path lmove ↑[`c[p3]]_(c1 ldisk) cs4
347
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d82f02f12f22f32f42e82f52f62f72f82f92fa2fb31131932933233a34a

2e0
225
35a
last c1 cs5 = c
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d82f02f12f22f32f42e82f52f62f72f82f92fa2fb31131932933233a34a
lc1cs5E:last c1 cs5 = c
2e0
226
35a
last (last c1 [seq ↑[i]_p1 | i <- cs1]) cs4 = c
35f
35a
last ↑[`c[p3]]_(c1 ldisk) cs4 = c
35f
35a
last ↑[`c[p6]]_p5 cs4 = c
35f
35a
last c1 cs = c -> last ↑[`c[p6]]_p5 cs4 = c
35f
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152232322d32d82f02f12f22f32f42e82f52f62f72f82f92fa2fb31131932933233a34a362

2e0
225
376
size cs5 < size [seq ↑[i]_p1 | i <- cs1] + size (c2 :: cs2)
361
size (lhanoi3 ↓[c1] `c[`p[p1, p]]) + (size (lhanoi3 `c[`p[p1, p]] ↓[c])).+1 < (size cs5).+1
226
376
size (lhanoi3 ↓[c1] `c[`p[p1, p]]) + (size (lhanoi3 `c[`p[p1, p]] ↓[c])).+1 < (size cs5).+1
225
376
size (lhanoi3 ↓[c1] `c[`p[p1, p]]) + (size (lhanoi3 `c[`p[p1, p]] ↓[c])).+1 <= size cs5
225
376
size cs5 < m
361
(forall c c0 : configuration 3 n.+1, path lmove c cs5 -> last c cs5 = c0 -> size (lhanoi3 c c0) <= size cs5 ?= iff (cs5 == lhanoi3 c c0)) -> size (lhanoi3 ↓[c1] `c[`p[p1, p]]) + (size (lhanoi3 `c[`p[p1, p]] ↓[c])).+1 <= size cs5
226
376
(size cs5).+1 < m.+1
38a
376
(forall c c0 : configuration 3 n.+1, path lmove c cs5 -> last c cs5 = c0 -> size (lhanoi3 c c0) <= size cs5 ?= iff (cs5 == lhanoi3 c c0)) -> size (lhanoi3 ↓[c1] `c[`p[p1, p]]) + (size (lhanoi3 `c[`p[p1, p]] ↓[c])).+1 <= size cs5
225
376
size (if c1 ldisk == c ldisk then [seq ↑[i]_(c ldisk) | i <- lhanoi3 ↓[c1] ↓[c]] else if lrel (c1 ldisk) (c ldisk) then [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, c ldisk]]] ++ ↑[`c[`p[c1 ldisk, c ldisk]]]_(c ldisk) :: [seq ↑[i]_(c ldisk) | i <- lhanoi3 `c[`p[c1 ldisk, c ldisk]] ↓[c]] else [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[c ldisk]] ++ ↑[`c[c ldisk]]_(`p[c1 ldisk, c ldisk]) :: [seq ↑[i]_(`p[c1 ldisk, c ldisk]) | i <- lhanoi3 `c[c ldisk] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_(c ldisk) :: [seq ↑[i]_(c ldisk) | i <- lhanoi3 `c[c1 ldisk] ↓[c]]) <= size cs5 ?= iff (cs5 == (if c1 ldisk == c ldisk then [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 ↓[c1] ↓[c]] else if lrel (c1 ldisk) (c ldisk) then [ seq ↑[i]_ (c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[ c1 ldisk, c ldisk]]] ++ ↑[`c[`p[ c1 ldisk, c ldisk]]]_ (c ldisk) :: [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 `c[`p[ c1 ldisk, c ldisk]] ↓[c]] else [ seq ↑[i]_ (c1 ldisk) | i <- lhanoi3 ↓[c1] `c[ c ldisk]] ++ ↑[`c[ c ldisk]]_ (`p[ c1 ldisk, c ldisk]) :: [ seq ↑[i]_ (`p[ c1 ldisk, c ldisk]) | i <- lhanoi3 `c[ c ldisk] `c[ c1 ldisk]] ++ ↑[`c[ c1 ldisk]]_ (c ldisk) :: [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 `c[ c1 ldisk] ↓[c]])) -> size (lhanoi3 ↓[c1] `c[`p[p1, p]]) + (size (lhanoi3 `c[`p[p1, p]] ↓[c])).+1 <= size cs5
225
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb204215228

size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 <= size [seq ↑[i]_p1 | i <- cs1] + size (c2 :: cs2) ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: cs2 == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_ (`p[p1, p]) :: [seq ↑[i]_ (`p[p1, p]) | i <- lhanoi3 `c[p] `c[p1]] ++ ↑[`c[p1]]_p :: [ seq ↑[i]_p | i <- lhanoi3 `c[p1] ↓[c]])
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb204215228232

39d
3a1
p3 = p
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb2042152282322d3
229
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea1eb2042152282322d3

39d
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32e82e92ea2eb2ec

39d
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb
229
(* this is impossible at least two moves to reach p *)
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282d32e82e92ea2eb2ec

300
3b1
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282d32e82e92ea2eb2ec

304
3b1
3bb
↑[last ↓[c2] cs2']_p2 = c -> p2 = p
3b1
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb

39d
3c3
size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 <= size cs1 + (size cs3 + (size cs4).+1).+1 ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p4 | i <- cs3] ++ c3 :: cs4 == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_ (`p[p1, p]) :: [seq ↑[i]_ (`p[p1, p]) | i <- lhanoi3 `c[p] `c[p1]] ++ ↑[`c[p1]]_p :: [ seq ↑[i]_p | i <- lhanoi3 `c[p1] ↓[c]])
3c3
size cs3 < m.+1
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb
Scs3:size cs3 < m.+1
size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 <= size cs1 + (size cs3 + (size cs4).+1).+1 ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p4 | i <- cs3] ++ c3 :: cs4 == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_(`p[p1, p]) :: [seq ↑[i]_(`p[p1, p]) | i <- lhanoi3 `c[p] `c[p1]] ++ ↑[`c[p1]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[p1] ↓[c]])
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf

3c7
3d4
size cs4 < m.+1
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf
Scs4:size cs4 < m.+1
3d0
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc

3c7
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc311

3c7
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc311319

3c7
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc311
p5Dp1:p5 != p1
3d0
(* cs has a duplicate *)
3e8
size ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p4 | i <- cs3] ++ c3 :: cs4) = size ([seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_(`p[p1, p]) :: [seq ↑[i]_(`p[p1, p]) | i <- lhanoi3 `c[p] `c[p1]] ++ ↑[`c[p1]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[p1] ↓[c]]) -> size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 == size cs1 + (size cs3 + (size cs4).+1).+1
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc311319
size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 < size cs1 + (size cs3 + (size cs4).+1).+1
3ea
3e8
size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 == size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1
3f1
3e8
3f4
3e9
3e8
325
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc311319329
3f4
3ea
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc311319329

3f4
3e9
405
↑[last c1' cs1]_p1 = c3
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc311319329
lc1'cs1Ec3:↑[last c1' cs1]_p1 = c3
3f4
3ea
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc31131932940d

3f4
3e9
(* exhibit a shortest path *)
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc31131932940d332

3f4
3e9
415
336
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc31131932940d33233a
3f4
3ea
415
33e
419
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc31131932940d33233a

3f4
3e9
422
346
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc31131932940d33233a34a
3f4
3ea
422
34e
426
422
352
426
422
356
426
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc31131932940d33233a34a

3f4
3e9
435
35e
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc31131932940d33233a34a362
3f4
3ea
435
366
439
435
36a
439
435
36e
439
435
372
439
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc31131932940d33233a34a362

3f4
3e9
44b
size cs5 < size cs1 + (size cs3 + (size cs4).+1).+1
43b
size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 < (size cs5).+1
3ea
44b
size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 < (size cs5).+1
3e9
44b
389
43b
(forall c c0 : configuration 3 n.+1, path lmove c cs5 -> last c cs5 = c0 -> size (lhanoi3 c c0) <= size cs5 ?= iff (cs5 == lhanoi3 c c0)) -> size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 < (size cs5).+1
3ea
44b
390
45a
44b
(forall c c0 : configuration 3 n.+1, path lmove c cs5 -> last c cs5 = c0 -> size (lhanoi3 c c0) <= size cs5 ?= iff (cs5 == lhanoi3 c c0)) -> size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 < (size cs5).+1
3e9
44b
size (if c1 ldisk == c ldisk then [seq ↑[i]_(c ldisk) | i <- lhanoi3 ↓[c1] ↓[c]] else if lrel (c1 ldisk) (c ldisk) then [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, c ldisk]]] ++ ↑[`c[`p[c1 ldisk, c ldisk]]]_(c ldisk) :: [seq ↑[i]_(c ldisk) | i <- lhanoi3 `c[`p[c1 ldisk, c ldisk]] ↓[c]] else [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[c ldisk]] ++ ↑[`c[c ldisk]]_(`p[c1 ldisk, c ldisk]) :: [seq ↑[i]_(`p[c1 ldisk, c ldisk]) | i <- lhanoi3 `c[c ldisk] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_(c ldisk) :: [seq ↑[i]_(c ldisk) | i <- lhanoi3 `c[c1 ldisk] ↓[c]]) <= size cs5 ?= iff (cs5 == (if c1 ldisk == c ldisk then [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 ↓[c1] ↓[c]] else if lrel (c1 ldisk) (c ldisk) then [ seq ↑[i]_ (c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[ c1 ldisk, c ldisk]]] ++ ↑[`c[`p[ c1 ldisk, c ldisk]]]_ (c ldisk) :: [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 `c[`p[ c1 ldisk, c ldisk]] ↓[c]] else [ seq ↑[i]_ (c1 ldisk) | i <- lhanoi3 ↓[c1] `c[ c ldisk]] ++ ↑[`c[ c ldisk]]_ (`p[ c1 ldisk, c ldisk]) :: [ seq ↑[i]_ (`p[ c1 ldisk, c ldisk]) | i <- lhanoi3 `c[ c ldisk] `c[ c1 ldisk]] ++ ↑[`c[ c1 ldisk]]_ (c ldisk) :: [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 `c[ c1 ldisk] ↓[c]])) -> size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 < (size cs5).+1
3e9
44b
size ([seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[c ldisk]] ++ ↑[`c[c ldisk]]_(`p[p1, c ldisk]) :: [seq ↑[i]_(`p[p1, c ldisk]) | i <- lhanoi3 `c[c ldisk] `c[p1]] ++ ↑[`c[p1]]_(c ldisk) :: [seq ↑[i]_(c ldisk) | i <- lhanoi3 `c[p1] ↓[c]]) <= size cs5 ?= iff (cs5 == [ seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[ c ldisk]] ++ ↑[`c[ c ldisk]]_ (`p[p1, c ldisk]) :: [ seq ↑[i]_ (`p[p1, c ldisk]) | i <- lhanoi3 `c[ c ldisk] `c[p1]] ++ ↑[`c[p1]]_ (c ldisk) :: [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 `c[p1] ↓[c]]) -> size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 <= size cs5
3e9
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc3113ec

3c7
46f
p5 = p
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc3113ec
p5Ep:p5 = p
3d0
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc3113ec477

3c7
47b
p2 = `p[p1, p]
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc3113ec477
p2Ep1p:p2 = `p[p1, p]
3d0
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc3113ec477483

3c7
487
p6 = p1
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc3113ec477483
p6Ep1:p6 = p1
3d0
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa2fb3cf3dc3113ec47748348f

3c7
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f
c3':=↓[c3]:configuration 3 n
cs4':=[seq ↓[i] | i <- cs4]:seq (configuration 3 n)
p8:=c3 ldisk:peg 3
cs4E:cs4 = [seq ↑[i]_p8 | i <- cs4']
c3'Pcs4':path (move (lrel (n:=3))) c3' cs4'

3c7
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f
cs5:seq (configuration 3 n)
cs6:seq (configuration 3 n.+1)
49a
p9:peg 3
p10:=`p[p8, p9]:peg 3
498
c4:=↑[`c[p10]]_p9:configuration 3 n.+1
p8Dp9:p8 != p9
p8Rp9:lrel p8 p9
lc3'cs5Epp10:last c3' cs5 = `c[p10]
cs4E:cs4 = [seq ↑[i]_p8 | i <- cs5] ++ c4 :: cs6
c3'Pcs5:path (move (lrel (n:=3))) c3' cs5
c4Pcs6:path (move (lrel (n:=3))) c4 cs6
3d0
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c
Scs4':size cs4' < m.+1

3c7
49d
4ae
size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 <= size cs1 + (size cs3 + (size cs4').+1).+1 ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p4 | i <- cs3] ++ c3 :: [ seq ↑[i]_p8 | i <- cs4'] == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_ (`p[p1, p]) :: [seq ↑[i]_ (`p[p1, p]) | i <- lhanoi3 `c[p] `c[p1]] ++ ↑[`c[p1]]_p :: [ seq ↑[i]_p | i <- lhanoi3 `c[p1] ↓[c]])
49d
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af
lc1csEp:↑[last ↓[c3] cs4']_(c3 ldisk) = c

4b3
49d
4b7
↓[↑[last ↓[c3] cs4']_(c3 ldisk)] = ↓[c] -> size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 <= size cs1 + (size cs3 + (size cs4').+1).+1 ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p4 | i <- cs3] ++ c3 :: [ seq ↑[i]_p8 | i <- cs4'] == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_ (`p[p1, p]) :: [seq ↑[i]_ (`p[p1, p]) | i <- lhanoi3 `c[p] `c[p1]] ++ ↑[`c[p1]]_p :: [ seq ↑[i]_p | i <- lhanoi3 `c[p1] ↓[c]])
49d
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b8
lc3'cs4'Ec':last ↓[c3] cs4' = ↓[c]

4b3
49d
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c1
IH1:size (lhanoi3 c1' `c[p3]) <= size cs1 ?= iff (cs1 == lhanoi3 c1' `c[p3])

4b3
49d
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c1
IH1:size (lhanoi3 c1' `c[p]) <= size cs1 ?= iff (cs1 == lhanoi3 c1' `c[p])

4b3
49d
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14cb
IH2:size (lhanoi3 c2' `c[p6]) <= size cs3 ?= iff (cs3 == lhanoi3 c2' `c[p6])

4b3
49d
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14cb
IH2:size (lhanoi3 `c[p] `c[p1]) <= size cs3 ?= iff (cs3 == lhanoi3 `c[p] `c[p1])

4b3
49d
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14cb4d5
IH3:size (lhanoi3 c3' ↓[c]) <= size cs4' ?= iff (cs4' == lhanoi3 c3' ↓[c])

4b3
49d
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14cb4d5
IH3:size (lhanoi3 `c[p1] ↓[c]) <= size cs4' ?= iff (cs4' == lhanoi3 `c[p1] ↓[c])

4b3
49d
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14d54df

(if cs1 == lhanoi3 c1' `c[p] then size (lhanoi3 c1' `c[p]) == size cs1 else size (lhanoi3 c1' `c[p]) < size cs1) -> size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 <= size cs1 + (size cs3 + (size cs4').+1).+1 ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p4 | i <- cs3] ++ c3 :: [ seq ↑[i]_p8 | i <- cs4'] == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_ (`p[p1, p]) :: [seq ↑[i]_ (`p[p1, p]) | i <- lhanoi3 `c[p] `c[p1]] ++ ↑[`c[p1]]_p :: [ seq ↑[i]_p | i <- lhanoi3 `c[p1] ↓[c]])
49d
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14d54df
E1:cs1 = lhanoi3 c1' `c[p]

4b3
15e17f631801661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14d54df
cs1D:cs1 != lhanoi3 c1' `c[p]
Lcs1:size (lhanoi3 c1' `c[p]) < size cs1
size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 <= size cs1 + (size cs3 + (size cs4').+1).+1 ?= iff ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p4 | i <- cs3] ++ c3 :: [seq ↑[i]_p8 | i <- cs4'] == [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_(`p[p1, p]) :: [seq ↑[i]_(`p[p1, p]) | i <- lhanoi3 `c[p] `c[p1]] ++ ↑[`c[p1]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[p1] ↓[c]])
49e
(* the first part cs1 is perfect *)
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14d54df4e9
E2:cs3 = lhanoi3 `c[p] `c[p1]

4b3
15e17f631801661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14d54df4e9
Lc1:size (lhanoi3 `c[p] `c[p1]) < size cs3
4ef
4eb49e
(* the second part cs3 is perfect *)
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14d54df4e94f4
E3:cs4' = lhanoi3 `c[p1] ↓[c]

4b3
15e17f631801661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14d54df4e94f4
Lc2:size (lhanoi3 `c[p1] ↓[c]) < size cs4'
4ef
4f64eb49e
(* the third part cs4 is perfect, only case of equality *)
4fc
size ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p4 | i <- cs3] ++ c3 :: [seq ↑[i]_p8 | i <- cs4']) = size ([seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_(`p[p1, p]) :: [seq ↑[i]_(`p[p1, p]) | i <- lhanoi3 `c[p] `c[p1]] ++ ↑[`c[p1]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[p1] ↓[c]]) -> size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 == size cs1 + (size cs3 + (size cs4').+1).+1
15e17f631801661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14d54df4e94f44fd
[seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p4 | i <- cs3] ++ c3 :: [seq ↑[i]_p8 | i <- cs4'] = [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p]] ++ ↑[`c[p]]_(`p[p1, p]) :: [seq ↑[i]_(`p[p1, p]) | i <- lhanoi3 `c[p] `c[p1]] ++ ↑[`c[p1]]_p :: [seq ↑[i]_p | i <- lhanoi3 `c[p1] ↓[c]]
4ff4f64eb49e
4fc
3f8
506
4fc
509
4fe
4fc
[seq ↑[i]_p1 | i <- cs1] = [seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[p]]
508
c2 = ↑[`c[p]]_(`p[p1, p])
508
[seq ↑[i]_p4 | i <- cs3] = [seq ↑[i]_(`p[p1, p]) | i <- lhanoi3 `c[p] `c[p1]]
508
c3 = ↑[`c[p1]]_p
508
[seq ↑[i]_p8 | i <- cs4'] = [seq ↑[i]_p | i <- lhanoi3 `c[p1] ↓[c]]
4ff4f64eb49e
511
4fc
516
51751951b4ff4f64eb49e
51f
4fc
518
51951b4ff4f64eb49e
524
4fc
51a
51b4ff4f64eb49e
529
4fc
51c
4fe
52e
4fc
p8 = p
508
cs4' = lhanoi3 `c[p1] ↓[c]
4ff4f64eb49e
4fc
537
4fe
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14d54df4e94f4501

4b3
4f5
53e
505
500
size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 < size cs1 + (size cs3 + (size cs4').+1).+1
4f64eb49e
53e
3f8
542
53e
544
4f5
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14d54df4e94f8

4b3
4ea
54e
505
4f7544
4eb49e
54e
3f8
552
54e
544
4ea
54e
size (lhanoi3 `c[p] `c[p1]) + size (lhanoi3 `c[p1] ↓[c]) < size cs3 + size cs4'
4ea
54e
size (lhanoi3 `c[p] `c[p1]) + size (lhanoi3 `c[p1] ↓[c]) <= size (lhanoi3 `c[p] `c[p1]) + size cs4'
4f7
size (lhanoi3 `c[p] `c[p1]) + size cs4' < size cs3 + size cs4'
4eb49e
54e
564
4ea
15e15f631651661671681701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f49849949a49b49c4af4b84c14d54df4ed4ee

4b3
49d
56b
505
4ec544
49e
56b
3f8
56f
56b
544
49d
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa

3c7
(* three moves in a row -> duplicate *)
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa
p8Ep:p8 = p

3c7
57e
p9 = p2
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa57f
p9Ep2:p9 = p2
3d0
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a74a84a94aa57f

p2 != ?Goal0
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a74a84a94aa57f
p2 != p8
58f
?Goal0 != p8
58f
lrel p2 ?Goal0
58f
lrel p2 p8
585
589
58b
590
58f
p1 != p8
58f
lrel p2 p1
595585
599
58b
59d
59e595585
5a2
58b
59f
595585
5a7
58b
596
584
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa57f587

3c7
5b1
p10 = p1
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa57f587
p10Ep1:p10 = p1
3d0
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa57f5875b9

3c7
5bd
↑[last c2' cs3]_p2 = c4
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa57f5875b9
cc:↑[last c2' cs3]_p2 = c4
3d0
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa57f5875b95c5

3c7
5c9
3f0
5c43f4
5c9
3f8
5cd
5c9
3f4
(* exhibit a shortest path *)
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa57f5875b95c5
cs7:=[seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p4 | i <- cs3] ++ cs6:seq (configuration 3 n.+1)

3f4
5d8
size cs7 < size cs
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa57f5875b95c55d9
scs7Lscs7:size cs7 < size cs
3f4
5d8
size ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p4 | i <- cs3] ++ cs6) < size ([seq ↑[i]_p1 | i <- cs1] ++ c2 :: [seq ↑[i]_p4 | i <- cs3] ++ c3 :: [seq ↑[i]_p8 | i <- cs5] ++ c4 :: cs6)
5de
5d8
size cs1 + (size cs3 + size cs6).+1 < size cs1 + (size cs3 + (size cs5 + (size cs6).+1).+1).+1
5de
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa57f5875b95c55d95e1

3f4
5ed
path lmove c1 cs7
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa57f5875b95c55d95e1
c1Mcs7:path lmove c1 cs7
3f4
5ed
[&& path (move (lrel (n:=3))) ↓[c1] cs1, last c1 [seq ↑[i]_p1 | i <- cs1] `-->_r c2 & path lmove c2 ([seq ↑[i]_p4 | i <- cs3] ++ cs6)]
5f2
5ed
[&& true, last c1 [seq ↑[i]_p1 | i <- cs1] `-->_r c2 & path lmove c2 ([seq ↑[i]_p4 | i <- cs3] ++ cs6)]
5f2
5ed
[&& true, ↑[`c[p3]]_(c1 ldisk) `-->_r c2 & path lmove c2 ([seq ↑[i]_p4 | i <- cs3] ++ cs6)]
5f2
5ed
[&& ↑[`c[p3]]_p1 `-->_r ↑[`c[p3]]_p2, path lmove ↑[`c[p3]]_p2 [seq ↑[i]_p2 | i <- cs3] & path lmove (last ↑[`c[p3]]_p2 [seq ↑[i]_p2 | i <- cs3]) cs6]
5f2
5ed
↑[`c[p3]]_p1 `-->_r ↑[`c[p3]]_p2
5e0
path lmove ↑[`c[p3]]_p2 [seq ↑[i]_p2 | i <- cs3]
5e0
path lmove (last ↑[`c[p3]]_p2 [seq ↑[i]_p2 | i <- cs3]) cs6
5f3
607
5ed
p1 != p3
5e0
p2 != p3
60b60d5f3
5ed
616
60a
5ed
60c
60d5f3
5ed
60e
5f2
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa57f5875b95c55d95e15f5

3f4
624
last c1 cs7 = c
15e17f6318016616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa57f5875b95c55d95e15f5
lc1cs7E:last c1 cs7 = c
3f4
624
last (last c2 [seq ↑[i]_p2 | i <- cs3]) cs6 = c
629
624
last (last ↑[↓[c2]]_p2 [seq ↑[i]_p2 | i <- cs3]) cs6 = c
629
624
last ↑[`c[p6]]_p2 cs6 = c
629
624
last c1 cs = c -> last ↑[`c[p6]]_p2 cs6 = c
629
624
last c4 cs6 = c -> last ↑[`c[p6]]_p2 cs6 = c
629
15e15f6316516616716816a1701811cb1d01d51871e31dc1e41e51da1e6c1e71e81e91ea2042152282322d32f02f12f22f32f42e82f52f62f72f82f92fa3cf3dc3113ec47748348f4a04a149a4a24a34984a44a54a64a74a84a94aa57f5875b95c55d95e15f562c

3f4
644
size cs7 < size cs1 + (size cs3 + (size cs4).+1).+1
62b
size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 < (size cs7).+1
644
(size cs3 + size cs6).+1 < (size cs3 + (size cs4).+1).+1
649
644
size cs3 + size cs6 <= size cs3 + ((size cs5).+1 + size cs6)
649
644
size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 < (size cs7).+1
644
size cs7 < m
62b
(forall c c0 : configuration 3 n.+1, path lmove c cs7 -> last c cs7 = c0 -> size (lhanoi3 c c0) <= size cs7 ?= iff (cs7 == lhanoi3 c c0)) -> size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 < (size cs7).+1
644
(size cs7).+1 < m.+1
65c
644
(forall c c0 : configuration 3 n.+1, path lmove c cs7 -> last c cs7 = c0 -> size (lhanoi3 c c0) <= size cs7 ?= iff (cs7 == lhanoi3 c c0)) -> size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 < (size cs7).+1
644
size (if c1 ldisk == c ldisk then [seq ↑[i]_(c ldisk) | i <- lhanoi3 ↓[c1] ↓[c]] else if lrel (c1 ldisk) (c ldisk) then [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, c ldisk]]] ++ ↑[`c[`p[c1 ldisk, c ldisk]]]_(c ldisk) :: [seq ↑[i]_(c ldisk) | i <- lhanoi3 `c[`p[c1 ldisk, c ldisk]] ↓[c]] else [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[c ldisk]] ++ ↑[`c[c ldisk]]_(`p[c1 ldisk, c ldisk]) :: [seq ↑[i]_(`p[c1 ldisk, c ldisk]) | i <- lhanoi3 `c[c ldisk] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_(c ldisk) :: [seq ↑[i]_(c ldisk) | i <- lhanoi3 `c[c1 ldisk] ↓[c]]) <= size cs7 ?= iff (cs7 == (if c1 ldisk == c ldisk then [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 ↓[c1] ↓[c]] else if lrel (c1 ldisk) (c ldisk) then [ seq ↑[i]_ (c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[ c1 ldisk, c ldisk]]] ++ ↑[`c[`p[ c1 ldisk, c ldisk]]]_ (c ldisk) :: [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 `c[`p[ c1 ldisk, c ldisk]] ↓[c]] else [ seq ↑[i]_ (c1 ldisk) | i <- lhanoi3 ↓[c1] `c[ c ldisk]] ++ ↑[`c[ c ldisk]]_ (`p[ c1 ldisk, c ldisk]) :: [ seq ↑[i]_ (`p[ c1 ldisk, c ldisk]) | i <- lhanoi3 `c[ c ldisk] `c[ c1 ldisk]] ++ ↑[`c[ c1 ldisk]]_ (c ldisk) :: [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 `c[ c1 ldisk] ↓[c]])) -> size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 < (size cs7).+1
644
size ([seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[c ldisk]] ++ ↑[`c[c ldisk]]_(`p[p1, c ldisk]) :: [seq ↑[i]_(`p[p1, c ldisk]) | i <- lhanoi3 `c[c ldisk] `c[p1]] ++ ↑[`c[p1]]_(c ldisk) :: [seq ↑[i]_(c ldisk) | i <- lhanoi3 `c[p1] ↓[c]]) <= size cs7 ?= iff (cs7 == [ seq ↑[i]_p1 | i <- lhanoi3 ↓[c1] `c[ c ldisk]] ++ ↑[`c[ c ldisk]]_ (`p[p1, c ldisk]) :: [ seq ↑[i]_ (`p[p1, c ldisk]) | i <- lhanoi3 `c[ c ldisk] `c[p1]] ++ ↑[`c[p1]]_ (c ldisk) :: [ seq ↑[i]_ (c ldisk) | i <- lhanoi3 `c[p1] ↓[c]]) -> size (lhanoi3 ↓[c1] `c[p]) + (size (lhanoi3 `c[p] `c[p1]) + (size (lhanoi3 `c[p1] ↓[c])).+1).+1 <= size cs7
by rewrite size_cat /= size_cat /= !size_map => ->. Qed. (* size on a perfect configuration depends which peg we consider *)
635

size (lhanoi3 `c[p1 , n] `c[p2]) = (if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p1 != p2))
670
63
IH:forall p1 p2 : peg 3, size (lhanoi3 `c[p1] `c[p2]) = (if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p1 != p2))
5

size (if `c[p1] ldisk == `c[p2] ldisk then [seq ↑[i]_(`c[p2] ldisk) | i <- lhanoi3 ↓[`c[p1]] ↓[`c[p2]]] else if lrel (`c[p1] ldisk) (`c[p2] ldisk) then [seq ↑[i]_(`c[p1] ldisk) | i <- lhanoi3 ↓[`c[p1]] `c[`p[`c[p1] ldisk, `c[p2] ldisk]]] ++ ↑[`c[`p[`c[p1] ldisk, `c[p2] ldisk]]]_(`c[p2] ldisk) :: [seq ↑[i]_(`c[p2] ldisk) | i <- lhanoi3 `c[`p[`c[p1] ldisk, `c[p2] ldisk]] ↓[`c[p2]]] else [seq ↑[i]_(`c[p1] ldisk) | i <- lhanoi3 ↓[`c[p1]] `c[`c[p2] ldisk]] ++ ↑[`c[`c[p2] ldisk]]_(`p[`c[p1] ldisk, `c[p2] ldisk]) :: [seq ↑[i]_(`p[`c[p1] ldisk, `c[p2] ldisk]) | i <- lhanoi3 `c[`c[p2] ldisk] `c[`c[p1] ldisk]] ++ ↑[`c[`c[p1] ldisk]]_(`c[p2] ldisk) :: [seq ↑[i]_(`c[p2] ldisk) | i <- lhanoi3 `c[`c[p1] ldisk] ↓[`c[p2]]]) = (if lrel p1 p2 then ((3 ^ n.+1).-1)./2 else (3 ^ n.+1).-1 * (p1 != p2))
636795
p1Ep2:p1 = p2

size [seq ↑[i]_p2 | i <- lhanoi3 ↓[`c[p1]] ↓[`c[p2]]] = (if lrel p1 p2 then ((3 ^ n.+1).-1)./2 else (3 ^ n.+1).-1 * ~~ true)
636795c
size (if lrel p1 p2 then [seq ↑[i]_p1 | i <- lhanoi3 ↓[`c[p1]] `c[`p[p1, p2]]] ++ ↑[`c[`p[p1, p2]]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[`p[p1, p2]] ↓[`c[p2]]] else [seq ↑[i]_p1 | i <- lhanoi3 ↓[`c[p1]] `c[p2]] ++ ↑[`c[p2]]_(`p[p1, p2]) :: [seq ↑[i]_(`p[p1, p2]) | i <- lhanoi3 `c[p2] `c[p1]] ++ ↑[`c[p1]]_p2 :: [seq ↑[i]_p2 | i <- lhanoi3 `c[p1] ↓[`c[p2]]]) = (if lrel p1 p2 then ((3 ^ n.+1).-1)./2 else (3 ^ n.+1).-1 * ~~ false)
683
684
683
if lrel p1 p2 then (if lrel p1 p2 then eq (size (lhanoi3 `c[p1] `c[`p[p1, p2]]) + (size (lhanoi3 `c[`p[p1, p2]] `c[p2])).+1) else eq (size (lhanoi3 `c[p1] `c[p2]) + (size (lhanoi3 `c[p2] `c[p1]) + (size (lhanoi3 `c[p1] `c[p2])).+1).+1)) ((3 ^ n.+1).-1)./2 else (if lrel p1 p2 then eq (size (lhanoi3 `c[p1] `c[`p[p1, p2]]) + (size (lhanoi3 `c[`p[p1, p2]] `c[p2])).+1) else eq (size (lhanoi3 `c[p1] `c[p2]) + (size (lhanoi3 `c[p2] `c[p1]) + (size (lhanoi3 `c[p1] `c[p2])).+1).+1)) ((3 ^ n.+1).-1 * 1)
683
if lrel p1 p2 then (if lrel p1 p2 then eq ((if lrel p1 `p[p1, p2] then ((3 ^ n).-1)./2 else (3 ^ n).-1) + (if lrel `p[p1, p2] p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1).+1) else eq ((if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p1 != p2)) + ((if lrel p2 p1 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p2 != p1)) + (if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p1 != p2)).+1).+1)) ((3 ^ n.+1).-1)./2 else (if lrel p1 p2 then eq ((if lrel p1 `p[p1, p2] then ((3 ^ n).-1)./2 else (3 ^ n).-1) + (if lrel `p[p1, p2] p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1).+1) else eq ((if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p1 != p2)) + ((if lrel p2 p1 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p2 != p1)) + (if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p1 != p2)).+1).+1)) (3 ^ n.+1).-1
683
(3 ^ n.+1).-1 = (3 ^ n).-1 + (3 ^ n).*2
636795c
Hd:(3 ^ n.+1).-1 = (3 ^ n).-1 + (3 ^ n).*2
68f
683
(3 * (3 ^ n).-1.+1).-1 = (3 ^ n).-1.+1.-1 + ((3 ^ n).-1.+1).*2
694
696
68f
696
if lrel p1 p2 then (if lrel p1 p2 then eq ((if lrel p1 `p[p1, p2] then ((3 ^ n).-1)./2 else (3 ^ n).-1) + (if lrel `p[p1, p2] p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1).+1) else eq ((if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p1 != p2)) + ((if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p2 != p1)) + (if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p1 != p2)).+1).+1)) ((3 ^ n.+1).-1)./2 else (if lrel p1 p2 then eq ((if lrel p1 `p[p1, p2] then ((3 ^ n).-1)./2 else (3 ^ n).-1) + (if lrel `p[p1, p2] p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1).+1) else eq ((if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p1 != p2)) + ((if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p2 != p1)) + (if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p1 != p2)).+1).+1)) (3 ^ n.+1).-1
636795c697
Hrel1:~~ lrel p1 p2

(3 ^ n).-1 * (p1 != p2) + ((3 ^ n).-1 * (p2 != p1) + ((3 ^ n).-1 * (p1 != p2)).+1).+1 = (3 ^ n.+1).-1
636795c697
Hrel1:lrel p1 p2
(if lrel p1 `p[p1, p2] then ((3 ^ n).-1)./2 else (3 ^ n).-1) + (if lrel `p[p1, p2] p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1).+1 = ((3 ^ n.+1).-1)./2
6a6
(3 ^ n).-1 + ((3 ^ n).-1 + (3 ^ n).-1.+1).+1 = (3 ^ n.+1).-1
6a9
6a6
(3 ^ n).-1 + ((3 ^ n).-1 + (3 ^ n).-1.+1).+1 = (3 ^ n + (3 ^ n + 3 ^ n)).-1
6a9
6ab
6ad
636795c6976ac
Hrel2:lrel p1 `p[p1, p2]

((3 ^ n).-1)./2 + (if lrel `p[p1, p2] p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1).+1 = ((3 ^ n.+1).-1)./2
636795c6976ac
Hrel2:~~ lrel p1 `p[p1, p2]
(3 ^ n).-1 + (if lrel `p[p1, p2] p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1).+1 = ((3 ^ n.+1).-1)./2
6bc
((3 ^ n).-1)./2 + (3 ^ n).-1.+1 = ((3 ^ n.+1).-1)./2
6bc
~~ lrel `p[p1, p2] p2
6c0
6bc
6ca
6bf
6c1
6c3
6c1
(3 ^ n).-1 + ((3 ^ n).-1)./2.+1 = ((3 ^ n.+1).-1)./2
6c1
((3 ^ n).-1)./2 + (3 ^ n).-1.+1 = ((3 ^ n).-1)./2 + 3 ^ n
by rewrite prednK // expn_gt0. Qed. Fixpoint size_lhanoi3 {n : nat} : configuration 3 n -> configuration 3 n -> _ := match n with | 0 => fun _ _ => 0 | n1.+1 => fun c1 c2 => let p1 := c1 ldisk in let p2 := c2 ldisk in if p1 == p2 then size_lhanoi3 ↓[c1] ↓[c2] else let p3 := `p[p1, p2] in if lrel p1 p2 then (size_lhanoi3 ↓[c1] `c[p3] + size_lhanoi3 `c[p3] ↓[c2]).+1 else (size_lhanoi3 ↓[c1] `c[p2] + (3 ^ n1).-1 + size_lhanoi3 `c[p1] ↓[c2]).+2 end.
62
size_lhanoi3 c1 c2 = size (lhanoi3 c1 c2)
6da
63
IH:forall c1 c2 : configuration 3 n, size_lhanoi3 c1 c2 = size (lhanoi3 c1 c2)
6c

(if c1 ldisk == c2 ldisk then size_lhanoi3 ↓[c1] ↓[c2] else if lrel (c1 ldisk) (c2 ldisk) then (size_lhanoi3 ↓[c1] `c[`p[c1 ldisk, c2 ldisk]] + size_lhanoi3 `c[`p[c1 ldisk, c2 ldisk]] ↓[c2]).+1 else (size_lhanoi3 ↓[c1] `c[c2 ldisk] + (3 ^ n).-1 + size_lhanoi3 `c[c1 ldisk] ↓[c2]).+2) = size (if c1 ldisk == c2 ldisk then [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 ↓[c1] ↓[c2]] else if lrel (c1 ldisk) (c2 ldisk) then [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, c2 ldisk]]] ++ ↑[`c[`p[c1 ldisk, c2 ldisk]]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[`p[c1 ldisk, c2 ldisk]] ↓[c2]] else [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[c2 ldisk]] ++ ↑[`c[c2 ldisk]]_(`p[c1 ldisk, c2 ldisk]) :: [seq ↑[i]_(`p[c1 ldisk, c2 ldisk]) | i <- lhanoi3 `c[c2 ldisk] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[c1 ldisk] ↓[c2]])
636e26c
lc1Elc2:c1 ldisk = c2 ldisk

size_lhanoi3 ↓[c1] ↓[c2] = size [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 ↓[c1] ↓[c2]]
636e26c
lc1Dlc2:c1 ldisk != c2 ldisk
(if lrel (c1 ldisk) (c2 ldisk) then (size_lhanoi3 ↓[c1] `c[`p[c1 ldisk, c2 ldisk]] + size_lhanoi3 `c[`p[c1 ldisk, c2 ldisk]] ↓[c2]).+1 else (size_lhanoi3 ↓[c1] `c[c2 ldisk] + (3 ^ n).-1 + size_lhanoi3 `c[c1 ldisk] ↓[c2]).+2) = size (if lrel (c1 ldisk) (c2 ldisk) then [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, c2 ldisk]]] ++ ↑[`c[`p[c1 ldisk, c2 ldisk]]]_ (c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[`p[ c1 ldisk, c2 ldisk]] ↓[c2]] else [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[c2 ldisk]] ++ ↑[`c[c2 ldisk]]_(`p[c1 ldisk, c2 ldisk]) :: [seq ↑[i]_(`p[c1 ldisk, c2 ldisk]) | i <- lhanoi3 `c[c2 ldisk] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_ (c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[c1 ldisk] ↓[c2]])
6ec
(if lrel (c1 ldisk) (c2 ldisk) then (size_lhanoi3 ↓[c1] `c[`p[c1 ldisk, c2 ldisk]] + size_lhanoi3 `c[`p[c1 ldisk, c2 ldisk]] ↓[c2]).+1 else (size_lhanoi3 ↓[c1] `c[c2 ldisk] + (3 ^ n).-1 + size_lhanoi3 `c[c1 ldisk] ↓[c2]).+2) = size (if lrel (c1 ldisk) (c2 ldisk) then [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, c2 ldisk]]] ++ ↑[`c[`p[c1 ldisk, c2 ldisk]]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[`p[c1 ldisk, c2 ldisk]] ↓[c2]] else [seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[c2 ldisk]] ++ ↑[`c[c2 ldisk]]_(`p[c1 ldisk, c2 ldisk]) :: [seq ↑[i]_(`p[c1 ldisk, c2 ldisk]) | i <- lhanoi3 `c[c2 ldisk] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[c1 ldisk] ↓[c2]])
636e26c6ed
lc1Rlc2:lrel (c1 ldisk) (c2 ldisk)

(size_lhanoi3 ↓[c1] `c[`p[c1 ldisk, c2 ldisk]] + size_lhanoi3 `c[`p[c1 ldisk, c2 ldisk]] ↓[c2]).+1 = size ([seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[`p[c1 ldisk, c2 ldisk]]] ++ ↑[`c[`p[c1 ldisk, c2 ldisk]]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[`p[c1 ldisk, c2 ldisk]] ↓[c2]])
636e26c6ed
lc1NRlc2:~~ lrel (c1 ldisk) (c2 ldisk)
(size_lhanoi3 ↓[c1] `c[c2 ldisk] + (3 ^ n).-1 + size_lhanoi3 `c[c1 ldisk] ↓[c2]).+2 = size ([seq ↑[i]_(c1 ldisk) | i <- lhanoi3 ↓[c1] `c[c2 ldisk]] ++ ↑[`c[c2 ldisk]]_(`p[c1 ldisk, c2 ldisk]) :: [seq ↑[i]_(`p[c1 ldisk, c2 ldisk]) | i <- lhanoi3 `c[c2 ldisk] `c[c1 ldisk]] ++ ↑[`c[c1 ldisk]]_(c2 ldisk) :: [seq ↑[i]_(c2 ldisk) | i <- lhanoi3 `c[c1 ldisk] ↓[c2]])
6fb
6fd
6fb
(size_lhanoi3 ↓[c1] `c[c2 ldisk] + (3 ^ n).-1 + size_lhanoi3 `c[c1 ldisk] ↓[c2]).+2 = size (lhanoi3 ↓[c1] `c[c2 ldisk]) + ((3 ^ n).-1 * (c2 ldisk != c1 ldisk) + (size (lhanoi3 `c[c1 ldisk] ↓[c2])).+1).+1
by rewrite eq_sym (negPf lc1Dlc2) muln1 !addnS addnA !IH. Qed. (* size on a perfect configuration depends which peg we consider *)
672
size_lhanoi3 `c[p1 , n] `c[p2] = (if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p1 != p2))
706
by rewrite size_lhanoi3E size_app_lhanoi3_p. Qed.
62
`d[c1, c2]_lmove = size_lhanoi3 c1 c2
70b
62
`d[c1, c2]_lmove <= size (lhanoi3 c1 c2) <= `d[c1, c2]_lmove
62
path lmove c1 (lhanoi3 c1 c2)
62
last c1 (lhanoi3 c1 c2) = c2
62
size (lhanoi3 c1 c2) <= `d[c1, c2]_lmove
714
62
719
71a
71e
62
71b
6364
p1:seq (finfun_finType (ordinal_finType n) (ordinal_finType 3))
p1H:gpath lmove c1 c2 p1

71b
728
last c1 p1 = c2
by apply: gpath_last p1H. Qed.
672
`d[`c[p1 , n], `c[p2 , n]]_lmove = (if lrel p1 p2 then ((3 ^ n).-1)./2 else (3 ^ n).-1 * (p1 != p2))
730
by rewrite gdist_lhanoi3_size size_lhanoi3_p. Qed. End LHanoi3.