: structural induction使

 (structural recursion) 

概要

編集

 x x. P(x)   SS 2 x

(structurally recursive function)(base cases) length  ++ 

 '<'  L, M LM(tail) L <M [] l P(l) 2

(一)P([]) 

(二) L P(L) L  MP(M) 

22 P(l) 2

(一) BC P(BC) 

(二) I P(I) M  IP(M) 

家系図での例

編集
 
31人の人物を記した、5世代にわたる家系図



1

12

g 2g-1 

1 g= 1 1  21 - 1 

1(induction hypothesis)  g, h p, qp  2g-1  q 2h-1 
g  h (h + 1)  p+ q+ 1 p + q+ 1  (2g - 1) + (2h - 1) + 1  (2h - 1) + (2h - 1) + 1 = (2h + 1 - 1) + 1

h  g


連結リストでの例

編集


    length (L ++ M) = length L + length M          [EQ]

 L M ++ 

length  ++ 
    length []     = 0                  [LEN1]
    length (h:t)  = 1 + length t       [LEN2]
    []    ++ list = list               [APP1]
    (h:t) ++ list = h : (t ++ list)    [APP2]

 (h:t)  h t[] 

 P(L)  MEQL. P(L) 

 P([]) L = []  MEQ
      length (L ++ M)  = length ([] ++ M)             (仮定 L = [] より)
                       = length M                     (APP1 より)
                       = 0 + length M
                       = length [] + length M         (LEN1 より)
                       = length L  + length M

   II  x xs( I= x:xs ) M (EQ L= xs) 
    length (xs ++ M) = length xs + length M    (帰納法の仮定)

P(I) M EQ ( L= I) 
    length L  + length M      = length (x:xs) + length M
                              = 1 + length xs + length M     (LEN2 より)
                              = 1 + length (xs ++ M)         (帰納法の仮定より)
                              = length (x: (xs ++ M))        (LEN2 より)
                              = length ((x:xs) ++ M)         (APP2 より)
                              = length (L ++ M)

 L P(L)  L MEQ

整礎

編集

 

 S, TS  T S< T < 

(full binary tree)1 CC  n l n + 1  lC   n= 0, l= 1 C  L NC  N2 L, SC  N LN  S C  n, l1 n + 1  cC  C

関連項目

編集

関連文献

編集
  • Hopcroft, John E.; Rajeev Motwani; Jeffrey D. Ullman (2001). Introduction to Automata Theory, Languages, and Computation (2nd ed.). Reading Mass: Addison-Wesley. ISBN 0-201-44124-1 

Early publications about structural induction include:

  • Burstall, R.M. (1969). “Proving Properties of Programs by Structural Induction”. The Computer Journal 12 (1): 41-48. doi:10.1093/comjnl/12.1.41. 
  • Aubin, Raymond (1976), Mechanizing Structural Induction, EDI-INF-PHD, 76-002, University of Edinburgh, hdl:1842/6649 
  • Huet, G.; Hullot, J.M. (1980). "Proofs by Induction in Equational Theories with Constructors". 21st Ann. Symp. on Foundations of Computer Science. IEEE. pp. 96–107.