What does discharging an assumption mean in Natural Deduction? I've also noticed as in the question here that it seems that many references I've read say "discharging an assumption" and assume the reader that we know what that means. It's funny because formal logic has very clear definitions of everything.
Regardless, I think my confusion stems from many things. I will try to outline them:


*

*To understand what "discharging as assumption" means, I have to understand what the word assumption means. Does it mean axiom or hypothesis or something else? The closest thing to a definition (even if its informal since thats a start) is that it's a "local axiom". Something that we assume true for the sake of a subproof. But eventually, it has to be shown true or otherwise whats the point!

*I need to know what discharging means. Looking at the answer that I referenced from mathoverflow it seems that it has a relation with the deduction theorem from metalogic. Let's recall it:
$$ T, P \vdash Q \text{ iff } T \vdash P \to Q $$
However, it's weird to me because it seems that the role of discharging is nearly the same as "establishing what has a proof already". However, when I write the statement $P \to Q$ I think of it as an implication, so I don't assume that $P$ is already true. It also doesn't tell me how it relates to the axioms. 


Idk if I'm confused because I am more used to thinking of starting from the axioms then we can reach statements and that is the only thing that is true. But here things seem to be a little different. Can anyone clarify what is going on? At the very least precise statements of what "discharing an assumption" and "assumptions" mean would be a fantastic start since I precise definition of those are not explicitly found (mostly implied) from what I've read. 
In addition, I heard the following comment about discharge:

Discharge function maps each leaf of the tree to an ancestor as allowed
  by the inference rules.

which isn't 100% clear to me what it meant.

Cross-posted:


*

*Quora: https://qr.ae/TDmouP

*Reddit: https://www.reddit.com/r/logic/comments/evqlgh/what_does_discharging_an_assumption_mean_in/
 A: The operation of "discharging" is typical of the proof system called Natural Deduction.
The proof "format" of ND is based on assumptions: starting formulas to which we apply the rules to derive new formulas.
This means that a derivation in ND is a "pattern" $\Gamma \vdash \varphi$ where $\Gamma$ is a set of formulas (maybe empty): the set of assumptions, and $\varphi$ is a formula: the conclusion of the derivation.
This pattern is the formal counterpart of a mathematical proof, where $\varphi$ is the theorem proved and $\Gamma$ is the set of axioms used.
Some of the rules allow to discharge assumption; the crucial one is the rule called $(\to \text{Introduction})$, that corresponds to the Deduction Theorem of so-called Hilbert-style proof systems (axioms+rules).
The gist of the rule (and of DT) is:

if we have derived $\varphi$ from the set $\Gamma \cup \{ \psi \}$ of assumption, with the $(\to \text{Introduction})$ rule we can convert the said derivation into a new derivation:

$\Gamma \vdash \psi \to \varphi$.



We may formalize the "discharging" operation with derivations in tree format; see e.g. Ian Chiswell & Wilfrid Hodges, Mathematical Logic (Oxford UP, 2007), page 54.
A: I may not completely answer your questions, but hope this helps. Also, these may be informal...


*

*
The closest thing to a definition (even if its informal since thats a start) is that it's a "local axiom". Something that we assume true for the sake of a subproof. But eventually, it has to be shown true or otherwise whats the point!

The "local axiom" is a good picture of it. However, assumptions are not 'spawned' to be shown true.
For example, we will prove $(A\wedge B) \rightarrow B$. In list form (Fitch-like style, I can't typeset it properly), a proof would proceed like this:
\begin{align}
&(1)\ A\wedge B\ \ \ \ [\text{assumption}]\\
&(2)\ \ \ \ B \ \ \ \ \ \ \ \ \ [\wedge E\ \ \text{on}\ \ (1)]\\
&...
\end{align}
At this point, we are now ready to discharge the assumption $(1)$. Now, did we establish a proof of $A\wedge B$ in the proof above? No. Is $A\wedge B$ a theorem (in Classical Logic)? No. However, for this proof, we assume that it is 'true' despite being unproven (in other words, "local axiom").
Now, did we establish a proof of $B$ in the proof above? No either, because the deduction of $B$ is 'tainted' with unproven assumption/s, which in this case is in $(1)$. On the other hand, if $B$'s deduction is not tainted with unproven assumption/s, then $B$ is a theorem.*
And this is where "discharging" comes in. What we have actually proven is $(A\wedge B) \rightarrow B$, and this is a theorem (taints no more). We discard the local axiom-ness of the unproven ** assumption $A\wedge B$, but with a catch of 'inserting' it in $B$, in the form of implication:
\begin{align}
&...\\
&(3)\ (A\wedge B)\rightarrow B \ \ \ \ [\rightarrow I, \text{discharge}\ (1)]\\
\end{align}


*
Deduction Theorem: $T, P \vdash Q \text{ iff } T \vdash P \to Q$

If we follow the note (*) below, we can actually define "assumptions" as anything on the left of turnstile ($\vdash$)! Now, we can define a theorem as a proposition $\Phi$ such that $\emptyset\vdash\Phi$. The discharge of assumption is more "visualized" here: $P$ is not an assumption anymore after being combined to $Q$ to become $P\rightarrow Q$. 
* In my answer, we consider proven "assumptions", as still assumptions. Nevertheless, these are also the theorems/axioms.
** On the other hand, we of course cannot discard the theorem/axiom-ness of proven "assumptions."
A: I want to credit all the answers here and on quora. They have helped me get a much better understanding and I hope to share it it be useful to others. 
From the answers I've read, discharing an assumption is the following transformation (left to right of deduction theorem, see OP for deduction theorm):
$$ T, P \vdash Q \implies T \vdash P \to Q $$
So we have "discharged" the assumption $P$.
For example, we might have the proof:


*

*$A \wedge B$ (Assumption)

*$A$ (Inference Rule: Elimination Left And, 1)

*$B$ (Inference Rule: Elimination Right And, 1)

*$B \wedge A$ (Inference Rule: Introduction And, 3, 2)

*$ A \wedge B \to B \wedge A $ (Inference Rule: Introduction Implication, 1 ,4)

*$ \vdots $ (proof continues)


Since we can use the deduction theorem from left to right (i.e. what I call the discharge operation), then we really have only proved $T \vdash A \wedge B \to B \wedge A $ with lines 1-5 ($T$ can be empty). 
On line 5, we say that the assumption on line 1 has been discharged. In subsequent lines of proof, we would not be able to refer to lines 1 - 4. These lines have been deactivated. We could, however, refer to line 5.
Discharge basically means: any further results or conclusions within the derivation are independent of that particular assumption. This is basically because of the deduction theorem because we are able to prove P from Q (i.e. $T, Q \vdash P$) then we get the implication P implies Q (i.e. $T \vdash P \to Q$ ). Which honestly makes sense intuitively (despite not remembering the deduction theorem's proof), if we have a proof from P to Q, that's more or less what $P \to Q$ is supposed to capture (e.g. modus ponens backs this interpretation).
So discharging means putting all the assumption on the left of the implications.

Example 1:
For a more interesting example:


*

*$A, B$

*$A \wedge B $ (Rule: And Introduction)

*$B \to (A \wedge B)$ (Rule: Implication Introduction)

*$A \to (B \to (A \wedge B) ) $ (Rule: Implication Introduction)

*$ \vdots $ (proof continues)
here we also say the proof of $A \to (B \to (A \wedge B) ) $ is complete, because all assumptions have been discharged.

Example 2:


*

*$A, B$

*$A \wedge B$ (Inference Rule: And Introduction)

*$B \to (A \wedge B)$ (Inference Rule: Implication Introduction)


Here this we don't really have a closed proof because the deduction theorem wasn't able to discharge all assumptions. We have a relative proof/under undischarged hypothesis A. "Assuming A, we have $B \to (A \wedge B)$"
reference: https://courses.grainger.illinois.edu/cs477/sp2020/lectures/03-prop-nat-ded.pdf
A: 
To understand what "discharging as assumption" means, I have to understand what the word assumption means. Does it mean axiom or hypothesis or something else? The closest thing to a definition (even if its informal since thats a start) is that it's a "local axiom". Something that we assume true for the sake of a subproof. But eventually, it has to be shown true or otherwise whats the point!

An assumption is sometimes called an hypothesis.
An assumption does not need be shown to be true.  All that is required is that derivations from the assumption are understood to be contingent. 
However, eventually the assumption needs to be discharged so that something may be inferred without that assumption. (Unless it is a premise, an hypothesis of the proof, not intended to be discharged.)
Consider the following Fitch style proof.  The indentations of the subproofs show where assumptions are made (lines 2,3) and discharged (lines 6,7).
$$\def\fitch#1#2{\quad\begin{array}{|l}#1\\\hline #2\end{array}}\fitch{1.~(P\wedge Q)\to R\hspace{5ex}\text{Premise}}{\fitch{2.~P\hspace{13ex}\text{Assumption}}{\fitch{3.~Q\hspace{9.5ex}\text{Assumption}}{4.~P\wedge Q\hspace{5.5ex}\text{Conjunction Introduction (2,3)}\\5.~R\hspace{10ex}\text{Conditional Elimination (1,4)}}\\6.~Q\to R\hspace{8ex}\text{Conditional Introduction (3-5)}}\\7.~P\to(Q\to R)\hspace{4ex}\text{Conditional Introduction (2-6)}}$$

Note, there are other rules of inference that discharge assumptions: notable negation introduction.
