:: FINSEQ_7 semantic presentation

theorem Th1: :: FINSEQ_7:1
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Nat st 1 <= b3 & b4 <= len b2 & b3 < b4 holds
b2 = ((((b2 | (b3 -' 1)) ^ <*(b2 . b3)*>) ^ ((b2 /^ b3) | ((b4 -' b3) -' 1))) ^ <*(b2 . b4)*>) ^ (b2 /^ b4)
proof end;

theorem Th2: :: FINSEQ_7:2
for b1 being Nat
for b2, b3, b4 being FinSequence st len b3 = len b4 & len b3 < b1 & b1 <= len (b3 ^ b2) holds
(b3 ^ b2) . b1 = (b4 ^ b2) . b1
proof end;

theorem Th3: :: FINSEQ_7:3
for b1 being Nat
for b2, b3 being FinSequence st 1 <= b1 & b1 <= len b2 holds
b2 . b1 = (b3 ^ b2) . ((len b3) + b1)
proof end;

theorem Th4: :: FINSEQ_7:4
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Nat st b3 in dom (b2 /^ b4) holds
(b2 /^ b4) . b3 = b2 . (b4 + b3)
proof end;

Lemma2: for b1, b2 being Nat holds (b1 -' b2) -' 1 = (b1 -' 1) -' b2
proof end;

notation
let c1 be non empty set ;
let c2 be FinSequence of c1;
let c3 be Nat;
let c4 be Element of c1;
synonym Replace c2,c3,c4 for c1 +* c2,c3;
end;

definition
let c1 be non empty set ;
let c2 be FinSequence of c1;
let c3 be Nat;
let c4 be Element of c1;
redefine func Replace as Replace c2,c3,c4 -> FinSequence of a1 equals :Def1: :: FINSEQ_7:def 1
((a2 | (a3 -' 1)) ^ <*a4*>) ^ (a2 /^ a3) if ( 1 <= a3 & a3 <= len a2 )
otherwise a2;
compatibility
for b1 being FinSequence of c1 holds
( ( 1 <= c3 & c3 <= len c2 implies ( b1 = Replace c3,c4, iff b1 = ((c2 | (c3 -' 1)) ^ <*c4*>) ^ (c2 /^ c3) ) ) & ( ( not 1 <= c3 or not c3 <= len c2 ) implies ( b1 = Replace c3,c4, iff b1 = c2 ) ) )
proof end;
correctness
coherence
Replace c3,c4, is FinSequence of c1
;
consistency
for b1 being FinSequence of c1 holds verum
;
proof end;
end;

:: deftheorem Def1 defines Replace FINSEQ_7:def 1 :
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Nat
for b4 being Element of b1 holds
( ( 1 <= b3 & b3 <= len b2 implies Replace b2,b3,b4 = ((b2 | (b3 -' 1)) ^ <*b4*>) ^ (b2 /^ b3) ) & ( ( not 1 <= b3 or not b3 <= len b2 ) implies Replace b2,b3,b4 = b2 ) );

theorem Th5: :: FINSEQ_7:5
canceled;

theorem Th6: :: FINSEQ_7:6
canceled;

theorem Th7: :: FINSEQ_7:7
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Element of b1
for b4 being Nat holds len (Replace b2,b4,b3) = len b2
proof end;

theorem Th8: :: FINSEQ_7:8
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Element of b1
for b4 being Nat holds rng (Replace b2,b4,b3) c= (rng b2) \/ {b3}
proof end;

theorem Th9: :: FINSEQ_7:9
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Element of b1
for b4 being Nat st 1 <= b4 & b4 <= len b2 holds
b3 in rng (Replace b2,b4,b3)
proof end;

Lemma5: for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Element of b1
for b4 being Nat st 1 <= b4 & b4 <= len b2 holds
(Replace b2,b4,b3) . b4 = b3
proof end;

theorem Th10: :: FINSEQ_7:10
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Element of b1
for b4 being Nat st 1 <= b4 & b4 <= len b2 holds
(Replace b2,b4,b3) /. b4 = b3
proof end;

theorem Th11: :: FINSEQ_7:11
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Element of b1
for b4 being Nat st 1 <= b4 & b4 <= len b2 holds
for b5 being Nat st 0 < b5 & b5 <= (len b2) - b4 holds
(Replace b2,b4,b3) . (b4 + b5) = (b2 /^ b4) . b5
proof end;

theorem Th12: :: FINSEQ_7:12
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Element of b1
for b4, b5 being Nat st 1 <= b4 & b4 <= len b2 & b4 <> b5 holds
(Replace b2,b5,b3) /. b4 = b2 /. b4
proof end;

theorem Th13: :: FINSEQ_7:13
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Element of b1
for b5, b6 being Nat st 1 <= b5 & b5 < b6 & b6 <= len b2 holds
Replace (Replace b2,b6,b3),b5,b4 = ((((b2 | (b5 -' 1)) ^ <*b4*>) ^ ((b2 /^ b5) | ((b6 -' b5) -' 1))) ^ <*b3*>) ^ (b2 /^ b6)
proof end;

theorem Th14: :: FINSEQ_7:14
for b1 being non empty set
for b2, b3 being Element of b1 holds Replace <*b2*>,1,b3 = <*b3*>
proof end;

theorem Th15: :: FINSEQ_7:15
for b1 being non empty set
for b2, b3, b4 being Element of b1 holds Replace <*b2,b3*>,1,b4 = <*b4,b3*>
proof end;

theorem Th16: :: FINSEQ_7:16
for b1 being non empty set
for b2, b3, b4 being Element of b1 holds Replace <*b2,b3*>,2,b4 = <*b2,b4*>
proof end;

theorem Th17: :: FINSEQ_7:17
for b1 being non empty set
for b2, b3, b4, b5 being Element of b1 holds Replace <*b2,b3,b4*>,1,b5 = <*b5,b3,b4*>
proof end;

theorem Th18: :: FINSEQ_7:18
for b1 being non empty set
for b2, b3, b4, b5 being Element of b1 holds Replace <*b2,b3,b4*>,2,b5 = <*b2,b5,b4*>
proof end;

theorem Th19: :: FINSEQ_7:19
for b1 being non empty set
for b2, b3, b4, b5 being Element of b1 holds Replace <*b2,b3,b4*>,3,b5 = <*b2,b3,b5*>
proof end;

definition
let c1 be non empty set ;
let c2 be FinSequence of c1;
let c3, c4 be Nat;
func Swap c2,c3,c4 -> FinSequence of a1 equals :Def2: :: FINSEQ_7:def 2
Replace (Replace a2,a3,(a2 /. a4)),a4,(a2 /. a3) if ( 1 <= a3 & a3 <= len a2 & 1 <= a4 & a4 <= len a2 )
otherwise a2;
correctness
coherence
( ( 1 <= c3 & c3 <= len c2 & 1 <= c4 & c4 <= len c2 implies Replace (Replace c2,c3,(c2 /. c4)),c4,(c2 /. c3) is FinSequence of c1 ) & ( ( not 1 <= c3 or not c3 <= len c2 or not 1 <= c4 or not c4 <= len c2 ) implies c2 is FinSequence of c1 ) )
;
consistency
for b1 being FinSequence of c1 holds verum
;
;
end;

:: deftheorem Def2 defines Swap FINSEQ_7:def 2 :
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Nat holds
( ( 1 <= b3 & b3 <= len b2 & 1 <= b4 & b4 <= len b2 implies Swap b2,b3,b4 = Replace (Replace b2,b3,(b2 /. b4)),b4,(b2 /. b3) ) & ( ( not 1 <= b3 or not b3 <= len b2 or not 1 <= b4 or not b4 <= len b2 ) implies Swap b2,b3,b4 = b2 ) );

theorem Th20: :: FINSEQ_7:20
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Nat holds len (Swap b2,b3,b4) = len b2
proof end;

Lemma15: for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Nat st 1 <= b3 & b3 <= len b2 & 1 <= b4 & b4 <= len b2 holds
( (Swap b2,b3,b4) . b3 = b2 . b4 & (Swap b2,b3,b4) . b4 = b2 . b3 )
proof end;

theorem Th21: :: FINSEQ_7:21
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Nat holds Swap b2,b3,b3 = b2
proof end;

theorem Th22: :: FINSEQ_7:22
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Nat holds Swap (Swap b2,b3,b4),b4,b3 = b2
proof end;

theorem Th23: :: FINSEQ_7:23
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Nat holds Swap b2,b3,b4 = Swap b2,b4,b3
proof end;

theorem Th24: :: FINSEQ_7:24
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Nat holds rng (Swap b2,b3,b4) = rng b2
proof end;

theorem Th25: :: FINSEQ_7:25
for b1 being non empty set
for b2, b3 being Element of b1 holds Swap <*b2,b3*>,1,2 = <*b3,b2*>
proof end;

theorem Th26: :: FINSEQ_7:26
for b1 being non empty set
for b2, b3, b4 being Element of b1 holds Swap <*b2,b3,b4*>,1,2 = <*b3,b2,b4*>
proof end;

theorem Th27: :: FINSEQ_7:27
for b1 being non empty set
for b2, b3, b4 being Element of b1 holds Swap <*b2,b3,b4*>,1,3 = <*b4,b3,b2*>
proof end;

theorem Th28: :: FINSEQ_7:28
for b1 being non empty set
for b2, b3, b4 being Element of b1 holds Swap <*b2,b3,b4*>,2,3 = <*b2,b4,b3*>
proof end;

theorem Th29: :: FINSEQ_7:29
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Nat st 1 <= b3 & b3 < b4 & b4 <= len b2 holds
Swap b2,b3,b4 = ((((b2 | (b3 -' 1)) ^ <*(b2 /. b4)*>) ^ ((b2 /^ b3) | ((b4 -' b3) -' 1))) ^ <*(b2 /. b3)*>) ^ (b2 /^ b4)
proof end;

theorem Th30: :: FINSEQ_7:30
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Nat st 1 < b3 & b3 <= len b2 holds
Swap b2,1,b3 = ((<*(b2 /. b3)*> ^ ((b2 /^ 1) | (b3 -' 2))) ^ <*(b2 /. 1)*>) ^ (b2 /^ b3)
proof end;

theorem Th31: :: FINSEQ_7:31
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Nat st 1 <= b3 & b3 < len b2 holds
Swap b2,b3,(len b2) = (((b2 | (b3 -' 1)) ^ <*(b2 /. (len b2))*>) ^ ((b2 /^ b3) | (((len b2) -' b3) -' 1))) ^ <*(b2 /. b3)*>
proof end;

Lemma19: for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4, b5 being Nat st b3 <> b4 & b5 <> b4 holds
(Swap b2,b3,b5) . b4 = b2 . b4
proof end;

theorem Th32: :: FINSEQ_7:32
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4, b5 being Nat st b3 <> b4 & b5 <> b4 & 1 <= b4 & b4 <= len b2 holds
(Swap b2,b3,b5) /. b4 = b2 /. b4
proof end;

theorem Th33: :: FINSEQ_7:33
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4 being Nat st 1 <= b3 & b3 <= len b2 & 1 <= b4 & b4 <= len b2 holds
( (Swap b2,b3,b4) /. b3 = b2 /. b4 & (Swap b2,b3,b4) /. b4 = b2 /. b3 )
proof end;

theorem Th34: :: FINSEQ_7:34
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Element of b1
for b4, b5 being Nat st 1 <= b4 & b4 <= len b2 & 1 <= b5 & b5 <= len b2 holds
Replace (Swap b2,b4,b5),b4,b3 = Swap (Replace b2,b5,b3),b4,b5
proof end;

theorem Th35: :: FINSEQ_7:35
for b1 being non empty set
for b2 being FinSequence of b1
for b3 being Element of b1
for b4, b5, b6 being Nat st b4 <> b5 & b6 <> b5 & 1 <= b4 & b4 <= len b2 & 1 <= b6 & b6 <= len b2 & 1 <= b5 & b5 <= len b2 holds
Swap (Replace b2,b5,b3),b4,b6 = Replace (Swap b2,b4,b6),b5,b3
proof end;

theorem Th36: :: FINSEQ_7:36
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4, b5 being Nat st b3 <> b4 & b5 <> b4 & 1 <= b3 & b3 <= len b2 & 1 <= b5 & b5 <= len b2 & 1 <= b4 & b4 <= len b2 holds
Swap (Swap b2,b3,b5),b5,b4 = Swap (Swap b2,b3,b4),b3,b5
proof end;

theorem Th37: :: FINSEQ_7:37
for b1 being non empty set
for b2 being FinSequence of b1
for b3, b4, b5, b6 being Nat st b3 <> b4 & b5 <> b4 & b6 <> b3 & b6 <> b5 & 1 <= b3 & b3 <= len b2 & 1 <= b5 & b5 <= len b2 & 1 <= b4 & b4 <= len b2 & 1 <= b6 & b6 <= len b2 holds
Swap (Swap b2,b3,b5),b4,b6 = Swap (Swap b2,b4,b6),b3,b5
proof end;