-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathmessaging.lyx
1197 lines (963 loc) · 31.4 KB
/
messaging.lyx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures false
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style tufte
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Title
Messaging
\end_layout
\begin_layout Abstract
Thoughts about messaging and a relationship to grammar.
Some old ideas, rephrased, some new ideas, incomplete.
\end_layout
\begin_layout Section*
Introduction
\end_layout
\begin_layout Standard
Two almost inrelated ideas, and one theme.
\end_layout
\begin_layout Standard
Lets start with an obvious observation: natural language is used to transmit
messages, from one human mind to another.
Language carries messages.
Painfully obviously.
Now pair this with another idea: message-passing algorithms are a good
way of solving NP-complete graphical constraint satisfaction problems.
This pairing suggests a wild insight: that a collection of human minds,
working together, are using message passing as a technique for collectively
solving some difficult problem.
To what degree can this insight be developed into a formal theory of the
mind, and speciffically, a formalm theory of the collective, social mind?
I don't know, and what follows below will be mostly unrelated to that,
and will instead tackle grammar again, the grammar of natural language.
\end_layout
\begin_layout Subsection*
Grammar via Belief Propagation
\end_layout
\begin_layout Standard
This is a reprise of a recurring theme.
The goal is to find effective and tractable computational strategies for
extracting meaning from natural language.
The current work concerns itself with a very basic layer, that of extracting
a lexical grammar, describing the syntax of the language, and a crude level
of semantics that follows there from.
By a
\begin_inset Quotes eld
\end_inset
lexical grammar
\begin_inset Quotes erd
\end_inset
, it is meant that sentences of the language can be broken down into words,
and that the relatioinship between words can be obtained from a lexicon,
that is, from a dictionary where each word can be looked up to discover
the grammatical relationships that word can engage in.
It is useful to note that such lexicons are redily extended to include
idioms, set phrases, institutional expressions, colocations; such multi-word
constructions do not alter the underlying concept.
\end_layout
\begin_layout Standard
Lexicality implies that language can be analyzed in terms of words (or set
phrases,
\emph on
etc.
\emph default
).
But language is also fundamentally statistical and probabilisitic: there
is no ultimate, final truth to syntax and semantics, but only likely meanings
and interpretations.
In this setting, lexicality means not only that language can be viewed
as a graph of relationships between words, but also that the graph can
be factored into local components.
Specifically, each local component consists of a word, and the other nearby
words that it may interact with: a word, and its syntactico-semantically-neares
t neighbors.
\end_layout
\begin_layout Standard
Modern probability theory has a standard formulation using the terminology
and notation of statistical mechanics.
In this formulation, one begins by asserting that the universe is described
by a summation over all possibilities: everything that might happen, can
happen, with some associated probability.
This sum is called the partition function; it is symbolized by
\begin_inset Formula $Z$
\end_inset
, and the partitioning is simply the statement each possibility has a probabilit
y.
For natural language, this just means that every possible sequence of words
(a
\begin_inset Quotes eld
\end_inset
sentence
\begin_inset Quotes erd
\end_inset
) occurs with some probability; ungrammatical sentences have a low, approximatel
y vanishing probability.
\end_layout
\begin_layout Standard
It is a theorem of Boltzmann that partition functions can be written as
sums over exponentials, and that the most likely possibility is given by
maximizing the entropy.
This is not an assumption that has to be artificially forced onto the system;
rather, it is the factual statement that, if you believe in probability,
then there is no other way: it is a theorem.
Combining natural language with probability then suggests that it is fruitful
to articulate the statistical mechanics thereof.
\end_layout
\begin_layout Standard
In what follows, the formal grammar of choice is Link Grammar.
\begin_inset CommandInset citation
LatexCommand cite
key "Sleator1991,Sleator1993"
literal "true"
\end_inset
This choice is made for several reasons.
First, one may argue that the actual choice of a grammar formalism is immateria
l, as all grammars are effectvely inter-convertable between one-another
by algorithmic means.
Thus, the choice of formalism boils down to convenience; what notational
system is most convenient? Here, Link Grammar stands out.
First, it is effectively a form of dependency grammar, and so is natural
to linguists trained in that tradition.
Second, by expressing grammar in terms of link types, it leverages type
theory, and has a very natural bridge to categorial grammars and pregroup
grammars: link types are just the type-theoretical types of the relationships
that categorial grammars articulate.
As categorial grammars are normally considered to be a form of phrase-structure
grammars, exposing the relationships as types provides the natural bridge
between the phrase-structure and dependency grammar schools of thought.
Finally, Link Grammar is appealing from the tradition of mathematics: Link
Grammar is a tensor algebra.
Lexical entries are tensors, and lexical entries are composed into sentences
in exactly the same way that one composes tensors in a tensor algebra.
It is precisely this tensorial nature that then enables Curry–Howard correspond
ance; Link Grammar is the
\begin_inset Quotes eld
\end_inset
internal language
\begin_inset Quotes erd
\end_inset
of monoidal categories.
\end_layout
\begin_layout Standard
The next section articulates the statistical mechanics Link Grammar.
This presents Link Grammar as both a constraint-statistfaction problem
as well as a maximum entropy problem.
This is followed by a section looking at the belief-propagation aglorithm,
inspired by and developed along the lines described by Mézard and Mora
\begin_inset CommandInset citation
LatexCommand cite
key "Mezard2008"
literal "true"
\end_inset
.
\end_layout
\begin_layout Subsection*
A Frequentist Model of Language
\end_layout
\begin_layout Standard
The goal of this section is to formulate a model of language, simultaneously
invoking both its graph-theoretical and statistical properties.
This mostly requires the introduction and review of fairly mainstream ideas
and notation, and an articulation of the notation so that it's meaning
becomes clear.
\end_layout
\begin_layout Standard
Consider first a word sequence
\begin_inset Formula $\underline{w}=\left(w_{1},\cdots,w_{n}\right)$
\end_inset
which can be taken to be a sentence that is
\begin_inset Formula $n$
\end_inset
words long; it need not be grammatical; that is, it need not be a valid
sentence.
One possible way of defining the statistics of language is to claim that
the probability of this word sequence is
\end_layout
\begin_layout Standard
\begin_inset Formula
\begin{equation}
P\left(\underbar{w}\right)=\lim_{N\to\infty}\frac{1}{N}\sum_{i=1}^{N}\delta\left(\underbar{w},\underbar{w}_{i}\right)\label{eq:frequentist}
\end{equation}
\end_inset
where
\begin_inset Formula $N$
\end_inset
is the number of sentences in a sample corpus representative of the language,
so that each
\begin_inset Formula $\underbar{w}_{i}$
\end_inset
is a grammatically valid sentence.
The above states that, basically, a word sequence
\begin_inset Formula $\underbar{w}$
\end_inset
is valid if and only if it occurs in the sample corpus; else it is not.
This is a naive and simplistic definition of language, dounded on a frequentist
view of probability.
It is inadequate on multiple fronts.
It's worth articulating these, lest they become an impediement later.
\end_layout
\begin_layout Itemize
The notation above assigned a fixed sentence length of
\begin_inset Formula $n$
\end_inset
.
This seems to be a notational inconvenience, rather than a fundamental
limitation.
From here on, sentences are assumed to be varying in length, and can be
chosen as desired.
\end_layout
\begin_layout Itemize
Morphology is ignored.
For the most part, this should not be an impediment; Link Grammar is able
to deal adequately with morpho-syntax, and even enforce phonetic agreement,
so this presents no particular stumbling block.
\end_layout
\begin_layout Itemize
Semantic structure on a scale larger than one sentence is ignored.
Most of what follows will be focused on syntax, and the lower reaches of
semantics, and so this simplification seems reasonable at this time.
\end_layout
\begin_layout Itemize
Corpora are assumed to be finite in size.
This is naturally the case for natural language, but it can cause difficulties
for certain mathematical approaches, which are more naturally expressed
in the continuum limit.
This is also glossed over, as it rarely presents any practical difficulties.
By contrast, formal languages with generative grammars are capable of producing
infinite corpora, and so the distinction between finite and infinite can
be blurred.
\end_layout
\begin_layout Itemize
The above definition completely ignores the obvious fact that language is
compositional: one can form sentences from sentence fragments; phrases
can have meanings; language is a collection of recurring word-patterns
plainly visible at a sub-sentence level.
Yet, one of the goals of research into linguistics is to elucidate the
compositional structure of language.
\end_layout
\begin_layout Standard
For all of these various reasons, the above probabilistic description of
language is patently absurd.
Yet it is often quoted as a foundational cornerstone, and so is worth repeating
here.
Despite these abusrdities, one might like the final formulation of language
be such that eqn
\begin_inset CommandInset ref
LatexCommand ref
reference "eq:frequentist"
\end_inset
, or at least something similar, can arise naturally from the theory.
\end_layout
\begin_layout Standard
For the remainder of this section, the assumption is made that the compostional
nature of language can be adequately captured by means of a lexis.
This is closely related too the assumption that language is syntactic,
but is, in some sense, strictly weaker, or, at least, should be interpreted
in a broader setting.
A lexical description of language is one where each word is associated
with a collection of properties and relations that specify how that word
can occur in grammatical contexts, and how rough, basic meaning can be
pinned down.
This is in contrast to
\begin_inset Quotes eld
\end_inset
syntax
\begin_inset Quotes erd
\end_inset
, which is usually taken to be synonym for the existence of a (planar) parse
tree.
The point here is that the graphical structure of language need not be tree-like
: the parse may contain loops; it may contain non-planar edges between words,
and it may contain relations operating at different conceptual levels.
For example, graphical relations enforcing phonetic agreement might typically
operate at a different level than count and tense agreement, and that in
turn operates at a different level than anaphora agreement.
\end_layout
\begin_layout Standard
It is possible that natural language has structure that cannot be captured
by probabilistic graphical representations.
That author, however, is currently unable to imagine what this might be.
Therefore, in all that follows, the assumption is made that the entirety
of meaning and structure in language can be captured by graphs that encode
functions and relations with statistical, probabilistic properties.
\end_layout
\begin_layout Subsection*
Link Grammar
\end_layout
\begin_layout Standard
The remainder of this paper assumes that Link Grammar is well suited to capture
most of the lexical, syntactic properties of language.
There are multiple reasons that this assumption seems justified.
These include:
\end_layout
\begin_layout Itemize
The Link Grammar formalism can be more-or-less directly related to dependency
grammars; it can be taken as a certain kind of dependency grammar, and
is rich enough that it can be mapped or translated to different styles
of dependency.
\end_layout
\begin_layout Itemize
The Link Grammar formalism can be directly related to categorial and pregroup
grammar-style grammars; insofar as those can be taken as examples of phrase-str
ucture grammar, a route exists to map Link Grammar into phrase structure,
and the kinds of phenomena exhibited there.
\end_layout
\begin_layout Itemize
Link Grammar bridges naturally to Lambek calculus.
The link types of Link Grammar can be interpreted as the types of type
theory; the
\begin_inset Quotes eld
\end_inset
disjuncts
\begin_inset Quotes erd
\end_inset
of Link Grammar are manifestly tensorial, and so Link Grammar can be taken
as a kind of tensor algebra.
As such, it can be understood via category theory: Link Grammar is the
\begin_inset Quotes eld
\end_inset
internal language
\begin_inset Quotes erd
\end_inset
of a monoidal category.
This makes it simultaneously very general, and abstractly powerful.
\end_layout
\begin_layout Standard
To summarize, the Link Grammar formalism lies at the nexus of a multitude
of different viewpoints and theories of language.
One need not go very far, or work particularly hard, to see how it captures
different linguistic (and mathematical) phenomena and theories.
\end_layout
\begin_layout Subsection*
Statistical Mechanics of Link Grammar
\end_layout
\begin_layout Standard
Lexical entries are then of the form
\begin_inset Formula
\[
\left(\left(w,d\right),h\right)
\]
\end_inset
where
\begin_inset Formula $w$
\end_inset
is a word,
\begin_inset Formula $d$
\end_inset
is a disjunct
\begin_inset Foot
status collapsed
\begin_layout Plain Layout
A definition of
\begin_inset Quotes eld
\end_inset
disjunct
\begin_inset Quotes erd
\end_inset
will be given shortly; the next few paragraphs do not rely on a precise
definition, and hold true generally for any lexical formulation.
In particular, one can imagine that a disjunct is an n-gram or a skip-gram;
this is useful, as it makes contact with nueral-net/deep-learning approaches
to language.
\end_layout
\end_inset
describing one of the grammatical relationships the word can engage in,
and
\begin_inset Formula $h$
\end_inset
is a
\begin_inset Quotes eld
\end_inset
cost
\begin_inset Quotes erd
\end_inset
or entropy associated with this word-disjunct pair.
\begin_inset Foot
status collapsed
\begin_layout Plain Layout
A single word might be associated with multiple disjuncts.
During grammatical analysis, only one of these may be used at a time; thus
the disjuncts are disjoined from one-another, whence the name.
\end_layout
\end_inset
It is convenient to write the cost as a function of the word-disjunct pair:
\begin_inset Formula $h=h\left(w,d\right)$
\end_inset
as only the lowest cost is meaningful, and it does not make sense for a
given disjunct to have more than one cost.
Impossible word-disjunct pairs have infinite cost, rendering their probability
zero.
That is, the probability of a word-disjunct pair, up to an overall normalizatio
n, can be taken as
\begin_inset Formula
\[
P\left(w,d\right)\sim\exp-h\left(w,d\right)
\]
\end_inset
\end_layout
\begin_layout Standard
The probability of a word sequence
\begin_inset Formula $\underbar{w}$
\end_inset
is then
\begin_inset Formula
\[
P\left(\underbar{w}\right)=\frac{1}{Z}\sum_{\left(d_{1},\cdots,d_{n}\right)}\prod_{j=1}^{n}P\left(w_{j},d_{j}\right)\Delta\left(d_{1},\cdots,d_{n}\right)
\]
\end_inset
where the formal grammar is encoded as a boolean satisfiability factor
\begin_inset Foot
status collapsed
\begin_layout Plain Layout
This is just the indicator function for a predicate.
Common alternate notation is
\begin_inset Formula $\mathbb{I}$
\end_inset
or
\begin_inset Formula $\mathbf{1}$
\end_inset
.
There is an implicit assumption that a parse, if it exists, is unique.
If this is not the case, and multiple distinct parses exist with a given
fixed
\begin_inset Formula $\underbar{d}$
\end_inset
, then
\begin_inset Formula $\Delta$
\end_inset
needs to count these with multiplicity.
\end_layout
\end_inset
\begin_inset Formula
\[
\Delta\left(d_{1},\cdots,d_{n}\right)=\begin{cases}
1 & \left(d_{1},\cdots,d_{n}\right)\mbox{ is a valid parse}\\
0 & \mbox{otherwise}
\end{cases}
\]
\end_inset
The probabilistic aspects, that some parses are more likely than others,
are encoded in the lexical factors
\begin_inset Formula $P\left(w,d\right)$
\end_inset
.
Replacing probabilities by their logs, one can equivalently write
\end_layout
\begin_layout Standard
\begin_inset Formula
\[
P\left(\underbar{w}\right)=\frac{1}{Z}\sum_{\underbar{d}}\Delta\left(\underbar{d}\right)\exp-\mathcal{A}\left(\underbar{w},\underbar{d}\right)
\]
\end_inset
using as shorthand
\begin_inset Formula $\underbar{d}=\left(d_{1},\cdots,d_{n}\right)$
\end_inset
as the string of
\begin_inset Formula $n$
\end_inset
disjuncts associated with the
\begin_inset Formula $n$
\end_inset
words
\begin_inset Formula $\underbar{w}=\left(w_{1},\cdots,w_{n}\right)$
\end_inset
.
The sum is taken over all possible lists
\begin_inset Formula $\underbar{d}$
\end_inset
of disjuncts
\begin_inset Formula $d_{j}$
\end_inset
; the
\begin_inset Formula $\Delta$
\end_inset
term excludes those sequences that do not correspond to valid parses in
the formal grammar.
\begin_inset Foot
status collapsed
\begin_layout Plain Layout
The summation
\begin_inset Formula $\sum_{\underbar{d}}\Delta\left(\underbar{d}\right)$
\end_inset
has the form that makes it clear that
\begin_inset Formula $\Delta$
\end_inset
has the form of an integration measure.
An obvious generalization is to replace it by a fuzzy or fractional measure.
\end_layout
\end_inset
The normalization
\begin_inset Formula $Z$
\end_inset
is famously known as the partition function.
\begin_inset Foot
status collapsed
\begin_layout Plain Layout
See Wikipedia.
\end_layout
\end_inset
\end_layout
\begin_layout Standard
The
\begin_inset Formula $\mathcal{A}$
\end_inset
is the
\begin_inset Quotes eld
\end_inset
action
\begin_inset Quotes erd
\end_inset
\begin_inset Foot
status collapsed
\begin_layout Plain Layout
This word comes from physics, specifically, the Lagrangian formulation of
classical mechanics.
\end_layout
\end_inset
, given by
\begin_inset Formula
\[
\mathcal{A}\left(\underbar{w},\underbar{d}\right)=\sum_{j=1}^{n}h\left(w_{j},d_{j}\right)
\]
\end_inset
As the cost
\begin_inset Formula $h$
\end_inset
is infinite for those words-disjunct pairs that do not occur in the lexis,
this sum excludes impossible pairings; no additional effort is needed to
otherwise exclude them.
\end_layout
\begin_layout Standard
Although the above formulation uses the word
\begin_inset Quotes eld
\end_inset
disjunct
\begin_inset Quotes erd
\end_inset
for
\begin_inset Formula $d_{j}$
\end_inset
, it was intentionally vague; none of the development required a more precise
definition.
In a lexical formulation, the term
\begin_inset Formula $\Delta\left(\underbar{d}\right)$
\end_inset
can also be factorized locally, as it is determined by a product of lexical
elements.
In the Link Grammar formulation, the lexical elements are explicitly graphical:
a vertex surrounded by half-edges or connectors, with two half-edges required
to make a full edge (link) connecting two vertices.
Algebraically, a disjunct is a list of connectors, which either can connect,
or not.
That is, an arity-
\begin_inset Formula $m$
\end_inset
disjunct is a conjunction of connectors
\begin_inset Formula $c$
\end_inset
written as
\begin_inset Formula
\[
d=c_{1}\&\cdots\&c_{m}
\]
\end_inset
with each connector being a half-link, that is, a link with a direction
indicator:
\begin_inset Formula
\[
c=\left(\ell,\sigma\right)
\]
\end_inset
with
\begin_inset Formula $\ell\in L$
\end_inset
being one of the Link Grammar link types, and
\begin_inset Formula $\sigma\in\left\{ -,+\right\} $
\end_inset
being a direction indicator.
\begin_inset Foot
status collapsed
\begin_layout Plain Layout
In standard link grammar, these direction indicators point to the left and
right, respectively, and encode the directional dependence of word order.
For languages with free word-order, it is convenient to use symbols for
head and tail instead of, or in addition to the direction indicators.
Head/tail markings are also useful for indicating dependency directions,
when these are desired, or for indicating catena.
\end_layout
\end_inset
Define the conjugate direction indicator
\begin_inset Formula $\bar{\sigma}$
\end_inset
as
\begin_inset Formula
\[
\bar{\sigma}=\begin{cases}
- & \mbox{if }\sigma=+\\
+ & \mbox{if }\sigma=-
\end{cases}
\]
\end_inset
Thus, two connectors
\begin_inset Formula $c_{a}$
\end_inset
and
\begin_inset Formula $c_{b}$
\end_inset
connect if the link types match, and the direction indicators are conjugate.
Thus, one may define
\begin_inset Formula
\[
\delta\left(c_{a},c_{b}\right)=\delta\left(\ell_{a},\ell_{b}\right)\delta\left(\sigma_{a},\bar{\sigma}_{b}\right)
\]
\end_inset
A sentence is parsable when all connectors are connectable, and so
\begin_inset Formula
\begin{equation}
\Delta\left(\underbar{d}\right)=\Delta\left(d_{1},\cdots,d_{n}\right)=\prod_{d_{j}=\left(c_{j1}\&\cdots\&c_{jm}\right)}\delta\left(c_{jk},c_{j^{\prime}k^{\prime}}\right)\label{eq:factor-graph}
\end{equation}
\end_inset
with the product being over all of the individual connectors in each disjunct.
That is,
\begin_inset Formula $\Delta=1$
\end_inset
if and only if every connector can be uniquely paired with some other connector
, and no dangling connectors remain.
To avoid double-counting, the product is meant to extend only over the
links (edges) in the graph, with one term per edge.
\end_layout
\begin_layout Standard
It is from this that the interpretation as a tensor algebra arises: Each
disjunct
\begin_inset Formula $d=d_{j}$
\end_inset
can be thought of as a tensor having
\begin_inset Formula $m$
\end_inset
indexes on it; each index must be contracted with some other index on some
other tensor.
The tensor indexes are always contracted pair-wise, and once connected
(consumed) cannot be connected to any other index.
\begin_inset Foot
status collapsed
\begin_layout Plain Layout
This is the content of the
\begin_inset Quotes eld
\end_inset
no cloning
\begin_inset Quotes erd
\end_inset
theorem.
\end_layout
\end_inset
A parse is valid if and only if
\begin_inset Formula $\Delta$
\end_inset
is a scalar, having no remaining uncontracted indexes.
Unlike symmetric tensor algebras, the connectors are directional: they
can contract only to the left, or to the right.
\end_layout
\begin_layout Standard
Implicit in the above is a further constraint that the parse graph be a
planar graph,
\emph on
i.e.
\emph default
that there is a no-links-crossing constraint.
This constraint is very useful for controlling the combinatorial explosion
of possible parses; unfortunately, it is a non-local constraint, and thus
cannot be easily written in a factorizable manner.
Rather than tackling the difficulty of obtaining an adequate notation for
such a non-local constraint, it is easier, for now, to implicitly keep
this in the background.
There are multiple techniques that can be used when dealing with this;
these, and planarity in general, are for now secondary concerns.
\end_layout
\begin_layout Standard
Taking the logarithm, so as to turn products into sums, the constraint can
be written in the form
\begin_inset Formula
\[
\Delta\left(\underbar{d}\right)=\Delta\left(d_{1},\cdots,d_{n}\right)=\exp-\left[\sum_{d_{j}=\left(c_{j1}\&\cdots\&c_{jm}\right)}\Xi\left(c_{jk},c_{j^{\prime}k^{\prime}}\right)\right]
\]
\end_inset
where
\begin_inset Formula $\Xi$
\end_inset
can be interpreted as a kinetic term, having a value of zero when
\begin_inset Formula $c_{jk}$
\end_inset
can be contracted with
\begin_inset Formula $c_{j^{\prime}k^{\prime}}$
\end_inset
and is infinite otherwise.
\end_layout
\begin_layout Standard
In this form, the constraint can be pulled into the action
\begin_inset Formula $\mathcal{A}$
\end_inset
, redefining it as a summation of local interactions:
\begin_inset Formula
\[
\mathcal{A}\left(\underbar{w},\underbar{d}\right)=\sum_{j=1}^{n}\left[h\left(w_{j},d_{j}\right)+\sum_{d_{j}=\left(c_{j1}\&\cdots\&c_{jm}\right)}\Xi\left(c_{jk},c_{j^{\prime}k^{\prime}}\right)\right]
\]
\end_inset
The intended reading of the above expression is that it is a summation over
Feynmann diagrams, with
\begin_inset Formula $h$
\end_inset
corresponding to a
\begin_inset Formula $m$
\end_inset
-point vertex (when the disjunct
\begin_inset Formula $d_{j}$
\end_inset
has arity
\begin_inset Formula $m$
\end_inset
), and the
\begin_inset Formula $\Xi$
\end_inset
terms corresponding to propagators connecting vertices.
The propagators are exactly the Link Grammar links, weighted in such a
way that they contribute zero to the action, when the link is allowed,
and otherwise contributing infinity.
\end_layout
\begin_layout Standard
The partition function can then be formally written as
\begin_inset Formula
\[
Z=\sum_{\underbar{w},\underbar{d}}\exp-\mathcal{A}\left(\underbar{w},\underbar{d}\right)
\]
\end_inset
with the summation over
\begin_inset Formula $\underbar{w}$
\end_inset
running over all possible word-sequences of arbitrary length.
As is conventional in partition function formulations, it is convenient
to introduce external currents
\begin_inset Formula $\underbar{J}$
\end_inset
so that variational principles can be used to extract quantities of interest.
Thus, for example, writing
\begin_inset Formula