What is wrong in this "proof" from graph theory? I am trying to understand the proof that we did in class, but I have some troubles with it. I believe I wrote some of the things wrong, and I can't figure out what is supposed to happen.

Theorem: Let $V(G) \geq 3$. If graph $G$ is connected and $|E(G)| = |V(G)| - 1$, then $G$ is a tree.


Proof: If $G$ is not a tree, then there exists $e \in E(G)$, such that $G - e$ is connected. Then we have, by the lemma, $|E(G-e)| = |E(G)| - 1 \geq (|V(G)| - 1) -1$. We remove edges, until we get a tree $T$. We have:
$|E(T)| = |V(T)| - 1 = |V(G)| - 1 $, while on the other hand, if we did in fact remove any edge, we have $|E(T)| < |E(G)| = |V(G)| - 1$. This is a contradiction.

So, the part I really don't understand is why we have $|V(T)| - 1 = |V(G)| - 1$. I am also confused why did we write that $|E(G-e)| = |E(G) - 1 \geq (|V(G)| - 1) -1$, if we never used it. Now I would appreciate if you figure out how the proof was meant to be, and if I actually wrote it wrongly, or if I just don't understand it. Thanks!
 A: We have $|V(T)|-1=|V(G)|-1$ because we never removed any vertices. Only edges. So the number of vertices remains the same. We have $|E(G-e)|=|E(G)|-1$ because we removed exactly one edge, and we have $|E(G)|-1 = (|V(G)|-1) -1$ because, by hypothesis, $|E(G)|=|V(G)|-1$. We don't need $\geq$ here. It's actually equal.
The idea is that if we start with $G$ and remove edges until we get a tree $T$, the number of vertices doesn't change, but the number of edges decreases. But if the number of vertices changes and the number of edges doesn't, then it's impossible to have $|V(G)|-|E(G)|=1$ and $|V(T)|-|E(T)|=1$. This is because $|V(G)|=|V(T)|$ stayed the same, but the subtracted value $|E(G)|$ decreased to $|E(T)|$. But the first of these two equalities ($|V(G)|-|E(G)|=1$) holds by hypothesis, and the other ($|V(T)|-|E(G)|=1$) holds because $T$ is a tree, so we get a contradiction.
A: You are right that this is a bit chaotic.
You do have by assumption that $|E(G)|\overset{!}= |V(G)|-1$ and it seems like you know that if $T$ is a tree then $|E(T)|=|V(T)|-1$.
So the idea is to do a proof by contradiction. We assume that $G$ is not a tree but still satisfies $|E(G)|=|V(G)|-1$. Since $G$ is connected but not a tree there is at least one edge $e$ such that $G-e$ is connected. Inductively you arrive at a proper subgraph $G‘ \subseteq G$, which is connected but becomes disconnected when deleting any edge from it. In other words this graph $G‘$ is a tree.
Now since you didn’t delete any vertices you still have $V(G‘)=V(G)$ and thus in particular $|V(G‘)|=|V(G)|$. But then
$$|V(G)|-1 = |V(G‘)|-1=|E(G‘)|<|E(G)|=|V(G)|-1$$
is a strict inequality (since $G‘\subseteq G$ is a proper subgraph), which is a contradiction.
