A toilet can be on either a 3 or, 4" pipe. A drain can go to a larger dia. but never can go smaller. That said you cannot reduce 4" in the building to 3" outside.
Depending on your local code you may use 3" for both the toilet and the line to the tank. Check with your local building inspection authorities.