Suppose that $S$ and $T$ are nonempty subsets of $\mathbb{R}$, with $T$ bounded and $S\subseteq T$.
(i) Prove that $\sup(S)\leq\sup(T)$ and $\inf(T)\leq\inf(S)$
(ii) Give an example that shows $\sup(S)=\sup(T)$ and $\inf(T)=\inf(S)$ even though $S\subsetneq T$.
Here is my proof:
(i) Since $S\subseteq T$, then there exists $t\in T$ such that $t\geq\sup(S)\geq s$ for all $s\in S$. Since $T$ is bounded, $T$ has a supremum such that $\sup(T)\geq t$ for all $t\in T$ and hence $\sup(T)\geq t\geq\sup(S)\geq s\Rightarrow\sup(T)\geq\sup(S)$. Similarly, there also exists $t\in T$ such that $t\leq\inf(S)\leq s$ for all $s\in S$. Since $T$ is bounded, $T$ has an infimum such that $\inf(T)\leq t$ for all $t\in T$ and hence $\inf(T)\leq t\leq\sup(S)\leq s\Rightarrow\inf(T)\leq\inf(S).$
(ii) Let $S=\{s\in\mathbb{R}: 0<s\leq 1\}$ and $T=\{t\in\mathbb{R}: 0\leq t\leq 1\}$. Clearly, $S\subsetneq T$ and $\sup(S)=\sup(T)=1$. For set $S$, $0$ is an upper bound and there exists a $s\in S$ such that $s<a$ for all $a>0$, for which we let $s=\frac{a+s}{2}$ if $a\in S$ and $s$ be any element in $S$ if $a\notin S$. Hence $\inf(S)=0$. Since $0\in T$, $\inf(T)=0$. Therefore, $\inf(S)=\inf(T)$ and $\sup(S)=\sup(T)$ but $S\subset T$.
Is the proof legit?
Wrong. This cannot be concluded from $S\subseteq T$.
E.g. let $T=(0,1)$ and $S=T\cap\mathbb Q$. Then no $t\in T$ exists with $t\geq1=\sup S$.
Proper way:
$\sup T$ is an upper bound of $T$ which means that $t\leq\sup T$ for every $t\in T$. Then - since $S$ is a subset of $T$ - also $s\leq\sup T$ for every $s\in S$. That means that $\sup T$ is an upper bound of $S$ and then $\sup S\leq\sup T$ because $\sup S$ is the least upper bound of $S$.
(ii) Your example $S=(0,1]$ and $T=[0,1]$ is okay.