0% found this document useful (0 votes)
4 views

Introduction to Dependent Types with Idris: Encoding Program Proofs in Types 1st Edition Boro Sitnikovski instant download

The document is an introduction to the book 'Introduction to Dependent Types with Idris: Encoding Program Proofs in Types' by Boro Sitnikovski, which covers dependent types and their application in programming and proofs. It includes a detailed table of contents outlining various chapters on formal systems, mathematical logic, type theory, programming in Idris, and proving in Idris. The book is intended for novices and is designed to be self-contained, requiring no prior programming experience.

Uploaded by

neicialcik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Introduction to Dependent Types with Idris: Encoding Program Proofs in Types 1st Edition Boro Sitnikovski instant download

The document is an introduction to the book 'Introduction to Dependent Types with Idris: Encoding Program Proofs in Types' by Boro Sitnikovski, which covers dependent types and their application in programming and proofs. It includes a detailed table of contents outlining various chapters on formal systems, mathematical logic, type theory, programming in Idris, and proving in Idris. The book is intended for novices and is designed to be self-contained, requiring no prior programming experience.

Uploaded by

neicialcik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Introduction to Dependent Types with Idris:

Encoding Program Proofs in Types 1st Edition


Boro Sitnikovski download

https://ebookmeta.com/product/introduction-to-dependent-types-
with-idris-encoding-program-proofs-in-types-1st-edition-boro-
sitnikovski-2/

Download more ebook from https://ebookmeta.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!

Introduction to Dependent Types with Idris: Encoding


Program Proofs in Types 1st Edition Boro Sitnikovski

https://ebookmeta.com/product/introduction-to-dependent-types-
with-idris-encoding-program-proofs-in-types-1st-edition-boro-
sitnikovski/

Gentle Introduction to Dependent Types With Idris 1st


Edition Boro Sitnikovski

https://ebookmeta.com/product/gentle-introduction-to-dependent-
types-with-idris-1st-edition-boro-sitnikovski/

Introducing Software Verification with Dafny Language:


Proving Program Correctness 1st Edition Boro
Sitnikovski

https://ebookmeta.com/product/introducing-software-verification-
with-dafny-language-proving-program-correctness-1st-edition-boro-
sitnikovski/

Mountain Landscapes in Transition Effects of Land Use


and Climate Change 1st Edition Udo Schickhoff R B Singh
Suraj Mal

https://ebookmeta.com/product/mountain-landscapes-in-transition-
effects-of-land-use-and-climate-change-1st-edition-udo-
schickhoff-r-b-singh-suraj-mal-2/
Notes on Hamiltonian Dynamical Systems 1st Edition
Antonio Giorgilli

https://ebookmeta.com/product/notes-on-hamiltonian-dynamical-
systems-1st-edition-antonio-giorgilli/

Lost Feather The Forgotten Angel Book 1 1st Edition


Merri Bright

https://ebookmeta.com/product/lost-feather-the-forgotten-angel-
book-1-1st-edition-merri-bright/

The Event of Music History 1st Edition J.P.E. Harper-


Scott

https://ebookmeta.com/product/the-event-of-music-history-1st-
edition-j-p-e-harper-scott-2/

Summary of At the Edge of the Orchard by Tracy


Chevalier Instaread

https://ebookmeta.com/product/summary-of-at-the-edge-of-the-
orchard-by-tracy-chevalier-instaread/

Academic writing A Handbook for International Students


5th Edition Bailey

https://ebookmeta.com/product/academic-writing-a-handbook-for-
international-students-5th-edition-bailey/
A Travel Guide to the Seven Kingdoms of Westeros 1st
Edition Daniel Bettridge

https://ebookmeta.com/product/a-travel-guide-to-the-seven-
kingdoms-of-westeros-1st-edition-daniel-bettridge/
Introduction to
Dependent Types
with Idris
Encoding Program
Proofs in Types

Boro Sitnikovski
Introduction to Dependent Types with Idris: Encoding Program Proofs
in Types
Boro Sitnikovski
Skopje, North Macedonia

ISBN-13 (pbk): 978-1-4842-9258-7 ISBN-13 (electronic): 978-1-4842-9259-4


https://doi.org/10.1007/978-1-4842-9259-4
Copyright © 2023 by Boro Sitnikovski
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Celestin Suresh John
Development Editor: James Markham
Coordinating Editor: Mark Powers
Copy Editor: Kezia Endsley
Cover designed by eStudioCalamar
Cover image by Stephanie Mulrooney on Unsplash (www.unsplash.com)
Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY
10004, U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected],
or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member
(owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance
Inc is a Delaware corporation.
For information on translations, please e-mail [email protected]; for
reprint, paperback, or audio rights, please e-mail [email protected].
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is
available to readers on GitHub (https://github.com/Apress). For more detailed information,
please visit http://www.apress.com/source-code.
Printed on acid-free paper
Dedicated to my wife Dijana and our kids
Table of Contents
About the Author���������������������������������������������������������������������������������ix

About the Technical Reviewers�����������������������������������������������������������xi

Acknowledgments�����������������������������������������������������������������������������xiii

Preface�����������������������������������������������������������������������������������������������xv

Introduction��������������������������������������������������������������������������������������xvii

Chapter 1: Formal Systems������������������������������������������������������������������1


1.1. MU Puzzle Example����������������������������������������������������������������������������������������3

Chapter 2: Classical Mathematical Logic���������������������������������������������7


2.1. Hierarchy of Mathematical Logic and Definitions������������������������������������������7
2.1.1. Propositional Logic��������������������������������������������������������������������������������8
2.1.2. First-order Logic����������������������������������������������������������������������������������11
2.1.3. Higher-order Logic�������������������������������������������������������������������������������13
2.2. Set Theory Abstractions�������������������������������������������������������������������������������15
2.3. Substitution and Mathematical Proofs���������������������������������������������������������20
2.3.1. Proofs by Truth Tables��������������������������������������������������������������������������22
2.3.2. Three-column Proofs���������������������������������������������������������������������������23
2.3.3. Formal Proofs��������������������������������������������������������������������������������������25
2.3.4. Mathematical Induction�����������������������������������������������������������������������29

v
Table of Contents

Chapter 3: Type Theory�����������������������������������������������������������������������31


3.1. Lambda Calculus������������������������������������������������������������������������������������������35
3.1.1. Term Reduction������������������������������������������������������������������������������������37
3.2. Lambda Calculus with Types������������������������������������������������������������������������40
3.3. Dependent Types������������������������������������������������������������������������������������������43
3.4. Intuitionistic Theory of Types�����������������������������������������������������������������������46
3.4.1. Intuitionistic Logic�������������������������������������������������������������������������������49

Chapter 4: Programming in Idris��������������������������������������������������������51


4.1. Basic Syntax and Definitions�����������������������������������������������������������������������52
4.1.1. Defining Functions�������������������������������������������������������������������������������52
4.1.2. Defining and Inferring Types����������������������������������������������������������������54
4.1.3. Anonymous Lambda Functions������������������������������������������������������������59
4.1.4. Recursive Functions����������������������������������������������������������������������������61
4.1.5. Recursive Data Types��������������������������������������������������������������������������64
4.1.6. Total and Partial Functions������������������������������������������������������������������66
4.1.7. Higher-Order Functions�����������������������������������������������������������������������68
4.1.8. Dependent Types���������������������������������������������������������������������������������70
4.1.9. Implicit Parameters�����������������������������������������������������������������������������72
4.1.10. Pattern-Matching Expressions����������������������������������������������������������74
4.1.11. Interfaces and Implementations��������������������������������������������������������75
4.2. Curry-Howard Isomorphism�������������������������������������������������������������������������77
4.3. Quantitative Type Theory������������������������������������������������������������������������������78

Chapter 5: Proving in Idris������������������������������������������������������������������81


5.1. Weekdays�����������������������������������������������������������������������������������������������������82
5.1.1. First Proof (Auto-Inference)�����������������������������������������������������������������83
5.1.2. Second Proof (Rewrite)������������������������������������������������������������������������84
5.1.3. Third Proof (Impossible)�����������������������������������������������������������������������87

vi
Table of Contents

5.2. Natural Numbers������������������������������������������������������������������������������������������88


5.2.1. First Proof (Auto-Inference and Existence)������������������������������������������89
5.2.2. Second Proof (Introduction of a New Given)����������������������������������������90
5.2.3. Third Proof (Induction)�������������������������������������������������������������������������91
5.2.4. Ordering�����������������������������������������������������������������������������������������������94
5.2.5. Safe Division����������������������������������������������������������������������������������������95
5.2.6. Maximum of Two Numbers������������������������������������������������������������������97
5.2.7. List of Even Naturals�������������������������������������������������������������������������100
5.2.8. Partial Orders�������������������������������������������������������������������������������������104
5.3. Computations as Types������������������������������������������������������������������������������105
5.3.1. Same Elements in a List (Vector)�������������������������������������������������������106
5.3.2. Evenness of Numbers������������������������������������������������������������������������109
5.4. Trees�����������������������������������������������������������������������������������������������������������110
5.4.1. Depth�������������������������������������������������������������������������������������������������111
5.4.2. Map and Size�������������������������������������������������������������������������������������113
5.4.3. Length of Mapped Trees��������������������������������������������������������������������114

Conclusion����������������������������������������������������������������������������������������117

Further Reading��������������������������������������������������������������������������������119

Appendix A: Writing a Simple Type Checker in Haskell��������������������121

Appendix B: Theorem Provers����������������������������������������������������������129

Appendix C: IO, Codegen Targets, Compilation, and FFI��������������������137

Appendix D: Implementing a Formal System�����������������������������������149

Index�������������������������������������������������������������������������������������������������153

vii
About the Author
Boro Sitnikovski has over ten years of experience working professionally
as a software engineer. He started programming using the Assembly
programming language on an Intel x86 at the age of ten. While in high
school, he won several prizes for competitive programming.
He is an informatics graduate; his bachelor’s thesis was titled
“Programming in Haskell Using Algebraic Data Structures,” and his
master’s thesis was titled “Formal Verification of Instruction Sets in Virtual
Machines.” He has also published papers on software verification. Other
research interests include programming languages, mathematics, logic,
algorithms, and writing correct software.
He is a strong believer in the open-source philosophy and contributes
to various open-source projects.
In his spare time, he enjoys time with his family.

ix
About the Technical Reviewers
Nathan Bloomfield holds a PhD in algebra from the University of Arkansas
and taught mathematics before joining Automattic, Inc. as a programmer.
He enjoys witnessing the intuitionist renaissance and likes how the
boring parts of abstract algebra transform into really interesting computer
science. Nathan usually feels a little out of his depth and prefers it that way.

Neil Mitchell is a Haskell programmer with a PhD in Computer Science


from York University, where he worked on making functional programs
shorter, faster, and safer. Neil is the author of popular Haskell tools such
as Hoogle, HLint, and Ghcid—all designed to help developers write good
code quickly. More recently, Neil has been researching build systems with
publications at ICFP and the Haskell Symposium, and a practical system
based on those ideas named Shake.

Marin Nikolovski works at Massive Entertainment | A Ubisoft Studio as


a senior web developer on UPlay PC. He has over ten years of experience
designing, developing, and testing software across a variety of platforms.
He takes pride in coding to consistently high standards and constantly tries
to keep up with the latest developments in the IT industry.

Vlad Riscutia is a software engineer at Microsoft working on Office. He is


interested in programming languages and type systems, and how these can
best be leveraged to write correct code.

xi
Acknowledgments
Special thanks to the Haskell community (#haskell@freenode), the Idris
community (#idris@freenode), and the Coq community (#coq@freenode).
Thanks to my family, coworkers, and friends for all the support they
give me.
Finally, thank you for purchasing this book! I hope that you will learn
new techniques in reading this book and that it will spark interest in logic,
dependent types, and type theory.

xiii
Preface
This book aims to be accessible to novices who have no prior experience
beyond high school mathematics. Thus, this book is designed to be
self-­contained. No programming experience is assumed. However, having
some kind of programming experience with the functional programming
paradigm will make things easier to grasp in the beginning. After you finish
reading the book, I recommend that you check the “Further Reading”
section if you are interested in diving deeper into some of the topics
discussed.
I have always been curious about understanding how things work. As a
result, I became very interested in mathematics while I was in high school.
One of the reasons for writing this book is that I could not find a book that
explained how things work, so I had to do a lot of research on the Internet
through white papers, forums, and example code in order to come up
with a complete picture of what dependent types are and what they are
good for.
I will consider this book successful if it provides you with some
additional knowledge. I tried to write this book so that the definitions
and examples provided in it show how different pieces of the puzzle are
connected.
Feel free to contact me at [email protected] for any questions you
might have, and I will do my best to answer. You can also access my blog at
bor0.wordpress.com to check out some of my latest work.

xv
Introduction
Writing correct code in software engineering is a complex and expensive
task, and too often our written code produces inaccurate or unexpected
results. There are several ways to deal with this problem. In practice, the
most common approach is to write tests, which means that you are writing
more code to test your original code. However, these tests can only detect
problems in specific cases. As Edsger Dijkstra noted, “testing shows the
presence, not the absence of bugs.” A less common approach is to find
a proof of correctness for your code. A software proof of correctness
is a logical proof that the software is functioning according to given
specifications. With valid proofs, you can cover all possible cases and be
more confident that the code does exactly what it was intended to do.
Idris is a general-purpose functional1 programming language that
supports dependent types. The features of Idris are influenced by Haskell,
another general-purpose functional programming language. Thus, Idris
shares many features with Haskell, especially in the part of syntax and
types, where Idris has a more advanced type system. There are several
other programming languages that support dependent types2; however,
I chose Idris for its readable syntax.
The first version of Idris was released in 2009. It is developed by The Idris
Community and led by Dr. Edwin Brady. Seen as a programming language,
it is a functional programming language implemented with dependent
types. Seen as a logical system, it implements intuitionistic type theory,
which I cover later. Finally, Chapter 4 shows how these two views relate.

1
The core concept of functional programming languages is a mathematical
function.
2
Several other languages with dependent types support are Coq, Agda, Lean.

xvii
Introduction

Idris allows you to express mathematical statements. By mechanically


examining these statements, it helps you find a formal proof of a program’s
formal specification.
To fully explain how proofs in Idris work, the book starts with the
foundations by defining formal systems, classical mathematical logic,
lambda calculus, intuitionistic logic, and type theory (which is a more
“up-­to-­date” version of classical mathematical logic).

xviii
CHAPTER 1

Formal Systems
Before you can construct proofs of correctness for software, you need to
understand what a proof is and what it means for a proof to be valid. This
is the role of formal systems. The purpose of formal systems is to let you
reason about reasoning—to manipulate logical proofs in terms of their
form, rather than their content. This level of abstraction makes formal
systems powerful tools.

Definition 1 A formal system is a model of abstract


reasoning. A formal system consists of:
1. A formal language that contains:
1. A finite set of symbols, which can be combined
into finite strings called formulas.
2. Grammar, which are rules that tell which
formulas are “well-formed.”
2. A set of axioms, which are formulas that we
accept as “valid” without justification.
3. A set of inference rules, which tell us how we can
derive new, valid formulas from old ones.

© Boro Sitnikovski 2023 1


B. Sitnikovski, Introduction to Dependent Types with Idris,
https://doi.org/10.1007/978-1-4842-9259-4_1
Chapter 1 Formal Systems

Inside a given formal system, the grammar determines which formulas


are syntactically sensible, while the inference rules govern which formulas
are semantically sensible. The difference between these two is important.
For example, if the English language is a (very complicated!) formal
system, the sentence “Colorless green ideas sleep furiously” is syntactically
valid (since different parts of speech are used in the right places), but is
semantically nonsense.
After a formal system is defined, other formal systems can extend it.
For example, set theory is based on first-order logic, which is based on
propositional logic that represents a formal system. The next chapter
briefly covers this theory.

Definition 2 For a given formal system, a system is


incomplete if there are statements that are true but cannot be
proven to be true inside that system. Conversely, a system is
complete if all true statements can be proven.

The statement, “This statement is not provable” can either be true or


false. When it is true, it is not provable. Alternatively, when it is false, it is
provable, but you’re trying to prove something false. Thus, the system is
incomplete, because some truths are unprovable.

Definition 3 For a given formal system, a system is


inconsistent if there is a theorem in that system that is contradictory.
Conversely, a system is consistent if there are no contradictory
theorems.

2
Another Random Scribd Document
with Unrelated Content
PHOTO BY FRITIOF FRYXELL

The Cunningham Cabin, where on an April morning in 1893 two men


were cornered and shot for horse-stealing.

Inside the cabin the unsuspecting men were sleeping quietly:


Spenser, the older man, sandy-haired and heavily built; Burnett, the
cowpuncher, slender and dark; and of course Swede Jackson,
Cunningham’s partner. The two rustlers intended to leave when it got
light.

Early in the morning the dog which was in the cabin with the men
began to bark shrilly, perhaps taking alarm at the scent of the posse.
Spenser got up, dressed, buckled on his revolver, and went out to the
corral.

The corral lay between the cabin and the shed, and after Spenser
had entered it one of the posse called to him to “throw ’em up.”
Instead Spenser drew with lightning speed and fired twice, one bullet
passing between two logs and almost hitting the spokesman, the
other nicking a log near by. The posse returned fire and Spenser fell
to the ground, propping himself up on one elbow and continuing to
shoot until he collapsed.

Meanwhile Burnett had got up, slipped on his overalls and boots, and
fastened on his revolver. Then he picked up his rifle in his right hand
and came out of the cabin. As he stepped forth, one of the men
behind the ridge fired at him. The bullet struck the point of a log next
to the door, just in front of Burnett’s eyes. Burnett swept the splinters
from his face with his right hand as he reached for his revolver with
his left, and fired lefthanded at the top of the gunman’s hat, just
visible over the ridge. The shot was perfect; the bullet tore away the
hat and creased the man’s scalp. He toppled over backwards.

Burnett then deliberately walked over to the corner of the cabin and
stopped, with rifle in hand, in full view of the entire posse, taunting
them to come out and show themselves. From inside the cabin
Jackson pleaded with him to come in or he would get it too. Burnett
finally turned, and as he did so one of the members of the posse shot
him. The bullet killed Burnett instantly, and he pitched forward
toward the cabin, discharging his rifle as he fell.

Now only Jackson was left in the cabin. A big, bumbling man 46
with a knack for trouble, Jackson had once before been taken
by mistake for a horsethief and been scared almost to death; when
he was now ordered to come out and surrender with his hands in the
air he did so immediately.

The work of the posse was done. Mike Burnett lay face down in the
dirt at the corner of the cabin, the bullet from his last shot lodged in
a log beside him; George Spenser, his six-shooter empty, was
sprawled inside the corral with 4 charges of buckshot and 4 or 5
bullets in his body. They were buried in unmarked graves a few
hundred yards southeast of the cabin, on the south side of a draw.

No investigation was ever made, no trial held, and the matter was
hushed up. As years went by the subject of the killing at Spread
Creek became a touchy one, and most of the men directly involved
preferred not to talk about it. Swede Jackson, apparently thoroughly
shaken by the incident, left the valley and did not return. The affair at
Cunningham’s Ranch was a closed story.

What information the members of the posse did volunteer in later


years was in justification of their actions. The posse leader was a
Montana sheriff, they said, and he and his men had come from
Evanston, Wyoming, with the “proper papers,” and deputized the
Jackson Hole men. According to them there had been no intention of
killing—the 2 victims had been given a chance to surrender, and after
the affair one of the men in the posse had gone to Evanston to report
it to the police.

Those in the valley who had not been in on the posse were not so
sure of the legality of the shooting. Cunningham said he thought the
leader was not an officer, and reiterated that the posse had been
instructed not to arrest but to kill. He stated that 2 local men had
previously been asked to dispose of the pair, but had refused. When
asked who raised the posse and investigated the killing, Cunningham
laughed and said he could tell but preferred not to; asked if he cared
to state whether the move was local or not, he quickly said, “Oh no—
it wasn’t only local.”

Cunningham himself was rumored to have warned the outlaws to be


on guard, having returned from the Spread Creek ranch only a short
time before the killing. The story easily gained credence, since
Spenser had caught the posse completely by surprise when he armed
himself and started directly for the corral and shed where the men
were hidden. Cunningham denied “tipping them off,” and Jackson
later said it was unusual for the dog to bark as it did that morning.
Spenser probably sensed from the dog’s actions that something was
amiss and so put on his gun before leaving the cabin, a precaution
which Jackson said the men had never taken during the previous
winter.

Cunningham seemed more favorably impressed by the behavior of


the 2 horsethieves than by any heroism on the part of the posse, an
attitude which was general in the valley. Members of the posse had
little to say about it.

In 1928, several years before his death, Pierce Cunningham


recounted the story of the killing at Spread Creek and ended by
pointing out the spot where the rustlers were buried. With 2 timbers
he marked the sage-covered plot, one corner of it crossed by the
road then running past the cabin, where George Spenser and Mike
Burnett had lain since their death in 1893.

Years later badgers threw out some of their bones into the sunlight.

47
[8]
PROSPECTOR OF JACKSON HOLE
By Fritiof Fryxell

In the 1880’s and 1890’s it was widely supposed that the Snake River
gravels of Jackson Hole, in Wyoming, contained workable deposits of
placer gold, and there were many who came to the region, lured by
such reports and a prospector’s eternal optimism.

Color, indeed, could be struck almost anywhere along the river, but
the gold of which it gave promise proved discouragingly scarce and
elusive. None found what in fairness to the word could be called a
fortune. Few found sufficient gold to maintain for any length of time
even the most frugal living—and who can live more frugally than the
itinerant prospector? So through these decades prospectors quietly
came and sooner or later as quietly left, leaving no traces of their
visit more substantial than the scattered prospect holes still to be
seen along the bars of the Snake River. Even today a prospector
occasionally finds his way into the valley, and, like a ghost out of the
past, may be seen on some river bar, patiently panning. Probably he,
too, will drift on. It is apparent now that the wealth of Jackson Hole
lies not in gold-bearing gravels but in the matchless beauty of its
snow-covered hills and the tonic qualities of its mountain air and
streams.

But one prospector stayed. Mysterious in life, Uncle Jack Davis has
become one of the most shadowy figures in the past of Jackson Hole,
little more than a name except to those few still left of an older
generation who knew him. He deserves to be remembered—deserves
it because of his singular story, and because he has the distinction
historically of having been the only confirmed prospector in Jackson
Hole.
He was “Uncle” only by courtesy for he lived a lonely hermit until his
death; and so far as is known he left no relatives. He first appeared
in 1887 as one of the throng of miners drawn irresistibly into that
maelstrom of the gold excitements, Virginia City, Montana. In a 48
Virginia City saloon he became involved in a brawl and struck a
man down, struck him too hard and killed him. Davis, it should be
remarked, was a man of herculean strength and, at the time of this
accident, he was drunk. Believing himself slated for the usual
treatment prescribed by Montana justice at the time—quick trial and
hanging—he fled the city.

Davis reappeared shortly after this in Jackson Hole, the resort of


more than one man with a past, and in the most isolated corner of
that isolated region he began life anew. At the south end of the Hole,
a few miles down the Grand Canyon, he took out a claim on the
south side of the Snake River near a little tributary known as Bailey
Creek. There he built a log cabin, the humblest structure imaginable
—one room, no windows, a single door hung on rawhide hinges. This
primitive shack was Jack Davis’ home for nearly a quarter of a
century. True, more than two decades later he built himself a new
cabin, but death knocked at the door of the old one before he could
move.
PHOTO BY AL AUSTIN

Uncle Jack’s cabin was located on the Snake River near the mouth of
Bailey Creek. The plank structure on the roof is the old sluice box which
was used to make his coffin.

Down in the bottom of this magnificent canyon which he had almost


to himself, Davis plied his old trade of placer mining, putting in the
usual crude system of sluice boxes and ditches. In addition, he
cultivated a patch of ground which yielded vegetables sufficient for
his own needs and for an occasional trade. The income from both
sources was ridiculously small, but his needs were modest enough.
Primarily he wished peace and seclusion, and these he found.

The Virginia City episode never ceased to trouble him. It made 49


him a recluse for life. He lived alone, and limited his associates
almost entirely to the few neighbors who, as the years passed, came
to share his canyon or that of the nearby Hoback River. Trips to town
were made only when necessary, and were brief. On such occasions it
was his practice to cross the Snake near his cabin and hike or
snowshoe up the west side to the store at Menor’s Ferry, 50 miles
distant. Having made his purchases he shouldered them and returned
by the same route. In the course of his journey he saw and talked to
few. He rarely went to Jackson, the only town in the region. He is
said to have been a sober man, afraid of drink.

Davis’ solitary habits sprang from a haunting fear of pursuit, not from
dislike of companionship. The presence of a stranger in the region
made him uneasy, and he did not rest until his mission was known,
sometimes pressing a friend into service to ascertain a stranger’s
business. He rarely allowed his photograph to be taken. Apparently
his fears had little foundation, for no one from “outside” ever came in
after him. Very likely Virginia City soon forgot him.

Davis’ past was known to only 1 or 2 of the most intimate of his


neighbors. They kept it to themselves. Nor would it have mattered
had this story been more generally known—not in Jackson Hole
where such a distinction was by no means unique, and where a man
was judged for what he was, not for what he had been, or had done.

Though a strange recluse, he was a man to be admired and


respected. Physically he was tall, broad, of magnificently erect
carriage—a blue-eyed, full-bearded giant. Stories of his strength still
enjoy currency. According to one of these, Uncle Jack once lifted a
casting which on its shipping bill was credited with weighing 900
pounds—lifted it by slipping a loop of rope under it, passing the loop
over his shoulders, and straightening his back. And it was well known
that for all his solitary habits, Uncle Jack was kind and generous as
he was strong.

It seems as though for the remainder of his days Uncle Jack did
penance for his one great mistake. He impressed one as trying hard
to do the right thing by everyone and everything. Such was his love
for birds and animals that he would go hungry rather than shoot
them. To callers at his shack he explained the absence of meat from
the table by a stock alibi so lame and transparent that it fooled no
one: “He’d eat so much meat lately that he’d decided to lay off it for
awhile.” His unwillingness to kill turned him into a vegetarian—here in
the midst of the best hunting country in America. A hermit, yet Uncle
Jack was hardly lonely. In birds and beasts of the canyon he found a
substitute for human companionship. The wild creatures about him
soon ceased to be wild. His family of pets included Lucy, a doe who
lived with him for many years; Buster, her fawn, whom the coyotes
finally killed; two cats—Pitchfork Tillman, named for a prominent
political figure of the times, and Nick Wilson, much given to night life,
so named after a prominent pioneer of the valley; and a number of
tame squirrels and bluebirds. Not to mention Dan, the old horse, and
Calamity Jane, the inevitable prospector’s burro, which had
accompanied Jack in his flight to Jackson Hole, where it finally died at
the advanced age of 40 years. Maintaining peace in such a family
kept Uncle Jack from becoming lonely.

Al Austin, who for many years was forest ranger in this region, 50
and who in time came to enjoy Uncle Jack’s closest confidence,
presents an unforgettable picture of the old man and his family.
Dropping in at mealtime for a friendly call, Austin would find Uncle
Jack in his cabin surrounded by his pets, each clamouring to be fed
and each jealous of attention bestowed on any creature other than
itself. If the bluebirds were favored, the squirrels chattered
vociferously. Buster, if irritated, would justify his name by charging
and upsetting the furniture. Add to this the audible impatience of
Pitchfork Tillman and Nick Wilson, Lucy was ladylike but nevertheless
insistent. To this motley circle Uncle Jack would hold forth in
inimitable language, carrying on a running stream of conversation—
scolding, lecturing, admonishing, or when discord became acute,
threatening dire punishment if they did not mend their ways. It is
hardly necessary to add that to Uncle Jack’s awful threats, and the
vivid profanity, which it must be admitted, accompanied them, the
members of the household remained serenely indifferent, and there is
no record that any of the promised disasters ever fell on their furry
heads.
PHOTOGRAPHER UNKNOWN

Uncle Jack Davis, the only confirmed prospector of Jackson Hole, was
tall, broad, of magnificently erect carriage—a blue-eyed, full-bearded
giant. This is a rare photograph taken shortly before his death.
Having no windows, Uncle Jack left his door open during the good
weather. One spring a pair of bluebirds flew through the open door
into the shack and, having inspected the place and found it to their
liking, built their nest behind a triangular fragment of mirror which
Uncle Jack had stuck on the wall. Uncle Jack then cut down the door
from its leather hinges and did not replace it until fall. Six successive
summers the bluebirds returned to the cabin, and, finding the door
removed in anticipation of their coming, built their nest and raised
their young behind Uncle Jack’s mirror.

Nearby Uncle Jack made a little graveyard for his pets, as they left
him one by one. It was lovingly cared for. In the course of the 24
years which he spent there the burial ground came to contain many
neat mounds—mounds of strangely different sizes. But Lucy, Pitchfork
Tillman, and Dan outlived Uncle Jack.

He would not accept charity, even during the last year or two of his
life when he was nearly destitute. Neighbors had to resort to strategy
to get him to accept help.

On his periodic trips up and down the canyon, Austin brought 51


the mail to Davis and to Johnny Counts, who lived next to the
north. Counts and Davis, too, occasionally exchanged visits. On
March 14, 1911, Austin called at Counts’ and, finding that nothing
had been heard of from Uncle Jack for some time, snowshoed on
down the canyon to see if all was well.

The old man lay in bed, delirious. The last date checked off on the
wall calendar was February 11. Outside the cabin, elk had eaten all
the hay, and the horse and Lucy were at the point of starvation.
Austin stayed by his bedside for several days, then, finding it
impossible to care for Uncle Jack decently in the dark old cabin,
summoned Counts. Several days later they moved the old man 6
miles up the river, carrying him where they could, most of the way
pulling him along in a boat from the shore. The old trail was one Jack
himself had built many years before. In Count’s cabin, a week later,
Uncle Jack died.
Austin made Uncle Jack’s coffin from one of the old man’s own sluice
boxes. Together the two men carried Uncle Jack to the grave they
had dug for him at Sulphur Springs, nearby in the canyon. A wooden
headboard on which Ranger Austin carved the inscription, “A. L.
Davis, Died March 25, 1911,” marks the grave—there Uncle Jack
sleeps alone.

In Davis’ shack was found the “fortune” which placer mining had
brought him—$12 in cash and about the same value in gold
amalgam.

52
[9]
MOUNTAIN RIVER MEN
THE STORY OF MENOR’S FERRY
By Frances Judge

“This ain’t W. D. Menor talking, this is H. H. Menor talking, by God.


Holy Saviour, yes!”

Both Bill and Holiday carried a mouthful of oaths that spilled out
whenever they spoke. They cursed their friends and neighbors, they
cursed each other, and they cursed themselves. But to lighten this
burden of words when women were around, Holiday would say,
before a sentence, in the middle of a sentence or at the end of one,
“Holy Savior, yes!” or “Holy Savior, no!”

Bill never bothered to lighten his profanity.

Yet, in spite of cursing, they were men of dignity.

Everyone in Jackson Hole knew Bill and Holiday Menor. They were as
much a part of the country as the Snake River or the Teton
Mountains. The type of men they were brought them here.

Then, as now, Jackson Hole had a marked collection of people. They


were unshackled and they had color. Strength was intensified.
Weakness was vivid. Bill and Holiday were plain spoken, strong-dyed
individualists. They belonged here.

The Menor brothers came originally from Ohio. They were tall men.
Bill, 11 years older than his brother, was thin and long-boned. His
nose and sharp eyes were like an old eagle’s. Holiday’s long body
sagged a little. He had a grizzled beard, long, shrewd nose, and
amused, gray eyes. He prospected in Montana before coming to
Jackson Hole. “My partner’s name was Mean, but I was Menor,” he
would say. He claimed to have made over one hundred and twenty
thousand dollars in one prospect. When asked what happened to the
money, he always said, “Wine, women and song.” He talked of going
off to Old Mexico, prospecting, but he never went. There was too
much living to be done on the banks of the Snake River.

Bill Menor, coming to this valley in 1892, settled on a 53


homestead by squatter’s right. He settled where the Snake
River hauls toward the great mountains. He was first to homestead
on the west bank of the Snake River, under the Tetons. He built a
low, log house among the cottonwoods on the shore of the river,
collected a cow or two, and a horse; a few chickens; plowed up sage
and made a field; planted a garden; built a blacksmith shop; and in
time opened a small store where he sold a few groceries, a lot of Bull
Durham, overalls, tin pans, fish hooks and odds and ends.

And he immediately constructed a ferry to ply the unreliable Snake.


Before settling in the valley, he spent 10 days with John Shive and
John Cherry “on the Buffalo.” At that time he considered establishing
a ferry somewhere along the Buffalo, but after talking with Cherry
and Shive, he decided on the Snake River. And his decision was wise
and farsighted.

Many settlers cut timber on Bill’s side of the river, so the ferry was
welcome. There were times when it was the only crossing within a 40
mile stretch up and down the river. Once in awhile there was no
crossing at all, when the river was “in spate” and Bill refused to risk
the ferry. At such a time people were forced to go up one side of the
river to Moran, cross the toll bridge, and travel down the other side—
80 miles to travel 8.

The ferry, a railed platform on pontoons, was carried directly across


the river by the current, guided by ropes attached to an overhead
cable. The cable was secured to a massive log—called a “dead man.”
The ferry was large enough to carry a 4-horse team, provided the
lead team was unhooked and led to the side of the wagon.
PHOTO BY AL AUSTIN

Menor’s Ferry at about the turn of the Century. Where the mad Snake
rolls by, and the shadow of the great mountains moves over sage, and
building, and river.

Bill Menor charged 50 cents for a team, 25 cents for a horse 54


and rider. A foot passenger was carried free if a vehicle was
crossing.

In those early days almost everyone who came to cross the ferry
around mealtime was invited to eat. If the river was too high for safe
crossing and the persons who wanted to cross were in no particular
hurry, Bill would keep them 2 or 3 days, bedding them and feeding
them generously until the waters subsided, and charging them only
the slim ferry fee. “When you see them rollers in the middle of the
river, I won’t cross,” he would say, apologizing in his grouchy way for
keeping people around.
Anyone who stayed with Bill had to be washed and combed and
ready to leap at the table at twelve-noon and six-sharp. Early in the
morning, as soon as the fire was built, he yelled at them, saying,
“Come on, get out of bed. Don’t lay there until the flies blow you!”
Nothing angered him more than to have someone late for a meal,
unless it was to put a dish or a pan in the wrong place. Bill had a
place for everything and everything had to be in place. Once the Roy
VanVlecks spent the night with Bill. They washed the morning dishes
before ferrying over the river. Bill, leaning against the kitchen
doorcasing, criticized and cursed because the frying pans shouldn’t
go here and the kettles shouldn’t go there. Yet he did not offer to put
them on their proper nails or even show where they belonged.

That was Bill, and his neighbors understood. He was a man boiled
down to his primary colors.

Bill was generally accommodating, but if he were particularly out of


humor, and had a natural distaste for a person who came along after
six in the evening, he would refuse to ferry him over the river or keep
him for the night. He apparently got satisfaction out of being
downright mean to a few individuals.

When the Snake is high, it is ferocious. It boils, seethes, growls,


beats its breast, and carries with it everything it can reach.

Once it got Bill.

A huge, uprooted tree swept against the ferry with such force that
the ropes broke and the boat was carried downstream, taking Bill
with it. After a quick trip, the ferry grounded on a submerged
sandbar. Neighbors gathered and conferred and hurried about, trying
to rescue Bill. He stood on the ferry violently cursing the rescue crew
and acting, in general, as though they alone were to blame for the
high water and his predicament.

Holiday Menor came to Jackson Hole about 1905. He lived for a


number of years with his brother, Bill. But the disposition of each was
cut on the bias, and the two disagreed over a neighbor. So Holiday
took up land on the east shore and built his houses directly across
from brother Bill, and let the river run between them. Like a great
many individualists, Bill and Holiday considered strong hate a mark of
character, so they did not speak to each other for 2 years.
Nevertheless, they were proud of each other, and the name of one
always cropped up in the conversation of the other, mixed well with
curses. And each watched across the river for the other, to make sure
all was right on the opposite shore.

One Christmas the brothers were invited to the Bar B C Ranch for
dinner. It was Holiday’s birthday. Neither knew the other was to be
there. When each arrived he was given a strong drink of whiskey to
insure amiability. The 2 brothers shook hands over the Christmas
table. Ever after they were on speaking terms.

And sometimes they spoke too freely, shaking fists and cursing each
other over the river. There was much gusto in their living.

Though Bill read hardly more than the daily paper that came to 55
him, Holiday subscribed to a number of magazines. He read 7
long months of the year and “talked it out” the other 5. He argued
politically with everyone, whether they would argue or not. “Now,
mind you, I’m telling you, this ain’t W. D. talking, this is H. H. Menor
talking, by God.” And for emphasis he would bang things with a stick
of stove wood. Once he came down on the red hot stove with his
bare fist and for a short while political views were unimportant.

Gradually the land was taken up by a homesteader or Government


leaser, and the Menors were surrounded with neighbors. Then, as
now, persons living 10 or 15 miles away were considered close
neighbors. Everybody in the valley knew everybody else, or at least
knew stories about him. For Holiday to have a close neighbor other
than Bill was intriguing. Mrs. Evelyn Dorman, a Pennsylvania woman,
homesteaded on the east bank, and her buildings were only a quarter
of a mile below Holiday’s. She called him the Patriarch of the Ford,
and he called her the Widow down the River.
To have Mrs. Dornan ask how he prepared some dish filled him with
pride. He enjoyed giving away his recipes. He would say, “You take
two handfuls of flour, that is, and a pinch of salt, that is ...” All his
recipes were generously seasoned with “that is’s”. He was an
excellent cook and loved to have his friends eat with him.

But there was the rooster episode.

Bill had a beautiful barred Plymouth Rock rooster; a huge single-


combed domestic fowl with graceful feathers in its tail, and pride in
its walk. But Holiday’s rooster had only two feathers in its tail, its
body was completely bare, and it had no pride.

It was a sad sight.

The Widow down the River laughed every time she looked at
Holiday’s rooster and wanted to take a picture of it. But Holiday said,
“No.”

“Holy Savior, no! I don’t want that rooster shown as an example of


what is raised on my ranch.”

Fearing Mrs. Dornan would take a picture of the fowl, he killed it,
cooked it, and invited her to eat it with him. He never once thought
that the bird might have been defeathered by disease. Mrs. Dorman
ate rooster and pretended to enjoy it. She was an understanding
neighbor.

Both Bill and Holiday raised excellent gardens. To be fairly safe


against frost they never planted until the snow melted up to a certain
level in the Tetons. They raised many vegetables. Their cauliflowers
were as big as footstools. They raised currents and raspberries
galore, and made jelly and jam. And they raised flowers. Holiday
always had pansies on the north side of his buildings. He called them
tansies. He and Bill always gave freely of their vegetables, berries,
and flowers.
During the wild berry season, Bill would charge “huckleberry rates” to
the local people—fare one way only—when the berries were ripe
along the ridges and around the lakes under the Tetons.

Holiday would can between 50 and 60 quarts of huckleberries during


a season. And since he drank periodically he made wine. At any rate
that is what he called it. He would make it of berries, raisins, prunes,
beets, plus whatever else was handy—and never wait for the mixture
to mature.

It would knock his hat off.

At five one summer morning, neighbors stopped at Holiday’s 56


returning from a dance. They were cold. They needed a
stimulant, but Holiday had no wine. He had drunk it all. So they
drank a cocktail made of gin and huckleberry juice—half and half.
After finishing their drinks, 2 young men in the party decided to go
shoot a rabbit for breakfast. They did.

“We shot it right in the eye,” one said, holding up what was left of the
rabbit.

The hind parts were shot away, slick as a whistle.

That is what gin and wild huckleberry juice did to a rabbit. Holy
Savior, yes! What might Holiday’s wine have done to it?

Holiday enjoyed the summer visitors in Jackson Hole. Bill probably


enjoyed them also, but they could not lift him from his natural state
of grouchiness. Once, after looking over the miles of sage that
covered the levels of land that rise from the river to the mountains,
an Eastern lady said to Bill, “Mr. Menor, what do you raise in this
country?”

Bill, a dyed-in-the-wool bachelor, looked at her and said, “Hell and


kids and plenty of both.”
He enjoyed startling people.

And he apparently knew what the “outsider” thought of a Jackson


Holer. In 1915 he made a trip to the World’s Fair with his neighbors,
Jim and Mary Budge. When they had boarded a San Francisco-bound
train, after a strenuous trek out of Jackson Hole, both Jim and Bill felt
in need of a long drink of whiskey. Entering the smoker with their
concealed bottle, they found one other man there. They did not like
his looks and they felt no need of him. Bill walked up and looked
down at him with his eagle stare. “Do you know where we’re from?”
he said. “JACKSON HOLE!”

The man made a quick escape.

Though Holiday was more jovial than Brother Bill, his neighbors
steered clear of him when he was in the process of making lime. He
made and sold lime to neighboring ranchers. Some of them, like Bill,
whitewashed their houses inside and out with it. Holiday chinked his
houses with it. He also used it as a cure-all for man and beast. When
he made lime he had to keep a steady fire going for thirty-odd hours
in the kiln just behind the house in the bank. During these hours he
was not fit company for man or beast. But his neighbors accepted his
limy disposition as a necessary part of the process. Holy Savior, yes.
What of it?

When late fall brought bitter winds, heavy fogs, and snow, the ferry
was beached for the winter. From then on all teams had to ford the
river. A little platform was hung from the river cable to accommodate
foot passengers. It would hold 3 or 4 at one time. The passengers
mounted the platform from a ladder and sat down. Bill released the
car; with a quick swoosh it ran down the slack in the cable where it
dipped within 10 feet of the river. Then the frightened passengers
would laboriously haul themselves up the relaxed cable to the
opposite shore.

In later years, when travel became heavier, a winter bridge was flung
across the main channel. Putting in the winter bridge was the

You might also like