A compound of the formula (I):wherein each symbol is as defined in the description, a salt thereof, and a prodrug thereof of the present invention unexpectedly have a superior GPR40 receptor agonist activity and superior properties as pharmaceutical products such as stability and the like, and can be safe and useful pharmaceutical agents for the prophylaxis or treatment of GPR40 receptor-related pathology or diseases in mammals.