|  |  |  | About this closure stuff... | 
 of LR(0) items for a grammar G with 
           productions P, we define  closure(
 of LR(0) items for a grammar G with 
           productions P, we define  closure( ) to be the smallest
           set of LR(0) items such that:
) to be the smallest
           set of LR(0) items such that:
            )
) 
 
	    
 1 . N2
1 . N2  2]
2] 
                                  closure(
 closure( ) 
                     and N2
) 
                     and N2 
            
 3
3  P  
                   then    
		      [N2
P  
                   then    
		      [N2 
            .
.  3]
3]  closure(
  closure( )
)
        )
 )
            ' equal to
' equal to  .
.
               
 1 . M
1 . M  2 ]
2 ] 
                   
 '
                   such that M
'
                   such that M 
            
 3
3  P and 
                  [ M
P and 
                  [ M 
            .
.  3 ]
3 ] 
 ' add 
                         [M
' add 
                         [M 
            .
.  3 ]  to
3 ]  to  '.
'.
           By identifying the invariant of the loop. Namely:
         At the beginning (and end) of each iteration of step (b),
          ' is a subset of the closure of
' is a subset of the closure of  .
.
      
 .
.  3  ] that the iteration will
            add must also be a member of closure(
3  ] that the iteration will
            add must also be a member of closure(  ) by the
            definition of closure.
) by the
            definition of closure.
            These facts establish that  ' will always be a subset of 
      closure(
' will always be a subset of 
      closure(  ).  If the loop terminates, then we know that
).  If the loop terminates, then we know that
       ' must contain closure(
' must contain closure(  ) and therefore
) and therefore
       ' = closure(
' = closure(  ).  Luckily, the loop must terminate since
      there are only a finite number of LR(0) items that step (b)
      could add to
).  Luckily, the loop must terminate since
      there are only a finite number of LR(0) items that step (b)
      could add to  '.
'.
|  |  |  | About this closure stuff... |