MAP_CONV : conv -> conv
Given an appropriate conv, the conversion MAP_CONV conv takes a term of the form --`MAP f [t1;...;tn]`-- to the theorem
|- MAP f [t1;...;tn] = [r1;...;rn]
- MAP_CONV ALL_CONV (--`MAP SUC [1;2;1;4]`--); |- MAP SUC[1;2;1;4] = [SUC 1;SUC 2;SUC 1;SUC 4]
We now construct a conversion that maps SUC n for any numeral n to the numeral standing for the successor of n:
- fun SUC_CONV tm = let val n = string_to_int(#Name(dest_const(rand tm))) val sucn = mk_const{{Name =int_to_string(n+1), Ty=(==`:num`==)}} in SYM (num_CONV sucn) end; SUC_CONV = - : conv
- num_CONV (--`4`--); |- 4 = SUC 3 - SUC_CONV (--`SUC 3`--); |- SUC 3 = 4
- MAP_CONV SUC_CONV (--`MAP SUC [1;2;1;4]`--); |- MAP SUC[1;2;1;4] = [2;3;2;5]