The 25th Amendment was added to the Constitution after the assassination of John F. Kennedy and provides for the replacement of the vice president if the office becomes vacant. (So it led indirectly to the presidency of Gerald Ford, the only American president who was never elected to any national office.) But Section 4 is about something else entirely:
Whenever the Vice President and a majority of either the principal officers of the executive departments or of such other body as Congress may by law provide, transmit to the President pro tempore of the Senate and the Speaker of the House of Representatives their written declaration that the President is unable to discharge the powers and duties of his office, the Vice President shall immediately assume the powers and duties of the office as Acting President.A temporary transfer of power has happened a handful of times since the Kennedy assassination, once when Ronald Reagan had cancer surgery and twice when George W. Bush underwent colonoscopies. Most people have thought of the 25th Amendment as a way to deal with a president who has had a heart attack or a stroke and has become incapacitated, as Woodrow Wilson did, with his wife effectively assuming the duties of the presidency for the remainder of his term.
Note that with the current composition of Congress, this is an action that could only be implemented by Republicans. More at Salon.
But the language of the amendment clearly encompasses other scenarios besides physical incapacitation. This topic was a subject of discussion toward the end of the Reagan administration, when it became obvious that the president was suffering a loss of cognitive ability. It wasn’t evoked then but as we now know, Reagan was indeed suffering from the early stages of Alzheimer’s disease. Had it become more acute or more obvious while he was in office, Congress might well have had to take action as laid out in the amendment.