src/CCL/ex/Nat.thy
changeset 3837 d7f033c74b38
parent 1474 3f7d67927fe2
child 17456 bcf7544875b2
equal deleted inserted replaced
3836:f1a1817659e6 3837:d7f033c74b38
    17 
    17 
    18 rules 
    18 rules 
    19 
    19 
    20   not_def     "not(b) == if b then false else true"
    20   not_def     "not(b) == if b then false else true"
    21 
    21 
    22   add_def     "a #+ b == nrec(a,b,%x g.succ(g))"
    22   add_def     "a #+ b == nrec(a,b,%x g. succ(g))"
    23   mult_def    "a #* b == nrec(a,zero,%x g.b #+ g)"
    23   mult_def    "a #* b == nrec(a,zero,%x g. b #+ g)"
    24   sub_def     "a #- b == letrec sub x y be ncase(y,x,%yy.ncase(x,zero,%xx.sub(xx,yy))) 
    24   sub_def     "a #- b == letrec sub x y be ncase(y,x,%yy. ncase(x,zero,%xx. sub(xx,yy))) 
    25                         in sub(a,b)"
    25                         in sub(a,b)"
    26   le_def     "a #<= b == letrec le x y be ncase(x,true,%xx.ncase(y,false,%yy.le(xx,yy))) 
    26   le_def     "a #<= b == letrec le x y be ncase(x,true,%xx. ncase(y,false,%yy. le(xx,yy))) 
    27                         in le(a,b)"
    27                         in le(a,b)"
    28   lt_def     "a #< b == not(b #<= a)"
    28   lt_def     "a #< b == not(b #<= a)"
    29 
    29 
    30   div_def    "a ## b == letrec div x y be if x #< y then zero else succ(div(x#-y,y)) 
    30   div_def    "a ## b == letrec div x y be if x #< y then zero else succ(div(x#-y,y)) 
    31                        in div(a,b)"
    31                        in div(a,b)"
    32   ack_def    
    32   ack_def    
    33   "ackermann(a,b) == letrec ack n m be ncase(n,succ(m),%x. 
    33   "ackermann(a,b) == letrec ack n m be ncase(n,succ(m),%x. 
    34                           ncase(m,ack(x,succ(zero)),%y.ack(x,ack(succ(x),y))))
    34                           ncase(m,ack(x,succ(zero)),%y. ack(x,ack(succ(x),y))))
    35                     in ack(a,b)"
    35                     in ack(a,b)"
    36 
    36 
    37 end
    37 end
    38 
    38