chriswarbo-net: ffd89477db028dabc509d70719d29ef18343145a
1: ---
2: title: Joining Parentheses
3: ---
4:
5: <small>Part of [my units pages](/projects/units)</small>
6:
7: TODO: Maybe just draw boxes?
8:
9: Parentheses are used to 'group together' parts of an expression; for example
10: $8 + ((3 + 2) \times (1 + 4))$. When many parentheses are nested, a common
11: problem is having to physically *count them* to figure out which ones match up;
12: or, in other words, to determine the extent of what's in them.
13:
14: Prior to the use of parentheses, it was common to use an over-bar (called a
15: 'vinculum') to express grouping. This would render the above like:
16: $8 + \overbar{\overbar{3 + 2} \times \overbar{1 + 4}}$
17:
18: <div style="display: none;">
19:
20: \newcommand{\overparens}[1]{\ensuremath{\bigl(\text{$\overline{\mathstrut\smash{\text{#1}}}$}\bigr)}}
21: \newcommand{\underparens}[1]{\ensuremath{\bigl(\text{$\underline{\mathstrut\smash{\text{#1}}}$}\bigr)}}
22:
23: </div>
24:
25: The vinculum makes its extent more clear, since it is physically present above
26: its entire contents. However, I still appreciate the way parentheses 'split up'
27: their interior from their exterior: we can combine both by using the vinculum to
28: 'join the parentheses', like so: $\overparens{3 + 2} \times \overparens{1 + 4}$
29:
30: Note that this may cause clutter when using
31: [overbars for negatives](negative_bar_notation.html), in which case it may be
32: preferable to join parentheses *below* their enclosed expression:
33: $\underparens{3 + 2} \times \underparens{1 + 4}$
34:
35: When there's no overbar ambiguity, and we have heavily-nested parentheses, I
36: find it helpful to alternate between over- and under-bars at each level of
37: nesting. This original example above would thus become:
38:
39: $$
40: 8 + \overparens{\underparens{3 + 2} \times \underparens{1 + 4}}
41: $$
42:
43: I use this extensively when working in combinatory logic (which makes extensive
44: use of nested tree structures!). For example, here's function composition:
45:
46: $$
47: \overparens{\underparens{\overparens{C f} g} x}
48: &= \overparens{\underparens{\overparens{\underparens{\overparens{S \underparens{K S}} K} f} g} x} \\
49: &= \overparens{\underparens{\overparens{\underparens{\overparens{K S} f} \underparens{K f}} g} x} \\
50: &= \overparens{\underparens{\overparens{S \underparens{K f}} g} x} \\
51: &= \overparens{\underparens{\overparens{K f} x} \underparens{g x}} \\
52: &= \overparens{f \underparens{g x}} \\
53: $$
Generated by git2html.