:: Representation of the {F}ibonacci and {L}ucas Numbers in Terms of the Floor and Ceiling Functor
:: by Magdalena Jastrz\c{e}bska
::
:: Copyright (c) 2009-2021 Association of Mizar Users

Lm1: for m, n being Nat holds - m <= m * ((- 1) to_power n)
proof end;

Lm2: for m, n being Nat holds - (m * ((- 1) to_power n)) >= - m
proof end;

theorem Th1: :: FIB_NUM4:1
for a, b being Real
for c being Nat holds (a / b) to_power c = (a to_power c) / (b to_power c)
proof end;

theorem Th2: :: FIB_NUM4:2
for a being Real
for b, c being Integer st a <> 0 holds
a to_power (b + c) = (a to_power b) * (a to_power c)
proof end;

theorem Th3: :: FIB_NUM4:3
for n being Nat
for a being Real st n is even & a <> 0 holds
(- a) to_power n = a to_power n by POWER:47;

theorem Th4: :: FIB_NUM4:4
for n being Nat
for a being Real st n is odd & a <> 0 holds
(- a) to_power n = - (a to_power n) by POWER:48;

Lm3:
proof end;

Lm4: tau_bar / tau = ((sqrt 5) - 3) / 2
proof end;

Lm5: tau / tau_bar = ((- 3) - (sqrt 5)) / 2
proof end;

Lm6: tau to_power 2 = (3 + (sqrt 5)) / 2
proof end;

Lm7: tau_bar to_power 2 = (3 - (sqrt 5)) / 2
proof end;

Lm8: tau_bar to_power 3 = 2 - (sqrt 5)
proof end;

Lm9: tau_bar to_power 6 = 9 - (4 * (sqrt 5))
proof end;

theorem Th5: :: FIB_NUM4:5
proof end;

Lm10: for n being Nat holds () * (1 / (sqrt 5)) > 0
proof end;

Lm11: for n being Nat holds () * (1 / (sqrt 5)) < 1 / 2
proof end;

theorem Th6: :: FIB_NUM4:6
for n being Nat
for r being non zero Real st n is even holds
r to_power n > 0
proof end;

theorem Th7: :: FIB_NUM4:7
for n being Nat
for r being Real st n is odd & r < 0 holds
r to_power n < 0
proof end;

theorem Th8: :: FIB_NUM4:8
for n being Nat st n <> 0 holds
tau_bar to_power n < 1 / 2
proof end;

theorem :: FIB_NUM4:9
for n, m being Nat
for r being Real st m is odd & n >= m & r < 0 & r > - 1 holds
r to_power n >= r to_power m
proof end;

theorem Th10: :: FIB_NUM4:10
for n, m being Nat st m is odd & n >= m holds
tau_bar to_power n >= tau_bar to_power m
proof end;

theorem Th11: :: FIB_NUM4:11
for n, m being Nat st n is even & m is even & n >= m holds
tau_bar to_power n <= tau_bar to_power m
proof end;

theorem Th12: :: FIB_NUM4:12
for m, n being non zero Nat st m >= n holds
Lucas m >= Lucas n
proof end;

Lm12: tau_bar ^2 = (3 - (sqrt 5)) / 2
by ;

Lm13:
by SQUARE_1:25;

then (sqrt 5) + 3 > (- (sqrt 5)) + 3
by XREAL_1:6;

then ((sqrt 5) + 3) / 2 > ((- (sqrt 5)) + 3) / 2
by XREAL_1:74;

then Lm14:
by ;

sqrt 5 < sqrt (3 ^2)
by SQUARE_1:27;

then sqrt 5 < 3
by SQUARE_1:def 2;

then (sqrt 5) - 3 < 3 - 3
by XREAL_1:9;

then Lm15: ((sqrt 5) - 3) / 2 < 0
;

theorem :: FIB_NUM4:13
for n being non zero Nat holds tau to_power n > tau_bar to_power n
proof end;

theorem Th14: :: FIB_NUM4:14
for n being Nat st n > 1 holds
- (1 / 2) < tau_bar to_power n
proof end;

theorem Th15: :: FIB_NUM4:15
for n being Nat st n > 2 holds
tau_bar to_power n >= - (1 / (sqrt 5))
proof end;

theorem Th16: :: FIB_NUM4:16
for n being Nat st n >= 2 holds
tau_bar to_power n <= 1 / (sqrt 5)
proof end;

theorem Th17: :: FIB_NUM4:17
for n being Nat holds
( (() / (sqrt 5)) + (1 / 2) > 0 & (() / (sqrt 5)) + (1 / 2) < 1 )
proof end;

theorem :: FIB_NUM4:18
for n being Nat holds [\((() / (sqrt 5)) + (1 / 2))/] = Fib n
proof end;

theorem :: FIB_NUM4:19
for n being Nat st n <> 0 holds
[/((() / (sqrt 5)) - (1 / 2))\] = Fib n
proof end;

set s5 = sqrt 5;

Lm16: 1 < sqrt 5
by ;

1 - (sqrt 5) <> 0
by ;

then (1 - (sqrt 5)) ^2 > 0
by SQUARE_1:12;

then Lm17: (1 - (sqrt 5)) to_power 2 > 0
by POWER:46;

Lm18:
by SQUARE_1:25;

2 * 1 < 2 * (sqrt 5)
by ;

then - (2 * (sqrt 5)) < - 2
by XREAL_1:24;

then (- (2 * (sqrt 5))) + 6 < (- 2) + 6
by XREAL_1:8;

then (1 - (2 * (sqrt 5))) + 5 < 4
;

then ((1 ^2) - ((2 * 1) * (sqrt 5))) + ((sqrt 5) ^2) < 4
by SQUARE_1:def 2;

then (1 - (sqrt 5)) ^2 < 2 ^2
;

then (1 - (sqrt 5)) ^2 < 2 to_power 2
by POWER:46;

then Lm19: (1 - (sqrt 5)) to_power 2 < 2 to_power 2
by POWER:46;

theorem :: FIB_NUM4:20
for n being Nat st n <> 0 holds
[\((tau to_power (2 * n)) / (sqrt 5))/] = Fib (2 * n)
proof end;

theorem :: FIB_NUM4:21
for n being Nat holds [/((tau to_power ((2 * n) + 1)) / (sqrt 5))\] = Fib ((2 * n) + 1)
proof end;

theorem Th22: :: FIB_NUM4:22
for n being Nat st n >= 2 & n is even holds
Fib (n + 1) = [\((tau * (Fib n)) + 1)/]
proof end;

theorem Th23: :: FIB_NUM4:23
for n being Nat st n >= 2 & n is odd holds
Fib (n + 1) = [/((tau * (Fib n)) - 1)\]
proof end;

theorem Th24: :: FIB_NUM4:24
for n being Nat st n >= 2 holds
Fib (n + 1) = [\((((Fib n) + ((sqrt 5) * (Fib n))) + 1) / 2)/]
proof end;

theorem :: FIB_NUM4:25
for n being Nat st n >= 2 holds
Fib (n + 1) = [/((((Fib n) + ((sqrt 5) * (Fib n))) - 1) / 2)\]
proof end;

theorem :: FIB_NUM4:26
for n being Nat holds Fib (n + 1) = ((Fib n) + (sqrt ((5 * ((Fib n) ^2)) + (4 * ((- 1) to_power n))))) / 2
proof end;

theorem :: FIB_NUM4:27
for n being Nat st n >= 2 holds
Fib (n + 1) = [\((((Fib n) + 1) + (sqrt (((5 * ((Fib n) ^2)) - (2 * (Fib n))) + 1))) / 2)/]
proof end;

Lm20:
by SQUARE_1:25;

Lm21: (sqrt 5) / (((sqrt 5) - 5) * tau) = (sqrt 5) / (((sqrt 5) - ((sqrt 5) ^2)) * tau) by SQUARE_1:def 2
.= (sqrt 5) / ((sqrt 5) * ((1 - (sqrt 5)) * tau))
.= ((sqrt 5) / (sqrt 5)) / ((1 - (sqrt 5)) * tau) by XCMPLX_1:78
.= 1 / (((1 - (sqrt 5)) * (1 + (sqrt 5))) / 2) by
.= (1 * 2) / ((1 - (sqrt 5)) * (1 + (sqrt 5))) by XCMPLX_1:77
.= 2 / ((1 ^2) - ((sqrt 5) ^2))
.= 2 / ((1 ^2) - 5) by SQUARE_1:def 2
.= - (1 / 2) ;

theorem :: FIB_NUM4:28
for n being Nat st n >= 2 holds
Fib n = [\((1 / tau) * ((Fib (n + 1)) + (1 / 2)))/]
proof end;

Lm22: sqrt 5 > 1
by ;

then Lm23: ( (sqrt 5) - 1 > 1 - 1 & sqrt 5 > 0 )
by XREAL_1:9;

sqrt 5 > 2
by ;

then - (sqrt 5) < - 2
by XREAL_1:24;

then (- (sqrt 5)) + 5 < (- 2) + 5
by XREAL_1:6;

then (- (sqrt 5)) + ((sqrt 5) ^2) < 3
by SQUARE_1:def 2;

then ((sqrt 5) * ((sqrt 5) - 1)) / 5 < 3 / 5
by XREAL_1:74;

then ((sqrt 5) - 1) * ((sqrt 5) / 5) < 6 / 10
;

then ((sqrt 5) - 1) * ((sqrt 5) / ((sqrt 5) ^2)) < 6 / 10
by SQUARE_1:def 2;

then ( ((sqrt 5) - 1) * ((1 * (sqrt 5)) / ((sqrt 5) * (sqrt 5))) < 6 / 10 & sqrt 5 > 0 )
by SQUARE_1:25;

then ((sqrt 5) - 1) * (1 / (sqrt 5)) < 6 / 10
by XCMPLX_1:91;

then Lm24: ((sqrt 5) - 1) / (sqrt 5) < 6 / 10
by XCMPLX_1:99;

sqrt ((3 / 2) ^2) <= sqrt 5
by SQUARE_1:26;

then 3 / 2 <= sqrt 5
by SQUARE_1:def 2;

then (3 / 2) * 2 <= (sqrt 5) * 2
by XREAL_1:64;

then Lm25: 3 / 4 <= (2 * (sqrt 5)) / (2 * 2)
by XREAL_1:72;

Lm26: ( (sqrt 5) - 1 > 1 - 1 & sqrt 5 > 0 )
by ;

( (- 1) + (sqrt 5) < 0 + (sqrt 5) & sqrt 5 > 0 )
by ;

then ( ((sqrt 5) - 1) / (sqrt 5) < (sqrt 5) / (sqrt 5) & sqrt 5 > 0 )
by XREAL_1:74;

then Lm27: ((sqrt 5) - 1) / (sqrt 5) < 1
by XCMPLX_1:60;

sqrt 5 < sqrt (3 ^2)
by SQUARE_1:27;

then sqrt 5 < 3
by SQUARE_1:def 2;

then - (sqrt 5) > - 3
by XREAL_1:24;

then Lm28: (- (sqrt 5)) + 3 > (- 3) + 3
by XREAL_1:6;

- (sqrt 5) < - 1
by ;

then (- (sqrt 5)) + 3 < (- 1) + 3
by XREAL_1:6;

then Lm29: (3 - (sqrt 5)) / 2 < 2 / 2
by XREAL_1:74;

theorem :: FIB_NUM4:29
for n, k being Nat st ( ( n >= k & k > 1 ) or ( k = 1 & n > k ) ) holds
[\((() * (Fib n)) + (1 / 2))/] = Fib (n + k)
proof end;

theorem :: FIB_NUM4:30
for n being Nat st n >= 2 holds
Lucas n = [\(() + (1 / 2))/]
proof end;

theorem :: FIB_NUM4:31
for n being Nat st n >= 2 holds
Lucas n = [/(() - (1 / 2))\]
proof end;

theorem :: FIB_NUM4:32
for n being Nat st n >= 2 holds
Lucas (2 * n) = [/(tau to_power (2 * n))\]
proof end;

theorem :: FIB_NUM4:33
for n being Nat st n >= 2 holds
Lucas ((2 * n) + 1) = [\(tau to_power ((2 * n) + 1))/]
proof end;

theorem :: FIB_NUM4:34
for n being Nat st n >= 2 & n is odd holds
Lucas (n + 1) = [\((tau * ()) + 1)/]
proof end;

theorem :: FIB_NUM4:35
for n being Nat st n >= 2 & n is even holds
Lucas (n + 1) = [/((tau * ()) - 1)\]
proof end;

theorem :: FIB_NUM4:36
for n being Nat st n <> 1 holds
Lucas (n + 1) = (() + (sqrt (5 * ((() ^2) - (4 * ((- 1) to_power n)))))) / 2
proof end;

theorem :: FIB_NUM4:37
for n being Nat st n >= 4 holds
Lucas (n + 1) = [\(((() + 1) + (sqrt (((5 * (() ^2)) - (2 * ())) + 1))) / 2)/]
proof end;

theorem :: FIB_NUM4:38
for n being Nat st n > 2 holds
Lucas n = [\((1 / tau) * ((Lucas (n + 1)) + (1 / 2)))/]
proof end;

theorem :: FIB_NUM4:39
for n, k being Nat st n >= 4 & k >= 1 & n > k & n is odd holds
Lucas (n + k) = [\((() * ()) + 1)/]
proof end;