:: by Andrzej Trybulec

::

:: Received May 24, 1995

:: Copyright (c) 1995-2012 Association of Mizar Users

begin

Lm1: for x, y being set holds rng <*x,y*> = {x,y}

proof end;

Lm2: for x, y, z being set holds rng <*x,y,z*> = {x,y,z}

proof end;

begin

theorem Th2: :: FINSEQ_6:2

for k being Nat

for f being FinSequence st k in dom f & ( for i being Nat st 1 <= i & i < k holds

f . i <> f . k ) holds

(f . k) .. f = k

for f being FinSequence st k in dom f & ( for i being Nat st 1 <= i & i < k holds

f . i <> f . k ) holds

(f . k) .. f = k

proof end;

theorem Th7: :: FINSEQ_6:7

for f2, f1 being FinSequence

for p being set st p in (rng f2) \ (rng f1) holds

p .. (f1 ^ f2) = (len f1) + (p .. f2)

for p being set st p in (rng f2) \ (rng f1) holds

p .. (f1 ^ f2) = (len f1) + (p .. f2)

proof end;

theorem Th9: :: FINSEQ_6:9

for f2, f1 being FinSequence

for p being set st p in (rng f2) \ (rng f1) holds

(f1 ^ f2) |-- p = f2 |-- p

for p being set st p in (rng f2) \ (rng f1) holds

(f1 ^ f2) |-- p = f2 |-- p

proof end;

theorem :: FINSEQ_6:11

for f1, f2 being FinSequence

for A being set st A c= dom f1 holds

(f1 ^ f2) | A = f1 | A by Th10, GRFUNC_1:27;

for A being set st A c= dom f1 holds

(f1 ^ f2) | A = f1 | A by Th10, GRFUNC_1:27;

registration
end;

theorem Th14: :: FINSEQ_6:14

for f1, f2 being FinSequence

for i being Nat holds (f1 ^ f2) | (Seg ((len f1) + i)) = f1 ^ (f2 | (Seg i))

for i being Nat holds (f1 ^ f2) | (Seg ((len f1) + i)) = f1 ^ (f2 | (Seg i))

proof end;

theorem Th15: :: FINSEQ_6:15

for f2, f1 being FinSequence

for p being set st p in (rng f2) \ (rng f1) holds

(f1 ^ f2) -| p = f1 ^ (f2 -| p)

for p being set st p in (rng f2) \ (rng f1) holds

(f1 ^ f2) -| p = f1 ^ (f2 -| p)

proof end;

theorem Th16: :: FINSEQ_6:16

for f1, f2 being FinSequence

for p being set st f1 ^ f2 just_once_values p holds

p in (rng f1) \+\ (rng f2)

for p being set st f1 ^ f2 just_once_values p holds

p in (rng f1) \+\ (rng f2)

proof end;

theorem :: FINSEQ_6:17

for f1, f2 being FinSequence

for p being set st f1 ^ f2 just_once_values p & p in rng f1 holds

f1 just_once_values p

for p being set st f1 ^ f2 just_once_values p & p in rng f1 holds

f1 just_once_values p

proof end;

theorem Th35: :: FINSEQ_6:35

for x, y being set

for f being FinSequence st x in rng f & y in rng (f -| x) holds

(f -| x) -| y = f -| y

for f being FinSequence st x in rng f & y in rng (f -| x) holds

(f -| x) -| y = f -| y

proof end;

theorem Th36: :: FINSEQ_6:36

for x being set

for f1, f2 being FinSequence st not x in rng f1 holds

x .. ((f1 ^ <*x*>) ^ f2) = (len f1) + 1

for f1, f2 being FinSequence st not x in rng f1 holds

x .. ((f1 ^ <*x*>) ^ f2) = (len f1) + 1

proof end;

theorem Th37: :: FINSEQ_6:37

for x being set

for f being FinSequence st f just_once_values x holds

(x .. f) + (x .. (Rev f)) = (len f) + 1

for f being FinSequence st f just_once_values x holds

(x .. f) + (x .. (Rev f)) = (len f) + 1

proof end;

begin

theorem Th40: :: FINSEQ_6:40

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f holds

f -: p = (f -| p) ^ <*p*>

for p being Element of D

for f being FinSequence of D st p in rng f holds

f -: p = (f -| p) ^ <*p*>

proof end;

theorem Th41: :: FINSEQ_6:41

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f holds

f :- p = <*p*> ^ (f |-- p)

for p being Element of D

for f being FinSequence of D st p in rng f holds

f :- p = <*p*> ^ (f |-- p)

proof end;

theorem Th44: :: FINSEQ_6:44

for D being non empty set

for p being Element of D

for f being FinSequence of D st f <> {} & f /. 1 = p holds

( f -: p = <*p*> & f :- p = f )

for p being Element of D

for f being FinSequence of D st f <> {} & f /. 1 = p holds

( f -: p = <*p*> & f :- p = f )

proof end;

theorem Th45: :: FINSEQ_6:45

for D being non empty set

for p1 being Element of D

for f being FinSequence of D holds (<*p1*> ^ f) /^ 1 = f

for p1 being Element of D

for f being FinSequence of D holds (<*p1*> ^ f) /^ 1 = f

proof end;

theorem Th48: :: FINSEQ_6:48

for k being Nat

for D being non empty set

for f being FinSequence of D st k in dom f & ( for i being Nat st 1 <= i & i < k holds

f /. i <> f /. k ) holds

(f /. k) .. f = k

for D being non empty set

for f being FinSequence of D st k in dom f & ( for i being Nat st 1 <= i & i < k holds

f /. i <> f /. k ) holds

(f /. k) .. f = k

proof end;

theorem Th49: :: FINSEQ_6:49

for D being non empty set

for p1, p2 being Element of D st p1 <> p2 holds

<*p1,p2*> -: p2 = <*p1,p2*>

for p1, p2 being Element of D st p1 <> p2 holds

<*p1,p2*> -: p2 = <*p1,p2*>

proof end;

theorem Th50: :: FINSEQ_6:50

for D being non empty set

for p1, p2, p3 being Element of D st p1 <> p2 holds

<*p1,p2,p3*> -: p2 = <*p1,p2*>

for p1, p2, p3 being Element of D st p1 <> p2 holds

<*p1,p2,p3*> -: p2 = <*p1,p2*>

proof end;

theorem Th51: :: FINSEQ_6:51

for D being non empty set

for p1, p3, p2 being Element of D st p1 <> p3 & p2 <> p3 holds

<*p1,p2,p3*> -: p3 = <*p1,p2,p3*>

for p1, p3, p2 being Element of D st p1 <> p3 & p2 <> p3 holds

<*p1,p2,p3*> -: p3 = <*p1,p2,p3*>

proof end;

theorem :: FINSEQ_6:52

for D being non empty set

for p being Element of D holds

( <*p*> :- p = <*p*> & <*p*> -: p = <*p*> )

for p being Element of D holds

( <*p*> :- p = <*p*> & <*p*> -: p = <*p*> )

proof end;

theorem Th54: :: FINSEQ_6:54

for D being non empty set

for p1, p2, p3 being Element of D st p1 <> p2 holds

<*p1,p2,p3*> :- p2 = <*p2,p3*>

for p1, p2, p3 being Element of D st p1 <> p2 holds

<*p1,p2,p3*> :- p2 = <*p2,p3*>

proof end;

theorem Th55: :: FINSEQ_6:55

for D being non empty set

for p1, p3, p2 being Element of D st p1 <> p3 & p2 <> p3 holds

<*p1,p2,p3*> :- p3 = <*p3*>

for p1, p3, p2 being Element of D st p1 <> p3 & p2 <> p3 holds

<*p1,p2,p3*> :- p3 = <*p3*>

proof end;

theorem Th56: :: FINSEQ_6:56

for k being Nat

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f & p .. f > k holds

p .. f = k + (p .. (f /^ k))

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f & p .. f > k holds

p .. f = k + (p .. (f /^ k))

proof end;

theorem Th57: :: FINSEQ_6:57

for k being Nat

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f & p .. f > k holds

p in rng (f /^ k)

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f & p .. f > k holds

p in rng (f /^ k)

proof end;

theorem Th58: :: FINSEQ_6:58

for k, i being Nat

for D being non empty set

for f being FinSequence of D st k < i & i in dom f holds

f /. i in rng (f /^ k)

for D being non empty set

for f being FinSequence of D st k < i & i in dom f holds

f /. i in rng (f /^ k)

proof end;

theorem Th59: :: FINSEQ_6:59

for k being Nat

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f & p .. f > k holds

(f /^ k) -: p = (f -: p) /^ k

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f & p .. f > k holds

(f /^ k) -: p = (f -: p) /^ k

proof end;

theorem Th60: :: FINSEQ_6:60

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f & p .. f <> 1 holds

(f /^ 1) -: p = (f -: p) /^ 1

for p being Element of D

for f being FinSequence of D st p in rng f & p .. f <> 1 holds

(f /^ 1) -: p = (f -: p) /^ 1

proof end;

theorem Th61: :: FINSEQ_6:61

for D being non empty set

for p being Element of D

for f being FinSequence of D holds p in rng (f :- p)

for p being Element of D

for f being FinSequence of D holds p in rng (f :- p)

proof end;

theorem Th62: :: FINSEQ_6:62

for x being set

for D being non empty set

for p being Element of D

for f being FinSequence of D st x in rng f & p in rng f & x .. f >= p .. f holds

x in rng (f :- p)

for D being non empty set

for p being Element of D

for f being FinSequence of D st x in rng f & p in rng f & x .. f >= p .. f holds

x in rng (f :- p)

proof end;

theorem Th63: :: FINSEQ_6:63

for k being Nat

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f & k <= len f & k >= p .. f holds

f /. k in rng (f :- p)

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f & k <= len f & k >= p .. f holds

f /. k in rng (f :- p)

proof end;

theorem Th64: :: FINSEQ_6:64

for D being non empty set

for p being Element of D

for f1, f2 being FinSequence of D st p in rng f1 holds

(f1 ^ f2) :- p = (f1 :- p) ^ f2

for p being Element of D

for f1, f2 being FinSequence of D st p in rng f1 holds

(f1 ^ f2) :- p = (f1 :- p) ^ f2

proof end;

theorem Th65: :: FINSEQ_6:65

for D being non empty set

for p being Element of D

for f2, f1 being FinSequence of D st p in (rng f2) \ (rng f1) holds

(f1 ^ f2) :- p = f2 :- p

for p being Element of D

for f2, f1 being FinSequence of D st p in (rng f2) \ (rng f1) holds

(f1 ^ f2) :- p = f2 :- p

proof end;

theorem Th66: :: FINSEQ_6:66

for D being non empty set

for p being Element of D

for f1, f2 being FinSequence of D st p in rng f1 holds

(f1 ^ f2) -: p = f1 -: p

for p being Element of D

for f1, f2 being FinSequence of D st p in rng f1 holds

(f1 ^ f2) -: p = f1 -: p

proof end;

theorem Th67: :: FINSEQ_6:67

for D being non empty set

for p being Element of D

for f2, f1 being FinSequence of D st p in (rng f2) \ (rng f1) holds

(f1 ^ f2) -: p = f1 ^ (f2 -: p)

for p being Element of D

for f2, f1 being FinSequence of D st p in (rng f2) \ (rng f1) holds

(f1 ^ f2) -: p = f1 ^ (f2 -: p)

proof end;

theorem :: FINSEQ_6:68

for D being non empty set

for p being Element of D

for f being FinSequence of D holds (f :- p) :- p = f :- p

for p being Element of D

for f being FinSequence of D holds (f :- p) :- p = f :- p

proof end;

theorem Th69: :: FINSEQ_6:69

for D being non empty set

for p1, p2 being Element of D

for f being FinSequence of D st p1 in rng f & p2 in (rng f) \ (rng (f -: p1)) holds

f |-- p2 = (f |-- p1) |-- p2

for p1, p2 being Element of D

for f being FinSequence of D st p1 in rng f & p2 in (rng f) \ (rng (f -: p1)) holds

f |-- p2 = (f |-- p1) |-- p2

proof end;

theorem Th70: :: FINSEQ_6:70

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f holds

rng f = (rng (f -: p)) \/ (rng (f :- p))

for p being Element of D

for f being FinSequence of D st p in rng f holds

rng f = (rng (f -: p)) \/ (rng (f :- p))

proof end;

theorem Th71: :: FINSEQ_6:71

for D being non empty set

for p1, p2 being Element of D

for f being FinSequence of D st p1 in rng f & p2 in (rng f) \ (rng (f -: p1)) holds

(f :- p1) :- p2 = f :- p2

for p1, p2 being Element of D

for f being FinSequence of D st p1 in rng f & p2 in (rng f) \ (rng (f -: p1)) holds

(f :- p1) :- p2 = f :- p2

proof end;

theorem Th72: :: FINSEQ_6:72

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f holds

p .. (f -: p) = p .. f

for p being Element of D

for f being FinSequence of D st p in rng f holds

p .. (f -: p) = p .. f

proof end;

theorem Th74: :: FINSEQ_6:74

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f holds

(f -: p) -: p = f -: p

for p being Element of D

for f being FinSequence of D st p in rng f holds

(f -: p) -: p = f -: p

proof end;

theorem Th75: :: FINSEQ_6:75

for D being non empty set

for p1, p2 being Element of D

for f being FinSequence of D st p1 in rng f & p2 in rng (f -: p1) holds

(f -: p1) -: p2 = f -: p2

for p1, p2 being Element of D

for f being FinSequence of D st p1 in rng f & p2 in rng (f -: p1) holds

(f -: p1) -: p2 = f -: p2

proof end;

theorem Th76: :: FINSEQ_6:76

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f holds

(f -: p) ^ ((f :- p) /^ 1) = f

for p being Element of D

for f being FinSequence of D st p in rng f holds

(f -: p) ^ ((f :- p) /^ 1) = f

proof end;

theorem Th77: :: FINSEQ_6:77

for D being non empty set

for f1, f2 being FinSequence of D st f1 <> {} holds

(f1 ^ f2) /^ 1 = (f1 /^ 1) ^ f2

for f1, f2 being FinSequence of D st f1 <> {} holds

(f1 ^ f2) /^ 1 = (f1 /^ 1) ^ f2

proof end;

theorem Th78: :: FINSEQ_6:78

for D being non empty set

for p2 being Element of D

for f being FinSequence of D st p2 in rng f & p2 .. f <> 1 holds

p2 in rng (f /^ 1)

for p2 being Element of D

for f being FinSequence of D st p2 in rng f & p2 .. f <> 1 holds

p2 in rng (f /^ 1)

proof end;

theorem Th79: :: FINSEQ_6:79

for D being non empty set

for p being Element of D

for f being FinSequence of D holds p .. (f :- p) = 1

for p being Element of D

for f being FinSequence of D holds p .. (f :- p) = 1

proof end;

Lm3: for i being Nat

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f & p .. f > i holds

i + (p .. (f /^ i)) = p .. f

proof end;

theorem Th81: :: FINSEQ_6:81

for i, k being Nat

for D being non empty set

for f being FinSequence of D holds f /^ (i + k) = (f /^ i) /^ k

for D being non empty set

for f being FinSequence of D holds f /^ (i + k) = (f /^ i) /^ k

proof end;

theorem Th82: :: FINSEQ_6:82

for k being Nat

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f & p .. f > k holds

(f /^ k) :- p = f :- p

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f & p .. f > k holds

(f /^ k) :- p = f :- p

proof end;

theorem Th83: :: FINSEQ_6:83

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f & p .. f <> 1 holds

(f /^ 1) :- p = f :- p

for p being Element of D

for f being FinSequence of D st p in rng f & p .. f <> 1 holds

(f /^ 1) :- p = f :- p

proof end;

theorem Th84: :: FINSEQ_6:84

for i, k being Nat

for D being non empty set

for f being FinSequence of D st i + k = len f holds

Rev (f /^ k) = (Rev f) | i

for D being non empty set

for f being FinSequence of D st i + k = len f holds

Rev (f /^ k) = (Rev f) | i

proof end;

theorem Th85: :: FINSEQ_6:85

for i, k being Nat

for D being non empty set

for f being FinSequence of D st i + k = len f holds

Rev (f | k) = (Rev f) /^ i

for D being non empty set

for f being FinSequence of D st i + k = len f holds

Rev (f | k) = (Rev f) /^ i

proof end;

theorem Th86: :: FINSEQ_6:86

for D being non empty set

for p being Element of D

for f being FinSequence of D st f just_once_values p holds

Rev (f |-- p) = (Rev f) -| p

for p being Element of D

for f being FinSequence of D st f just_once_values p holds

Rev (f |-- p) = (Rev f) -| p

proof end;

theorem Th87: :: FINSEQ_6:87

for D being non empty set

for p being Element of D

for f being FinSequence of D st f just_once_values p holds

Rev (f :- p) = (Rev f) -: p

for p being Element of D

for f being FinSequence of D st f just_once_values p holds

Rev (f :- p) = (Rev f) -: p

proof end;

theorem Th88: :: FINSEQ_6:88

for D being non empty set

for p being Element of D

for f being FinSequence of D st f just_once_values p holds

Rev (f -: p) = (Rev f) :- p

for p being Element of D

for f being FinSequence of D st f just_once_values p holds

Rev (f -: p) = (Rev f) :- p

proof end;

begin

:: deftheorem Def1 defines circular FINSEQ_6:def 1 :

for D being non empty set

for IT being FinSequence of D holds

( IT is circular iff IT /. 1 = IT /. (len IT) );

for D being non empty set

for IT being FinSequence of D holds

( IT is circular iff IT /. 1 = IT /. (len IT) );

definition

let D be non empty set ;

let f be FinSequence of D;

let p be Element of D;

coherence

( ( p in rng f implies (f :- p) ^ ((f -: p) /^ 1) is FinSequence of D ) & ( not p in rng f implies f is FinSequence of D ) );

consistency

for b_{1} being FinSequence of D holds verum;

;

end;
let f be FinSequence of D;

let p be Element of D;

func Rotate (f,p) -> FinSequence of D equals :Def2: :: FINSEQ_6:def 2

(f :- p) ^ ((f -: p) /^ 1) if p in rng f

otherwise f;

correctness (f :- p) ^ ((f -: p) /^ 1) if p in rng f

otherwise f;

coherence

( ( p in rng f implies (f :- p) ^ ((f -: p) /^ 1) is FinSequence of D ) & ( not p in rng f implies f is FinSequence of D ) );

consistency

for b

;

:: deftheorem Def2 defines Rotate FINSEQ_6:def 2 :

for D being non empty set

for f being FinSequence of D

for p being Element of D holds

( ( p in rng f implies Rotate (f,p) = (f :- p) ^ ((f -: p) /^ 1) ) & ( not p in rng f implies Rotate (f,p) = f ) );

for D being non empty set

for f being FinSequence of D

for p being Element of D holds

( ( p in rng f implies Rotate (f,p) = (f :- p) ^ ((f -: p) /^ 1) ) & ( not p in rng f implies Rotate (f,p) = f ) );

registration

let D be non empty set ;

let f be non empty FinSequence of D;

let p be Element of D;

coherence

not Rotate (f,p) is empty

end;
let f be non empty FinSequence of D;

let p be Element of D;

coherence

not Rotate (f,p) is empty

proof end;

registration

let D be non empty set ;

ex b_{1} being FinSequence of D st

( b_{1} is circular & b_{1} is 1 -element )

ex b_{1} being FinSequence of D st

( b_{1} is circular & not b_{1} is trivial )

end;
cluster Relation-like NAT -defined D -valued Function-like V34() 1 -element FinSequence-like FinSubsequence-like circular for FinSequence of D;

existence ex b

( b

proof end;

cluster non trivial Relation-like NAT -defined D -valued Function-like V34() FinSequence-like FinSubsequence-like circular for FinSequence of D;

existence ex b

( b

proof end;

registration

let D be non empty set ;

let p be Element of D;

let f be non empty circular FinSequence of D;

coherence

Rotate (f,p) is circular

end;
let p be Element of D;

let f be non empty circular FinSequence of D;

coherence

Rotate (f,p) is circular

proof end;

theorem :: FINSEQ_6:90

for D being non empty set

for p being Element of D

for f being FinSequence of D st f is circular & p in rng f holds

rng (Rotate (f,p)) = rng f

for p being Element of D

for f being FinSequence of D st f is circular & p in rng f holds

rng (Rotate (f,p)) = rng f

proof end;

theorem Th91: :: FINSEQ_6:91

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f holds

p in rng (Rotate (f,p))

for p being Element of D

for f being FinSequence of D st p in rng f holds

p in rng (Rotate (f,p))

proof end;

theorem Th92: :: FINSEQ_6:92

for D being non empty set

for p being Element of D

for f being FinSequence of D st p in rng f holds

(Rotate (f,p)) /. 1 = p

for p being Element of D

for f being FinSequence of D st p in rng f holds

(Rotate (f,p)) /. 1 = p

proof end;

theorem Th93: :: FINSEQ_6:93

for D being non empty set

for p being Element of D

for f being FinSequence of D holds Rotate ((Rotate (f,p)),p) = Rotate (f,p)

for p being Element of D

for f being FinSequence of D holds Rotate ((Rotate (f,p)),p) = Rotate (f,p)

proof end;

theorem Th97: :: FINSEQ_6:97

for D being non empty set

for p1, p2, p3 being Element of D holds Rotate (<*p1,p2,p3*>,p1) = <*p1,p2,p3*>

for p1, p2, p3 being Element of D holds Rotate (<*p1,p2,p3*>,p1) = <*p1,p2,p3*>

proof end;

theorem :: FINSEQ_6:98

for D being non empty set

for p1, p2, p3 being Element of D st p1 <> p2 holds

Rotate (<*p1,p2,p3*>,p2) = <*p2,p3,p2*>

for p1, p2, p3 being Element of D st p1 <> p2 holds

Rotate (<*p1,p2,p3*>,p2) = <*p2,p3,p2*>

proof end;

theorem :: FINSEQ_6:99

for D being non empty set

for p2, p3, p1 being Element of D st p2 <> p3 holds

Rotate (<*p1,p2,p3*>,p3) = <*p3,p2,p3*>

for p2, p3, p1 being Element of D st p2 <> p3 holds

Rotate (<*p1,p2,p3*>,p3) = <*p3,p2,p3*>

proof end;

theorem :: FINSEQ_6:100

for D being non empty set

for f being non trivial circular FinSequence of D holds rng (f /^ 1) = rng f

for f being non trivial circular FinSequence of D holds rng (f /^ 1) = rng f

proof end;

theorem Th101: :: FINSEQ_6:101

for D being non empty set

for p being Element of D

for f being FinSequence of D holds rng (f /^ 1) c= rng (Rotate (f,p))

for p being Element of D

for f being FinSequence of D holds rng (f /^ 1) c= rng (Rotate (f,p))

proof end;

theorem Th102: :: FINSEQ_6:102

for D being non empty set

for p2, p1 being Element of D

for f being FinSequence of D st p2 in (rng f) \ (rng (f -: p1)) holds

Rotate ((Rotate (f,p1)),p2) = Rotate (f,p2)

for p2, p1 being Element of D

for f being FinSequence of D st p2 in (rng f) \ (rng (f -: p1)) holds

Rotate ((Rotate (f,p1)),p2) = Rotate (f,p2)

proof end;

theorem Th103: :: FINSEQ_6:103

for D being non empty set

for p2, p1 being Element of D

for f being FinSequence of D st p2 .. f <> 1 & p2 in (rng f) \ (rng (f :- p1)) holds

Rotate ((Rotate (f,p1)),p2) = Rotate (f,p2)

for p2, p1 being Element of D

for f being FinSequence of D st p2 .. f <> 1 & p2 in (rng f) \ (rng (f :- p1)) holds

Rotate ((Rotate (f,p1)),p2) = Rotate (f,p2)

proof end;

theorem Th104: :: FINSEQ_6:104

for D being non empty set

for p2, p1 being Element of D

for f being FinSequence of D st p2 in rng (f /^ 1) & f just_once_values p2 holds

Rotate ((Rotate (f,p1)),p2) = Rotate (f,p2)

for p2, p1 being Element of D

for f being FinSequence of D st p2 in rng (f /^ 1) & f just_once_values p2 holds

Rotate ((Rotate (f,p1)),p2) = Rotate (f,p2)

proof end;

theorem :: FINSEQ_6:105

for D being non empty set

for p2, p1 being Element of D

for f being FinSequence of D st f is circular & f just_once_values p2 holds

Rotate ((Rotate (f,p1)),p2) = Rotate (f,p2)

for p2, p1 being Element of D

for f being FinSequence of D st f is circular & f just_once_values p2 holds

Rotate ((Rotate (f,p1)),p2) = Rotate (f,p2)

proof end;

theorem :: FINSEQ_6:106

for D being non empty set

for p being Element of D

for f being FinSequence of D st f is circular & f just_once_values p holds

Rev (Rotate (f,p)) = Rotate ((Rev f),p)

for p being Element of D

for f being FinSequence of D st f is circular & f just_once_values p holds

Rev (Rotate (f,p)) = Rotate ((Rev f),p)

proof end;

begin

:: from AMISTD_1, 2007.07.26, A.T.

theorem :: FINSEQ_6:107

for D being non empty set

for f being trivial FinSequence of D holds

( f is empty or ex x being Element of D st f = <*x*> )

for f being trivial FinSequence of D holds

( f is empty or ex x being Element of D st f = <*x*> )

proof end;

begin

theorem :: FINSEQ_6:108

for i being Nat

for p, q being FinSequence st len p < i & ( i <= (len p) + (len q) or i <= len (p ^ q) ) holds

(p ^ q) . i = q . (i - (len p))

for p, q being FinSequence st len p < i & ( i <= (len p) + (len q) or i <= len (p ^ q) ) holds

(p ^ q) . i = q . (i - (len p))

proof end;

theorem :: FINSEQ_6:109

for D being non empty set

for x being set

for f being FinSequence of D st 1 <= len f holds

( (f ^ <*x*>) . 1 = f . 1 & (f ^ <*x*>) . 1 = f /. 1 & (<*x*> ^ f) . ((len f) + 1) = f . (len f) & (<*x*> ^ f) . ((len f) + 1) = f /. (len f) )

for x being set

for f being FinSequence of D st 1 <= len f holds

( (f ^ <*x*>) . 1 = f . 1 & (f ^ <*x*>) . 1 = f /. 1 & (<*x*> ^ f) . ((len f) + 1) = f . (len f) & (<*x*> ^ f) . ((len f) + 1) = f /. (len f) )

proof end;

theorem :: FINSEQ_6:111

for D being non empty set

for f being FinSequence of D

for k being Nat holds len (f /^ k) = (len f) -' k by RFINSEQ:29;

for f being FinSequence of D

for k being Nat holds len (f /^ k) = (len f) -' k by RFINSEQ:29;

theorem :: FINSEQ_6:112

definition

let f be FinSequence;

let k1, k2 be Nat;

coherence

( ( k1 <= k2 implies (f /^ (k1 -' 1)) | ((k2 -' k1) + 1) is FinSequence ) & ( not k1 <= k2 implies Rev ((f /^ (k2 -' 1)) | ((k1 -' k2) + 1)) is FinSequence ) );

consistency

for b_{1} being FinSequence holds verum;

;

end;
let k1, k2 be Nat;

func mid (f,k1,k2) -> FinSequence equals :Def3: :: FINSEQ_6:def 3

(f /^ (k1 -' 1)) | ((k2 -' k1) + 1) if k1 <= k2

otherwise Rev ((f /^ (k2 -' 1)) | ((k1 -' k2) + 1));

correctness (f /^ (k1 -' 1)) | ((k2 -' k1) + 1) if k1 <= k2

otherwise Rev ((f /^ (k2 -' 1)) | ((k1 -' k2) + 1));

coherence

( ( k1 <= k2 implies (f /^ (k1 -' 1)) | ((k2 -' k1) + 1) is FinSequence ) & ( not k1 <= k2 implies Rev ((f /^ (k2 -' 1)) | ((k1 -' k2) + 1)) is FinSequence ) );

consistency

for b

;

:: deftheorem Def3 defines mid FINSEQ_6:def 3 :

for f being FinSequence

for k1, k2 being Nat holds

( ( k1 <= k2 implies mid (f,k1,k2) = (f /^ (k1 -' 1)) | ((k2 -' k1) + 1) ) & ( not k1 <= k2 implies mid (f,k1,k2) = Rev ((f /^ (k2 -' 1)) | ((k1 -' k2) + 1)) ) );

for f being FinSequence

for k1, k2 being Nat holds

( ( k1 <= k2 implies mid (f,k1,k2) = (f /^ (k1 -' 1)) | ((k2 -' k1) + 1) ) & ( not k1 <= k2 implies mid (f,k1,k2) = Rev ((f /^ (k2 -' 1)) | ((k1 -' k2) + 1)) ) );

definition

let D be non empty set ;

let f be FinSequence of D;

let k1, k2 be Nat;

:: original: mid

redefine func mid (f,k1,k2) -> FinSequence of D;

coherence

mid (f,k1,k2) is FinSequence of D

end;
let f be FinSequence of D;

let k1, k2 be Nat;

:: original: mid

redefine func mid (f,k1,k2) -> FinSequence of D;

coherence

mid (f,k1,k2) is FinSequence of D

proof end;

theorem :: FINSEQ_6:113

for D being non empty set

for f being FinSequence of D

for k1, k2 being Element of NAT st 1 <= k1 & k1 <= len f & 1 <= k2 & k2 <= len f holds

Rev (mid (f,k1,k2)) = mid ((Rev f),(((len f) -' k2) + 1),(((len f) -' k1) + 1))

for f being FinSequence of D

for k1, k2 being Element of NAT st 1 <= k1 & k1 <= len f & 1 <= k2 & k2 <= len f holds

Rev (mid (f,k1,k2)) = mid ((Rev f),(((len f) -' k2) + 1),(((len f) -' k1) + 1))

proof end;

theorem Th114: :: FINSEQ_6:114

for D being non empty set

for n, m being Element of NAT

for f being FinSequence of D st 1 <= m & m + n <= len f holds

(f /^ n) . m = f . (m + n)

for n, m being Element of NAT

for f being FinSequence of D st 1 <= m & m + n <= len f holds

(f /^ n) . m = f . (m + n)

proof end;

theorem Th115: :: FINSEQ_6:115

for D being non empty set

for i being Element of NAT

for f being FinSequence of D st 1 <= i & i <= len f holds

(Rev f) . i = f . (((len f) - i) + 1)

for i being Element of NAT

for f being FinSequence of D st 1 <= i & i <= len f holds

(Rev f) . i = f . (((len f) - i) + 1)

proof end;

theorem :: FINSEQ_6:116

for D being non empty set

for f being FinSequence of D

for k being Nat st 1 <= k holds

mid (f,1,k) = f | k

for f being FinSequence of D

for k being Nat st 1 <= k holds

mid (f,1,k) = f | k

proof end;

theorem :: FINSEQ_6:117

for D being non empty set

for f being FinSequence of D

for k being Element of NAT st k <= len f holds

mid (f,k,(len f)) = f /^ (k -' 1)

for f being FinSequence of D

for k being Element of NAT st k <= len f holds

mid (f,k,(len f)) = f /^ (k -' 1)

proof end;

theorem Th118: :: FINSEQ_6:118

for D being non empty set

for f being FinSequence of D

for k1, k2 being Element of NAT st 1 <= k1 & k1 <= len f & 1 <= k2 & k2 <= len f holds

( (mid (f,k1,k2)) . 1 = f . k1 & ( k1 <= k2 implies ( len (mid (f,k1,k2)) = (k2 -' k1) + 1 & ( for i being Element of NAT st 1 <= i & i <= len (mid (f,k1,k2)) holds

(mid (f,k1,k2)) . i = f . ((i + k1) -' 1) ) ) ) & ( k1 > k2 implies ( len (mid (f,k1,k2)) = (k1 -' k2) + 1 & ( for i being Element of NAT st 1 <= i & i <= len (mid (f,k1,k2)) holds

(mid (f,k1,k2)) . i = f . ((k1 -' i) + 1) ) ) ) )

for f being FinSequence of D

for k1, k2 being Element of NAT st 1 <= k1 & k1 <= len f & 1 <= k2 & k2 <= len f holds

( (mid (f,k1,k2)) . 1 = f . k1 & ( k1 <= k2 implies ( len (mid (f,k1,k2)) = (k2 -' k1) + 1 & ( for i being Element of NAT st 1 <= i & i <= len (mid (f,k1,k2)) holds

(mid (f,k1,k2)) . i = f . ((i + k1) -' 1) ) ) ) & ( k1 > k2 implies ( len (mid (f,k1,k2)) = (k1 -' k2) + 1 & ( for i being Element of NAT st 1 <= i & i <= len (mid (f,k1,k2)) holds

(mid (f,k1,k2)) . i = f . ((k1 -' i) + 1) ) ) ) )

proof end;

theorem :: FINSEQ_6:119

for D being non empty set

for f being FinSequence of D

for k1, k2 being Element of NAT holds rng (mid (f,k1,k2)) c= rng f

for f being FinSequence of D

for k1, k2 being Element of NAT holds rng (mid (f,k1,k2)) c= rng f

proof end;

theorem :: FINSEQ_6:121

for D being non empty set

for f being FinSequence of D st 1 <= len f holds

mid (f,(len f),1) = Rev f

for f being FinSequence of D st 1 <= len f holds

mid (f,(len f),1) = Rev f

proof end;

theorem Th122: :: FINSEQ_6:122

for D being non empty set

for f being FinSequence of D

for k1, k2, i being Element of NAT st 1 <= k1 & k1 <= k2 & k2 <= len f & 1 <= i & ( i <= (k2 -' k1) + 1 or i <= (k2 - k1) + 1 or i <= (k2 + 1) - k1 ) holds

( (mid (f,k1,k2)) . i = f . ((i + k1) -' 1) & (mid (f,k1,k2)) . i = f . ((i -' 1) + k1) & (mid (f,k1,k2)) . i = f . ((i + k1) - 1) & (mid (f,k1,k2)) . i = f . ((i - 1) + k1) )

for f being FinSequence of D

for k1, k2, i being Element of NAT st 1 <= k1 & k1 <= k2 & k2 <= len f & 1 <= i & ( i <= (k2 -' k1) + 1 or i <= (k2 - k1) + 1 or i <= (k2 + 1) - k1 ) holds

( (mid (f,k1,k2)) . i = f . ((i + k1) -' 1) & (mid (f,k1,k2)) . i = f . ((i -' 1) + k1) & (mid (f,k1,k2)) . i = f . ((i + k1) - 1) & (mid (f,k1,k2)) . i = f . ((i - 1) + k1) )

proof end;

theorem :: FINSEQ_6:123

for D being non empty set

for f being FinSequence of D

for k, i being Nat st 1 <= i & i <= k & k <= len f holds

(mid (f,1,k)) . i = f . i

for f being FinSequence of D

for k, i being Nat st 1 <= i & i <= k & k <= len f holds

(mid (f,1,k)) . i = f . i

proof end;

theorem :: FINSEQ_6:124

for D being non empty set

for f being FinSequence of D

for k1, k2 being Element of NAT st 1 <= k1 & k1 <= k2 & k2 <= len f holds

len (mid (f,k1,k2)) <= len f

for f being FinSequence of D

for k1, k2 being Element of NAT st 1 <= k1 & k1 <= k2 & k2 <= len f holds

len (mid (f,k1,k2)) <= len f

proof end;

theorem Th125: :: FINSEQ_6:125

for D being non empty set

for f being FinSequence of D

for k being Element of NAT

for p being Element of D holds (<*p*> ^ f) | (k + 1) = <*p*> ^ (f | k)

for f being FinSequence of D

for k being Element of NAT

for p being Element of D holds (<*p*> ^ f) | (k + 1) = <*p*> ^ (f | k)

proof end;

theorem :: FINSEQ_6:126

for D being non empty set

for f being FinSequence of D

for k1, k2 being Element of NAT st k1 < k2 & k1 in dom f holds

mid (f,k1,k2) = <*(f . k1)*> ^ (mid (f,(k1 + 1),k2))

for f being FinSequence of D

for k1, k2 being Element of NAT st k1 < k2 & k1 in dom f holds

mid (f,k1,k2) = <*(f . k1)*> ^ (mid (f,(k1 + 1),k2))

proof end;