Bra-Ket Notation I'm having difficulty understanding the bra-ket notation used in quantum mechanics. For instance, take the notation used in the question Is there a relation between quantum theory and Fourier analysis?
Let $O$ be an operator on a (wave)function, $f,g$ be (wave)functions, and $x$ be a dummy variable (representing a basis for $f$, I suppose).
If I'm understanding the notation correctly, then


*

*$|f\rangle =$ a function independent of basis, i.e., $|\psi\rangle =$ the state vector

*$\langle x|f\rangle = f = |f\rangle$ transformed to a position basis

*$\langle x|O\rangle =$ operator on an eigenvalue of $O$ that produces the corresponding eigenfunction under a position basis

*$|O\rangle =$ operator on an eigenvalue of O that produces the corresponding eigenfunction independent of basis

*$\langle g(x)\rangle = \langle \psi|g(x)|\psi\rangle = $expectation of g(x) on measure $|\langle x|\psi\rangle|^2$

*$\langle f|g\rangle$ is the projection of $g$ onto $f$, i.e. $\langle f,g\rangle$ for normalized $f$

*$\langle f|x\rangle$ is undefined

*$\langle x|x\rangle$ is undefined

*$|x\rangle$ is undefined

*The bra portion of the bra-ket is always a dummy variable ($x$ for position, $p$ for momentum, etc).

*The ket portion is always a function/operator ($p$ for the momentum operator, etc)


Does this look right? Also, how does the three-argument version $\langle a|b|c\rangle$ work? Same question for the bra version $\langle a|$ - if the bra is the basis, then what does it mean to take a basis without a function?
 A: A Brief Look at Quantum Mechanics through Dirac's Bra-ket Notation [*]
1- In quantum mechanics a physical state is represented by a state vector in a complex vector space. The dimension of the vector space is specified by the nature of the physical system under consideration.
2- A state vector is denoted by a ket, $|\alpha\rangle$, which contains complete information about the physical state.
3- Two kets can be added to produce a new ket and a ket can be multiplied by a complex number.
$$|\alpha\rangle+|\beta\rangle=|\gamma\rangle$$
$$c|\alpha\rangle=|\alpha\rangle c$$
The kets $|\alpha\rangle$ and $c|\alpha\rangle$ ($c\neq0$) represent the same physical state.
4- An observable is denoted by an operator, $\hat{A}$.
5- An operator acts on a ket from the left side, $\hat{A}|\alpha\rangle$.
6- In general, $\hat{A}|\alpha\rangle$ is not a constant times $|\alpha\rangle$ but there are particular kets, eigenkets of $\hat{A}$, say $|{a}'\rangle$, $|{a}''\rangle$, $|{a}'''\rangle,...$ which have the property
$$\hat{A}|{a}'\rangle=\lambda_{{a}'}|{a}'\rangle, \hat{A}|{a}''\rangle=\lambda_{{a}''}|{a}''\rangle, \hat{A}|{a}'''\rangle=\lambda_{{a}'''}|{a}'''\rangle,...$$
where $\lambda_{{a}'}$,  $\lambda_{{a}''}$, $\lambda_{{a}'''}$ are just numbers and called eigenvalues. The complete set of eigenvalues denoted by $\left \{ \lambda_{{a}'}\right \}$.
7- A physical state corresponding to an eigenket is called eigenstate.
8- Lets say we are interested in an N-dimensional vector space spanned by N eigenkets of an observable $\hat{A}$, then any $|\alpha\rangle$ can be written as
$$|\alpha\rangle=\sum_{{a}'} c_{{a}'}|{a}'\rangle$$
where the summation is over all eigenkets of $\hat{A}$ and $c_{{a}'}$ are complex numbers (the uniqueness of such an expansion can be proved). Here $\sum$ indicates countable (discrete) states, finite or infinite. For noncountable (continuous) states the $\sum$ is replaced by $\int$ (see 30).
9- There exists a dual space of ket space, which is called the bra space, and for every ket $|\alpha\rangle$ there exists a bra, denoted by $\langle\alpha|$. The bra space is spanned by eigenbras $\left \{ \langle {a}'|\right \}$ which correspond to eigenkets $\left \{ |{a}'\rangle \right \}$.
10- There is one-to-one correspondence (dual correspondence, DC) between a ket space and a bra space and roughly speaking the bra space can be regarded as some kind of mirror image of the ket space.
$$|\alpha\rangle \overset{DC}{\leftrightarrow} \langle\alpha|$$
$$|\alpha\rangle+|\beta\rangle \overset{DC}{\leftrightarrow} \langle\alpha|+\langle\beta|$$
$$c|\alpha\rangle \overset{DC}{\leftrightarrow} c^{*}\langle\alpha|$$
where $c^{*}$ is complex conjugate of $c$.
11- The inner product of a bra $\langle\beta|$ and a ket $|\alpha\rangle$ is in general a complex number and written as $\langle\beta|\alpha\rangle$.
12- Two fundamental properties of inner product are
$$\langle\beta|\alpha\rangle=\langle\alpha|\beta\rangle^{*}$$
$$\langle\alpha|\alpha\rangle {\geq}0 \textrm{ (positive definite metric)} $$
13- Two kets $|\alpha\rangle$ and $|\beta\rangle$ are said to be orthogonal if
$$\langle\alpha|\beta\rangle=0$$
14- A ket $|\alpha\rangle$ (not being a null ket) can be normalized
$$|\tilde{\alpha}\rangle=\frac{1}{\sqrt{\langle\alpha|\alpha\rangle}}|\alpha\rangle$$
with property
$$\langle\tilde{\alpha}|\tilde{\alpha}\rangle=1$$
where $\sqrt{\langle\alpha|\alpha\rangle}$ is called the norm of $|\alpha\rangle$.
15- Let's consider three operators $\hat{X}$, $\hat{Y}$ and $\hat{Z}$ (not necessarily representing observables). $\hat{X}$ is said to be the null operator if
$$\hat{X}|\alpha\rangle=0$$
and $\hat{X}$ and $\hat{Y}$ are said to be equal if
$$\hat{X}|\alpha\rangle=\hat{Y}|\alpha\rangle$$
16- Operators can be added, and addition is commutative and associative
$$\hat{X}+\hat{Y}=\hat{Y}+\hat{X}$$
$$\hat{X}+(\hat{Y}+\hat{Z})=(\hat{X}+\hat{Y})+\hat{Z}.$$
17- Operators are linear
$$\hat{X}(c_{\alpha}|\alpha\rangle+c_{\beta}|\beta\rangle)=c_{\alpha}\hat{X}|\alpha\rangle+c_{\beta}\hat{X}|\beta\rangle$$
18- An operator acts on a bra from the right side, $\langle\alpha|\hat{X}$.
19- There is the dual correspondence
$$\hat{X}|\alpha\rangle \overset{DC}{\leftrightarrow} \langle\alpha|\hat{X}^{\dagger}$$
where $\hat{X}^{\dagger}$ is Hermitian conjugate of $\hat{X}$.
20- Operators can be multiplied and multiplication is noncommutative but associative.
$$XY\neq YX$$
$$X(YX)=(XY)Z=XYZ$$
It can be proved that
$${\left ( XY \right )}^{\dagger}=Y^{\dagger}X^{\dagger}$$
21- A ket $|\alpha\rangle$ and a bra $\langle\beta|$ can form an operator through an outer product $|\alpha\rangle\langle\beta|$.
22- The following are illegal products, $\hat{X}\langle\alpha|$, $|\alpha\rangle\hat{X}$, $|\alpha\rangle|\beta\rangle$, $\langle\alpha|\langle\beta|$ (assuming that $|\alpha\rangle$ and $\beta\rangle$ are in the same space).
23- The expression $|\beta\rangle\langle\alpha|\gamma\rangle$ can be interpreted in two different ways: first, the operator $|\beta\rangle\langle\alpha|$ acting on ket $|\gamma\rangle$; second, the number $\langle\alpha|\gamma\rangle$ multiplying the ket $|\beta\rangle$. According to first interpretation the operator $|\beta\rangle\langle\alpha|$ rotates the ket $|\gamma\rangle$ into the direction of $|\beta\rangle$.
24- Three important equalities to keep in mind are:
$$\langle\beta|\alpha\rangle=\langle\alpha|\beta\rangle^{*}\textrm{ (see 12)}$$
$$\left (|\beta\rangle\langle\alpha|\right )^{\dagger}=|\alpha\rangle\langle\beta|$$
$$\langle\alpha|\hat{X}|\beta\rangle=\langle\beta|\hat{X}^{\dagger}|\alpha\rangle^{*}$$
25- In quantum mechanics Hermitian operators ($\hat{A}=\hat{A}^{\dagger}$) quite often turn out to be operators representing some physical observables. It can be shown that a Hermitian operator, $\hat{A}$, has real eigenvales and orthogonal (or conventionally orthonormal) eigenkets. That is for
$$\hat{A}|{a}'\rangle=\lambda_{{a}'}|{a}'\rangle$$
we have
$$\lambda_{{a}'}=\lambda_{{a}'}^{*}\textrm{ and }\langle{a}''|{a}'\rangle=\delta _{{a}''{a}'}$$
where $\delta$ is Kronecker delta.
26- We have shown that (see 8) an arbitrary ket $|\alpha\rangle$, in the space spanned by the eigenkets of $\hat{A}$, can be expanded as
$$|\alpha\rangle=\sum_{{a}'} c_{{a}'}|{a}'\rangle$$
by multiplying both sides of the equation with $\langle{a}''|$ from the left side and using orthonormality we have
$$c_{{a}'}=\langle{a}'|\alpha\rangle$$
which is equivalent to
$$|\alpha\rangle=\sum_{{a}'}|{a}'\rangle\langle{a}'|\alpha\rangle$$
Because $|\alpha\rangle$ is an arbitrary ket we must have
$$\sum_{{a}'}|{a}'\rangle\langle{a}'|=\mathbb{I}$$
where $\mathbb{I}$ represents the identity operator. This is known as completeness relation or closeness and the operator
$$\Lambda_{{a}'}=|{a}'\rangle\langle{a}'|$$
is called projection operator.
27- In quantum mechanics a measurement always causes the system to jump into one of the eigenstates of the physical observable that is being measured.
Let’s say that the system is in a state $|\alpha\rangle$ before the measurement and we want to measure the observable $\hat{A}$. After the measurement, the system is thrown into one of the $\left \{ |{a}'\rangle \right \}$, say $|{a}'\rangle$, that is,
$$|\alpha\rangle\xrightarrow{measurement}|{a}'\rangle$$
In other words, the measurement usually changes the state. The only exception is when the state is already in one of the eigenstates then we have
$$|{a}'\rangle\xrightarrow{measurement}|{a}'\rangle$$
When the measurement causes $|\alpha\rangle$ to change into $|{a}'\rangle$ it is said that $\hat{A}$ is measured to be $\lambda_{{a}'}$, that is, the measurement yields one of the eigenvalues of the observable.
28- We do not know in advance into which of the $\left \{ |{a}'\rangle \right \}$ the system will be thrown as the result of measurement but it is postulated that the probability for jumping into some particular eigenstate $|{a}'\rangle$ is given by $\left | \langle{a}'|\alpha\rangle \right |^{2}$.
29- The expectation value of an observable $\hat{A}$ for a state $|\alpha\rangle$ is defined as
$$\langle A\rangle \equiv \langle \alpha|\hat{A}|\alpha \rangle$$
which is equivalent to
$$\langle A\rangle = \sum_{{a}'}\sum_{{a}''} \langle \alpha|{a}'' \rangle \langle {a}''|\hat{A}|{a}' \rangle \langle {a}'|\alpha \rangle$$
and agrees with intuition of average measured value 
$$\langle A\rangle = \sum_{{a}'} \lambda_{{a}'} \left | \langle {a}'|\alpha \rangle \right |^{2}$$
that is, sum of all measured values $\lambda_{{a}'}$, $\lambda_{{a}''},...$ multiplied by corresponding probabilities of measuring the particular value, $\left | \langle {a}'|\alpha \rangle \right |^{2}$, $\left | \langle {a}''|\alpha \rangle \right |^{2},...$
30- As mentioned before (see 8) the notation presented so far was for vector spaces with discrete (countable) dimensions. In the case vector spaces with continuous (uncountable) dimension the notation changes slightly.
Let $\hat{\eta}$ represent an observable with continuous eigenkets $|\eta \rangle$, then previous definitions changes to
$$\begin{matrix} discrete     & &       continuous\\ \hat{A}|{a}'\rangle=\lambda_{{a}'}|{a}'\rangle &\rightarrow& \hat{\eta}|{\eta}'\rangle=\lambda_{{\eta}'}|{\eta}'\rangle\\ \langle{a}'|{a}''\rangle=\delta _{{a}'{a}''} & \rightarrow& \langle{\eta}'|{\eta}''\rangle=\delta \left (  {\eta}'-{\eta}'\right ) \\ \sum_{{a}'}|{a}'\rangle\langle{a}'|=\mathbb{I} &\rightarrow& \int\mathrm{d}{\eta}'|{\eta}' \rangle\langle{\eta}'|=\mathbb{I} \\ |\alpha\rangle=\sum_{{a}'}|{a}'\rangle\langle{a}'|\alpha\rangle    &\rightarrow &       |\alpha\rangle=\int \mathrm{d}{\eta}'|{\eta}'\rangle\langle{\eta}'|\alpha\rangle\\ \end{matrix}$$
where $\delta \left (  {\eta}'-{\eta}'\right )$ is Dirac's delta function.
31- Position, as an observable, is a good example for a vector space with continuous dimension. Let $\hat{X}$ be the position operator in one dimension then
$$ \hat{X}|{x}'\rangle=\lambda_{{x}'}|{x}'\rangle $$
and for any random state $|\alpha\rangle$ we have
$$|\alpha\rangle=\int \mathrm{d}{x}'|{x}'\rangle\langle {x}'|\alpha\rangle$$
Similar to the discrete case (see 28)
$$\left |\langle {x}'|\alpha\rangle  \right |^{2}\mathrm{d}{x}'$$
is postulated to be the probability of finding the particle in a small interval $\mathrm{d}{x}'$ around the point ${x}'$.
32- The term $\langle {x}'|\alpha\rangle$ is the wave function in position space and represented as
$$\psi_{\alpha}\left ( {x}' \right )=\langle {x}'|\alpha\rangle$$
Using the definition of wave function the inner product $\langle \beta|\alpha\rangle$ can be written as
$$\begin{align*} \langle \beta|\alpha\rangle&=\int\mathrm{d}{x}'\langle \beta|{x}'\rangle\langle {x}'|\alpha\rangle \\&=\int\mathrm{d}{x}'\psi_{\beta}^*\left ( {x}' \right )  \psi_{\alpha} \left ( {x}' \right ) \end{align*}$$
[*] Adopted from the book Modern Quantum Mechanics (Revised Edition) of J. J. Sakurai, p 10-60.
A: Let me work in mathematicians' notation for a bit and then switch back to Dirac notation.
Suppose you start with a Hilbert space $\mathscr H$, which you can understand as a space of functions from some coordinate space $S$ into $\mathbb C$, i.e. if $f\in\mathscr H$ then $f:R\to \mathbb C$, and that you have some suitable notion of inner product $(·,·):\mathscr H\times \mathscr H\to\mathbb C$, like e.g. an integral over $R$. (Note that here $(·,·)$ should be linear on the second argument.)
Given this structure, for every vector $f\in\mathscr H$ you can define a linear functional $\varphi_f:\mathscr H\to \mathbb C$, i.e. a function tha takes elements $g\in \mathscr H$ and assigns them complex numbers $\varphi_f(g)\in \mathbb C$, whose action is given specifically by $\varphi_f(g) = (f,g)$. As such, $\varphi_f$ lives in $\mathscr H^*$, the dual of $\mathscr H$, which is the set of all (bounded and/or continuous) linear functionals from $\mathscr H$ to $\mathbb C$.
There's plenty of other interesting functionals around. For example, if $\mathscr H$ is a space of functions $f:R\to \mathbb C$, then another such functional is an evaluation at a given point $x\in R$: i.e. the map $\chi_x:\mathscr H\to\mathbb C$ given by
$$\chi_x(g) = g(x).$$
In general, this map is not actually bounded nor continuous (w.r.t. the topology of $\mathscr H$), but you can ignore that for now; most physicists do.
Thus, you have this big, roomy space of functionals $\mathscr H^*$, and you have this embedding of $\mathscr H$ into $\mathscr H^*$ given by $\varphi$. In general, though, $\varphi$ may or may not cover the entirety of $\mathscr H^*$.

The correspondence of this into Dirac notation goes as follows:


*

*$f$ is denoted $|f\rangle$ and it's called a ket.

*$\varphi_f$ is denoted $\langle f|$ and it's called a bra.

*$\chi_x$ is denoted $\langle x|$, and it's also called a bra.
Putting these together you start getting some of the things you wanted:
2. $\langle x |f\rangle$ is $\chi_x(f) = f(x)$, i.e. just the wavefuntion.
6. $\langle f | g \rangle$ is $\varphi_f(g) = (f,g)$, i.e. the iner product of $f$ and $g$ on $\mathscr H$, as it should be.
Note in particular that these just follow from juxtaposing the corresponding interpretations of the relevant bras and kets.
7. Somewhat surprisingly, $\langle f | x\rangle$ is actually defined - it just evaluates to $f(x)^*$. This is essentially because, in physicists' brains,
9. $|x\rangle$ is actually defined. It's normally understood as "a function that is infinitelly localized at $x$", which of course takes a physicist to make sense of (or more accurately, to handwave away the fact that it doesn't make sense). This ties in with
8.' $\langle x' | x\rangle$, the braket between different positions $x,x'\in R$, which evaluates to $\delta(x-x')$. Of course, this then means that
8. $\langle x | x\rangle$, with both positions equal, is not actually defined.
If this looks like physicists not caring about rigour in any way, it's because it mostly is. I should stress, though, that it is possible to give a rigorous foundation to these states, through a formalism known as rigged Hilbert spaces, where you essentially split $\mathscr H$ and $\mathscr H^*$ into different "layers". On balance, though, this requires more functional analysis than most physicists really learn, and it's not required to successfully operate on these objects.
Having done, that, we now come to some of the places where you've gone down some very strange roads:
3. $\langle x| O\rangle$ does not mean anything. Neither does "operator on an eigenvalue of $O$ that produces the corresponding eigenfunction under a position basis".
4. $|O\rangle$  is not a thing. You never put operators inside a ket (and certainly not on their own).
Operators always act on the outside of the ket. So, say you have an operator $O:\mathscr H\to\mathscr H$, which in mathematician's notation would take a vector $f\in \mathscr H$ and give you another $O(f)\in \mathscr H$. In Dirac notation you tend to put a hat on $\hat O$, and you use $\hat O|f\rangle$ to mean $O(f)$.
In particular, this is used for the most fundamental bit of notation:


*

*$\langle f |\hat O|g\rangle$, which a mathematician would denote $\varphi_f(O(g)) = (f,O(g))$, or alternatively (once you've defined the hermitian conjugate $O^*$ of $O$) $\varphi_{O^*(f)}(g) = (O^*(f),g)$.


This includes as a special case
5. $\langle f |G(\hat x)|f\rangle$. This is sometimes abbreviated as $\langle G(\hat x)\rangle$, but that's a good recipe for confusion. In this case, $G:R \to \mathbb C$ is generally a function, but $G(\hat x)$ is a whole different object: it's an operator, so e.g. $G(\hat x)|f\rangle$ lives in $\mathscr H$, and its action is such that this vector has wavefunction
$$ \langle x| G(\hat x) | f \rangle  = G(x) f(x).$$
The general matrix element $\langle g |G(\hat x)|f\rangle$ is then taken to be the inner product of $|g\rangle$ with this vector, i.e. $\int_R g(x)^*G(x) f(x)\mathrm dx$, and similarly in the special case $g=f$.
Finally, this brings us to your final two questions: 
10. The statement that "the bra portion of the bra-ket is always a dummy variable" is false. As you have seen, $\langle f|$ is perfectly well defined. (Also, $x$ and $p$ are not "dummy" variables, either, again as you have seen above.)
11. Similarly, the statement that "the ket portion is always a function/operator" is also false. You never put operators inside a ket (you put them to the left), and it's generally OK to put $x$'s in there (though, again, this does require either more work to bolt things down, or a willingness to handwave away the problems).

I hope this is enough to fix the problems in your understanding and get you using Dirac notation correctly. It does take a while to wrap one's head around but once you do it is very useful. Similarly, there's plenty of issues in terms of how we formalize things like position kets like $|x\rangle$, but they're all surmountable and, most importantly, they make much more sense once you've been using Dirac notation correctly and comfortably for a while.
