:: Lucas Numbers and Generalized {F}ibonacci Numbers :: by Piotr Wojtecki and Adam Grabowski :: :: Received May 24, 2004 :: Copyright (c) 2004-2012 Association of Mizar Users begin theorem :: FIB_NUM3:1 for a being real number for n being Element of NAT st a to_power n = 0 holds a = 0 proofend; theorem Th2: :: FIB_NUM3:2 for a being non negative real number holds (sqrt a) * (sqrt a) = a proofend; theorem Th3: :: FIB_NUM3:3 for a being real number holds a to_power 2 = (- a) to_power 2 proofend; theorem Th4: :: FIB_NUM3:4 for k being non empty Nat holds (k -' 1) + 2 = (k + 2) -' 1 proofend; theorem Th5: :: FIB_NUM3:5 for a, b being Element of NAT holds (a + b) |^ 2 = (((a * a) + (a * b)) + (a * b)) + (b * b) proofend; theorem Th6: :: FIB_NUM3:6 for n being Element of NAT for a being non empty real number holds (a to_power n) to_power 2 = a to_power (2 * n) proofend; theorem Th7: :: FIB_NUM3:7 for a, b being real number holds (a + b) * (a - b) = (a to_power 2) - (b to_power 2) proofend; theorem Th8: :: FIB_NUM3:8 for n being Element of NAT for a, b being non empty real number holds (a * b) to_power n = (a to_power n) * (b to_power n) proofend; registration cluster tau -> positive ; coherence tau is positive by FIB_NUM2:33; cluster tau_bar -> negative ; coherence tau_bar is negative by FIB_NUM2:36; end; theorem Th9: :: FIB_NUM3:9 for n being Nat holds (tau to_power n) + (tau to_power (n + 1)) = tau to_power (n + 2) proofend; theorem Th10: :: FIB_NUM3:10 for n being Nat holds (tau_bar to_power n) + (tau_bar to_power (n + 1)) = tau_bar to_power (n + 2) proofend; begin definition let n be Nat; func Lucas n -> Element of NAT means :Def1: :: FIB_NUM3:def 1 ex L being Function of NAT,[:NAT,NAT:] st ( it = (L . n) `1 & L . 0 = [2,1] & ( for n being Nat holds L . (n + 1) = [((L . n) `2),(((L . n) `1) + ((L . n) `2))] ) ); existence ex b1 being Element of NAT ex L being Function of NAT,[:NAT,NAT:] st ( b1 = (L . n) `1 & L . 0 = [2,1] & ( for n being Nat holds L . (n + 1) = [((L . n) `2),(((L . n) `1) + ((L . n) `2))] ) ) proofend; uniqueness for b1, b2 being Element of NAT st ex L being Function of NAT,[:NAT,NAT:] st ( b1 = (L . n) `1 & L . 0 = [2,1] & ( for n being Nat holds L . (n + 1) = [((L . n) `2),(((L . n) `1) + ((L . n) `2))] ) ) & ex L being Function of NAT,[:NAT,NAT:] st ( b2 = (L . n) `1 & L . 0 = [2,1] & ( for n being Nat holds L . (n + 1) = [((L . n) `2),(((L . n) `1) + ((L . n) `2))] ) ) holds b1 = b2 proofend; end; :: deftheorem Def1 defines Lucas FIB_NUM3:def_1_:_ for n being Nat for b2 being Element of NAT holds ( b2 = Lucas n iff ex L being Function of NAT,[:NAT,NAT:] st ( b2 = (L . n) `1 & L . 0 = [2,1] & ( for n being Nat holds L . (n + 1) = [((L . n) `2),(((L . n) `1) + ((L . n) `2))] ) ) ); theorem Th11: :: FIB_NUM3:11 ( Lucas 0 = 2 & Lucas 1 = 1 & ( for n being Nat holds Lucas ((n + 1) + 1) = (Lucas n) + (Lucas (n + 1)) ) ) proofend; theorem Th12: :: FIB_NUM3:12 for n being Nat holds Lucas (n + 2) = (Lucas n) + (Lucas (n + 1)) proofend; theorem Th13: :: FIB_NUM3:13 for n being Nat holds (Lucas (n + 1)) + (Lucas (n + 2)) = Lucas (n + 3) proofend; theorem Th14: :: FIB_NUM3:14 Lucas 2 = 3 proofend; theorem Th15: :: FIB_NUM3:15 Lucas 3 = 4 proofend; theorem Th16: :: FIB_NUM3:16 Lucas 4 = 7 proofend; theorem Th17: :: FIB_NUM3:17 for k being Nat holds Lucas k >= k proofend; theorem :: FIB_NUM3:18 for m being non empty Element of NAT holds Lucas (m + 1) >= Lucas m proofend; registration let n be Element of NAT ; cluster Lucas n -> positive ; coherence Lucas n is positive proofend; end; theorem :: FIB_NUM3:19 for n being Element of NAT holds 2 * (Lucas (n + 2)) = (Lucas n) + (Lucas (n + 3)) proofend; theorem :: FIB_NUM3:20 for n being Nat holds Lucas (n + 1) = (Fib n) + (Fib (n + 2)) proofend; theorem Th21: :: FIB_NUM3:21 for n being Nat holds Lucas n = (tau to_power n) + (tau_bar to_power n) proofend; theorem :: FIB_NUM3:22 for n being Nat holds (2 * (Lucas n)) + (Lucas (n + 1)) = 5 * (Fib (n + 1)) proofend; theorem Th23: :: FIB_NUM3:23 for n being Nat holds (Lucas (n + 3)) - (2 * (Lucas n)) = 5 * (Fib n) proofend; theorem :: FIB_NUM3:24 for n being Nat holds (Lucas n) + (Fib n) = 2 * (Fib (n + 1)) proofend; theorem :: FIB_NUM3:25 for n being Nat holds (3 * (Fib n)) + (Lucas n) = 2 * (Fib (n + 2)) proofend; theorem :: FIB_NUM3:26 for n, m being Element of NAT holds 2 * (Lucas (n + m)) = ((Lucas n) * (Lucas m)) + ((5 * (Fib n)) * (Fib m)) proofend; theorem :: FIB_NUM3:27 for n being Element of NAT holds (Lucas (n + 3)) * (Lucas n) = ((Lucas (n + 2)) |^ 2) - ((Lucas (n + 1)) |^ 2) proofend; theorem Th28: :: FIB_NUM3:28 for n being Nat holds Fib (2 * n) = (Fib n) * (Lucas n) proofend; theorem :: FIB_NUM3:29 for n being Element of NAT holds 2 * (Fib ((2 * n) + 1)) = ((Lucas (n + 1)) * (Fib n)) + ((Lucas n) * (Fib (n + 1))) proofend; theorem :: FIB_NUM3:30 for n being Element of NAT holds (5 * ((Fib n) |^ 2)) - ((Lucas n) |^ 2) = 4 * ((- 1) to_power (n + 1)) proofend; theorem :: FIB_NUM3:31 for n being Element of NAT holds Fib ((2 * n) + 1) = ((Fib (n + 1)) * (Lucas (n + 1))) - ((Fib n) * (Lucas n)) proofend; begin definition let a, b be Nat; :: original:[ redefine func[a,b] -> Element of [:NAT,NAT:]; coherence [a,b] is Element of [:NAT,NAT:] proofend; end; definition let a, b, n be Nat; func GenFib (a,b,n) -> Element of NAT means :Def2: :: FIB_NUM3:def 2 ex L being Function of NAT,[:NAT,NAT:] st ( it = (L . n) `1 & L . 0 = [a,b] & ( for n being Nat holds L . (n + 1) = [((L . n) `2),(((L . n) `1) + ((L . n) `2))] ) ); existence ex b1 being Element of NAT ex L being Function of NAT,[:NAT,NAT:] st ( b1 = (L . n) `1 & L . 0 = [a,b] & ( for n being Nat holds L . (n + 1) = [((L . n) `2),(((L . n) `1) + ((L . n) `2))] ) ) proofend; uniqueness for b1, b2 being Element of NAT st ex L being Function of NAT,[:NAT,NAT:] st ( b1 = (L . n) `1 & L . 0 = [a,b] & ( for n being Nat holds L . (n + 1) = [((L . n) `2),(((L . n) `1) + ((L . n) `2))] ) ) & ex L being Function of NAT,[:NAT,NAT:] st ( b2 = (L . n) `1 & L . 0 = [a,b] & ( for n being Nat holds L . (n + 1) = [((L . n) `2),(((L . n) `1) + ((L . n) `2))] ) ) holds b1 = b2 proofend; end; :: deftheorem Def2 defines GenFib FIB_NUM3:def_2_:_ for a, b, n being Nat for b4 being Element of NAT holds ( b4 = GenFib (a,b,n) iff ex L being Function of NAT,[:NAT,NAT:] st ( b4 = (L . n) `1 & L . 0 = [a,b] & ( for n being Nat holds L . (n + 1) = [((L . n) `2),(((L . n) `1) + ((L . n) `2))] ) ) ); theorem Th32: :: FIB_NUM3:32 for a, b being Nat holds ( GenFib (a,b,0) = a & GenFib (a,b,1) = b & ( for n being Nat holds GenFib (a,b,((n + 1) + 1)) = (GenFib (a,b,n)) + (GenFib (a,b,(n + 1))) ) ) proofend; theorem Th33: :: FIB_NUM3:33 for a, b being Element of NAT for k being Nat holds ((GenFib (a,b,(k + 1))) + (GenFib (a,b,((k + 1) + 1)))) |^ 2 = (((GenFib (a,b,(k + 1))) |^ 2) + ((2 * (GenFib (a,b,(k + 1)))) * (GenFib (a,b,((k + 1) + 1))))) + ((GenFib (a,b,((k + 1) + 1))) |^ 2) proofend; theorem Th34: :: FIB_NUM3:34 for a, b, n being Nat holds (GenFib (a,b,n)) + (GenFib (a,b,(n + 1))) = GenFib (a,b,(n + 2)) proofend; theorem Th35: :: FIB_NUM3:35 for a, b, n being Nat holds (GenFib (a,b,(n + 1))) + (GenFib (a,b,(n + 2))) = GenFib (a,b,(n + 3)) proofend; theorem Th36: :: FIB_NUM3:36 for a, b, n being Element of NAT holds (GenFib (a,b,(n + 2))) + (GenFib (a,b,(n + 3))) = GenFib (a,b,(n + 4)) proofend; theorem :: FIB_NUM3:37 for n being Element of NAT holds GenFib (0,1,n) = Fib n proofend; theorem Th38: :: FIB_NUM3:38 for n being Element of NAT holds GenFib (2,1,n) = Lucas n proofend; theorem Th39: :: FIB_NUM3:39 for a, b, n being Element of NAT holds (GenFib (a,b,n)) + (GenFib (a,b,(n + 3))) = 2 * (GenFib (a,b,(n + 2))) proofend; theorem :: FIB_NUM3:40 for a, b, n being Element of NAT holds (GenFib (a,b,n)) + (GenFib (a,b,(n + 4))) = 3 * (GenFib (a,b,(n + 2))) proofend; theorem :: FIB_NUM3:41 for a, b, n being Element of NAT holds (GenFib (a,b,(n + 3))) - (GenFib (a,b,n)) = 2 * (GenFib (a,b,(n + 1))) proofend; theorem :: FIB_NUM3:42 for a, b, n being non empty Element of NAT holds GenFib (a,b,n) = ((GenFib (a,b,0)) * (Fib (n -' 1))) + ((GenFib (a,b,1)) * (Fib n)) proofend; theorem :: FIB_NUM3:43 for n, m being Nat holds ((Fib m) * (Lucas n)) + ((Lucas m) * (Fib n)) = GenFib ((Fib 0),(Lucas 0),(n + m)) proofend; theorem :: FIB_NUM3:44 for n being Element of NAT holds (Lucas n) + (Lucas (n + 3)) = 2 * (Lucas (n + 2)) proofend; theorem :: FIB_NUM3:45 for a, n being Element of NAT holds GenFib (a,a,n) = ((GenFib (a,a,0)) / 2) * ((Fib n) + (Lucas n)) proofend; theorem :: FIB_NUM3:46 for a, b, n being Element of NAT holds GenFib (b,(a + b),n) = GenFib (a,b,(n + 1)) proofend; theorem :: FIB_NUM3:47 for a, b, n being Element of NAT holds ((GenFib (a,b,(n + 2))) * (GenFib (a,b,n))) - ((GenFib (a,b,(n + 1))) |^ 2) = ((- 1) to_power n) * (((GenFib (a,b,2)) |^ 2) - ((GenFib (a,b,1)) * (GenFib (a,b,3)))) proofend; theorem :: FIB_NUM3:48 for a, b, k, n being Element of NAT holds GenFib ((GenFib (a,b,k)),(GenFib (a,b,(k + 1))),n) = GenFib (a,b,(n + k)) proofend; theorem Th49: :: FIB_NUM3:49 for a, b, n being Element of NAT holds GenFib (a,b,(n + 1)) = (a * (Fib n)) + (b * (Fib (n + 1))) proofend; theorem :: FIB_NUM3:50 for b, n being Element of NAT holds GenFib (0,b,n) = b * (Fib n) proofend; theorem :: FIB_NUM3:51 for a, n being Element of NAT holds GenFib (a,0,(n + 1)) = a * (Fib n) proofend; theorem :: FIB_NUM3:52 for a, b, c, d, n being Element of NAT holds (GenFib (a,b,n)) + (GenFib (c,d,n)) = GenFib ((a + c),(b + d),n) proofend; theorem :: FIB_NUM3:53 for a, b, k, n being Element of NAT holds GenFib ((k * a),(k * b),n) = k * (GenFib (a,b,n)) proofend; theorem :: FIB_NUM3:54 for a, b, n being Element of NAT holds GenFib (a,b,n) = ((((a * (- tau_bar)) + b) * (tau to_power n)) + (((a * tau) - b) * (tau_bar to_power n))) / (sqrt 5) proofend; theorem :: FIB_NUM3:55 for a, n being Element of NAT holds GenFib (((2 * a) + 1),((2 * a) + 1),(n + 1)) = ((2 * a) + 1) * (Fib (n + 2)) proofend;