# Canonical module of a semigroup ring

Let $S$ be a numerical semigroup and $k[S]$ is the associated semigroup ring. I would like to compute canonical module $\omega$ of $k[S].$

I want to show that $\omega=k[t^{-n}:n\in\mathbb Z\setminus S]$.

I have shown that $H^1_{m}(k[S])=k[t^{n}:n\in\mathbb Z\setminus S]$ where $m$ is the maximal homogeneous ideal of $k[S].$ Using duality I tried to compute canonical ideal but I am not able to do it.

I'm going to assume you mean $S$ to be graded with the obvious $\Bbb Z$-grading (i.e. $\operatorname{deg}(t)=1$), and that you're asking for the graded canonical module. Otherwise, I don't know what you mean by canonical module.
By graded local duality, $$\omega_S \cong H^1_\mathfrak{m}(S)^\vee,$$ where $(-)^\vee$ is the graded Matliss dual: If $M$ is a graded $S$-module, define $$M^\vee := \operatorname{{}^*Hom}_k(M,k),$$ where $\operatorname{{}^*Hom}_k(M,N)$ is the vector space of finite-degree homogeneous vector space maps and whose $d$th graded component is the vector subspace of degree $d$ maps. Knowing this, $$H^1_\mathfrak{m}(S)^\vee \cong k[t^{-n}| n\in \Bbb Z\setminus S],$$ as hoped.
I don't know how to show the claim from duality theory but it follows quite easily from the formula $\omega_B=Hom_A(B,\omega_A)$. Here, $A$ is a CM-ring and $B$ is an $A$-algebra which is a free $A$-module of finite rank.
In our case, we take $B=k[S]$ and $A=k[t^f]$ where $f\in\mathbb N$ is larger than the maximal gap of $S$. Then $f,f+1,f+2,\ldots\in S$. Let $I:=\{0,1,\ldots,f-1\}$. Then $B$ is a free $A$-module with basis $t^M:=\{t^n\mid n\in M\}$ where $M=(I\cap S)\cup(f+(I\setminus S))$. Since $\omega_A$ is freely generated by an element of degree $f$ (namely $d\ t^f)$) the canonical module of $B$ is a free $A$-module with basis $t^{M'}$ where $$M'=f-M=(f-(I\cap S))\cup(-(I\setminus S))$$ From $$-M'=(-f+(I\cap S))\cup(I\setminus S)$$ one easily checks that $t^{-M'}$ is a basis of $k[\mathbb Z\setminus S]$ as a $k[t^{-f}]$-module.
This identifies $\omega_B$ with $k[t^{-n}\mid n\in\mathbb Z\setminus S]$, at least as an $A$-module. As a last step one has to verify that this is an isomorphism of $B$-modules which is elementary.