Proving the LOOP function

We must demonstrate that our guess is good, i.e.

   f = [WHILE]
     = ( R < Y --> ident ) | ( R >= Y and Y > 0 --> Q,R := Q+R/Y, R mod Y )
  1. show f behaves like identity when the loop boolean is false
  2. show dom(f) = dom([WHILE])
  3. show f = [IF] o f where IF is made of the loop components

    [IF] = ( R >= Y --> Q,R := Q+1,R-Y ) | ( R < Y --> ident )

    Simplified, [IF] o f =
        ( R >= Y and R < 2Y --> Q,R := Q+1, R-Y )
        | ( R >= 2Y and Y > 0 --> Q,R := Q+R/Y, R mod Y )
        | ( R < Y --> identity )
    
    So rewrite the concurrent assignment in the first clause:
        = ( Y <= R < 2Y and Y > 0 --> Q,R := Q+R/Y, R mod Y )
        | ( R >= 2Y and Y > 0 --> Q,R := Q+R/Y, R mod Y )
        | ( R < Y --> identity )
    
    Note that when Y <= R < 2Y we have these:
       Y < 2Y  which implies  Y > 0
       R/Y = 1
       R-Y = R mod Y