  Homophonic coding is a framework to reversibly convert a message into a
sequence with some target distribution. This is a promising tool to generate a
codeword with a biased code-symbol distribution, which is required for
capacity-achieving communication by asymmetric channels. It is known that
asymptotically optimal homophonic coding can be realized by a Fixed-to-Variable
(FV) length code using an interval algorithm similar to a random number
generator. However, FV codes are not preferable as a component of channel codes
since a decoding error propagates to all subsequent codewords. As a solution
for this problem an asymptotically optimal Variable-to-Fixed (VF) length
homophonic code, dual Shannon-Fano-Elias-Gray (dual SFEG) code, is proposed in
this paper. This code can be interpreted as a dual of a modified
Shannon-Fano-Elias (SFE) code based on Gray code. It is also shown as a
by-product that the modified SFE code, named SFEG code, achieves a better
coding rate than the original SFE code in lossless source coding.
