100% found this document useful (8 votes)
53 views

Prolog Programming in Depth 1st Edition Michael A. Covington download pdf

Prolog

Uploaded by

burrymaine8i
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (8 votes)
53 views

Prolog Programming in Depth 1st Edition Michael A. Covington download pdf

Prolog

Uploaded by

burrymaine8i
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 77

Download the full version of the ebook at

https://ebookfinal.com

Prolog Programming in Depth 1st Edition


Michael A. Covington

https://ebookfinal.com/download/prolog-
programming-in-depth-1st-edition-michael-a-
covington/

Explore and download more ebook at https://ebookfinal.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Programming in Prolog Fifth Edition W. F. Clocksin

https://ebookfinal.com/download/programming-in-prolog-fifth-edition-w-
f-clocksin/

ebookfinal.com

Digital SLR Astrophotography 1st Edition Michael A.


Covington

https://ebookfinal.com/download/digital-slr-astrophotography-1st-
edition-michael-a-covington/

ebookfinal.com

Introduction to Programming Languages Programming in C C


Scheme Prolog C and SOA 5th Edition Yinong Chen

https://ebookfinal.com/download/introduction-to-programming-languages-
programming-in-c-c-scheme-prolog-c-and-soa-5th-edition-yinong-chen/

ebookfinal.com

OSGi in Depth 1st Edition Alexandre De Castro Alves

https://ebookfinal.com/download/osgi-in-depth-1st-edition-alexandre-
de-castro-alves/

ebookfinal.com
Mac OS X Snow Leopard In Depth 1st Edition Paul Mcfedries

https://ebookfinal.com/download/mac-os-x-snow-leopard-in-depth-1st-
edition-paul-mcfedries/

ebookfinal.com

Sabina Spielrein Forgotten Pioneer of Psychoanalysis 1st


Edition Coline Covington

https://ebookfinal.com/download/sabina-spielrein-forgotten-pioneer-of-
psychoanalysis-1st-edition-coline-covington/

ebookfinal.com

Mac OS X Lion in depth 2nd ed Edition Robyn Ness

https://ebookfinal.com/download/mac-os-x-lion-in-depth-2nd-ed-edition-
robyn-ness/

ebookfinal.com

Beginning C Through Game Programming 4th Edition Michael


Dawson

https://ebookfinal.com/download/beginning-c-through-game-
programming-4th-edition-michael-dawson/

ebookfinal.com

Beginning Mac OS X Snow Leopard Programming 1st Edition


Michael Trent

https://ebookfinal.com/download/beginning-mac-os-x-snow-leopard-
programming-1st-edition-michael-trent/

ebookfinal.com
Prolog Programming in Depth 1st Edition Michael A.
Covington Digital Instant Download
Author(s): Michael A. Covington, Donald Nute, Andre Vellino
ISBN(s): 9780131386457, 013138645X
Edition: 1
File Details: PDF, 26.18 MB
Language: english
PROLOG PROGRAMMING IN DEPTH

Michael A. Covington
The Uniuersityof Georgia
Athens,Georgia

Donald Nute
The Llniaeisityof Georgia
Athens,Georgia

Andr6 Vellino
Nortel Technologies
Ottawa,Ontario,Canada

PrenticeHall, Upper Saddle Rive{, New Jersey07458


Llbrary of CorgressCataloglrqg.ln-Publlcatlon
Date

Covingtan,Michael A.
Prolog programmingin depth/I,tichael A. Covington,Dondd Nute,
Andre'Vellino.
P. crn.
Includesbibliographical refercncesand index.
ISBN0-13-r38645-X
l. Prolog(Comprterprogramlanguage).L Nute, Dqrald, 1947-
II. Vellino,Andre'. Itr. Title.
Q 76.73.nrc68 1997
005.13'3-4c20 96-tU2
CIP

Acquisitians edilor: Marcla Horton


Production editor: Sharyn Vltrano
Managing editor: Bayenl Mendoza de Leon
Cover designer: Bruce Kenselear
Dircctor of production and manufacturing: Devld V9. Rlccerdl
Manufacturing buyer: Donna Sulllvan
Editorial assistant: Delores Mars

@ lWl by Prentice-Hall,Inc.
Simon& Schuster/AViacom Company
UpperSaddleRiver, NJ 07458

All rights resewed. No part of this book may be


reproduced, in any form or by any meansr
without permission in writing from the publisher.

The aurhor and prblisher of rhis book have used their best efforts in preparing this book. These efforts include the
development, r€search, and testing of the theories and programs to determine their effectiveness. The author and
publisher make no warranty of any kind, expressed or implied, with regard to these programs or the documentation
contained in this book. The author and publisher shall not be liable in any event for incidental or consequential damages
in connectim with, or arising out of, the fumishing, performance, or use of these Prclgrams.

Printed in the United States of America

r098765432r

ISBN 0-1,3-l,3Btr+5-X

Prentice-Hall Intemational (UK) Limited, Lordon


Prentice-Hall of Australia Pty. Limited, Sydney
Prentice-Hall Canada Inc., Toronto
Prentice-Hall Hispanoamericana, S.A., M exico
Prentice-Hall of India Private Limited, New Delhi
Prentice-Hall of lapan, Tnc., To ky o
Simon & Schuster Asia he. l,t:d.,Singapore
Editora Prentice-Hall do Brasil, bda., Rio dc faneiro
Contents

I The Prolog Language


Introducing Prolog t
1 . 1 The Idea of Prolog 1
7 . 2 How Prolog Works 2
1 . 3 Varieties of Prolog 4
7 . 4 A Practical Knowledge Base . 4
1 . 5 Unifi cation and Variable Instantiation 9
7 . 6 Backtracking 10
7 . 7 Prolog Syntax 74
1 . 8 Defining Relations 76
r.9 Conjoined Goals ("And") 18
1.10 Disjoint Goals ("Or") . . 79
1.11 Negative Goals ("Not") 20
7.72 Testing for Equality . 22
1.13 Anonymous Variables 24
7.74 Avoiding Endless Computations 25
1.15 Using the Debuggerto TraceExecution 27
7.76 Stylesof EncodingKnowledge 28
7.77 BibliographicalNotes 30
Constructing Prolog Programs 3L
2.7 Declarativeand ProceduralSemantics .31
2.2 Output: write, nI, display .32
2.3 Computing versusPrinting .34
2.4 Forcing Backtrackingwith f aiI . .34
2.5 Predicatesas Subroutines .J/

2.6 Input of Terms:read .38


21 Manipulating the Knowledge Base .40
2.8 Staticand Dynamic Predicates .42
2.9 More about consult and reconsult .43
2.70 File Handling: see,seen,tell, told .45
2.77 A Program that "Learns" .46
2.72 CharacterInput and Ouput: get, getO,put .48
2.73 ConstructingMenus .51
2.74 A Simple Expert System .54

Data Structuresand Computation 6l


3.1 Arithmetic . .67
3.2 ConsfructingExpressions .63
3.3 PracticalCalculations .65
3.4 Testingfor Instantiation .67
3.5 Lists .69
3.6 Storing Data in Lists .7r
3.7 Recursion .72
3.8 Counting List Elements .74
3.9 Concatenating(Appending) Lists . . .75
3.10 Reversinga List Recursively . .77
3.11 A FasterWay to ReverseLists .78
3.72 CharacterStrings .79
3.13 Inputting a Line as a String or Atom .81
3.74 Structures .83
3.15 The "OccursCheck" .85
3.1.6 ConstructingCoals at Runtime .85
3.77 Data StorageStrategies. .87
3.18 BibliographicalNotes .89

ExpressingProceduralAlgorithms 91.
4.I ProceduralProlog .9r
4.2 Conditional Execution .92
4.3 The "Cut" Operator( !) .94
4.4 Red Cuts and GreenCuts .96
4.5 Where Not to Put Cuts . .97
4.6 Making a Goal DeterministicWithout Cuts .98
4.7 The "If-Then-Else"Structure(->) .99
4.8 Making a Goal Always Succeedor Always Fail .99
4.9 RepetitionThrough Backtracking . . 101
4.10 Recursion . 103
v

4.77 More about RecursiveLoops . 704


4.72 Organizing RecursiveCode . 107
4.13 Why Thil Recursionis Special . 108
4.1,4 Indexing . . 111
4.75 Modularity, Name Conflicts,and Stubs . . . 113
4.76 How to Document Prolog Predicates . 774
4.77 Supplement:SomeHand Computations . 176
4.78 BibliographicalNotes . 727

ReadingData in ForeignFormats 129


5.1 The Problem of Free-FormInput . 729
5.2 Converting Stringsto Atoms and Numbers . 729
5.3 Combining Our Code with Yours . 133
5.4 Validating User Input . 734
5.5 ConstructingMenus . 135
5.6 ReadingFileswith get-byte . . 736
5.7 File Handles (StreamIdentifiers) . 739
5.8 Fixed-LengthFields . 740
5.9 Now \AlhatDo You Do with the Data? . 743
5.10 Comma-DelimitedFields . 743
5.11 Binary Numbers . 744
5.72 Grand Finale: Readinga Lotus Spreadsheet . 748

Prolog as Its Own Metalanguage 153


6.7 Languageand Metalanguage . 153
6.2 Collecting Alternative Solutionsinto a List . . 754
6.3 Using bagof and setof . 756
6.4 Finding the Smallest,Largest,or "Best" Solution . 757
6.5 Intensionaland ExtensionalQueries . 159
6.6 Operator Definitions . 767
6.7 Giving Meaning to Operators . 763
6.8 Prolog in Prolog . 765
6.9 Extending the InferenceEngine . 767
6.70 Personalizingthe User Interface. . 770
6.1.1. BibliographicalNotes . 772
AdvancedTechniques 173
7.7 Structuresas Trees . 773
7.2 Lists as Structures . 175
7.3 How to Searchor ProcessAny Structure . 776
7.4 Internal Representationof Data . 177
7.5 Simulating Arrays in Prolog . . 181
7.6 DifferenceLists . 782
7.7 Quicksort . 183
7.8 Efficiency of Sorting Algorithms . 787
7.9 Mergesort . 789
7.I0 Binary Trees. . 797
vl

7.I7 Tieesort 794


7.12 CustomizedArithmetic: A Replacementfor is t97
7.73 Solving EquationsNumerically . . 198
7.74 BibliographicalNotes 207

u Artificial Intelligence Applications


I Artificial Intelligence and the Searchfor Solutions 207
8.1 and Prolog .
Artificial Intelligence,PuzzLes, . 207
8.2 Through the Maze . 277
8.3 Missionariesand Cannibals . 274
8.4 The TrianglePuzzle . 279
8.5 Coloring a Map . . 224
8.6 Examining Molecules . 227
8.7 ExhaustiveSearch,Intelligent Search,and Heuristics . 234
8.8 Scheduling . 243
8.9 Forward-ChainingandProduction-RuleSystems . 253
8.10 A Simple Forward Chainer . 255
8.11 Production Rulesin Prolog . 256
8.72 BibliographicalNotes . 263

A Simple Expert SystemShell 265


9.7 Expert Systems . 265
9.2 Expert Consultantsand Expert Consulting Systems. . 266
9.3 Partsof an Expert Consulting System. . 267
9.4 Expert SystemShells . 267
9.5 Extending the Power of Prolog . 269
9.6 XSHELL:The Main Program . 279
9.7 Asking about Propertiesin XSHELL . 287
9.8 Asking about Parametersin XSHELL . . 283
9.9 XSHELL"sExplanatoryFacilitY . 286
9.70 CICHLID: A SampleXSHELL Knowledge Base . 289
9.77 A Consultationwith CICHLID . 296
9.72 PAINT: A SampleXSHELL Knowledge Base. . 298
9.13 Developing XSHELL Knowledge Bases . 307
9.74 BibliographicalNotes . 311

L0 An Expert System Shell with Uncertainty 3L3


10.1 Uncertainty, Probability, and Confidence . . 313
70.2 Representingand Computing Confidence or Certainty . 374
10.3 ConfidenceRules . . 316
70.4 The CONMAN InferenceEngine . 318
10.5 Getting Information from the User . 322
10.6 The CONMAN ExplanatoryFacilities . 323
70.7 The Main Program . 325
10.8 CONMAN Knowledge Bases . 336
10.9 No Confidence in "Confidence" . 343
10.10 Bibliographical Notes 344

11 Defeasible Prolog 345


11.1 Nonmonotonic Reasoning and Prolog 345
7I.2 New Syntax for Defeasible Reasoning 346
11.3 StrictRules 348
77.4 IncompatibleConclusions 351
11.5 Superiority of Rules 352
77.6 Specificiry . . 353
777 Defining Strict Derivability in Prolog . 363
11.8 d-Prolog: Preliminaries 365
17.9 Using Defeasible Rules . 366
11.10 Preemptionof Defeaters 368
11.11 DefeasibleQueriesand ExhaustiveResponses 384
77.72 Listing DefeasiblePredicates 385
11.13 Consulting and Reconsultingd-Prolog Files 386
1.7.74The d-Prolog Dictionary 387
11.15 RescindingPredicatesand Knowledge Bases 387
17.76 Finding Contradictions 388
L1.77 A SpecialExplanatoryFacility . 389
11.18 A Suite of Examples 390
17.79 Some Feathered and Nonfeathered Friends 394
77.20 Inheritance Reasoning 395
77.27 Temporal Persistence . 397
77.22 The ElectionExample 407
77.23 d-Prolog and the ClosedWorld errrr*pUon 444
71.24 BibliographicalNotes 405

12 Natural LanguageProcessing 407


72.7 Prolog and Human Languages 407
72.2 Levels of Linguistic Analysis 408
72.3 Tokenization 409
72.4 Template Systems 470
72.5 GenerativeGrammars 416
72.6 A Simple Parser. 419
72.7 Grarirmar Rule (DCG) Notation . 422
72.8 GrammaticalFeatures 425
72.9 Morphology . 428
72.70 Constructing the ParseTiee 437
72.77 Unbounded Movements 433
72.72 SemanticInterpretation 435
72.73 ConstructingRepresentations 448
72.74 Dummy Enfities 450
72.75 BibliographicalNotes 453
vill

A Summary of ISO Prolog 455


A.1 Syntaxof Terms . . 456
A.2 Program Structure . 467
A.3 Control Structures . 463
A.4 Error Handling . 465
A.5 Flags . . 465
A.6 Arithmetic . . 468
A.7 Input and Output . . 469
A.8 Other Built-In Predicates. . 474
A.9 Modules . . 48r

B Some DifferencesBetweenProlog Implementations 485


8.1 Introduction . . 485
8.2 Which Predicatesare Built-In? . . . 486
8.3 Variation In Behaviorof Built-In Predicates . 486
8.4 Control Constructs . 488
B.5 Syntaxand Program Layout . . 490
8.6 Arithmetic . . 491
8.7 Input and Output . . 492
8.8 Definite-ClauseGrammars . 494

Bibliography 497

Index 502
Preface

Prolog is an up-and-comingcomputerlanguage.It has takenits placealongsideLisp


in artificial intelligenceresearch,and industry has adopted it widely for knowledge-
basedsystems.
In this book, we emphasizepracticalProlog progranuning, not just theory. We
present several ready-to-run expert system shells, as well as routines for sorting,
searching,nafural languageprocessing,and evennumerical equation solving.
We also emphasizeinteroperabilitywith other software. For example,Chapter
5 presentstechniquesfor reading Lotus spreadsheetsand other specialfile formats
from within a Prolog program.
There is now an official ISO standard for the Prolog language, and this book
follows it while retaining compatibility with earlier implementations. We summa-
rize the ISO Prolog standard in Appendix A. It is essentiallywhat has been called
"Edinburgh" Prolog. Our programs have been testedunder Quintus Prolog, Arity
Prolog, ALS Prolog, LPA Prolog, and a number of other cornmercial implementa-
tions, as well as freeware Prologs from ESL and SWI. (We do not cover Turbo IPDCI
Prolog, nor Colmerauer'sProlog II and III, which are distinctly different languages.)
An earlierversion of this book was publishedby Scott,Foresmanin7987. Since
then, we have used the book in our own coursesevery year,and the presentversion
reflectsnumerous refinementsbased on actual classroomexperience. We want to
thank all our studentsand colleagueswho made suggestions,especiallyDon Potter,
Harold Dale, Iudy Guinan, Stephen McSweeney,Xun Shao, Joerg zeppen, joerg
Grau, JasonPrickett, Ron Rouhani, Ningyu Chen, FengChen, |on Ha-nnliruand Mario
Nakazawa. We thank Melody Covington for her diligent work with the typesetting.
\A/hennecessary,Chapter 7 canbe skipped sincethe remainder of the book does
not rely on it. Those who are not preparing for work in the software industry may
take Chapter 5 somewhat lightly or skip it altogether. A Prolog language course for
experiencedAI progranunersshould cover ChaptersI-7 and 12 but may place less
emphasison the basicAI topics in Chapters8-11.
The programs and data files from this book are available by anonymous FTP
from ai.uga.edu. From the same FTP site you can also obtain freeware Prolog
compilers and demonstrationsof commercialproducts.
We are always interested in hearing from readers who have questions or sug-
gestions for improvement.

MichaelA. Coaington
DonaldNute
TheUniaersityof Georgia

Andr6 VeIIino
NortelTechnologies
Part I

The PrologLanguage
Chapter L

Introducing Prolog

1.1.THE IDEAOF PROLOG

Until recently, progranuning a computer meant giving it a list of things to do, step
by step, in order to solve a problem. In Prolog, this is no longer the case.A Prolog
program can consistof a set of factstogetherwith a setof conditions that the solution
must satisfy;the computer can figure out for itself how to deducethe solution from
the facts given.
This is called LOGICPROGRAMMING. Prolog is basedon formal logic in the same
way that FORTRAN, BASIC, and similar languagesare based on arithmetic and
simple algebra.Prologsolvesproblemsby applying techniquesoriginally developed
to prove theoremsin logic.
Prolog is a very versatile language. We want to emphasizethroughout this
book Prologcan implementaII kinds of algorithms,not just those uthichit was
1,hat for
speciallydesigned.Using Prolog does not tie you to any specific algorithm, flow of
control, or file format. That is, Prolog is no /esspowerful than Paical, C, or C+-u
in many respectsit is morepowerful. Whether Prolog is the best language for your
PurPoseswill depend on the kind of job you want it to do, and we will do ourbest
to equip you to judge for yourself.
Prolog was invented by Alain Colmerauer and his colleaguesat the University
of Aix-Marseille, in Marseilles, France,n 7972. The name rtands for programming
in Today Prolog is used mainly for artificial intelligence applications, espe-
f9Src.
cially automated reasoning systems. Prolog was the language chbien for the Fifth
GenerationProject,the billion-dollar program initiated Uy tne lapanesegovernment
lntroducihgProlog Chap. 1

in 1982to createa new generationof knowledge-basedcomprlters. Commercially,


Prolog is often used in expert systems,automatedhelpdesks,iltelligent databases,
and natural languageprocessingPrograms.
Prolog has much in common with Lisp, the language trpditionally used for
artificial intelligence research. Both languagesmake it easy to perform complex
computationson complex data, and both have the power to expressalgorithms ele-
gantly. Both Lisp and Prolog allocatememory dynamically, so that the Progranuner
does not have to declare the size of data structures before creating them. Both lan-
guagesallow the program to examineand modify itself; thus, a frogram can "Iearn"
from information obtained at run time.
The main differenceis that Prolog has an automated rea$oningprocedure -
an INFERENCE ENGINE - built into it, while Lisp doesnot. As a rbsult, programs that
perform logical reasoningaremuch easierto write in Prolog tharl in Lisp. If the built-
in inference engine is not suitable for a particular problem, the Prolog progranuner
can usually use part of the built-in mechanismwhile rewriting the rest. In Lisp, on
the other hand, if an inferenceengineis needed,the programmdr must supply it.
Is Prolog "object-oriented"?Not exactly.Prolog is a different, newer,and more
versatile solution to the problem that objectorientation was de$ignedto solve. It is
quite possibleto organizea Prolog program in an object-orientedway' but in Prolog,
that's not the only option availableto you. Prolog lets you talk {bout propertiesand
relations directly, rather than approaching them indirectly thrbugh an inheritance
mechanism.

I . 2 . H O W P R O L O GW O R K S

Prolog derives its power from a PROCEDURAL INTERPRETATION dp t-OCtC- that is, it
representsknowl"dgu in terms of procedure definitions, and.reasoning becomes a
simple processof calling the right procedures.To seehow this works, consider the
following two piecesof information:
States.
11] For any x, if x is in Georgia,then x is in the United
t2l Atlantais in Georgia'
We will call a collection of information such as this a KNOWLEDGE BASE.We will call
item [1] a nur-pbecauseit enablesus to infer one piece of inforn[ation from another,
and we will call item [2] a reCrbecause it does not depend on anlyother information.
Note that a rule contains an "if" antda fact does not. Facts a{rd rules are the two
types of clnusrs.
A fact need.not be a true statementabout the real world; if you said Minneapolis
was in Florida, prolog would believe you. Facts are someti[nescalled GROUND
SLAUSES becausethey are the basis from which other informatipn is inferred.
Supposewe want to know whether Atlanta is in the UnitNd States.Clearly, [1)
and [2] *1 U" chained together to answer this question,but how should this chaining
be implemented o. u.oir,puter? The key is to express[1] and [2] as definitions of
procedures:
Sec.1.2. HowPrologWorks

[1'] Toprovethatx is in the UnitedStates,provethatx is in Georgia.


l)tl
t-l ToprovethatAtlantais in Georgia,
do nothing.
We ask our question by issuing the instruction:
Provethat Atlantais in the UnitedStates.
This callsprocedure[1'], which in turn callsprocedure[2'], which returns the answer
"yes."
Prolog has its own notation for representing knowledge. Our sample knowl-
edgebasecan be representedin Prolog as follows:
in-united_states(X) :- in_georgia(X).
in-georgia(atlanta) .

Here in-georgia and in-united-states are PREDICATES- that is, they say things
about individuals. A predicatecan take any fixed number of aRcuvENTS(parame-
ters);for example,
female (sharon) .
might mean "Sharon is female," arrd
mother (nelody, sharon) .

might mean "Melody is the mother of Sharon." A predicate that takes I,I arguments
(for any number l/) is called an I/-pLecE rREDTcATE; thus we say that in_leorgia,
in-rrnited-states, and female are ONE-PLACEPREDICATES, while mother is a two-
PLACEPREDICATE.A one-place predicate describes a pRopERTyof one individual; a
two-place predicate describes a RELATIoNbetween two individuals.
The number of arguments that a predicate takes is called its ARITv (from terms
lTke unary, binary, ternary, and the like). TWo distinct predicates can have the same
name if they have different arities; thus you might have both mother(melody),
meaning Melody is a mother, and mother(nelody, sharon), meaning Melody is the
mother of Sharon. We will avoid this practice because it can lead to confusion.
In some contexts a predicate is identified by giving its name, a slash, and
its arity; thus we can refer to the two predicates just mentioned as mother/L and
mother /2.

Exercise1.2.L
Give an example, in Prolog, of. a fact, a rule, a clause,a one-placepredicate, and a
predicateof arity 2.

Exercise1".2.2
Lnthe previous example,we represented"in Georgia" as a property of Atlanta. Write a
Prolog fact that represents"in" as a relation betweenAthnla and Georgia.

ExerciseL.2.3
How would you represent, in Prolog, the fact "Atlanta is at latitude 34 north and
longitude 84 west"? (Hint: More than one approachis possible. Secondhint: It is OK
to use numbers as constantsin prolog.)
4 IntroducingProlog Chap. 1

1 . 3 . V A R I E T I E SO F P R O L O G

An important goal of this book is to teach you how to write portable Prolog code.
Accordingly,we will stick to featuresof the languagethat are the samein practically
all implementations. The programs in this book were developed in Arity Prolog and
ALS Prolog on IBM PCs and Quintus Prolog on Sun workstations. Most of them
have also been testedin SWI Prolog,LPA Prolog,Cogent (Amzi) Prolog, and Expert
SystemsLimited's Public Domain Prolog-2.1
For many years,the de factostandardfor Prologwas the languagedescribedby
Clocksin and Mellish in their popular textbook,Programmingin Prolog(1981,second
edition '1984).This is essentiallythe languageimplemented on the DEC-10by D.
H. D. Warren and his colleaguesin the late 1970s,and is often called "Edinburgh
Prolog" or "DEC-10Prolog." Most corunercial implementationsof Prolog aim to be
compatiblewith it.
In 1995the International Organizationfor Standardization(ISO)published an
international standard for the Prolog language (Scowen1995). ISO Prolog is very
similar to Edinburgh Prolog but extendsit in someways. Our aim in this book is to
be ascompatiblewith the ISO standardaspossible,but without using featuresof ISO
Prolog that are not yet widely implemented. SeeAppendix A for more information
about ISO Prolog.
Finally, we must warn you that this book is not about Turbo Prolog (PDC
Prolog), nor about Colmerauer's Prolog II and Prolog III. Turbo Prolog is Prolog
with data type declarationsadded. As a result, programs run fasterbut are largely
unable to examine and modify themselves. Colmerauer's Prolog II and III are
CONSTRAINT LOGICPROGRAMMING languages,which means they let you put limits
on the value of a variable before actually giving it a value; this makes many new
techniquesavailable. The conceptsin this book are certainly relevant to Turbo (PDC)
Prolog and Prolog II and III, but the details of the languagesare different.
L.3.1
Exercise
If you havenot doneso already,familiarizeyourselfwith the manualsfor the version
of Prolog that you will be using.

ExerciseL.3.2
'?- beJ,p.' do anything useful? Try it
In the Prolog that you are using, does the query
and see.

1.4. A PRACTICAL KNOWLEDGE BASE

Figure 1.1 shows a Prolog knowledge base that describes the locations of certain
North American cities. It defines a single relation, called located-in, which relates
a city to a larger geographical unit. The knowledge base consists of facts such as
lUsers of ESL Public Domain Prolog-2 must select Edinburgh-compatible syntax by adding the
line ': - stat€ (token-class , -,dec1O).' at the beginningof every Program.Note that ESL Prolog-2has
nothing to do with Colmerauer'sPrologII.
Sec. 1.4. A PracticalKnowledgeBase

% File GEO.PL
% Sarnple geographical knouledge base

/* Clause t */ located-in(atl-anta,georgia).
/* Cl.a:use2 */ located-in(houston,texas).
/* Clause 3 */ located-in(austin,texas).
/* Clause 4 */ Iocated-in(toronto,ontario).
/* Cfause 5 */ locat€d-in(I,usa) :- locat€d-in(I,georgia).
/* Clause 6 */ Located-in(I,usa) :- located-in(I,texas).
/* C].aase 7 */ located-ia(I,canada) :- located-in(I,ontario).
/* Clause 8 */ located-in(X,north-anerica) :- located-in(I,usa).
/* Clause 9 */ Iocated-in(I,north-arnerica) :- located-in(I,canada).

Figure 1.1 A simplePrologknowledgebase.

"Atlanta is located in Georgia," "Hotston is located in Texas," and the like, plus
rules such as "X is located in the United States if X is located in Georgia."
Notice that names of individuals, as well as the predicate located-in, always
begin with lowercase letters. Names that begin with capital letters are variables and
can be given any value needed to carry out the computation. This knowledge base
contains only one variable, called X. Any name can contain the underscore character
( _) .
Notice also that there are two ways to delimit comments. Anything bracketed
by /* and */ is a comment; so is anything between 7. and the end of the line, like
this:

/* This is a comment */
7. So is this

Comments are ignored by the computer; we use them to add explanatory information
and (in this case) to number the clauses so we can talk about them conveniently.
It is not clear whether to call this knowledge base aprogram; it contains nothing
that will actually cause computation to start. Instead, the user loads the knowledge
base into the computer and then starts computation by typing a QUERY,which is a
question that you want the computer to answer. A query is also called a GOAL. It
looks like a Prolog clause except that it is preceded by t?-' - although in most cases
the Prolog implementation supplies the'?-'and you need only type the goal itself.
Unfortunately, we cannot tell you how to use Prolog on your computerbecause
there is considerable variation from one implementation to another. In general,
though, the procedure is as follows. First use a text editor to create a file of clauses
such as GEO.PL in Figure 1. Then get into the Prolog interpreter and type the special
query:

?- consult('geo.pI').

(Remember the period at the end - if you don't type it, Prolog will assume your
query continues onto the next line.) Prolog replies
Introducing
Prolog Chap.1

y es

to indicate that it succeeded in loading the knowledge base.


TWo important notes: First, if you want to load the same program again
after escaping to an editor, use reconsult instead of consult. That way you
won't get two copies of it in memory at the same time. Second, if you're using
aPC, note that backslashes (\) in the file name may have to be written twice (".9.,
consult ( 'c : \\nyprog. pl' ) to load C:\MYPROG.PL). This is required in the ISO
standard but not in most of the MS-DOS Prologs that we have worked with.
As soon as consult has done its work, you can type your queries. Eventually,
you'll be through using Prolog, and you can exit from the Prolog system by typing
the special query

?- ha1t .

Most queries, however, retrieve information from the knowledge base. You can type

?- located-in(atlanta,georgia) .

to ask whether Atlanta is in Georgia. Of course it is; this query matches Clause 1
exactly, so Prolog again replies "yes." Similarly, the query

?- located-in(atlanta,usa) .

can be answered (or, in Prolog jargon, SoLVEDor SATISFIED) by calling Clause 5 and
1, it,
then Clause so too, gets a"yes." On the other hand, the query

?- loc at ed -i n (a tl a n ta rte x a s ) .

gets a "no" because the knowledge base contains no information from which the
existence of an Atlanta in Texas can be deduced.
We say that a query SUCCEEDS if it gets a "yes" answer, or FAILSif it gets a "r1o"
answer.
Besides answering yes or no to specific queries, Prolog can filIin the blanks in
a query that contains variables. For example, the query

?- loc at ed -i n (X,te x a s ) .

means "Give me a value of X such that in(X,texas) succeeds."


Here we run into another unique feature of Prolog - a single query can have
multiple solutions. Both Houston and Austin are in Texas. What happens in this
case is that Prolog finds one solution and then asks you whether to look for another.
This continues until all alternatives are found or you stop asking for them. In some
Prologs, the process looks like this:

?- loc at e d -i n (X ,te x a s ) .
X = houston
Hore $ /il? y
X = austin
(y/n)?y
I:'"
Sec.1.4. A Practical
Knowledge
Base

The "no" at the end means there are no tnoresolutions.


In Arity Prolog, the notation is more concise.After eachsolution, the computer
displays an arrow (->). You respondby typing a semicolon(meaninglook for more
alternatives) or by hitting Return (meaning quit), like this:
?- located-in(I,texas) .
X = houston -) ;

Xo= "ottto
In Quintus Prolog and many others, there isn't even an arrow; the computer just
pausesand waits for you to type a semicolon and then hit Return, or elsehit Return
bv itself:
?- located-in(I,texas).
x = houston i
x = austin ;
no
Also, you'll find ithard to predictwhether the computerpausesafter the lastsolution;
it dependspartly on the way the user interfaceis written, and partly on exactlywhat
you have queried. From here on, we will present interactions like theseby printing
only the solutions themselvesand leaving out whatever the user had to type to get
the alternatives.
Sometimesyour Prolog system may not let you ask for alternatives Oy typing
semicolons,or whatever) even though alternativesolutions do exist. There are two
possiblereasons.First, if your query hasperformed any output of its own, the Prolog
systemwill assumethat you've alreadyprinted out whateveryou wanted to see,and
thus that you're not going to want to search for alternatives interactively. So, for
example,the query
?- Iocated_in(X,texas), write(X) .
displays only one answer even though, logically, there are alternatives. Second, if
your query contains no variables, Prolog will only print "yes" once no matter how
many ways of satisfying the query there actually are.
Regardless of how your Prolog system acts, here's a sure-fire way to get a list
of all the cities in Texas that the knowledge base knows about:
?- located_in(X,texas), write(I), Dl, fai1.
The special predicate write causes each value of X to be written oug nI starts a new
line after each value is written; and f ail forces the computer to backtrack to find all
solutions' We will explain how this works in Chap ter 2. For now, take it on faith.
We say that the predicate located.-in is NoNDETERMTNISTTc because the same
question can yield more than one answer. The term "nondeterministic" does not
mean that computers are unPredictable or that th"y have free will, but only that they
can produce more than one solution to a single problem.
Another important characteristic of Prolog is that any of the arguments of
a predicate can be queried. Prolog can either compute the state frorn-the city or
compute the city from the state. Thus, the query
I Prolog Chap.1
Introducing

?- located-in(austin,X) .

retrieves the names of regions that contain Austin, and

?- located-in(X,texas) .

retrieves the names of cities that are in Texas.We will call this feature REVERSIBILITY
or INTERCHANGEABILITY OFUNKNOWNS. In many - but not all - Situations,Prolog
can fill in any argument of a predicateby searchingthe knowledge base.In Chapter
3 we will encountersomecaseswhere this is not so.
We can even query all the argurnentsof a predicate at once. The query
?- located-in(I,Y).

means "What is in what?" andeach answer contains values forboth X and Y (Atlanta
is in Georgia, Houston is in Texas, Austin is in Texas, Toronto is in Ontario, Atlanta is
in the U.S.A., Houston is in the U.S.A., Austin is in the U.S.A., Toronto is in Canada,
and so forth). On the other hand,

?- located-in(X,X).

means "What is in itself?" and fails - both occurrences of X have to have the same
value, and there is no value of X that can successfully occur in both positions at the
same time. If we were to add New York to the knowledge base, this query could
succeed because the city has the same name as the state containing it.

Exercise1.4.L
Load GEO.PL into your Prolog system and try it out. How does your Prolog system
respond to eachof the following queries?Give all responsesif there is more than one.
?- located-in(austinrtexas) .
?- located-in(austin, georgia) .
?- located-in(llhat,texas) .
?- located-in(atlanta,l{hat) .

Exercise1.4.2
Add your home town and state (or region) and country to GEO.PL and demonstrate
that the modified version works correctly'

Exercise1,.4.3
'?- located-in(teras,usa) .'? \A/hy?
How doesGEO.PLrespondto the query

Exercise1.4.4 (for PC usersonly)


in file namesto be written double? That is, to load
Doesyour Prologrequirebackslashes
C:\MYDIRIWPnO-C.PL, do you have to type consult (' c : \\nydir\\nyprog -pl' ) ?
Trv it and see.
Sec. 1.5. Unificationand VariableInstantiation

1 . 5 . U N I F I C A T I O NA N D V A R I A B L EI N S T A N T I A T I O N

The first step in solving any query is to match - or UNIFv- the query with a fact
or with the left-hand side (the Hsao) of a rule. Unification can assign a value to a
variable in order to achieve a match; we refer to this as INSTANTIATINGthe variable.
For example, the query
?- located-in(austin, north_anerica) .
unifies with the head of Clause 8 by instantiating X as austin. The right-hand side
of Clause8 then becomesthe new goal. Thus:
Goal: ?- Iocated-in(austin,north_arnerica).
Clause 8: located-in(X,north-america) : - located_in(X,usa) .
Instantiation: X = austin
New goal: ?- located_in(austin,usa).

We can then unify the new query with Clause 6:


G oal: ? - l o c a te d _ i n (a u s ti n ,u s a ).
Claus e 6: l o c a te d _ i n (X,u s a ) : - l o cated_i n(X ,texas) .
Instantiation: X = austin
New query: ?- Iocated_in(austin,texas) .
This query matches Clause 3. Since Clause 3 does not contain an "if ," no new query
is generated and the process terminates successfully. lf, at some point, we had had
a query that would not unify with any clause, the process would terminate with
failure.
Notice that we have to instantiate X two times, once when we call Clause 8
and once again when we call Clause 6. Although called by the same name, the X in
Clause 8 is not the same as the X in Clause 6. There is a general principle at work
here:
Like-namedaariablesare not the same aariable unless therl occur in the same
clauseor the samequery.
In fact, if we were to use Clause 8 twice, the value given to I the first time would
not affect the value of x the second time. Each instantiation applies only to one
clause and only to one invocation of that clause. However, it does apply to all of the
occurrences of that variable in that clause; when we instantiate X, all the lt's in the
clause take on the same value at once.
If you've never used a language other than Prolog, you're probably thinking
that this is obvious, and wondering why we made such a point of it; Prolog couldn't
possibly work any other way. If you're accustomed to a conventional hnjuage, we
want to make sure that you don't think of instantiation as storinga value in i vaiiable.
Instantiation is more like passingfr parameter. Suppose you have a Pascal procedure
such as this:
pr oc edur e p( x :i n te g e r); { Ttri s i s pascal , not prol og! }
begin
writeln(tThe answer is ,,x)
e nd;
10 Introducing
Prolog Chap.1

If you call this with the statement

p(3)

you are passing 3 to procedure p as a parameter. The variable x in the procedure is


instantiated as 3 but only for the duration of this invocation of p. It would not be
correct to think of the value 3 as being "stored" in a location called x; as soon as the
procedure terminates, it is gone.
One uninstantiated variable can even be unified with another. When this hap-
pens, the two variables are said to SHARE,which means that they become alternative
names for a single variable, and if one of them is subsequently given a value, the
other one will liarre the same value at the same time. tnis situition is relatively
uncoffunon, but there are programs in which it plays a crucial role. We will discuss
unification and instantiation at greater length in Chapter 3.

Exercise1.5.1,
What would happen to GEO.PLif Clauses5 and 6 were changedto the following?
located-in(Y,usa) :- located-in(Y,georgia).
located-in(Z,usa) :- Iocated-in(Z,texas) .

Exercise1.5.2
Disregardingthe wisdom of this section,a beginning Prolog student loads GEO.PLand
has the following dialogue with the computer:
?- located-in(austin,I) .
I = texas
?- write(X).
X is rurinstantiated
't€xas'
Why didn't the computer print the second time? Try this on your computer.
What does your computer print when you try to write out an uninstantiated variable?

1.6. BACKTRACKING

If several rules can unify with a query, how does Prolog know which one to use?
After all, if we unify

?- loc at ed -i n (a u s ti n ,u s a ) .

with Clause 5, we generate

? - located-in(austin, georgia) .

which fails. However, if we use Clause 6, we generate

?- I oc at ed -i n (a u s ti n , te x a s ) .

which succeeds. From the viewpoint of our query, Clause 5 is a blind alley that does
not lead to a solution.
The answer is that Prolog does not know in advance which clause will succeed,
but it does know how toback out of blind alleys. This process is called BACKTRACKING.
Sec. 1.6. Backtracking 11

Prolog tries the rules in the order in which they are given in the knowledge base.
If a rule does not lead to success,it backs up and tries another. Thus, th-. q,r"ry
'?- located-in(austin,usa) .'will
first try to unify with Clause5 and then,when
that fails, the computer will back up and try Clause 6.
A good way to conceive of backtracking is to arrange all possible paths of
computation into a tree. Considerthe query:
?- located-in (toronto , north_america) .

Figure 1.2 shows, in tree form, all the paths that the computation might follow. We
can Prove that Toronto is in North America if we can prove that it is in either the
U.S.A.or Canada. If we try the U.S.A.,we have to try severalstates;fortunately,we
only know about one Canadian province. Almost all of the paths are blind alleys,
and only the rightmost one leads to a successfulsolution.
Figure 1.3is the samediagram with arrows added to show the order in which
the possibilities are tried. Whenever the computer finds that it has gone down a
blind alley, it backs up to the most recent query for which there are still untried
alternatives,and tries anotherpath. Rememberthis principle:
Backtracking
alwaysgoesbackto themostrecentuntriedalternatiae.
When a successfulanswer is found, the processstops, unless, of course, the user
asks for alternatives, in which casethe computer continues backtracking to look for
another successfulpath.
This strategyof searchinga treeis called DEnrH-FIRST
sEARCH becauseit involves
going as far along eachpath as possiblebeforebacking up and trying another path.
Depth-first search is a powerful algorithm for solving almost any problem that
involves trying alternative combinations. Programs based on depth-first searchare
easyto write in Prolog.
Note that, if we use only the featuresof Prolog discussedso far, any Prolog
query gives the sameanswersregardlessof the order in which the rules and facts are
stated in the knowledge base. Rearranging the knowledge base affects the order in
which alternative solutions are found, aswell as the number of blind alleys that must
be tried beforefinding a successfulsolution,but it doesnot affectthe actual answers
given. This is one of the most striking differencesbetween Prolog and conventional
progranuning languages.
ExerciseL.6.L
Make a diagram like Figure 1.3showing how GEo.pL handlesthe query
'?-
located_in(austinrnorth_america) .,

Exercise1.5.2
with GEO.PL,which is fasterto compute,
'?- located_in(attantarusa)
.' or' ?- located._in(austin,usa).,? Why?

ExerciseL.5.3
Without using the computer, predict the order in which the Prolog system will find
the various solutionsto the query '?- located,-in(I,usa) .' Then .tiu itr" computer to
verify your prediction.
t2 Introducing
Prolog Chap.1

Clause 8 Clause9
I I
?- located_in(toronto,usa). ?- located_in(toronto,canada).

Clause5 Clause 6 Clause7


I I I
(toronto,ontario).
?- located_in(toronto,georgia). ?- located_in(toronto,texas). ?- located_in

No match. No match. Clause 4


Back up. Back up.

'€;:.Tsiln
alongoneof thesepaths.
to thequeryliessomewhere
Figure1.2 Thesolution
Sec.1.6. Backtracking

?- located_in(toronto,north_america).

Clause8 Clause9
*l *l
?- located_in(toronto,usa). (toronto,canada).
?- located_in

Clause 5 Clause6 Clause 7


il *l *l
?- located_in(toronto,georgia). ?- located_in(toronto,texas). ?- located_in
(toronto,ontario).

No match. No match. Clause 4


Back up. Back up,

Exactmatch.
Success!

Figure 1.3 Thecomputer thepathsin thisorder.


searches
t4 Introducing
Prolog Chap.1

I.7. PROLOG
SYNTAX

The fundamental units of Prolog syntax are atoms, numbers, strucfures, and vari-
ables. Wewill discussnumbers and structuresfurther in Chapter 3. Atoms, numbers,
strucfures, and variables together are known as TERMS.
Atoms are used as names of individuals and predicates. An atom normally
begins with a lowercase letter and can contain letters, digits, and the underscore
mark (-). The following are examplesof atoms:
x
georSr.a
ax123aBCD
ab c d- x - and- y- a- 1ong- exanpl e

If an atom is enclosed in single quotes, it can contain any characters whatsoever,


but there are two points to note. First, a quote occurring within single quotes is
normally written double. Second, in some implementations, a backslash within an
atom has special significance; for details see Appendix A and your manual. Thus,
the following are also atoms:
' F lor idat
ta very long atom with blanks in it'
, 1 2 $ 1 2 $'
ra,
'don"t worry'
' bac k \ \ s lash e s '

' ' is an atom (the empty


In fact, ,32, is an atom, not equal to the number 32. Even
atom), although it is rarely used.
Atoms composed entirely of certain special characters do not have to be written
between quotes; for example,'-->' (without quotes) is a legitimate atom. (We will
explore this feature further in Chapter 5.) There is usually no limit on the length of
an atom, with or without quotes, but check the manual for your implementation to
be sure.
A structure normally consists of an atom, an opening parenthesis, one or more
arguments separated by conunas, and a closing parenthesis. However, an atom by
itsef is, strictly speaking, a structure with no arguments. All of the following are
structures:

a(b, c ,d)
located-in (atlanta, texas )
located-in (X , georgia)
mother-of ( cathy, nelody)
t a W e i r d ! ? ! A t o m '( x x x , y l y , z z z )
i-have-no-argu.ments
Sec. 1.7. PrologSyntax 15

The atom at the beginning is called the FUNCToR of the structure. (If some of the
arguments are also structures,then the functor at the beginning of the whole thing is
called the pnnvclpAl FUNCTOR.) So far we have used structures only in queries, facts,
and rules. In all of these,the functor signified the name of a predicate. Functors
have other usesthat we will meet in Chapter 3.
Actually, even a complete rule is a structure; the rule
a(x) :- b(x).
could equally well be written
: - ( a ( X ), b ( x )) .

or possibly,in someimplementations,
, : - , ( a ( X ), b ( x )) .

The functor ': -' is called an INFIXOPERATOR becauseit is normally written between
its arguments rather than in front of them. In Chapter 6 we will seehow to create
other functors with this special feature.
Variablesbegin with capital lettersor the underscore mark, like these:
A Result Which_Ever
-howdy _L2345 Xx

A variable name can contain letters, digits, and underscores.


Prolog knowledge bases are written in free format. That is, you are free to insert
spaces or begin a new line at any point, with two restrictions: You cannot break up
an atom or a variable name, and you cannot put anything between a functor and the
opening parenthesis that introduces its arguments. That is, in place of

located_in (at tanta, georgia) .

you are welcome to write

loc at ed- in( a tl a n ta ,


georgia ).

but not
located_in (at lanta,georgia) '/, tvo syntax
errors !
Most implementationsof Prologrequireall the clausesfor a particular predicate
-
to be grouped togetherin the file from which the clausesare loaded. That is, you can
say
mother (neIody, cathy) .
mother (eleanor, melody) .
f ather (urichael, cathy) .
f ather ( j im,melody) .

but not
16 Introducing
Prolog Chap.1

mother(melody,cathy) , f, wrong!
f ather (michael, cathy) .
mother (eleanor, nelody) .
f ather ( j im,melody) .

The results of violating this rule are up to the implementor. Many Prologs do
not object at all. Quintus Prolog gives warning messages,but loads all the clauses
properly. A few Prologsignore someof the clauseswith no warning. SeeAppendices
A and B for more information about discontiguoussetsof clauses.
Exercise L.7.1

Identify each of these as an atom, number, structure, variable, or not a legal term:
asdfasdf 234 f(a,b) -on
I(y,z) in-out- 'I' (II) 'I'

Exercise L.7.2

What are the two syntax errors in the following?

Iocated-in (at lanta,georgia).

Exercise 1,.7.3

What does your Prolog system do if the clauses for a predicate are not grouped together?
Does it give an error or warning message? Does it ignore any of the clauses? Experiment
and see.

1 . 8 . D E F I N I N GR E L A T I O N S

The file FAMILY.PL (Figure 1.4) contains some information about the family of one of
the authors. It states facts in terms of the relations mother and father, each of which
links two individuals. In each paLr,we have decided to list the parent first and the
son or daughter second.
FAMILY.PL can answer queries such as "Who is Cathy's mother?" -

?- mother(X,cathy).
X = melody

or "Who is Hazel the mother of?" -

?- mother(hazel,A).
A = michael
g = 5ulie

More importantly, we can define other relations in terms of the ones already defined'
For example, let's define "parent." A parent of X is the father or mother of X. Since
there are two ways to be a parent, two rules are needed:

parent(X,Y) :- father(X,Y) .
p a r e n t ( X , Y ) : - m o t h e r ( X , Y ).
Sec.1.8. Defining
Relations t7

7. File FAMfLY.PL
% part of a fanily tree erpressed iu Prolog

7. In father/2, motber/2, and parent/2,


% first arg. is parent and second arg. is child.

father (nichael, cathy) .


father (nichael, sharon) .
f ather ( charles-gordon,nichael) .
father (charles-gordon, julie) .
father (charles , charles-gordon) .
father(jim,melody) .
father (j im, crystal) .
father (elno, j im) .
f ather (greg, stephanie) .
father (greg, danielle) .

mother (neJ-ody, cathy) .


mother (nelody, sharon) .
mother (hazel, michael) .
mother(hazeI, julie) .
mother (elea.rror, meJ.ody) .
mother (eleaqor, crystal) .
mother (crystal, stephanrie) .
nother ( crystal, danielle) .

par€nt(X,Y) :- father(X,Y) .
parent(X,Y) :- mother(I,Y) .

Figure 1.4 Partof a familytree in Prolog.


18 Prolog Chap.1
Introducing

Thesetwo rules are alternatives. The computer will try one of them and then, if it
doesn't work or if alternative solutions are requested,back up and try the other. If
we ask
?- parent(X,nichael).

we get X=charles-gordon, using the first definition of "parent," artd then X=hazel,
using the second definition.

Exercise 1".8.1-

Make a diagram like Figure 1.3 showing how Prolog answers the query
?- parent (I,danieI1e) .
using FAMILY.PL as the knowledge base.

Exercise L.8.2

Make a modified copy of FAMILY.PL using information about your own family. Make
sure that queries to mother, f ather, and parent are answered correctly.

1 . 9 . C O N J O I N E DG O A L S( " A N D " )

We can even ask Prolog to satisfy two goals at once. Supposewe want to know the
name of Michael's paternal grandfather.That is, we want to find out who Michael's
father is, and then find out the name of that person's father. We can exPressthis as:
?- father(F,michae1), father(G,F) .
P = charles-gordon G = charles

In English: "Find F and G such that F is the father of Michael and G is the father of
F." The computer's task is to find a single set of variable instantiations that satisfies
both parts of this compound goal. It first solves f ather(F,michael), instantiating F
to charles-gordon, and then solves f ather (G, charles-gordon), instantiating G to
charles. This is consistent with what we said earlier about variable instantiations
because F and G occur in the same invocation of the same clause.
We will get exactly the same answer if we state the subgoals in the opposite
order:

?- father(G,F), father(F,nichael) .
F = charles-gordon G = charles

In fact, this is intuitively easier to follow because G,F, and nichael are mentioned in
chronological order. However, it slows down the computation. In the first subgoal,
G and f are both uninstantiated, so the computer can instantiate them by using any
clause that says someone is someone's father. On the first try, it uses the very first
clause in the knowledge base, which instantiates G to nichael and F to cathy. Then
it gets to the second subgoal and discovers that Cathy is not Michael's father, so it
hai to back up. Eventually, it gets to father(charles-gordon,charles) and can
proceed.
Goals("Or")
Sec.1.10. Disjoint 19

The way we originally stated the query, there was much less backtracking be-
causethe computer had to find the father of Michael before proceeding to the second
subgoal. It pays to think about the searchorder as well as the logical correcbressof
Prolog expressions.We will return to this point in Chapter 4.
We can use compound goals in rules, as in the following definition of "grand-
father":
grandfather(G,C) :- father(F,C), father(G,F) .
grandfather(G,C) :- mother(M,C), father(G,M) .

The comma is pronounced " and" - in fact, there have been Prolog implementations
that write it as an ampersand(&).
Exercise
1.9.1
Add the predicates grandf ather, grandmother, and grandparent to FAMILY.PL. (Hint:
You will find parent useful.) Verify that your new predicates work correctly.

1 . 1 0 . D | S J O I N TG O A T S( " O R " )

Prolog alsoprovides a semicolon,meaning"or," but we do not recofiunendthat you


use it very much. The definition of parent in FAMILY.PLcould be written as a single
rule:
parent (X, Y) : - f ather (1(,Y) ; mother (X, Y) .

However, the normal way to express an "or" relation in Prolog is to state two rules,
not one rule with a semicolon in it. The semicolon adds little or no expressive
Power to the language, and it looks so much like the conuna that it often leads to
typographical errors. In some Prologs you cem use a vertical bar, 'l', ifl place of a
semicolon; this reduces the risk of misreading.
If you do use semicolons, we advocate that you use parentheses and/or dis-
tinctive indentation to make it crystal clear that they are not conunas. If there are no
parentheses to indicate otherwise, the semicolon has wider scope than the comma.
For example,

f(x) :- a(X), b(X); c(X), d(X).

is equivalent to

f(x) :- (a(x), u(X)); (c(x), d(x)).


and means,"To satisfyf (x), find an X that satisfieseithera(x) and b(x), or else
c (I) and d(x)." The parentheses make it easier to understand. O'Keefe (1990:101)
reconunends that, instead, you should write:

f(x) :- ( a(X), b(x)


t c (X) , d(x)
).
20 Prolog Chap.1
Introducing

to make the disjunction really prominent. In his style, the parentheses call attention
to the disjunction itself, and the scope of the ands and ors is represented by rows and
columns. But as a rule of thumb, we recommend that instead of mixing semicolons
and commas together in a single predicate definition, /ou should usually break up
the complex predicate into simpler ones.

Exercise1.10.1
Go back to GEO.PLand add the predicateeastern/l, defined as follows: A place is
easternif it is in Georgiaor in Ontario. Implement this predicatetwo different ways:
first with a semicolon,and then without using the semicolon.

Exercise1.10.2
Define a predicateequivalentto
f(x) :- (a(x), b(I)); (c(x), d(x)).
but without using semicolons.Use as many clausesas necessary.

1.11. NEGATIVE GOALS ("NOT")

The special predicate \+ is pronounced "not" or "cannot-prove" and takes any goal
as its argument. (In earlier Prologs, \+ was written not; \+ is a typewritten rePresen-
tation of V, which means "not provable" in formal logic.)
If g is any goal, then \+ g succeedsif g fails, and fails if g succeeds. For instance:

?- father(michael, cathY) .
yes
?- \+ father(nichael,cathy) .
no
?- father(michael,melodY) .
no
?- \+ father(michael,melody) .
yes

Notice that \+ doesnot require parenthesesaround its argument.


The behavior of \+ is called NEGATION AS FAILURE.In Prolog, you cannot
state a negative fact ("Cathy is not Michael's father"); all you can do is conclude
a negativJstatement if you cannot concludethe correspondingpositive statement.
Mor6 precisely,the computer cannot know that Cathy is not Michael's father; all it
can kno* is that it has no proof that she ls his father.
Rulescan contain \+- For instance,"non-parent" can be defined as follows:
n o n - p a r e n t ( X , Y ): - \ + f a t h e r ( X , T ) , \ + m o t h e r ( X , Y')
That is, I is a non-parentof y if x is not the father of Y and X is also not the mother of
Y.
In FAMILY.PL,the "non-parents" of Cathy are everyone except Michael and
Melody. Sure enough, the following queries succeed:
Goals("Not")
Sec.1.11. Negative 2l

?- non-parent (elmo, cathy) .


yes
?- non-parent (sharon, cathy) .
yes
?- non-parent (charles, cathy) .
yes

and non-parent fails if its argumentsare in fact a parent and his or her child:
?- non-parent (urichael, cathy) .
no
? - non-parent (meIody, cathy)
no

So far, so good, but what happens if you ask about people who are not in the
knowledge baseat all?
?- non-parent (donald, achsa) .
y es

Wrong! Actually, Donald (another of the authors of this book) is the father of
Achsa, but FAMILY.PL doesn't know about it. Because the computer can't prove
father(donald,achsa) nor mother(donald,achsa), the non-parent query suc-
ceeds, giving a result that is false in the real world.
Here we see a divergence between Prolog and intuitively correct thinking. The
Prolog system assumes that its knowledge base is complete (e.g., that there aren't any
fathers or mothers in the world who aren't listed). This is called the cLosED-woRLD
ASSUMPTION.Under this assumption, \+ means about the same thing as "not," but
without the closed-world assumption, \+ is merely a test of whether a query fails.
That's why many Prolog users refuse to call \+ "not," pronouncing it "cannot-prove"
or "faTl-if" instead.
Note also that a query preceded by \+ never refurns a value for its variables.
You might think that the query

?- \+ father(X,Y).

would instantiate X and Y to two people, the first of which is not the father of
the second. Not so. To solve \+ father(X,Y), the computer attempts to solve
father(x,Y) and then fails if the latter goal succeedsor succeeds if the latter goal
fails. In turn, father(x,Y) succeeds by matching u clause in the knowledge base.
Therefore, \+ f ather (I, Y) has to fail, and because it fails, it does not report variable
instantiations.
As if this were not enough, the order of subgoals in a query containing \+ can
affect the outcome. Let's add the fact

blue_eyed(cathy) .

to the knowledge base. Now look at the results of the following queries:
22 IntroducingProlog Chap. 1

?- blue- ey e d (X ),n o n -p a re n t (I, Y )


X = cathy
yes
?- non- pare n t (X, Y ),b l u e -e y e d (X)
no

The first query succeedsbecause X gets instantiated to cathy before non-parent (X, Y)
is evaluated, and non-parent(cathy,Y) succeedsbecause there are no clauses that
list Cathy as a mother or father. But in the second query, X is uninstantiated when
non-parent (X, Y) is evaluated, and non-parent (X, Y) fails as soon as it finds a clause
that matches f ather (X, Y) .
To make negation apply to a compound goal, put the compound goal in paren-
theses, and be sure to leave a space after the negation symbol. Here's a whimsical
example:2

blue-eyed-non-grandparent (X) : -
blue-eyed(X),
\+ (parent(X,Y), par€rt(Y,Z)) .
That is, you're a blue-eyed non-grandparent if you are blue-eyed, and you are not
the parent of some Person Y who is in turn the parent of some person Z.
Finally, note that \+ (with its usual Prolog meaning) can aPPear only in a query
or on the right-hand side of a rule. It cannot appear in a fact or in the head of a rule.
If you say
'/.
\+ f ather (cathy,michael) wrong !

you are not denying that Cuthy is Michael's father; you are merely redefining the
6uilt-in predicate \+, with no useful effect. Some Prolog implementations will allow
this, with possibly unpleasant results, while others will display an error message
saying thai \+ is a built-in predicate and you cannot add clauses to it.

ExerciseL.11.1
Define non-grandparent(X,Y), which should succeedif X is not a grandparentof Y.

Exercise1.1't'.2
Define young-parent (I), which should succeedif I has a child but doesnot have any
grandchildren. Make sureit works correctly;considerthe caseof someonewho has two
children, one of whom, in turn, has a child of her own while the other one does not.

T.I2. TESTING FOR EQUALITY

Now consider the problem of defining "sibling" (brother or sister). TWo people are
siblings if they have the same mother. (They also have the same father, but this
- at least in this
is irrelevant because everyone has both a father and a mother
knowledge base.) So a first approximation is:
2Some prologs will print a waming message that the value of Z in this clause is never put to any
use. See "Anonymous Variables" (Sec. 1.1'3)'
Sec.1.'12. Testing
forEquality 23

sibling(X,Y) :- mother(M,X), mother(M,Y) .

If we put this rule into FAMILY.PL and then ask for all the pairs of siblings known
to the computer,we get a surprise:
?- sibling(X,Y).
X=cathy Y=cathy
X=cathy Y=sharon
[=sharon Y=cathy
[=sharon Y=sharon (etc. )

Cathy is not Cathy's sibling, yet Cathy definitely has the same mother as Cathy. We
need to rephrase the rule: "x is a sibling of y if M is the mother of x, and M is the
mother of Y, and X is not the same as Y."
To express "not the same" we need an equality tesf if I and Y are instantiated
to the same value, then

X==Y

succeedsand, of course,

\+X==Y
fails. The new rule is:

sibling(X,Y) :- mother(M,X), mother(M,Y), \+ X == y.

With it, we get the desired result:


?- sibling(X,Y).
[=cathy Y=sharon
[=sharon Y=cathy (etc. )

Wait a minute, /ou say. That's the same answer twice! We reply: No, it isn't. Remem-
ber that, as far as Prolog is concerned, the two conclusions sibling(cathy, sharon)
and sibling(sharon, cathy) are separate pieces of knowledge. Both of them are
true, so it's entirely correct to get them both.
Here's another example of equality testing. X is an only child if x's mother
doesn't have another child different from X. In Prolog:

only_child(X) :- mother(M,X), \+ (mother(M,y), \+ X == y).


Note how the negations are nested. Given X, the first step is to find X's mother,
namely M.Then we test whether Mhas another child Y different from I.
There are actually two "equal" predicates in Prolog. The predicate '==' tests
whether its arguments alreadyhave the same value. The other equality predicate,'=',
attempts to unify its arguments with each other, and succeeds if it can do so. Thus,
you can use it not only to test equality, but also to give a variable a value: I = a will
unify X with a. With both arguments instantiated, '=' arld '=='behave exactly alike.
It's a waste of time to use an equality test if you can do the same job by simply
putting a value in an argument position. Suppose, for instance, you want to define
a predicate parent-of -cathy(X) that succeeds if x is a parent of Cathy. Here is one
way to express it:
24 Prolog Chap. 1

parent-of-cathy(X) :- parent(X,Y), Y = cathy. 7. poor style

That is: first find a person Y such that X is a parent of Y, then check whether Y is
Cathy. This involves an unnecessarystep, since we can get the same answer in a
single step with the rule:
par ent - of - c a th y (X ) :- parent (X, cathy) 7. better style
'=' and '=='
Howgvgr, are often necessaryin programs that perform input from the
keyboard or a file during the computation. We can have goalssuch as:

?- read(X), write(X), X = cathy.

This means: Instantiate X to a value read in from the keyboard, then write X on the
'='
screen, then test whether X equals cathy. It is necessary to use or'==' here because
we cannot predict what value X will have, and we don't want the computation to fail
before printing X out. We will deal with input and output in Chapter 2.

Exercise1.12.7
DoesFAMILY.PLlist anyonewho satisfiesonly-child asdefinedin this section?Explain
why or why not.

Exercise"1,,12.2
Can a query suchas'?- only-child(x) .' retrieve a value for I? Explain why or why
not. Ifnecessary,add an instance of an only child to the knowledge base in order to test
this.

Exercise1.12.3
From the information in FAMILY.PL,can you tell for certain who is married to whom?
Explain why or why not.

Exercise1.12.4
Add to FAMILY.PLthe definitions of.brother,sister,uncle, and aunt. Verify that your
predicatedefinitions work correctly. (Hinl Recallthat you have two kinds of uncles:
ihe brothersof your parents,and the husbandsof your aunts. You will needto add facts
to specifywho is male, who is female,and who is married to whom.)

1.13. ANONYMOUS VARIABLES

Supposewe want to find out whether Hazel is a mother but we don't care whose
mother she is. We can expressthe query this way:
?- mother(hazel,-).

Here the underscore mark stands for an ANONYMOUSvARIABLE,a special variable that
matches anything, but never takes on a value. The values of anonymous variables
are not printed out in response to a query. More importantly, successive anonyrnous
variables in the same clause do not take on the same value; they behave as if they
were different variables.
Sec.1.14. Avoiding
EndlessComputations 25

You should use an anonyrnous variable whenever a variable occurs only once
in a clause and its value is never put to any use. For example, the rule

is-a-grandmother (I) : - mother (X, Y) r por€rrt (Y ,Z) .

is exactly equivalent to

is - a- gr andnot h e r(I) :- mo th e r(X ,Y) r par€nt(Y ,_) .

but is less work for the computer because no value need be assigned to the anony-
mous variable. Here X and Y cannot be replaced with anonyrnous variables because
each of them has to occur in two places with the same value.

Exercise1.13.1
Modify blue-eyed_non-grandparent (p.22) by putting an anonymous variable in the
appropriateplace.

Exercise1.13.2
Ufhy isn't the following a proper definition of grandparent?
gr andpare n t(G,C ):- p a r€ n t(G,_ ), p a r ent(_,C ). 7. wrong!

1.14. AVOIDING ENDLESS COMPUTATIONS

SomeProlog rules, although logically correct,causethe computation to go on end-


lessly.suppose,for example,we have the following knowledge base:
married(michael,nelody) . 11]
married (greg, crystal) .
married(j im, eleanor) .

and we want to express the fact that if x is married to Y, then y is married to I. We


might try the rule:

narried(X,Y):-married(Y,X). t2l
Now suppose we type the query:

?- married(don, ja.n'e).

Don and Jane are not in the knowledge base. Accordingly, this query does not match
any of the facts in [1], so rule [2] gets invoked and the ne* goal becomes:

? - m ar r ied( jan e ,d o n )

Again, this does not match any of the facts in [1], so rule I2l is invoked and the new
goal becomes:

?- m ar r ied( do n ,S a n e ).
26 Introducing
Prolog Chap.1

Now we're back here we started. The loop continues until the computer runs out
of stack spaceor e user interrupts the computation.
One way to revent the loop is to have two "married" predicates, one for facts
and one for rules Given the facts in [1], we can define a predicate couple /2 which,
unlike married, ill take its arguments in either order. The definition is as follows:

c o u p l e ( x , Y ) : - r m a r r i e d ( X , Y ).
couple (Y , I) : - ]narried (X , Y) .

No loop can aris{ becauseno rule can call itself directly or indirectly; so now the
query '?- coupld(don,5ane).' fails,as it should. (Only becausethey are not in the
knowledge base;fve hastento assurereaderswho know us personally that they are
married!)
Sometimes{ rule has to be able to call itself in order to expressrepetition. To
keep the loop frofn being endless,we must ensure that, when the rule calls itself, it
doesnot simply {uplicate the previous call.
For an exaniple,let's go back to FAMILY.PLand develop a definition for "an-
cestor." One clau$eis easy,sinceparentsare ancestorsof their children:
a n r c e s t o r ( x , Y ): - p a r e n t ( X , Y ) . t3l
But the relation of ancestorto descendantcan span an unlimited number of genera-
tions. We might tty to expressthis with the clause:
ar r c es t or ( x , Y) : - a n c e s to r (x ,z ) , a nrcestor(Z , Y ) . 7, wrong ! [4]

But this causes a lpop. Consider the query:

.
?- ancestor(catfry,Who)
Cathy isn't an an(estor of anyone,and the query should fail. Instead,the computer
goesinto an infinite loop. To solvethe query,the computerfirst tries clause[3], which
fails becauseit cafi't satisfyparent ( cathy , Who) . Then it tries clause[4], generating
the new goal:
?- anc es to r(c a tfry ,Z ), a n rc e s to r(Z ,l .Iho).

In order to solve {.ncestor(cathy,Z) the computer will do exactly the same things
as for ancestor({atfry,}fho); in fact, since both Z and Whoare uninstantiated, the
new goal is in effdct the same as the old one. The loop continues over and over until
the computer runp out of stack space or the user interrupts the computation.
We can fix t$e problem by replacing [aJ with the following:

ancestor(x,Y) tl- p"tett(X,Z), ancestor(Z,Y). t51

This definition ilt still follow an ancestor-descendant chain down an unlimited


number of gener tions, but now it insists on finding a Parent-child relation in each
step before callin itself again. As a result, it never gets into endlessloops.' Many,
though not all, tr nsitive relations can be expressedin this way in order to prevent
looping.
-
Finally, and fnore obviously, Prolog can get into a loop whenever two rules call
Sec.1.15. Usingthe Debugger
to TraceExecution 27

hr:man-being(X) :- person(X) .
person(X) :- hurnan-being(X).
The cure in this case is to recognize that the predicates human-being and person are
equivalent, and use only one of them.
It is possible to have a computation that never halts but never repeats a query.
For instance, with the rules:
positive-integer(1) .
positive-integer(X) :- Y is X-1, positive-integer(Y).
'?- positive-integer (2 . 5) . ' generatesthe endless sequence:
the query
?- positive_integer(1. 5) .
?- pos it iv e_ i n te g e r(0 . 5 ) .
?- positive_integer(-0. 5) .
?- positive_integer(-1. 5) .
and so on.

Exercisel.'l.,4.'1,
Add to FAMILY.PLthe predicatererated(r,T) such that r is related to y if x and y
have any ancestorin common but are not the sameperson. (Note that when you ask
for all the solutions,it will be normal to get many of them more than once,becauseif

ffi i"","J#ffiffi"ff:tTJl,i3#,T.iJ;*?.io'haveearrierancestorsinco
Verify that Michael and ]ulie are related, Cathy and Danielle are related, but
Michael and Melody are not related.
'j..14.2
Exercise

Describe how to fixpositive-integer so that queries withnoninteger arguments would


fail rather than looping. (You haven't been given quite enough Prolog to actually
implement your solution yet.)

1 . 1 5 .U S I N GT H E D E B U G G E R
T O T R A C EE X E C U T I O N

Almost all Prolog systemshave a DEBUGGER (perhapsit should be called a tracer)


modeled on the one in Edinburgh Prolog. The debuggerallows you to trace exactly
what is happening as Prolog executesa query. Here's an example (using GEO.PL):
?- spy(located-in/2) . (specifles
whatpredicate
youaretracing)
yes
?- trace . (turns on the debugger)
y es
?- located-in(toronto, canada) .
** (0) CALL: located-in(toronto,canrada) ? > (pressReturn)
* * ( 1) CA LL: l o c a te d -i n (to ro n to ,o n ta ri o ) ? > (pressR eturn)
* * ( 1) E X I T : l o c a te d -i n (to ro n to ,o n ta ri o ) ?
* * ( 0) E x r r : l o c a te d -i n (to ro n to ,c a n a d a ) ? > (pressR eturn)
y es
28 lntroducing
Prolog Chap.1

That is: to prove located-in(toronto,canada), the computer first had to prove


located-in(toronto,ontario). Here's an example in which the backtracking is
more complicated:

? - loc at ed -i n (W h a t,te x a s ) .
** ( 0) CA L L : l o c a te d -i n (-0 0 8 5 ,te x a s) ? > (R eturn)
** ( 0) E X IT : l o c a te d -i n (h o u s to n ,te xas) ? > (R eturn)
tilhat = houston ->;
** (0) RED0: located_in(houston,texas) 7 > (Return)
** ( 0) E X IT : l o c a te d -i n (a u s ti n ,te x a s) ? > (R eturn)
!{hat = austin -);
** ( 0) RE D 0 : l o c a te d -i n (a u s ti n ,te x a s) ?
( 0) F AIL : l o c a te d -i n (-0 0 8 5 ,te x a s) ? > (R eturn)
;:

Here -0085 denotes an uninstantiated variable. Notice that each step is marked one
of four ways:

CALL marks the beginning of execution of a query;

REDo means an alternative solution is being sought for a query that has already
succeeded once;

EXIT means that a query has succeeded;

FAIL means that a query has failed.

If you keep hitting Return you will see all the steps of the computation. If you
hit s (for "skip"), the debugger will skip to the end of the current query (useful if
the current query has a lot of subgoals which you don't want to see). If you hit a
("abort"), the computation will stop.
To turn off the debuggea type

?- notrace.

To learn more about what the debugger can do, consult your manual.

Exercise1.15.1.
Use the debuggerto traceeachof the following queries:
?- located-in(austin,What) . (usingGEO.PL)
?- parent (nichael, cathy) . (using FAMILY.PL)
?- uncle (Who,cathy) . (using your solution to Exercise7.12.4)
?- ancestor(Who,cathy). (usingFAMILY.PLwith [4] and [5] from section1'14)
Describewhat happensin eachcase.

1.16. STYLES OF ENCODING KNOWLEDGE

In FAMILY.PL,we took the relations"mother" and "father" asbasic and defined all
other relations in terms of them. We could equally well have taken "parent" as basic
and used it (along with "maLe"and "female") to define "mother" and "father":
Random documents with unrelated
content Scribd suggests to you:
toccar l’Austria fin che essa non provocasse; aversi a sperar meglio
nella Russia che nell’Inghilterra, questa amica, quella nemica
naturale dell’Austria; del resto l’unità d’Italia non poter venire che dal
principato, la sua reviviscenza dalla libertà.
Leopoldo Galeotti (Della sovranità temporale dei papi) era d’avviso
che a riformare gli Stati Pontifizj bastasse il richiamar le antiche
leggi, e principalmente i Capitoli di Eugenio IV. Gino Capponi (Attuali
condizioni della Romagna) dicea che tutti consentono nella necessità
del dominio temporale, sol doversi cambiare ministro, istituzioni,
leggi, e consigliava i papi a farlo e rendere così venerabile la tiara
prima che qualche evento europeo obbligasse a bruttarla di sangue
per lasciarla cadere nel fango; un papa che regni senza governare è
l’unica soluzione del nodo; Roma ha più bisogno del papa che il papa
di Roma. Altre idee e partigioni diverse propugnava un Lombardo nei
Pensieri sull’Italia, considerando come impedimento quel dominio
papale, che pel Gioberti era la salute, per Durando la ruina d’Italia.
Della reviviscenza guelfa indispettì il poeta Giambattista Niccolini, e
nell’Arnaldo da Brescia pose una bella poesia e un’imperfettissima
erudizione a servigio delle passioni. Anche il Giusti berteggiava
«quest’Apollo tonsurato che dall’Alpi a Palermo insegna il
cantofermo», e il tuffare la penna nell’acqua benedetta.
In verità l’assunto dei neoguelfi pareva ognor meno accettabile in
grazia della speciale condizione dello Stato Ponlifizio, portato da
lunghi eventi allo sconcio eccezionale di concentrare nella stessa
persona la sovranità temporale e l’impero sulle coscienze, come nella
società pagana; talchè sul papa ricadeano anche le colpe o i difetti
del principe. Gregorio XVI, ancora monaco, avea scritto il Trionfo
della santa Sede, dove, zelando la primazia pontifizia, in nome del
cristianesimo proclama il diritto delle nazionalità. Un ingiusto
conquistatore, con tutta la sua potenza, non può mai spogliare dei
suoi diritti la nazione, ingiustamente conquistata. Potrà con la forza
ridurla schiava, rovesciare i suoi tribunali, uccidere i suoi
rappresentanti; ma non potrà giammai indipendentemente dal suo
consenso o tacito o espresso, privarla de’ suoi originali diritti
relativamente a quei magistrati, a que’ tribunali, a quella forza cioè
che la costituiva imperante (pag. 37).
Fervoroso per la causa di Dio e la santa maestà del dogma, secondò
le reviviscenze gerarchiche, infervorò i parroci ne’ doveri religiosi, e
cercò opporsi alle ripullulanti eresie; santificò Alfonso Liguori,
Francesco di Geronimo gesuita, Giuseppe della Croce minorita,
Pacifico da San Severino minor osservante, Veronica Giuliani
cappuccina; altri italiani beatificò; accelerò la ricostruzione
dell’incendiato San Paolo [38]; conchiuse concordati col re di
Sardegna, per cui lasciavasi al fòro secolare la cognizione dei crimini
di ecclesiastici, mentre i delitti, eccetto quei di finanza, restavano di
competenza curiale, e nei casi capitali fosse comunicato il processo
al vescovo che deve degradare il condannato. Anche al duca di
Modena consentì che le cause meramente civili fra ecclesiastici e laici
si portassero al fôro secolare, e così i delitti di lesa maestà, sedizioni
o contrabbando, intervenendovi però un deputato del clero; e per le
pene capitali deve il vescovo conoscere il processo originale: del
resto integrava i pieni diritti pontifizj e vescovili, ed aboliva le
restrizioni ai possessi di manomorta. Ebbe a lottare colla Spagna che
tolse i beni al clero e la nunziatura, col Portogallo a proposito
dell’istituzione canonica dei vescovi, colla Svizzera per la
soppressione dei conventi d’Argovia, e così coll’America meridionale:
e mentre da un secolo i papi non avean mostrato vigore che col
soffrire, Gregorio uscì dalla posizione meramente passiva per
mostrare la fronte ai persecutori subdoli o prepotenti. Animato dalla
coscienza cosmopolitica del supremo sacerdozio, scomunicò i fautori
della tratta dei Negri. A proposito de’ matrimonj misti parlò alto al re
di Prussia; e avendo questo incarcerato l’arcivescovo di Colonia, esso
il denunziò a tutta la cristianità per modo che il persecutore dovette
chinarsi. Approvò la rivoluzione dei Belgi perchè eccitata da
persecuzione religiosa; ma allorchè alla Polonia sollevata contro la
Russia scismatica rammentò l’obbligo d’obbedire, parve insultare a
un cadavere. Al tempo stesso egli ricorse al czar perchè trattasse
meglio i Cattolici, e adempisse le promesse fatte loro: ma il czar non
che badarvi, adoprò seduzione e persecuzioni per unificare l’impero
anche nelle credenze. Corse anche voce, e un opuscolo pubblicato
da persona a lui vicina parve confermarlo, che l’imperator Nicolò si
credesse il vero rappresentante dell’impero romano, e in
conseguenza il capo di tutta la cristianità nel religioso come nel
politico. La sua forza già gli attribuiva predominio sui re; rimaneva di
ridurre a una sola le due Chiese, latina e greca; ossia, considerando
questa come l’unica vera, e la latina come scismatica, questa
richiamare all’unità sotto di lui, unico papa. A tal fine erano dirette le
persecuzioni ai Cattolici, mediante le quali molti preti e intere
provincie fece apostatare, di orride persecuzioni punendo chi
reluttasse. Il papa le espose in una relazione (1842), che fece
inorridire il mondo. Essendo poi il czar passato per Roma nel visitare
sua moglie che miglior salute cercava a Palermo, Gregorio, invece
delle blandizie profusegli dai principi, gli fece severi raffacci delle
sevizie usate ai Cattolici, intimandogli: — Fra breve noi compariremo
al tribunale di Dio; e non oserei sostener la vista del mio giudice se
non difendessi la religione, della quale io sono il tutore, voi
l’oppressore». Quelle minaccie non uscirono vane, e provarono
quanto un pontefice possa ancora sul mondo allorchè tuteli la verità
e l’innocenza, scevro da interessi mondani e da grette paure.
Chi conobbe Gregorio nell’intima vita, lo trovò di consuetudini
semplici, e gusti fin vulgari; facile alle udienze, studioso anche sui
libri nuovi che gli si lasciassero arrivare; ai parenti non diede nè
ricchezze nè cariche, mentre debolmente condiscendeva al
cameriere Gaetano Moroni, che blandito con titoli e decorazioni dai
re e fin con applausi letterarj, subì la responsalità di quanti errori
allora si fecero. Piovvero epigrammi su quest’amicizia, e
sull’ubriacarsi del papa e su altre baje, dove non era di vero se non
la debolezza di un vecchio e frate.
Di costituzione, di bilancio, degli altri arzigogoli estranei alla teologia
ed esotici nel regno di Dio, nulla intendeva, sicchè bisognava
lasciasse fare ai ministri e alle circostanze, per cui colpa le riforme
promesse nel 1831 riuscirono a nulla o a male. Quelle imperfette
concessioni guardava il Governo come estorte, e voleva eliderle;
impacciava le amministrazioni comunali coll’intervento governativo;
gl’impieghi conferiti a laici nelle Legazioni furono ritolti; il
regolamento del 1835 metteva norma ai giudizj il diritto comune,
moderato dal canonico, e senz’abolire gli statuti locali. La giustizia
era corruttibile non solo, ma esposta agli arbitrj de’ superiori, e alle
interminabili restituzioni in intero. Commissioni militari erigevansi ad
ogni attentato contro la sicurezza pubblica, sinchè non vi venne
sostituita la Consulta, che, con norme eccezionali anch’essa, dava il
difensore, ma scelto fra quattro proposti dal Governo, e vincolato al
secreto; testimonj e giudici lasciava ignoti al reo.
Le riforme amministrative si riduceano a una maggior regolarità di
protocolli, insegnata da un magistrato austriaco (Sebregondi), a tal
uopo deputatovi; e al crescere gl’impiegati, parassita aggiunta alle
altre: crebbero fuor modo le ruberie e le venalità, l’onnipotenza
degl’intriganti, l’assolutezza moltiplicata quanti erano i potenti,
quanti i domestici del papa. Il debito, lasciato o causato dalla
rivoluzione del 31, era ben lungi dall’essere spento dalle tasse nuove
e da altri compensi; tanto più che tutti dilapidavano, e il lusso
governativo cresceva, e il cardinal Tosti tesoriere non sapeva
asciugar pozza che col farne un’altra, tanto da non fallire [39]. Le
opere pubbliche volgeansi al fasto, più che all’utile: e il viaggiatore,
gemente su quelle incomparabili ruine, domandava perchè
piantagioni e coltura non tornassero sane e ubertose le circostanze
di Roma, perchè vaporiere non risalissero il Tevere, perchè strade
ferrate non congiungessero coi due mari la metropoli della
cristianità.
Peggio andava nel morale; ed oltre la Polizia, una ciurma
ammantavasi di devozione al Governo per trasmodare contro le
opinioni opposte. Il papa nol sapeva, chè de’ favoriti suoi era cura
non gli si ragionasse di affari, talchè rimanea persuaso che ogni cosa
andasse nel meglio possibile. Vollero ribadirgli questa persuasione
col fargli intraprendere uno di que’ viaggi (1841), in cui il principe
non riceve se non riverenze e trionfi, gli si lasciava solo il tempo di
visitar chiese, monumenti, istituti pubblici parati ad inganno, e
uomini disposti a staccare i cavalli e tirar la carrozza, e quella turba
di cittadini che s’affollano sulle strade o nelle anticamere,
applaudendo se vulgo, petizionando se civili. Ne riportò dunque
l’idea della beatitudine universale; e intanto lo scontento delle
Legazioni, già preveduto dai diplomatici nel 1831, fu portato al colmo
dal non averle egli visitate; e massimamente a Bologna preferivasi
palesemente la dominazione austriaca [40], perchè forte, di truppe
disciplinate, d’incorrotta giustizia, di tutto quel bene che l’odio del
proprio fa supporre ne’ Governi altrui. Al fine del 36 i Francesi si
erano ritirati da Ancona, i Tedeschi dalle Legazioni, lasciando
sentimenti opposti, ma accordantisi nell’avversione al dominio
papale.
Anche ai miglioramenti non faceasi buon viso; e quando fu
pubblicata la riforma giudiziaria, non solo avvocati e tribunali la
combatterono così, che fu duopo sospenderla, ma una stampa
clandestina diceva: «È dell’onor nostro il resistere. Niuna transazione
con Roma». Anche voti ragionevoli si mormoravano, e tratto tratto si
gridavano in tono di rivolta; ma le insurrezioni tentate ripetutamente
diedero ragione a repressioni vigorose, tanto più che spesso la causa
degli insorgenti confondeasi con quella de’ masnadieri, cronico
morbo al paese.
Un Renzi riminese, reduce di Francia dove avea mestato nelle
combriccole, mandato o fingendosi dai liberali di Romagna, e
affiatatosi con altri ricoverati in Toscana, indusse a fare una protesta
armata per sostenere un’altra scritta dal dottore Farini, intestata
Libertà civile, Governo secolare, Ordine pubblico. Avuto compagni ed
arme, il Renzi sbucò da San Marino, e occupò Rimini; ma poichè
nessuna città rispose, i soldati svizzeri gliel’ebbero prontamente
ritolta, ed egli con cencinquanta rifuggì in Francia traversando
Toscana. Stolto tentativo; eppure se ne fece un gran parlare, e valse
a fissare gli occhi d’Europa sopra le domande de’ Papalini, in gran
parte sensate ed effettibili. Tolse a sostenerle il piemontese Massimo
d’Azeglio, che, nei Casi di Romagna, riprovando risolutamente le
congiure, le manifestazioni di piazza, le insurrezioni, insieme
mostrava come unica via di evitarli il governar bene, svellere gli
abusi, concedere le riforme necessarie.
La Polizia rabbrividì quando non si trovava più a fronte sediziosi da
incarcerare, ma ragioni da ribattere; non minacciata la religione, non
i possidenti, nè tampoco il Governo, ma gli abusi, le turpi passioni e
l’inerzia negativa; non imposte nuove concessioni, ma rammentato
voti già espressi nel 1832 dalle Potenze che si chiamano tutrici della
servitù, poi dimentichi a segno, da parer adesso novità [41]. Il
Governo rispose al manifesto, parte negando o attenuando que’ fatti,
parte mostrando o ingiuste o improvvide le domande, parte
denigrando i sovvertitori; e sebbene dicesse molte verità, ognun sa
quanto poco vagliano le difese, tanto più quelle d’un Governo contro
un nome divenuto popolare. Cresceano dunque i fremiti; e come in
Lombardia formolavansi nella cacciata degli stranieri, così qui nella
parola di secolarizzazione.
Un principe a tempo, scelto per lo più in vecchiaja, tra una classe
aliena per istituto dagli affari temporali; scelto, aggiungiamo, a
preferenza per le virtù che continuino la serie di tanti virtuosi, e
rendano servigi alla Chiesa universale, deve riuscire men proprio a
governare il paese quanto più l’istituzione ecclesiastica si rende
piamente austera ed esemplare; insomma peggiora per quelle
condizioni di moralità, per le quali gli altri Governi unicamente
possono perpetuarsi. Di qui la necessità di stabili istituzioni, le quali
possano in qualunque caso dirizzare i consigli sovrani. E tanto più
che negli interregni l’anarchia diventa regola, sconnettendosi ogni
autorità, e riagendosi contro chi era stato potente: sicchè il Governo
che sottentra deve ripristinare l’obbedienza, effetto sempre
scabrosissimo e viepiù con gente nuova com’è quella messa in posto
dal nuovo pontefice, di cui è consuetudine, se non obbligo, il dare lo
scambio ai ministri del predecessore.
Roma da un pezzo non ha municipalità, l’amministrazione della città
confondendosi collo Stato, e rammentandosi con ribrezzo i tempi
quando ancora il Comune di Roma osteggiava i papi, e li cacciava ad
Avignone. L’avere il Consalvi concentrato moltissimi affari nella
segreteria di Stato, e tutto il potere esecutivo, aveva sminuita la
partecipazione dei cardinali alla sovranità.
Il concistoro di questi, eletto fra tutte le nazioni, e dagli uomini più
eminenti per scienza ecclesiastica, ha tutt’altra destinazione che la
accidentale di reggere lo Stato. Prima della rivoluzione, alla Corte di
Roma si formavano buoni amministratori e destri politici, atteso le
vive relazioni con tutt’Europa, e l’essere la prelatura riservata ai
cadetti delle famiglie nobili, che vi portavano meno l’austerità
ecclesiastica, che l’attitudine ereditaria agli affari, l’appoggio delle
parentele, la ricchezza, le aderenze. Tutto cambiò nell’eguaglianza
sopravvenuta; perì quella scuola di diplomatici; e poichè il riformare
richiede genio ed esperienza, qui pure si preferì il non far nulla, o
quell’acquistar tempo ch’è reputato guadagno dai poteri egoistici.
CAPITOLO CXC.
Pio IX. Le Riforme. Le Costituzioni.

Morto Gregorio XVI (1846 1 giugno), si antivedeva un conclave


tumultuoso, e intanto le Romagne e le Marche bollivano; ad Ancona
fu assassinato il colonnello Allegrini; dappertutto adunanze, e
petizioni; ma prima che s’iniziassero le brighe diplomatiche, il sacro
Collegio nominò (16 giugno) Giovanni Mastai Ferretti, nobile di
Sinigaglia e vescovo d’Imola. Preso il nome di Pio IX, nell’enciclica
ripetè i lamenti del predecessore contro l’indifferenza, il razionalismo,
le società bibliche, la stampa sfrenata; poi colse ogni occasione per
ripetere che egli era papa cattolico innanzi tutto, padre di tutti i
fedeli e non dei soli Italiani, geloso di non menomare gli affidatigli
diritti della santa Sede.
Poco dopo (6 luglio) concesse amnistia a chi avea «meritato castigo
offendendo l’ordine della società e i sacri diritti del legittimo
sovrano»; per ottenerla bisognava riconoscersi in colpa e promettere
lealtà di suddito. I menapopolo stettero un istante in bilico; ma
poichè, dopo tanto odiare e bestemmiare, se non altro per varietà
voleasi assentire ed encomiare, diedero il segno degli applausi: nella
limitata amnistia vollero vedere un avviamento a concessioni
maggiori; cominciarono a parlarne col miele sulle labbra, indi con
ammirazione, infine con adorazione; si ripeteano i detti del papa, se
ne inventavano; su ogni atto di lui, presente o passato si
diffondevano aneddoti benevoli, arguti, generosi; se ne ammanierò
un idolo a capriccio, attribuendogli concetti, atti, parole, divisamenti,
alieni dal suo vedere e dal suo volere; e «Viva Pio IX» fu la parola di
moda, surrogata a tutti gli applausi, a tutte le speranze.
In realtà, egli era un pio sacerdote, che d’ogni giorno molte ore
riservava alla preghiera; che nei dubbj del pensiero gettavasi a’ piè
della Madonna; che il bene volea lealmente, ma, se non ampliare,
neppure sminuire la podestà trasmessagli. Preso però dalla più cara
delle seduzioni, quella del favor popolare, credette farsene appoggio
alle rette intenzioni, e sorrise a quella pioggia di fiori da cui
resterebbe soffogato. Roma cominciò un non più interrotto
carnevale; ogni giorno corso, inni, serenate, battimani; tripudio
quando il papa usciva, quando villeggiava, quando tornava, applausi
altrettanti a chiunque diceasi suo amico, suo servo, suo ammiratore.
Di tali entusiasmi, come sempre, era difficile assegnare le cause; nei
più era un seguir l’andazzo; in molti una sincerità irriflessiva; quei
che s’accorgeano dell’allucinamento, compiacevansi che tale
cospirazione d’assensi iniziasse un moto, il quale, moderato dal
nome augusto, rimarrebbe sacro al popolo, rispettato ai re. Noi
Italiani soprattutto vi vedemmo un lampo di care speranze: quei che
«aspettavano il rigeneramento dalla santa libertà e dalla robusta
moderazione, anzichè dall’ira declamatrice, dalla denigrazione
folliculare, dal despotismo rivoluzionario» [42], credeano mostrerebbe
quanto vaglia un principe che, risoluto al bene, s’affidi al suo popolo,
ed osi resistere a’ suoi proprj amici; laonde inneggiammo Pio IX
quasi a lezione degli altri regnanti.
Le Romagne ferveano, non più di rivolta, ma di riforma, chiedendo il
memorandum del 1831; iteravano petizioni, dimostrazioni, indirizzi
coperti da migliaja di firme, partecipazione al vanto quando più non
recava pericolo: e Pio IX pareva inanimarli coll’accoglierli (1847 12
marzo); furono scelte commissioni per maturar riforme; invitati i
municipj e le persone meglio credute a proporne; e concessa libertà
di trattare dell’amministrazione e di cose politiche sui giornali. Se ne
esaltò il sentimento individuale, e mentre questo vagellava nelle
proposte più dissenzienti, le speranze sconobbero ogni limite di
opportunità, di tempo, di luogo: un papa di ferrea volontà bastava
volesse il bene, foss’anche contro la natura del principato
ecclesiastico; Pio IX nol facea, dunque la colpa era di cardinali e
Gesuiti.
Aspettate un pezzo, apparvero le riforme (14 aprile), cioè una
consulta di Stato, formata da un cittadino per provincia, scelto dal
sovrano sopra triplice proposta dei legati e preseduta da un
cardinale. Più tardi si decretò un consiglio municipale di cento, dai
quali il papa scerrebbe un senato di nove; restituendo così alla città
di Roma la rappresentanza civica.
Erasi ripetuto a sazietà che il papato era avverso per essenza ad ogni
innovamento e alle istituzioni liberali, e necessario alleato dell’Austria
e dell’assolutismo. Or ecco Pio IX secondare i voti dei buoni, i quali si
presumeva non potessero volere se non l’indipendenza italiana.
Spiritavasi dunque d’applausi, che si propagarono dalle Romagne al
resto d’Italia, e di là al mondo; Europei come Americani, Protestanti
come Cattolici ripeteano «Viva Pio IX»; in ogni casa il suo busto; sue
medaglie, battute a migliaja di migliaja in ogni metallo, fregiavano
ogni petto; sui fazzoletti, sui mobili, sui giocattoli il ritratto e i colori
suoi; il nome su tutte le pareti, in tutte le bocche, in tutte le favelle;
tutti voleano aver veduto l’uomo del secolo; tutti almeno parlarne,
lodarlo; il Turco stesso mandò offrendogli omaggi, amicizia,
promessa di ben trattare i Cristiani; i figli di Voltaire riconciliavansi a
un papa che sarebbe piaciuto al loro patriarca; i liberali incarnavano
in esso quanto di meglio potessero chiedere i popoli o fare i principi;
Mazzini stesso gli dirigeva mistiche esortazioni a farsi capo della
grande impresa: oh, la generazione che la vide, non potrà più
dimenticare quelle dimostrazioni.
Un Angelo Brunetti, per soprannome Ciciruacchio, bello, robusto, di
facile loquela, d’esultanti canzoni, ardito e generoso come que’
popolani, tutta cosa di bettolieri, mercatini, vetturali, vinaj, a’ quali
mediava contratti, prestava servigi e, occorrendo denari e braccio, si
fece il rappresentante della plebe presso Pio IX; egli sistemare le
feste, egli disporre i baccani o i silenzj, egli buttar nelle piazze la
parola imboccatagli d’encomio o disapprovazione, che ripetuta da
ventimila lingue, sembrava parola di popolo. E Ciciruacchio da
quell’ora divise i trionfi e la celebrità con Pio IX, e col principe di
Canino l’appalto delle dimostrazioni.
Chi si ricordava d’aver visto anni fa la serva di Royer-Collard portata
in trionfo dalle ortolane di Parigi, sorrideva e compassionava. Chi
conosce che la popolarità vuole schiavi coloro che sceglie per idoli, si
sgomentava d’incensi sotto cui fiutava il sito rivoluzionario; e non
potendo parlare in quei momenti in cui non è consentita che
l’ammirazione, diede indietro, lasciando soletto il papa, e
compiangendolo d’aver preso le vertigini. Adunque egli si trovò solo
(1847), e obbligato a valersi degli esuli richiamati o di inesperti,
contro cui strepitavano coloro i quali non osavano adoprarsi, e pur si
dolevano di non vedersi adoprati. Il siciliano padre Ventura, buon
filosofo, e che dagli Scolastici avea dedotto il concetto della riverenza
all’autorità e dei diritti del popolo, lo incoraggiava a procedimenti, da
cui credea dipendere il bene della religione; ma mancava
d’esperienza. Agli infervorati parea che il papa avanzasse più lento
dei desiderj; sicchè per rinfocolarlo buccinarono d’una gran congiura
(16 luglio), dove al popolo radunato a festa correrebbesi addosso,
indistintamente trucidandolo con pugnali impressi del Viva Pio IX, si
troncherebbero le redini de’ cavalli, si getterebbe fuoco nei fenili, i
soldati uscirebbero fingendo di calmare la sedizione e invece
aizzandola, e fra le stragi e le fiamme si costringerebbe Pio a fuggire
e abdicare, mentre gli Austriaci sopraggiunti col pretesto di mettere
ordine ripristinerebbero la tirannide. Indicavansi i luoghi, le persone,
i mezzi; e in tutto ciò non eravi di vero se non che voleasi farlo
credere, e valersene per domandare l’armamento di tutto il popolo a
difesa del suo Pio, quasi questo avesse nemici. Era riproduzione d’un
noto incidente della rivoluzione di Francia, e il buon papa mise fuori
un ordine per dissipare quegli artefatti terrori: ma dopo l’emozione
de’ tripudj voleasi l’emozione della paura; e Italia ed Europa
credettero alla gran congiura, all’orribile attentato della lega austro-
gesuitica.
Tutti i paesi d’Italia scotevansi alle scosse di Roma, neppure
s’accorgendo che cominciasse qualcosa più che una festa; da tutto
prendeasi occasione di dimostrazioni: l’anniversario dell’uccisione dei
Bandiera, della cacciata dei Tedeschi da Genova, della battaglia di
Gavinana, dell’assunzione del papa, la morte di O’ Connel a Genova,
quella di Federico Confalonieri a Milano, la sconfitta del Sunderbund
a Lucerna, offrivano titolo a parate, a canti, soprattutto a pranzi, la
esternazione allora più usitata del giubilo. Ricardo Cobden,
industriale di Manchester, aveva proposto il libero commercio dei
grani in Inghilterra, e sostenutolo con tutti gli artifizj legali che offre
il suo paese, tanto che lo vide trionfare, a dispetto de’ possidenti, i
quali per prosperare le proprie terre, aveano durato enormi spese
nella fiducia di rifarsene coll’alto prezzo delle derrate. La quistione
era affatto estrania all’Italia, ma il qui comparire di lui fu un trionfo;
a Torino, a Genova, a Roma, a Napoli, a Firenze, a Milano, ebbe
festeggiamenti nelle accademie, a cui davano aria di adunanze
parlamentari i calorosi discorsi che la stampa divulgava; e
celebravasi la libertà universale di commercio come necessario
fondamento della scienza economica, come santa alleanza de’
popoli.
L’importanza stava non in quel che si diceva, bensì nel potere e nel
voler dirlo; giacchè da una parte si imparava che noi pure abbiamo il
dono della favella, dall’altra cominciava ad atteggiarsi qualche
dicitore, qualche capobanchetto. Al vulgo de’ caffè intanto davasi a
credere che Cobden fosse inviato dall’Inghilterra a tastar il polso del
nostro paese e riferirne: altrettanto si disse di Cormenin, capitato
pure di Francia in quei giorni, e che poi pubblicò un libretto ove
mostravasi ignaro non solo di quel che si pensava, ma fin di quello
che si diceva. Non imputiamolo troppo, giacchè nella scialacquata
eloquenza di quei giorni noi pure mostravamo una deplorabile
ignoranza di principj e legali e politici; la colposa trascuranza de’ fatti
positivi e dei mali veri suggeriva rimedj o folli o insulsi, e rivelava
esorbitanti dissensi fra quelli che sin allora eransi creduti in perfetto
accordo perchè d’accordo nel fremere o piangere; che eransi creduti
amatori della libertà perchè unanimi in un odio.
Nella placida Toscana, il vecchio Fossombroni continuò a dar la
parola al sostituitogli don Neri Corsini: morto questo, fu messo a
capo del ministero Francesco Cempini, e consigliere intimo il
Baldasseroni, sgradito al popolo siccome sogliono essere i finanzieri.
Il primo dissenso tra il popolo e il principe si manifestò quando il
Renzi, ribelle papale (pag. 77), fuggendo da Rimini, fu lasciato
passare per la Toscana, con promessa che non più vi tornerebbe. Ma
egli di Francia vi ricomparve, e arrestato (1846 gennajo) come
violatore della parola, fu consegnato al suo principe. Sembrò un
rinunziare alla propria indipendenza; si sublimò come un eroe il
Renzi, il quale poi nelle carceri romane mostrossi ben altro.
Nuova debolezza parve il mandar via Massimo d’Azeglio, a cui tale
persecuzione, accompagnata da ovazioni, attribuì inaspettata
importanza politica. La opposizione allora s’ingagliardì; e poichè il
Gioberti avea messo di moda l’odio de’ Gesuiti, essendosi voluto
porre a Pisa una casa di Suore del Sacro Cuore, si fece una
dimostrazione chiassosa (febbrajo), e una supplica firmata dai
professori e da quei tanti che non vogliono mancar di figurare in una
lista.
L’elezione di Pio IX e le sue riforme aggiunsero stimoli e coraggio.
Bettino Ricasoli in una petizione esponeva lo scontento del paese,
accagionandone l’immoralità del clero, l’istruzione non incoraggita,
l’inettitudine degl’impiegati, la mancanza di buoni ordini nel
comunitativo e nell’economico, la censura che confondeva il parere
dell’uom savio colla suggestione del turbolento; e chiedeasi una
buona costituzione. Servì di rincalzo un discorso del Salvagnoli, poi
altri ed altri come quando entra la moda: gli stessi capi liberali non
cadevano però d’accordo; il che è ovvio quando molteplici oggetti
vengono abbracciati; ma i remoranti ne traevano una potente
objezione.
Su que’ primordj s’andava poco più innanzi che nel secolo passato,
insistendo perchè si ridonasse lena alle istituzioni municipali: ma i
buoni vollero applicare un motore, presto abbrancato dai diversi, la
stampa clandestina [43]. Giravano alla macchia informazioni, conforti,
ed una petizione di radicali trascendenze, che rifiuta le migliorie
parziali per chiedere il bene di tutta Italia, e che sia unita in nazione.
Cominciarono di qui le consuete satire e declamazioni, che toglieano
credito ai buoni pensamenti, e ne elidevano l’efficacia; gli uni
esclamavano contro i settarj, gli altri contro gli stipendiati
dall’Austria; parole di partito su cui fabbricano i loro libri gli scrittori
che li compongono come i giornali.
Anche l’arcadica Toscana covava dunque i suoi vulcani. Leoli e Bici
nel 1846 aveano fondata a Livorno la società segreta de’ Progressisti
italiani, coll’aspetto di migliorare l’educazione, ma coll’intento di
cacciare gli Austriaci e unire Italia sotto Carlalberto; e fecero proseliti
nelle infime classi. Scoperti, processati, il granduca li compatì come
traviati di buona intenzione. A Modigliana pure si tumultuò contro la
forza, e il granduca perdonò ai cinquanta imputati: si tumultuò a
Pescia, a Pistoja, con danno d’oneste persone, e con rapine a titolo
di carestia, e il duca perdonava. Più che altre riottava la plebe
livornese, mista d’ogni nazione; animosi giovani la istigavano, e il
Guerrazzi, che ripetendo sempre concordia e fraternità, causava
l’opposto.
Udite le riforme di Pio IX, Leopoldo (1847 maggio) le concede
anch’esso, e una Consulta di Stato, e gran larghezza di stampa, dove
è notabile che n’erano eccettuate le pastorali dei vescovi. Gli studenti
di Pisa le solennizzarono processionalmente, gridando «Viva
Leopoldo e la stampa»; ma dalla folla usci un «Viva la grascia, viva il
pane a buon mercato»; e il grido popolare fu secondato, e ne derivò
rissa e capiglia. Anche a Siena i carabinieri urtansi coi giovani, e ne
uccidono uno; il popolo pretende siano chiusi in quartiere i soldati, e
il Governo consente.
Nell’Università di Pisa insinuavasi quell’indisciplina che non tollera
superiori, impedivasi di castigare i cattivi, i professori austeri
venivano presi a fischi: uno tra le baruffe restò ferito, uno scolaro
ucciso, e, fosse Rinaldo o Martano, ebbe esequie spettacolose
ripetute in ogni parte, fra imprecazioni ai carabinieri, dianzi portati a
cielo perchè sottentrati alla sbirraglia, ora accusati d’aver fatto
affilare le sciabole per dare addosso agli studenti.
Comandava le poche forze toscane il Laugier, militare napoleonico,
fin allora vantato per la sua Storia militare degli Italiani, e proponeva
di reprimere quei tumulti colla forza; ma negatogli dal Governo,
dovette scendere a parlamentare col Lilla, ch’era il Ciciruacchio di
Livorno; e da quel punto restò bersaglio all’odio e alle imprecazioni
de’ liberali, mentre gli smodati sentironsi sicuri dell’impunità. Anzi
alcuni Fiorentini mandarono una spada di fino magistero a Giuseppe
Garibaldi nizzardo, che profugo nel 1834, condottosi in America,
invece di struggere la vita a ribramare la patria, si era messo soldato
di ventura; a capo d’una banda d’Italiani servì ai cittadini di
Montevideo contro Oribe; scarso d’intelligenza, semplice anzi rozzo
di modi, disinteressato, assoluto, abbondante del valore di cui era
tanta scarsezza; onde i Mazziniani lo inneggiarono, come possibile
spada dell’insurrezione italica.
E già il fremito di questa era espresso ne’ giornali, che, appena
trovata qualche larghezza, trascesero di numero e di modi: la Patria
proclamava l’accordo dei principi colla libertà; l’Italia sperava il
risorgimento dal papa, al quale avversava l’Alba, missionando l’unità
nazionale e repubblicana. Mentre l’alzarsi della marea mette a galla
le persone abili e credute dal popolo, gli inetti smaniosi sentono di
non poterlo se non cambiandola in burrasca, dando sul capo di chi si
eleva, guastando le previdenze, corrompendo i consigli, proponendo
cose che farebbero se fossero in potere; e inefficaci di operare nello
Stato e nelle città, s’arrabattano nei caffè e sui giornali, i due perni di
questa rivoluzione; e sorretti dalla turba che ascolta sempre a chi più
grida e in frasi più rimbombanti, acquistano apparenza di partito,
mentre erano pochi egoisti immolanti la causa pubblica all’ambizione
personale. Le concessioni del granduca pareano o tarde o inevitabili,
onde, invece di riconoscenza, gli si sporgeano domande sempre
nuove; flagellavasi l’autorità quando più pareva disposta ad
emendarsi; diffondeansi insinuazioni maligne, crudi sospetti, coll’arte
di Giuda stillando il biasimo nella lode, e ciò mentre non si parlava
che di fratellanza. Altri invece ostentavano liberalità col proporre
collette onde erigere monumenti a Pio IX e Leopoldo, al Ferruccio e
al Savonarola, e convegni, gite, mascherate, conviti solennizzavano
gli eventi giornalieri o le ricorrenze.
E memorabile fu l’anniversario (10 8bre) della morte del Ferruccio,
quando innumera gente raccolta a Gavinana, udì un discorso del
Guerrazzi, ritraente a colori biblici la possa d’un popoletto che potè
resistere a Carlo V padrone di due mondi; e mostrando come le
discordie fraterne avessero tutto mandato a ruina, invitava a giurare
eterna concordia. E concordia, risorgimento, Italia, èra nuova,
ripeteansi dappertutto; quasi le stesse persone dappertutto
ricomparivano; abbondando e declamazioni e tutto ciò che in politica
è inutile, nulla di ciò ch’è necessario ad una ricostruzione.
Appena a Roma fu concessa la guardia civica, i Toscani la
domandarono anch’essi, parendo, in quella tal fratellanza, male
assicurata la quiete e la proprietà da poche truppe e frolle. Il
granduca asserì non la darebbe mai, e presto dovette darla:
nell’editto rammemorava che «tutti gl’interessi sono impegnati
nell’ordine e nell’osservanza delle leggi; che le agitazioni anzichè
portare al progresso civile, cagionano discordie, ristagno
dell’industria e del commercio, perturbazione degl’interessi particolari
e generali, inducendo diffidenza e timore». Parole al vento: più di
ventimila persone andarono a ringraziare il principe fra canti e viva
chiassosissimi; dappertutto processioni, Tedeum, allocuzioni,
bandiere biancherosse, corone ai simulacri d’illustri antichi, ovazioni
al Niccolini pel suo Arnaldo da Brescia; i pezzi della catena rapita a
Porto Pisano e sospesa in trionfo a Firenze, sono staccati e rimessi a
Pisa.
In questa città si rinnova e maggiore il frastuono: Mayer economista,
Montanelli poeta, Centofanti filosofo fanno iscrizioni, arringhe, canti;
tra gli accorsi della provincia si ricambiano le bandiere, e preti e frati
a benedirle. A Livorno molto di più; donne vestite d’amazzoni
palleggiano le spade, vecchi gravi discorrono da collegiali, e fra i
mille cinquecento vessilli che quel giorno (8 7bre) sventolarono
sopra cinquantamila accorsi, grandeggiò il tricolore.
Ed ecco (giacchè ogni frivolezza era appiccagnolo) al domani
comparire due dei più vivi nelle dimostrazioni romane, il principe di
Canino e il suo segretario Masi improvvisatore, vestiti da guardia
nazionale romana; accolti spettacolosamente e tra infiammati
applausi del Guerrazzi al nipote di Napoleone, essi snudano e
incrociano le spade, invitando tutti a giurare la santa causa italiana.
Voleasi costringervi a fischi anche il Laugier, che sovrappose in fatti
la sua spada gridando «Viva Leopoldo II».
A Pisa ebbero nuovi trionfi, e la loro carrozza fu tirata da una schiera
di preti (12 7bre). Più misurati a Firenze: ma quivi si rinnovò la festa,
venendovi deputati da tutti i Comuni, e ventiquattromila guardie
civiche, e cinquanta bande musicali, e senza numero bandiere,
sciorinanti i Viva di moda. Sei milioni costò allo Stato il montare la
guardia civica, oltre lo speso dai particolari, che si pavoneggiavano in
quella, ed esercitavansi a cantar gl’inni, imparare la marcia e la
carica in dodici tempi; mentre nessuno arrolavasi alla milizia, per
quanto il Ministero vi esortasse; non che mantenere quiete, in ogni
villaggio istituivansi botteghe ove leggere giornali e spoliticare; i
tumulti cresceano, gli sgomenti ingrandivano, i capitali si ritiravano
dalla cassa di risparmio, ch’ebbe bisogno di sussidj del granduca; la
feccia montava su; la proprietà non era rispettata, nè la sicurezza
delle persone; «dall’umile castello di Castagneto nella maremma
pisana ascendendo a gradi fin alla capitale, non scorreva quasi
giornata senza nuovi tumulti» (Zobi); il commercio livornese
deperiva, perchè quella agitazione toglieva ai forestieri la sicurezza;
del che lamentandosi, i negozianti chiesero una commissione di
Polizia; e questa fu riguardata come vessatoria. La plebe cittadina,
erettasi sovrana, arrestava e insultava col titolo di traditore e di spia;
l’autorità violentata ne’ suoi strumenti, alternava parole
amorevolissime con provvedimenti rigorosi che lasciava senza
effetto; ogni concessione si considerava puro dovere, ogni freno una
tirannia, ogni indugio tradimento o vigliaccheria.
Il granduca nominò una consulta, e spiacque perchè tutta di persone
già in alti uffizj, e non rappresentava nè le ricchezze nè gl’ingegni
delle provincie. Si riforma la legislazione municipale, si nominano
commissarj per compilare il Codice civile e criminale: ma dacchè il
duca riconobbe che le leggi e gli ordinamenti sono viziosi, nessuno
più vuole osservarli; qualunque legge venga fuori è denigrata da
quelli che non furono convocati a discuterla; gl’impiegati dal far poco
mettonsi al far nulla, in attesa delle riforme. Del resto che forza
poteano questi avere quando tutto era sul mutarsi? e la circolare
ministeriale del 30 novembre 1847 poneva «i buoni impiegati e la
libertà nell’esercizio di loro attribuzioni sotto la salvaguardia
dell’onore e della forza de’ magistrati municipali, della guardia civica
e de’ buoni e savj cittadini che la componevano». Dolorosa
confessione d’impotenza!
Sentendo il disordine rigonfiare sotto la congiura degli applausi, chi
ne imputava i Mazziniani, chi i Buonaparte, chi la lega austro-
gesuitica, e nessuno le basse passioni e i codardi interessi. E noi,
testimonj e parte di que’ fatti, or che li ricorriamo, a fatica sappiamo
persuaderci come allora non si avvertissero o si scagionassero,
volendo soltanto scorgere gioja, fratellanza, tripudj, fiducia d’italica
rigenerazione, e guaj a chi credesse altrimenti.
Le maggiori speranze fabbricavansi su Carlalberto. Cominciò egli a
guastarsi coll’Austria quand’essa sui vini, ricchezza del Piemonte,
pose un dazio così gravoso, che equivaleva ad escluderli. Egli a
vicenda concesse alla Svizzera di trarre da Genova il sale che
l’Austria aveva il privilegio di somministrarle. Ne cominciarono
dissensi diplomatici; e poichè la patria, come la religione, non
conosce colpe inespiabili, bastò che Carlalberto mostrasse all’Austria
non il pugno ma il broncio, perchè venisse anch’egli idealizzato come
spada d’Italia, di cui Pio era la testa. I Piemontesi se ne esaltano,
con tono insolito si discute di dogane, si propone una società per lo
spaccio dei vini, si brinda ai conviti, si dilata la smania di far qualche
cosa, d’esser qualche cosa, di mostrarsi capaci per quando i tempi
verrebbero. A tale intento un’Associazione agraria ne’ suoi comizj
riproduceva in piccolo i congressi scientifici; le elezioni e la
presidenza davano origine a partiti, già caratterizzandosi gli
eccedenti e i moderati, i repubblicanti e i costituzionali: ma il re
troncò le quistioni col rendere carica di Stato la presidenza, e
affidarla al conte di Collobiano. Carlalberto, col solito intradue,
lasciava scrivere ma non favoriva gli scriventi; fa coniare una
bellissima medaglia, ove tra le effigie di grandi Italiani compare il
leone di Savoja straziante l’aquila, col motto J’attends mon astre, ma
la regala quasi di nascosto; lascia festeggiare Cobden, ma non
istampare i recitati discorsi; nè vuole si stampino quelli de’ comizj
agrarj a Casale; eppur colà manda al Castagneto una lettera ove
dice: — Che bel giorno quello in cui si griderà guerra per
l’indipendenza d’Italia! Io monterò a cavallo co’ miei figliuoli, e mi
porrò alla testa del mio esercito».
Fu la favilla in un pagliajo; gli s’inviò un indirizzo, e — Comandate, o
sire; non vi rattenga alcun riguardo pe’ vostri popoli: vita, averi
daremo per voi». Il bollore rigonfia, eppure Carlalberto nulla risolve;
ed egli comincia a temere che anche il suo popolo s’invogli dei
tumulti, il popolo a sospettare che il suo re lo meni per le buone
parole: raddoppia dunque gl’inni a Pio IX, ma mentre li canta a piena
gola sul passeggio degli spaldi, ecco a un tratto «da opposte parti
sboccare soldati, gendarmi, agenti di Polizia, con nude sciabole e
pistole inarcate, maltrattando, percotendo, insultando senza riguardo
uomini, donne, vecchi, fanciulli» [44] (30 8bre). Ultima velleità di
resistenza; poichè Carlalberto si trovò subito condotto a concedere
riforme amministrative; un tribunale di cassazione; pubblici
dibattimenti nelle cause criminali; allargata la stampa; la Polizia
passata dai governatori militari agl’intendenti; garantita la sicurezza
individuale; i municipj eletti a tempo non in vita; ripristinato il
ministero dell’interno; sostituito il merito all’anzianità e alla nobiltà
nelle promozioni militari.
Quasi avesse commesso un delitto, Carlalberto rinnova il decreto
contro gli assembramenti, e da Torino corre a Genova: ma vi è
ricevuto con un’esultanza chiassosissima; sventolava innanzi al
popolo la bandiera tolta il 1746 agli Austriaci, innanzi ai preti la
bandiera di Gioberti, e «Viva Gioberti» ripeteasi violentemente
presso al collegio de’ Gesuiti; e fu chi gridò amnistia, e tutti
l’echeggiarono; e fu chi gridò al re — Passa il Ticino e tutti ti
seguiremo»; e Carlalberto ai minacciosi omaggi impallidiva e taceva.
Ma più che a svolgere le riforme si pensava a incorniciarle
d’applausi: i giornali della media Italia intonavano ch’essi valevano
quanto un intero esercito; negli inesauribili pranzi faceano tirocinio
d’eloquenza i futuri oratori [45]; per le strade al pari che ne’ gabinetti
cantavasi che l’aquila d’Austria avea perduto le penne, che l’Italia s’è
desta, che ogni squilla sonò i vespri; a Genova nella festività de’
bicchieri mescolavansi patrizj e popolani per cantare inni; per un
pranzo esibito ai Torinesi, per una visita a Origina, smetteansi negozj
e affari; tutti voleano ragionacchiare di politica, tale credendo
soltanto quella del giorno e la energumena [46], tutti sbattere acqua
e sapone per farne bolle, tutti satollarsi d’applausi col secondare le
vulgarità, e discorrere e cantare della battaglia di Legnano,
dell’assedio di Parma, dell’insurrezione di Genova, del Procida, del
Balilla, d’Alessandro III; e vantare la potenza d’Italia, lo sfasciamento
de’ nemici, l’entusiasmo che la causa nostra ispirava a lutti i popoli; e
gonfiar panegirici, a cui capo metteasi sempre una calunnia; e con
errori calcolati e reticenze, dondolare ogni nome tra le ovazioni e le
sassate.
Le quistioni vitali offuscavansi in una quantità di giornali, fra cui
primeggiavano la Concordia di Valerio, il Risorgimento di Cavour e
Balbo, il Messaggiere di Brofferio, il Corriere mercantile del Papi. Una
commissione di censura pareva garantire e dalle trascendenze e
dagli arbitrj d’un giudice solo, ma a qual censore sarebbe bastato il
coraggio di levare una sillaba, quando sapeva che al domani sarebbe
messo alla gogna da tutti i giornali, forse fischiato per la via?
Prendeasi dunque spirito ad ogni eccesso: folliculari, nodriti di
rancori, servili e fatti audaci dalla paura, intimidivano i savj: di
patriotismo mascheravansi lo spionaggio e la manìa del far ridere
prima, poi far tremare: facile tema a tutti restava poi il bestemmiare
l’Austria, quasi non sia leggerezza insultare un nemico prima di
vincerlo, come ingenerosità il dileggiarlo vinto; tutto ciò senza
mettere la mano sui nemici e sui mali sentiti.
E poichè ciascuno volea rumoreggiare più dell’altro, avventandosi a
quel declamare tribunizio che più scalda quanto meno ha modestia e
riserbo, dalle riforme politiche si passava alle sociali, proclamavansi
dottrine comuniste, spiegavasi l’infelice coraggio della provocazione.
Oh Foscolo che, trent’anni prima, deploravi che i letterati fossero
ruina d’Italia! possano gl’Italiani aver imparato a sì caro prezzo se
con schiamazzi e giornali si rigenera una nazione.
Di quei che pensavano o se ne davano l’aria, alcuni metteano
importanza nell’ottenere qualcosa: ragionevole o no, buona o meno,
sarebbe scala ad altro, per via via elevarsi a quell’altezza che non si
osava confessare. Machiavellica, nella quale impigliaronsi presto
anche i principi, concedendo qualcosa colla fiducia di fermarsi a quel
poco, e disposti ad eluderlo. Altri però, meditando il passato,
cercavano trovarsi disposti alle grandi eventualità; e vedeano che, in
forme liberissime si può essere schiavo; che libertà non regge se non
con ragione, libero essendo l’uomo di cui si prevede quel che
opererà domani, non quello che bizzarramente cangia pensieri ed
atti; che il divario delle costituzioni consiste nell’essenza non nel loro
esterno; nè una sola può attagliarsi a tutti, dovendo elle dedursi da
ciò che un popolo è e fu, e da ciò che sono quelli che lo circondano;
trarsi insomma dalla natura, non dalla fantasia. Quei che a costoro
non poteano negare forza di ragione, li tacciavano di timidità di
cuore, perchè, vedendo il bene, asserivano che bisognasse
aspettarlo.
E d’aspettarlo aveasi grand’argomento quando tutti i principi italiani
si mostravano convinti dell’obbligo di migliorare la condizione de’
sudditi, se non col farli partecipi al potere, almeno nobilitandone
l’obbedienza; e consolidando il principato col fare da esso emanare i
miglioramenti, prima che il popolo li strappasse a forza. Ma mentre
moltiplicavansi apoteosi a Cobden, si applicava la dottrina opposta di
List, il quale aveva indotto gli Stati germanici a una lega doganale,
per natura sua esclusiva de’ popoli non consociati. Si parlò di una
lega italiana per togliere le infinite barriere doganali: era un atto
rilevantissimo, sì pel vantaggio economico della penisola sminuzzata,
sì per divergere l’attenzione sovra altro che mera politica, e
convincere i popoli che si pensava al loro meglio positivo.
«Persuasi che la vera e sostanziale base di un’unione italiana sia la
fusione degl’interessi materiali delle popolazioni che formano i loro
Stati», il papa, il re di Sardegna e il duca di Toscana fecero una
specie di preliminare: il duca di Modena non v’aderì, pure
prometteva libero passo pe’ suoi Stati interposti: il re di Napoli amò
sempre far casa da sè. Anche quest’opera potendo effettuarsi
soltanto dai principi, agli schiamazzanti non restava che arzigogolare
articoli e brindisi, e diceano: — L’Austria o non v’assente, ed eccola
riconoscersi straniera all’Italia; o vi annette l’unico suo Stato italiano,
ed ecco questo separato dagli altri dominj ereditarj».
Le nazioni, quanto più sono civili, maggior varietà di principj
contengono, la cui lotta costituisce la storia. Ma l’utopista o il
passionato suppongono un principio solo, quel che è conforme alle
inclinazioni proprie, gli altri dimentica, e vorrebbe dimenticati da
tutti; il vulgare non vede che un uomo, che un libro, che un giornale;
a quello sacrifica le proprie convinzioni, e spingesi agli estremi,
mentre i contrapposti domandano continue limitazioni per arrivare ad
accordi.
Pure bello e degno di studio fu quel momento. Neppure gli avventati
pensavano a impeto di atti, quando anche fossero impetuosissimi di
parole; violenza non era usata da nessuno, neppure dall’Austria, per
quanto accusatane e provocata; anzi neppur dalla piazza; e pareva
l’Italia venir incamminata al bene da’ principi in armonia co’ popoli,
dalle audacie giovanili accordate col senno de’ vecchi. In sì cara
illusione trasaliva essa di tripudj e banchetti; dimostrazioni e trionfi a
chiunque volesse buscarseli coi paroloni simpatici; le difficoltà o non
si vedeano, o pigliavansi a gabbo. Ma gl’inni di fratellanza, pregni di
collera e d’orgoglio, abbagliavano le menti, quando saria stato
bisogno e dovere di rischiararle: a Parma, nel festeggiare
l’anniversario dell’elevazione di Pio IX nacquero conflitti con percosse
e ferite di cittadini, sin d’una fanciulla di dieci anni, donde una fiera
indignazione: così a Piacenza, così a Modena, così a Milano, così a
Ferrara, dove fu trucidato il barone Barattelli; sicchè i giorni di
prestabilito applauso soleano riuscire a inaspettato compianto. Tutto
ciò mettea sull’avviso l’Austria, l’odio contro la quale era per
avventura l’unico sentimento comune della lirica italianità.
A gloria de’ principi italiani ricadevano anche le nuove sventure
dell’Austria; chè noi deploreremo sempre come sventuratissimo un
Governo costretto a ristabilire l’ordine colla fierezza. Da qualche
tempo le teoriche liberali erano trascese in socialismo. Mentre i
Liberali dicevano, — L’uomo è buono, cattivo è il Governo, bisogna
riformarlo»; i Socialisti dicevano, — Cattiva è la società, bisogna
rifonderla; quanto finora si tenne per bene fu male, e il male bene;
le passioni sono naturali e perciò buone, onde il reprimerle non è
virtù; dunque ogni Governo è tirannia, ogni soggezione è schiavitù,
paradiso unico è la terra; libertà, eguaglianza, fraternità non possono
combinarsi colla superstizione cristiana; onde bisogna rimuoverla, e
ripudiare l’esperienza di tanti secoli per improvvisare qualcosa di
meglio».
Gli elementi della società si tengono talmente connessi, che non si
può eliminarne uno senza scomporre tutto; negata l’antitesi del bene
e del male, vien dietro l’unità, vale a dire il panteismo nella fede, il
despotismo ne’ Governi; posta l’eguaglianza di tutti gli uomini sia nel
comandare sia nell’obbedire, più non rimangono nè nazionalità nè
monarchia, niun limite deve porsi alle passioni, niuno all’esercizio
dell’attività, niuna distinzione di tuo e di mio, e la proprietà sarà
furto. Da qui la forma sua più popolare, il comunismo, il quale
rinnega e la famiglia e i possessi, volendo che tutti abbiano diritto a
tutto, chi non lavora possa partecipare ai guadagni di chi lavora.
L’inestinguibile ira del povero contro il ricco s’incalorì di queste
teoriche, predicate colla storditaggine giornalistica; e mentre in
Francia scavavano ridendo un gorgo dove ben tosto s’inabisserebbe
l’ordine sociale, ne’ paesi slavi incitò le popolazioni servili contro i
signori. La Gallizia nell’iniquo sbrano della Polonia era toccata
all’Austria, la quale cercò emanciparvi i possessi, abolire il servaggio,
eguagliare ogn’uomo in faccia alla legge: di ciò l’odiavano i signori,
quasi ella attentasse ai privilegi loro; mentre il vulgo la considerava
tutrice delle sue giustizie. Quando ogni assurdo credeasi, si credette
che il Governo austriaco, per umiliare i ricchi, aizzasse i poveri.
Il fatto è che i villani sollevatisi saccheggiarono, scannarono,
vituperarono i ricchi. La forza armata, corti marziali, esecuzioni feroci
repressero una feroce insurrezione; gli orrori di cui erasi contaminato
il manto matronale di Maria Teresa, offuscarono il titolo di buono che
Ferdinando aveva meritato. In Gallizia governò Massimiliano d’Este
arciduca, buon soldato e intollerante, che si fece detestare più per
despotismo che per animo ribaldo; tutta Europa ne fremette contro
quegli strazj, che parvero mettere l’Austria al bando delle nazioni
civili.
Ne trasse profitto la Russia, da un pezzo affaccendata a propagare il
panslavismo, cioè la nazionalità di tutti gli Slavi, proponendo di
toglierli alla Prussia, all’Austria, alla Turchia, per farne sotto il suo
scettro un popolo di ottanta milioni, che avrebbe signoreggiata tutta
Europa. E fu dalla Russia appunto che venne lanciata primamente
questa parola di nazionalità, che accettata per imitazione, doveva
essere favilla di tanti incendj [47].
Risonò essa anche in Germania. Un aggregato di genti diversissime
d’origine e di civiltà non potea che essere spinto all’abisso dalla
proclamazione della nazionalità; e il ministro Metternich, il quale
erasi ostinato a non toccar nessuna pietra per tema di sconnettere
l’intero edifizio, e fin allora le difficoltà avea superate all’esterno colla
prevalenza dell’esercito e dentro coi sopratieni, sentivasi impotente
ai nuovi urti, e vacillava ne’ proprj consigli. «Abbiamo attraversati
(scriveva a Radetzky) giorni difficili, richiesero grandi sforzi, eppure
non furono tristi quanto gli odierni. Lottare contro i corpi sappiamo
noi, ma contro larve che vale? e larve appunto abbiamo di fronte:
era nei fati che al mondo comparisse perfin un papa
liberaleggiante» [48].
L’umiliazione della gran nemica rimoveva dai principi italiani la paura
di esser impediti nelle riforme, ma vedeano la necessità di non
porgerle pretesti a prender l’offensiva [49]; cingerla bensì di paesi ben
organati, dopo una regolare trasformazione del diritto interno, che
speravasi condotta per la via della conciliazione.
L’applauso ai principi riformatori s’ingrossava delle imprecazioni
lanciate allo straniero, che ben avea ragione di sgomentarsi: e
pertanto la posizione dell’Italia diventava soggetto anche di trattati e
dispute fra gli stranieri. Francia limitavasi a dar coraggio ai principi,
fiducia ai popoli; ma a questi e a quelli facea dire non uscissero dalle
vie pacifiche, non isperassero rimpasto territoriale [50]. In Inghilterra
il ministro Palmerston sorrideva al risorgimento italiano, lanciando
frasi a guisa di cavaliero che dà di sprone al cavallo, ma intanto ne
serra il freno. Ma Metternich vi ravvisava la radicale sovversione della
società, una frenesia rivoluzionaria, un passo alla repubblica
federativa. E alle Corti amiche trasmise (agosto) un memorandum,
ove esprimeva «l’Italia essere un nome geografico; de’ suoi Stati
sovrani e indipendenti, l’esistenza e la circoscrizione fondasi su
principj di diritto pubblico generale, corroborati da accordi politici
incontestabili; l’imperatore è deciso a rispettarli, nè cerca di là di
quanto possiede, e lo saprà difendere»: chiedea che le Potenze glielo
garantissero di nuovo, e dessero mano a soffogare un incendio, che
presto diverrebbe irrefrenabile. I Gabinetti, consentendo nel primo
punto, voleano però che ogni Stato potesse riformarsi nell’interno,
senza che altri se ne brigasse [51].
E cercò trar la quistione sul campo dov’era certamente superiore, la
forza, ed occupò Ferrara come necessaria alla sua sicurezza: ma la
dignitosa protesta del papa, efficace come ogni parola ferma
appoggiata sul diritto, lo costrinse a ritirarsi, e comprendere che non
era tempo di violenze.
Ma se non aveasi a temere la forza armata del nemico, ve n’ha
un’altra del pari tirannesca, quella dei vulghi dotti e ignoranti; e già
la si sentiva pigliare il sopravvento in iscritti violenti d’ira o
nauseabondi di lodi, ove gente avvezza sin allora a giudicar di
ballerine e di cantanti, sentenziava di politica e moveva le chiassate
di piccola turba cittadina, usurpante il sacro nome di popolo. E
poichè i siffatti han bisogno d’attaccarsi a grandi reputazioni per
roderle o per carezzarle, agli applausi di moda innestarono la moda
di esecrazioni, e non più contro il comune nemico, ma contro nostri;
non si esaltavano Pio IX, Carlalberto, Leopoldo riformatori, e Gioberti
ed altri italianissimi, che non s’imprecasse al re di Napoli sanguinario
e ai Gesuiti; e gesuita era l’emulo, l’avversario, il rivale, l’invidiato, il
benefattore; e Metternich guatava e diceva: — Gli Italiani fortunati
s’invidieranno, sfortunati si malediranno, discordi sempre o vincitori o
vinti».
Il riformare è una delle opere più difficili ad uomo di Stato, quanto
pare leggiero ad uomo di partito, il quale movendo da un’idea
assoluta, arriva necessariamente a cambiamento radicale. Se v’è
paese dove questo passaggio sia inevitabile, vuol dire che inevitabile
v’era la rivoluzione: e tale appariva in Italia. Pio IX, quantunque
gioisse di quella popolarità senza pari, si impauriva dell’accelerantesi
movimento, che mal dissimulava di separare il gran sacerdote dal
principe riformatore [52]. Già nell’istituire un patriarca a
Gerusalemme, egli protestò contro l’abusarsi del nome suo come
opposizione alle autorità; encomiava la Compagnia di Gesù come
sopra tutt’altre benemerita della religione; aprendo poi la consulta di
Stato (4 8bre), dichiarò avere fatto e voler fare quel che credea vero
bene, ma non mettere a repentaglio la sovranità della santa Sede
con istituzioni incompatibili con questa.
Coloro che delle benedizioni di Pio IX voleano fare carica da cannoni,
non si smarrivano a tali dichiarazioni, e le diceano tributi alle
esigenze straniere. Sopraggiungevano poi casi che complicavano
sempre più la situazione. Francesco IV di Modena era morto (1846 1
genn.), e suo figlio avea secondato l’opinione nel liberare i detenuti
politici; limitò a venti giorni al più le pene correzionali, congedò il
Riccini odiato ministro di Polizia, e moderò le esorbitanze.
A Lucca l’infante continuava a gravarsi di debiti, sicchè il granduca,
destinato a succedergli, dichiarò non li riconoscerebbe più, e volle
come sicurtà la rendita delle dogane e delle regalie. Anche in quella
città erano avvenute le scene stesse che in Toscana; tra le canzoni si
assalirono i carabinieri, e perchè si difesero, furono imputati di
assassini (1847 luglio). Il duca alzò la voce contro, queste «frasi di
letterati ed esaltamenti di scolari», e assicurava voler mantenere la
sua monarchia quale l’avea ricevuta, piccola sì ma assoluta.
A dire propriamente, egli l’avea ricevuta costituzionale dagli
spartipopoli del congresso di Vienna; e Luigi Fornaciari, tutto dedito
a studj di filologia e di beneficenza, gli scrisse per rammentarglielo, e
per mostrare quanto complirebbe al popolo e al principe l’avere uno
statuto. In risposta fu destituito da consigliere di Stato e preside
della rota criminale, e se n’andò in trionfale esiglio. I rumori
crescono, e quei plausi che sgomentavano i principi come poco poi le
campane a martello; si arrestano alquanti giovani, ma bisogna
rilasciarli; finchè il duca, tediato de’ complicantisi casi, abdica (8bre),
anticipando così l’accessione di quel ducato alla Toscana.
Lucca diventava città secondaria in quella Toscana, di cui ai tempi
Longobardi era stata capo: atteso però gli applausi allora di moda
verso il granduca, il sagrifizio fu accettato con ilarità. Ma secondo le
stipulazioni viennesi, il Pontremoli dovea unirsi al Parmigiano;
mentre i distretti lunesi di Fivizzano, Pietrasanta e Barga erano
destinati al duca di Modena. Adunque nella strepitosissima festa
allora combinata, ecco apparire lo stendardo bruno dei Lunigiani che
ricusano cadere sotto al duca di Modena. I calorosi di Firenze e di
Lucca gridano di non volere staccarsi da que’ loro fratelli, non
foss’altro per far onta all’Austria; ma il duca di Modena manda
soldati ad occuparli.
I Lunesi si difendono, e nella collisione (4 9bre) perdesi qualche vita;
si protesta, s’invoca la mediazione del papa e di Carlalberto; pure il
duca di Modena conserva il suo possesso, sol per accordo
amichevole (17 xbre) lasciando al granduca il Pontremoli finchè non
muoja Maria Luigia. Ed ecco appunto Maria Luigia muore; Carlo
Lodovico di Borbone diviene duca di Parma e di Piacenza; ed anche
Pontremoli cessa d’appartenere alla famiglia toscana, mentre questa
aggiungeva allora cendiciotto miglia di terreno alle sue ottomila e
ventiquattro. A Lucca, tolta l’autonomia, fu conceduta una corte
d’appello: ma Pisa pretende sia messa sotto la sua giurisdizione,
onde zizzanie, proteste, tumulti; perchè in que’ giorni ogni incidente
prendeva l’importanza d’un gran fatto, e diveniva occasione
d’affratellamenti o accozzaglie, ire od applausi; arti colle quali si
credea conquistare la libertà e l’indipendenza, e intanto il vero vinto
era l’autorità pubblica e la pubblica quiete; e gli amici sodi d’Italia
sentivano un cupo rombo ruggire sotto agli applausi [53].
In fatti al cominciare del 1848 Livorno era in effervescenza, perchè
tardasse a giungere il decreto per la guardia civica, come necessaria
a difendersi dai Tedeschi; l’autorità è costretta ogni tratto a
parlamentare colla turba, e non avendo soldati a reprimerla, dee
scendere a patti coi tumultuanti, e così perde ogni valor morale. Un
proclama diceva: — Toscani! Davanti alla vostra coscienza, alla faccia
del mondo, alla storia, voi spontanei offriste vite e sostanze per
sostenere i fratelli vostri di Fivizzano e di Pontremoli: eppure
Fivizzano fu abbandonato, Pontremoli s’abbandona. Spergiuri, perchè
avete giurato? millantatori, perchè vi siete vantati? codardi, perchè vi
mostraste generosi? Eh via queruli schiavi, imparate a dormire
tranquilli nel letto della vostra viltà... O ministri, voi siete traditori: lo
siate per perversità o per inettezza, la conseguenza torna sempre la
stessa. Sgombrate, traditori e codardi; sgombrate arcadi, sofisti,
dottrinarj! I destini d’un popolo sono troppo peso per le vostre mani
da eunuchi e da omicciattoli. La patria è in pericolo! Ora sapete
come si fa a salvarla, o Toscani? si chiamano uomini che non temano
morire, e si pongono volenti o repugnanti al timone dello Stato
d’accordo col principe; si dichiara la patria in pericolo. Così si salva la
patria, e se non si vince, si muore onorati e si lascia celebrità di
nome, legato di vendetta ai figliuoli, esempio di gloria ad imitare ai
popoli! Toscani, la patria è in pericolo! Questo grido, se sarà
soffocato dai traditori, serva almeno per far conoscere che non tutti
fra i Toscani furono vili, ignoranti ed inetti, e la infamia ricada a cui
tocca».
Questo cartello incendiario buttato fra popolo sì mite,
quest’inoculazione di rabbie civili fatta per retorica amplificazione,
furono il trabocchetto delle nostre sorti. Si credette vedere in fiamme
il paese, e l’autorità e la gente d’ordine presero sbigottimento: le
comunità spedirono indirizzi al principe offrendo denaro e sangue
contro la ruggente ribellione, ed esacerbando il male coll’imputare i
Livornesi e singole persone. I giornalisti al solito incancrenivano la
ferita. E il popolo prorompe (6 genn.), nè v’ha modo a calmarlo, per
quanto Leopoldo assicuri non esservi pericoli; vi fossero, e’ gli
affronterebbe e vincerebbe, risoluto com’era a compire le riforme, le
quali però non si poteano senza la pace: e raccomandava la
tranquillità di Firenze, di Lucca, di Pisa alla guardia civica. Ma una
deputazione Livornese che chiedeva armi, armi, si fa deliberante e
accusa il Governo; fin gli apostoli della Giovane Italia, i quali
assicuravano che «il sangue de’ martiri di questa era stato non meno
prezioso de’ nostri inchiostri» [54], si affrettavano a disapprovare que’
moti e separare la causa loro dalla setta livornese. Ripreso il
sopravvento, Guerrazzi e alcuni altri son condotti a Portoferraio tra i
fischi della plebe, che jeri ne facea l’apoteosi.
Qui nuovi accidenti mutano carattere al movimento italiano.
Sponemmo già le condizioni del Napoletano, paese di così splendido
avvenire e di presente così tenebroso. L’aspirazione nazionale per cui
febbricitava la restante Italia, non erasi comunicata ai Siciliani,
ricordevoli dei Normanni, degli Svevi, dell’antico loro Parlamento e
della prosperità che alcun tempo vi produsse la ingerenza inglese;
prosperità derivata da condizioni eccezionali, com’era il trovarsi ivi
solo pace fra le guerre napoleoniche, ivi fra il blocco continentale
uno scalo al contrabbando britannico, che vi mandava per
cencinquanta milioni annui. La costituzione del 1812, data sotto gli
auspizj inglesi, lasciò intatte la feudalità, le moltissime manimorte, le
primogeniture, gli altri mali su cui una rivoluzione può passare la
spugna inzuppata di sangue, mentre un Governo regolare, comechè
ben ispirato, non le abolisce che passo passo.
L’Inghilterra si era fatta garante di quella costituzione; ma
Ferdinando I non vi badò; crebbe l’imposta, che prima era fissata in
annue onze 1,287,687, nè più convocò il Parlamento. Di qui odio
mortale contro la Casa regnante; e guardare i Napoletani come
stranieri e oppressori; e non badare all’Italia, bensì a recuperare la
costituzione del 1812. Il principe di Castelnuovo legò ventimila onze
all’uomo di Stato che indurrebbe il re a riconoscerla; il principe di
Villafranca vecchione non cessava di protestare in questo senso; in
questo andavano molti libri. Il Lanza, nelle Considerazioni sulla storia
del Botta, repugna deciso all’unione col Napoletano, preferisce al
regno di Carlo III quel di Vittorio Amedeo perchè lontano, e lascia
«ad altri la perniciosa chimera dell’italica unione, nella quale, per
maggiore danno dell’Italia medesima, sono caduti gl’inesperti e i mal
accorti, presi dalle grida di novatori» (pag. 421). Michele Amari,
descrivendo la guerra del Vespro Siciliano, sentenzia di stranieri
Giovanni da Procida e Ruggero di Loría, spogliandoli dell’aureola
tradizionale per cingerla al popolo siciliano [55]. Palmieri storiò la
costituzione siciliana in senso dell’aristocrazia e con allusioni
mordenti.
L’isola realmente non avea più Corte nè ministeri come all’età
normanna, pure era trattata con favori eccezionali; non bollo di
carta, non privativa di tabacchi, non coscrizione; ma anche
pochissime istituzioni, cattive strade e gli sconcj d’un Governo
lontano. Chi vedesse quell’isola, già granajo d’Italia, ora stremata di
popolazione, sparsa di ruine, con immense campagne incolte e
impaludite, ed altre non pascolate che da meschini branchi di
pecore; chi vi paragoni la spigliatezza degli ingegni, il loro amor di
patria, la risoluta volontà del meglio augurava il momento ch’ella
tornasse centro al commercio del Mediterraneo, e provveditrice alle
navi dirette all’estremo Oriente. Ma l’imputare tutti i mali al Governo
era giusto?
Vedemmo i Siciliani non essersi voluti affratellare alla rivoluzione
napoletana del 1821, così accelerandone il crollo. Le riazioni seguite
ne infistolivano le piaghe; e sebbene Ferdinando II, ch’era nato in
Sicilia, professasse volerle medicare, troppo erano inveterate perchè
il buon volere bastasse. Egli vi destinò vicerè il conte di Siracusa suo
fratello, dal che nacquero speranze volesse farlo re indipendente: ma
poi Ferdinando vi surrogò lo svizzero Tschudi (1835). Se ne
invelenirono gli odj, e di tutto si facea dimostrazione, dell’arrivo d’un
magistrato, di una festa messinese, della morte di Bellini; lo
scontento, fomentato dai nobili, dal clero, dai Gesuiti, talora
prorompeva, specialmente nel 37 in occasione del cholera (t. xiii, p.
415). Compressa fieramente la sollevazione, si cassarono il ministero
distinto, che erasi istituito nel 33, l’amministrazione speciale, le
giurisdizioni patrimoniali, la feudalità; insieme si decretarono
trentaquattro strade, nuovo catasto, lo spartimento delle terre
demaniali fra i poveri: ma i decreti erano mal eseguiti; poi qualunque
provvedimento venisse da Napoli era sgradito; il re, andatovi in
persona nel 42, vi fu accolto mutamente; ogni umiliazione di lui
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like