function to set permalink to /%postname%/ on theme activation

You could, but I’d actually highly advise against that. In quite a few cases that will cause lots of 404 errors.