My grandmother's tenant had a one-year lease that expired two years ago (she lives on 1st floor; he's on the 2nd floor). Did he automatically become tenant at will?
He just notified her on the 4th that he's moving out at end of month. Now wants his security deposit back. Does she have to give it back since he gave less than 30-days notice?

Security Deposit
Yes, the tenant becomes a tenant at will after the lease expires and must, thereafter, give thirty day's notice before moving out. As long as you Grandmother followed all the legal requirements surrounding the acceptance of a security deposit, she can keep it to pay for the unpaid rent for August.
In all likelihood, her tenant will then throw a fit and either threaten or actually file a law suit to obtain the security deposit. This is one of the most bitter areas of conflict between landlords and tenants. Your Grandmother may be "right" but the way the law is written in MA, if she did not follow numerous requirements regarding the deposit, she may not win in court. If I were in your Grandmother's shoes, I would spend the next few weeks looking for a new tenant and, as long as the apartment is clean and undamaged, return the deposit when the current tenant moves out.
Sorry, should have clarified,
Sorry, should have clarified, he moved out the end of June, and notified her on the 4th of June. He then again contacted her on 6/10 asking if it would be possible to continue living there as he was waiting on a job offer out of state by 6/14, and if it would be OK if he waited until then to decide whether he wanted to continue living in the apartment. At that point (at my urging), she said sure, if he'd sign a new lease at a slightly higher rent, which he declined.
I did find two "Rent and Security Deposit Receipt" forms in her possession that were initialed by the tenant, and she said she has the money in a savings account at her bank. The forms don't have an account number, just the bank name and address, though.
Would prorating the 4 days be
Would prorating the 4 days be an option? Also, there were a few things that had to be repaired in the apartment. Should I send back the apartment condition letter first, before sending any of the deposit back?