Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type...

46
Let’s make set theory great again! John Harrison Amazon Web Services AITP 2018, Aussois 27th March 2018 (10:45–11:30)

Transcript of Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type...

Page 1: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Let’s make set theory great again!

John HarrisonAmazon Web Services

AITP 2018, Aussois

27th March 2018 (10:45–11:30)

Page 2: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Contents

I Why types? Why not?

I Set theory as a foundation

I Formalizing mathematics in set theory

I Avoiding fake theoremsI Numeric subtypesI Encoding undefinednessI Reflection principles

I Relevance to AITP

I Questions / discussions

Page 3: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Type theory and set theory

The divide between type theory and ‘untyped’ axiomatic set theorygoes back to different reactions to the paradoxes of naive settheory:

I Russell — introduced a system of types

I Zermelo — developed axioms for set construction

This divide is still with us today and pretty much all type theoriesare (distant) descendants of Russell’s system.

Page 4: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Type theory and set theory

The divide between type theory and ‘untyped’ axiomatic set theorygoes back to different reactions to the paradoxes of naive settheory:

I Russell — introduced a system of types

I Zermelo — developed axioms for set construction

This divide is still with us today and pretty much all type theoriesare (distant) descendants of Russell’s system.

Page 5: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Type theory and set theory

The divide between type theory and ‘untyped’ axiomatic set theorygoes back to different reactions to the paradoxes of naive settheory:

I Russell — introduced a system of types

I Zermelo — developed axioms for set construction

This divide is still with us today and pretty much all type theoriesare (distant) descendants of Russell’s system.

Page 6: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Foundations in theorem proving

Many of the most popular interactive theorem provers are based ontype theory

I Simple type theory (HOL family, Isabelle/HOL)

I Constructive type theory (Agda, Coq, Nuprl)

I Other typed formalisms (IMPS, PVS)

Far fewer substantial systems are based on set theory:

I Metamath

I Isabelle/ZF (but much less popular than Isabelle/HOL)

I Mizar (but that layers a type system on top)

Page 7: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Foundations in theorem proving

Many of the most popular interactive theorem provers are based ontype theory

I Simple type theory (HOL family, Isabelle/HOL)

I Constructive type theory (Agda, Coq, Nuprl)

I Other typed formalisms (IMPS, PVS)

Far fewer substantial systems are based on set theory:

I Metamath

I Isabelle/ZF (but much less popular than Isabelle/HOL)

I Mizar (but that layers a type system on top)

Page 8: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Why types?

The dominance of types has come about for a mix of technical andsocial reasons:

I Types make logical inference simpler (or even avoid it):∀x : R. P(x) instead of ∀x . x ∈ R⇒ P(x)

I Types give a systematic way of assigning implicit properties: iff : G → H is a homomorphism then you know what + meanswhere in f (x + y) = f (x) + f (y)

I Types are part of an overall philosophical approach tofoundations, e.g. from Martin-Lof

I Types are natural to computer scientists who develop manytheorem proving programs.

I Types are a rich topic of pure research and therefore more‘interesting’

But not all these are good reasons, and some are perverseincentives.

Page 9: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Why types?

The dominance of types has come about for a mix of technical andsocial reasons:

I Types make logical inference simpler (or even avoid it):∀x : R. P(x) instead of ∀x . x ∈ R⇒ P(x)

I Types give a systematic way of assigning implicit properties: iff : G → H is a homomorphism then you know what + meanswhere in f (x + y) = f (x) + f (y)

I Types are part of an overall philosophical approach tofoundations, e.g. from Martin-Lof

I Types are natural to computer scientists who develop manytheorem proving programs.

I Types are a rich topic of pure research and therefore more‘interesting’

But not all these are good reasons, and some are perverseincentives.

Page 10: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Why types?

The dominance of types has come about for a mix of technical andsocial reasons:

I Types make logical inference simpler (or even avoid it):∀x : R. P(x) instead of ∀x . x ∈ R⇒ P(x)

I Types give a systematic way of assigning implicit properties: iff : G → H is a homomorphism then you know what + meanswhere in f (x + y) = f (x) + f (y)

I Types are part of an overall philosophical approach tofoundations, e.g. from Martin-Lof

I Types are natural to computer scientists who develop manytheorem proving programs.

I Types are a rich topic of pure research and therefore more‘interesting’

But not all these are good reasons, and some are perverseincentives.

Page 11: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Why types?

The dominance of types has come about for a mix of technical andsocial reasons:

I Types make logical inference simpler (or even avoid it):∀x : R. P(x) instead of ∀x . x ∈ R⇒ P(x)

I Types give a systematic way of assigning implicit properties: iff : G → H is a homomorphism then you know what + meanswhere in f (x + y) = f (x) + f (y)

I Types are part of an overall philosophical approach tofoundations, e.g. from Martin-Lof

I Types are natural to computer scientists who develop manytheorem proving programs.

I Types are a rich topic of pure research and therefore more‘interesting’

But not all these are good reasons, and some are perverseincentives.

Page 12: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Why types?

The dominance of types has come about for a mix of technical andsocial reasons:

I Types make logical inference simpler (or even avoid it):∀x : R. P(x) instead of ∀x . x ∈ R⇒ P(x)

I Types give a systematic way of assigning implicit properties: iff : G → H is a homomorphism then you know what + meanswhere in f (x + y) = f (x) + f (y)

I Types are part of an overall philosophical approach tofoundations, e.g. from Martin-Lof

I Types are natural to computer scientists who develop manytheorem proving programs.

I Types are a rich topic of pure research and therefore more‘interesting’

But not all these are good reasons, and some are perverseincentives.

Page 13: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Why types?

The dominance of types has come about for a mix of technical andsocial reasons:

I Types make logical inference simpler (or even avoid it):∀x : R. P(x) instead of ∀x . x ∈ R⇒ P(x)

I Types give a systematic way of assigning implicit properties: iff : G → H is a homomorphism then you know what + meanswhere in f (x + y) = f (x) + f (y)

I Types are part of an overall philosophical approach tofoundations, e.g. from Martin-Lof

I Types are natural to computer scientists who develop manytheorem proving programs.

I Types are a rich topic of pure research and therefore more‘interesting’

But not all these are good reasons, and some are perverseincentives.

Page 14: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Why types?

The dominance of types has come about for a mix of technical andsocial reasons:

I Types make logical inference simpler (or even avoid it):∀x : R. P(x) instead of ∀x . x ∈ R⇒ P(x)

I Types give a systematic way of assigning implicit properties: iff : G → H is a homomorphism then you know what + meanswhere in f (x + y) = f (x) + f (y)

I Types are part of an overall philosophical approach tofoundations, e.g. from Martin-Lof

I Types are natural to computer scientists who develop manytheorem proving programs.

I Types are a rich topic of pure research and therefore more‘interesting’

But not all these are good reasons, and some are perverseincentives.

Page 15: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Why not types?

My thesis is that types, despite their merits, have significantdisadvantages:

I Types can create dilemmas or inflexibility

I Types can clutter proofs

I Subtypes may not work smoothly

I Type systems are complicated

There are simple type theories like HOL but they are the mostinflexible.

Page 16: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Why not types?

My thesis is that types, despite their merits, have significantdisadvantages:

I Types can create dilemmas or inflexibility

I Types can clutter proofs

I Subtypes may not work smoothly

I Type systems are complicated

There are simple type theories like HOL but they are the mostinflexible.

Page 17: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Why not types?

My thesis is that types, despite their merits, have significantdisadvantages:

I Types can create dilemmas or inflexibility

I Types can clutter proofs

I Subtypes may not work smoothly

I Type systems are complicated

There are simple type theories like HOL but they are the mostinflexible.

Page 18: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Why not types?

My thesis is that types, despite their merits, have significantdisadvantages:

I Types can create dilemmas or inflexibility

I Types can clutter proofs

I Subtypes may not work smoothly

I Type systems are complicated

There are simple type theories like HOL but they are the mostinflexible.

Page 19: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Why not types?

My thesis is that types, despite their merits, have significantdisadvantages:

I Types can create dilemmas or inflexibility

I Types can clutter proofs

I Subtypes may not work smoothly

I Type systems are complicated

There are simple type theories like HOL but they are the mostinflexible.

Page 20: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Types can create dilemmas or inflexibility

When formalizing anything intuivtively corresponding to apredicate/set, say over some domain D

I We can formalize it as a predicate P : D → B or subset S ⊆ D

I We can introduce a new type corresponding to P

We have to make a choice, and depending on other features of thetype system, that can greatly influence how easy or hard it is toprove something.For example, if you prove something generic about groups over atype, you may not be able to instantiate it later to a group over asubset of a type.

Page 21: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Types can create dilemmas or inflexibility

When formalizing anything intuivtively corresponding to apredicate/set, say over some domain D

I We can formalize it as a predicate P : D → B or subset S ⊆ D

I We can introduce a new type corresponding to P

We have to make a choice, and depending on other features of thetype system, that can greatly influence how easy or hard it is toprove something.For example, if you prove something generic about groups over atype, you may not be able to instantiate it later to a group over asubset of a type.

Page 22: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Subtypes may not work smoothly

There are type systems with subtypes, but many type systems donot permit it. One special but annoyingly uniquitous case is thatyou need to distinguish various different number systems

I N, N+ = N− {0}I ZI QI RI R+ = {x | x ∈ R ∧ x ≥ 0}, R = R ∪ {−∞,+∞}I C

You may need multiple versions of theorems, explicit or implicittype casts, lots of complications even if the system partly hides itfrom the average user.

Page 23: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Types can clutter proofs

Consider a very elementary construction in algebra where we startfrom an arbitrary field F and construct an extension F ′ with a rootof the irreducible polynomial p:

I Take the ring of polynomials in one variable F [x ] (set of finitepartial functions N→ F )

I Take the quotient F [x ]/(p(x)) by the ideal generated by p(elements are equivalence classes, i.e. sets of polynomials)

Thinking of F as a base type, we have jumped up a couple oflevels in the type hierarcy just to adjoin one root.If we want to construct the algebraic closure of a field we have todo this transfinitely . . .

Page 24: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Types can clutter proofs

Consider a very elementary construction in algebra where we startfrom an arbitrary field F and construct an extension F ′ with a rootof the irreducible polynomial p:

I Take the ring of polynomials in one variable F [x ] (set of finitepartial functions N→ F )

I Take the quotient F [x ]/(p(x)) by the ideal generated by p(elements are equivalence classes, i.e. sets of polynomials)

Thinking of F as a base type, we have jumped up a couple oflevels in the type hierarcy just to adjoin one root.If we want to construct the algebraic closure of a field we have todo this transfinitely . . .

Page 25: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Type systems are complicated

This inference rule is from Coq (or more precisely Matita)

46 A BI-DIRECTIONAL REFINEMENT ALGORITHM FOR CIC

(K−letcorec)

Σ�,Φ�,

let corec f1(−−−−−→x1

p1: T 1

p1) : T 1

p1+1 := t1 and . . .

and fn(−−−−−→xn

pn:Tn

pn) : Tn

pn+1 := tn

∈ Env

Σ� = ∅ Φ� = ∅ 1 ≤ i ≤ n

(fi : Ti) ∈ Env

(K−inductive)

(Σ�,Φ�, I) ∈ EnvΣ� = ∅ Φ� = ∅ 1 ≤ p ≤ n

(Ipl : Π

−−−→xl : Ul.Ap) ∈ Env

(K−constructor)

(Σ�,Φ�, I) ∈ EnvΣ� = ∅ Φ� = ∅ 1 ≤ p ≤ n 1 ≤ j ≤ mp

(kjp : Π

−−−→xl : Ul.K

jp) ∈ Env

(K−lambda)

Env,Σ,Φ,Γ � T : SEnv,Σ,Φ,Γ � S �whd S� S� is a sort or a metaEnv,Σ,Φ,Γ ∪ (n : T ) � u : U

Env,Σ,Φ,Γ � λn : T.u : Πn : T.U

(K−product)

Env,Σ,Φ,Γ � T : s1

Env,Σ,Φ,Γ ∪ (n : T ) � U : s2

(s1, s2, s3) ∈ PTS

Env,Σ,Φ,Γ � Πn : T.U : s3

(K−letin)

Env,Σ,Φ,Γ � t : T �

Env,Σ,Φ,Γ � T : S Env,Σ,Φ,Γ � T ↓ T �

Env,Σ,Φ,Γ ∪ (x : T := t) � u : U

Env,Σ,Φ,Γ � let (x : T ) := t in u : U [x/t]

(K−appl − base)

Env,Σ,Φ,Γ � h : Πx : T.UEnv,Σ,Φ,Γ � t : T � Env,Σ,Φ,Γ � T ↓ T �

Env,Σ,Φ,Γ � h t : U [x/t]

(K−appl − rec)Env,Σ,Φ,Γ � (h t1) t2 · · · tn : T

Env,Σ,Φ,Γ � h t1 t2 · · · tn : T

(K−match)

(Σ�,Φ�, I) ∈ Env Σ� = ∅ Φ� = ∅ Env,Σ,Φ,Γ � t : T

Env,Σ,Φ,Γ � T �whd Ipl−→ul

−→u�

r

Ap[−−−→xl/ul] = Π

−−−−→yr : Yr.s Kj

p[−−−→xl/ul] = Π

−−−−−−→xj

nj : Qjnj .I

pl−→xl

−→vr j = 1 . . . mp

Env,Σ,Φ,Γ � U : V Env,Σ,Φ,Γ � V �whd Π−−−−→zr : Yr.Πzr+1 : Ip

l−→ul

−→zr .s�

(s, s�) ∈ elim(PTS)

Env,Σ,Φ,Γ � λ−−−−−−→xj

nj : P jnj .tj : Tj j = 1, . . . , mp

Env,Σ,Φ,Γ � Tj ↓ Π−−−−−−→xj

nj : Qjnj .U

−→vr (kpj−→ul

−→xj

nj ) j = 1, . . . , mp

Env,Σ,Φ,Γ � match t in Ipl return U

[kp1 (

−−−−−−→x1

n1: P 1

n1) ⇒ t1 | . . . |kp

mp (−−−−−−−−→x

mpnmp

: Pmpnmp

) ⇒ tmp ] : U−→u�

r t

Page 26: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Set theory as a foundation

We propose in some sense the ‘obvious’ foundation in set theory,and the only innovations are a few conventions we think makething smoother or more natural.

I Work in a fairly standard (ZFC...?) universe of sets andconstruct number systems and mathematical objects in one ofthe ‘usual’ ways, probably in fairly standard first-order logic.

I Things you would express as type constraints in typed systemsare usually expressed as set membership: x : R becomesx ∈ R etc.

I Constraints that quantify over ‘large’ collections likew : ordinal become applications of predicates ordinal(w),though we could support syntactic sugar like x ∈ On.

Page 27: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Set theory as a foundation

We propose in some sense the ‘obvious’ foundation in set theory,and the only innovations are a few conventions we think makething smoother or more natural.

I Work in a fairly standard (ZFC...?) universe of sets andconstruct number systems and mathematical objects in one ofthe ‘usual’ ways, probably in fairly standard first-order logic.

I Things you would express as type constraints in typed systemsare usually expressed as set membership: x : R becomesx ∈ R etc.

I Constraints that quantify over ‘large’ collections likew : ordinal become applications of predicates ordinal(w),though we could support syntactic sugar like x ∈ On.

Page 28: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Set theory as a foundation

We propose in some sense the ‘obvious’ foundation in set theory,and the only innovations are a few conventions we think makething smoother or more natural.

I Work in a fairly standard (ZFC...?) universe of sets andconstruct number systems and mathematical objects in one ofthe ‘usual’ ways, probably in fairly standard first-order logic.

I Things you would express as type constraints in typed systemsare usually expressed as set membership: x : R becomesx ∈ R etc.

I Constraints that quantify over ‘large’ collections likew : ordinal become applications of predicates ordinal(w),though we could support syntactic sugar like x ∈ On.

Page 29: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Set theory as a foundation

We propose in some sense the ‘obvious’ foundation in set theory,and the only innovations are a few conventions we think makething smoother or more natural.

I Work in a fairly standard (ZFC...?) universe of sets andconstruct number systems and mathematical objects in one ofthe ‘usual’ ways, probably in fairly standard first-order logic.

I Things you would express as type constraints in typed systemsare usually expressed as set membership: x : R becomesx ∈ R etc.

I Constraints that quantify over ‘large’ collections likew : ordinal become applications of predicates ordinal(w),though we could support syntactic sugar like x ∈ On.

Page 30: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Set theory as a machine codeThe philosophy is to use set theory act as a simple,well-understood foundation but leave the theorem proving to layersof code, which the foundations don’t help but also don’t hinder.

I Can do some kind of ‘type checking’ for catching errors,encouraging a disciplined style, and do some inference moreefficiently.

I Wiedijk’s paper “Mizar’s soft type theory” shows how inprinciple Mizar’s type system can be understood this way,even though in practice it’s coded separately.

I Other convenient ‘magic’ like using symmetries, transferringresults via isomorphisms, homotopy equivalence or elementaryequivalence (Urban’s Ultraviolence Axiom) is done by theoremproving, not the foundations.

This is a computer science view, analogous to starting withmachine code as the foundation and building higher-level layers ontop.

Page 31: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Set theory as a machine codeThe philosophy is to use set theory act as a simple,well-understood foundation but leave the theorem proving to layersof code, which the foundations don’t help but also don’t hinder.

I Can do some kind of ‘type checking’ for catching errors,encouraging a disciplined style, and do some inference moreefficiently.

I Wiedijk’s paper “Mizar’s soft type theory” shows how inprinciple Mizar’s type system can be understood this way,even though in practice it’s coded separately.

I Other convenient ‘magic’ like using symmetries, transferringresults via isomorphisms, homotopy equivalence or elementaryequivalence (Urban’s Ultraviolence Axiom) is done by theoremproving, not the foundations.

This is a computer science view, analogous to starting withmachine code as the foundation and building higher-level layers ontop.

Page 32: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Avoiding fake theorems

I Set theory is sometimes criticized because you get too manyidentifications or spurious theorems from the constructions:‘zero is a subset of a line’

I We propose to use definitional extension principles that merelyrequire a consistency proof (analogous to type definition rulesin HOL) but don’t necessarily tie

I You still get some ‘fake theorems’ if you consider everythingas a set: ∅ ⊆ anything.

I Even those can be avoided by starting with a set theoryallowing urelements (not everything has to be a set).

Page 33: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Numeric subtypesThe idea that the usual number systems are all overlaid with theobvious subset relations is ubiquitous in the mathematicalliterature.

I We don’t necessarily propose to help out with other analogousconventions: 0 can also be the trivial group, 2 can be1R +R 1R in a ring, . . .

I But the number system inclusions are so ingrained in informalmathematics, and the profusion of different number systems isso inconvenient, that it’s worth the effort to make this literallytrue.

I Each time a new number system is constructed we show thatwe could make it a superset (Q ⊆ R etc.) even if it doesn’tarise naturally that way.

I If all else fails, just take the union of the smaller structure andthe new elements minus the isomorphic image of the smallerone.

Page 34: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Encoding undefinedness (1)

There are a number of common conventions around‘undefinedness’ in mathematics, which arguably don’t fit well withtypcial formal treatments.Often equations are taken implicitly to include definedness: s = tmeans ‘either both s and t are both undefined, or they are bothdefined and equal’.

So for instance this equation includes the assertion that the sumconverges

∞∑

n=1

1/n2 = π2/6

And this one holds over R regardless of whether x and y are zero

(xy)−1 = x−1y−1

Page 35: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Encoding undefinedness (1)

There are a number of common conventions around‘undefinedness’ in mathematics, which arguably don’t fit well withtypcial formal treatments.Often equations are taken implicitly to include definedness: s = tmeans ‘either both s and t are both undefined, or they are bothdefined and equal’.So for instance this equation includes the assertion that the sumconverges

∞∑

n=1

1/n2 = π2/6

And this one holds over R regardless of whether x and y are zero

(xy)−1 = x−1y−1

Page 36: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Encoding undefinedness (1)

There are a number of common conventions around‘undefinedness’ in mathematics, which arguably don’t fit well withtypcial formal treatments.Often equations are taken implicitly to include definedness: s = tmeans ‘either both s and t are both undefined, or they are bothdefined and equal’.So for instance this equation includes the assertion that the sumconverges

∞∑

n=1

1/n2 = π2/6

And this one holds over R regardless of whether x and y are zero

(xy)−1 = x−1y−1

Page 37: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Encoding undefinedness (2)There are a number of formal approaches, which require a lot ofcomplexity or a lot of radical logical changes:

I Every type is lifted and includes an ‘undefined’ element ⊥(LCF)

I The logic explicitly supports partial terms (IMPS) or eventhree-valued predicates (VDM)

In set theory we can get much of this with one trivial convention:

I Every function f : A→ B explicitly contains a domain A andcodomain B.

I Function application is defined to map f (x) = B (the set Bitself) if x 6∈ A. So f (x) ∈ B ⇔ x ∈ A (since B 6∈ B in ZF).

I This amounts to using the codomain itself as a kind ofbottom element, rather like LCF

I No theorem proving obligations we didn’t have before, and asimple encoding of ‘undefined’ terms

Page 38: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Encoding undefinedness (2)There are a number of formal approaches, which require a lot ofcomplexity or a lot of radical logical changes:

I Every type is lifted and includes an ‘undefined’ element ⊥(LCF)

I The logic explicitly supports partial terms (IMPS) or eventhree-valued predicates (VDM)

In set theory we can get much of this with one trivial convention:

I Every function f : A→ B explicitly contains a domain A andcodomain B.

I Function application is defined to map f (x) = B (the set Bitself) if x 6∈ A. So f (x) ∈ B ⇔ x ∈ A (since B 6∈ B in ZF).

I This amounts to using the codomain itself as a kind ofbottom element, rather like LCF

I No theorem proving obligations we didn’t have before, and asimple encoding of ‘undefined’ terms

Page 39: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Reflection (1)

A common pattern in theorem proving is the following, often called(small-scale) reflection

x

f (x)

pxq

pf (x)q

-

6 6

Semantics to syntax

Syntax to semantics

fSyntactictransform

The idea is to do most of the work in the ‘syntactic’representation, because you can prove a more generic theorem inthis context or (in Coq) because proof/evaluation is faster there.

Page 40: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Reflection (2)

What about reflection in set theory?

I The basic pattern of small-scale reflection is equally applicablein set theory; in fact the absence of types may makeevaluation functions easier

I Unlike constructive type theories, there isn’t any built-innotion of efficient evaluation, definitional equality etc., butone could consider defining one

ZFC offers a more interesting large-scale principle in the ‘reflectiontheorem’: if φ is any formula of first-order ZFC, then there exists aset V in which φ holds with all quantifiers relativized to V .

I May allow one to perform dynamic or large-scale reflection.

I Apossible approach to using higher-order notions, categorytheory etc. without the complication of universes.

Page 41: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Reflection (2)

What about reflection in set theory?

I The basic pattern of small-scale reflection is equally applicablein set theory; in fact the absence of types may makeevaluation functions easier

I Unlike constructive type theories, there isn’t any built-innotion of efficient evaluation, definitional equality etc., butone could consider defining one

ZFC offers a more interesting large-scale principle in the ‘reflectiontheorem’: if φ is any formula of first-order ZFC, then there exists aset V in which φ holds with all quantifiers relativized to V .

I May allow one to perform dynamic or large-scale reflection.

I Apossible approach to using higher-order notions, categorytheory etc. without the complication of universes.

Page 42: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Reflection (2)

What about reflection in set theory?

I The basic pattern of small-scale reflection is equally applicablein set theory; in fact the absence of types may makeevaluation functions easier

I Unlike constructive type theories, there isn’t any built-innotion of efficient evaluation, definitional equality etc., butone could consider defining one

ZFC offers a more interesting large-scale principle in the ‘reflectiontheorem’: if φ is any formula of first-order ZFC, then there exists aset V in which φ holds with all quantifiers relativized to V .

I May allow one to perform dynamic or large-scale reflection.

I Apossible approach to using higher-order notions, categorytheory etc. without the complication of universes.

Page 43: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Reflection (2)

What about reflection in set theory?

I The basic pattern of small-scale reflection is equally applicablein set theory; in fact the absence of types may makeevaluation functions easier

I Unlike constructive type theories, there isn’t any built-innotion of efficient evaluation, definitional equality etc., butone could consider defining one

ZFC offers a more interesting large-scale principle in the ‘reflectiontheorem’: if φ is any formula of first-order ZFC, then there exists aset V in which φ holds with all quantifiers relativized to V .

I May allow one to perform dynamic or large-scale reflection.

I Apossible approach to using higher-order notions, categorytheory etc. without the complication of universes.

Page 44: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Relevance to AITP

Maybe thinking about foundations is not the first priority forpeople interested in applying AI methods, but I would argue that itmay give a closer correspondence with informal texts, which mighthelp in projects to exploit that correspondence.

The original aim of the writer was to take mathematicaltextbooks such as Landau on the number system,Hardy-Wright on number theory, Hardy on the calculus,Veblen-Young on projective geometry, the volumes byBourbaki, as outlines and make the machine formalize allthe proofs (fill in the gaps).

Wang “Toward Mechanical Mathematics”, 1960.

Page 45: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Relevance to AITP

Maybe thinking about foundations is not the first priority forpeople interested in applying AI methods, but I would argue that itmay give a closer correspondence with informal texts, which mighthelp in projects to exploit that correspondence.

The original aim of the writer was to take mathematicaltextbooks such as Landau on the number system,Hardy-Wright on number theory, Hardy on the calculus,Veblen-Young on projective geometry, the volumes byBourbaki, as outlines and make the machine formalize allthe proofs (fill in the gaps).

Wang “Toward Mechanical Mathematics”, 1960.

Page 46: Let's make set theory great again! - AITP: Conferenceaitp-conference.org/2018/slides/JH.pdf · Type theory and set theory The divide between type theory and ‘untyped’ axiomatic

Questions?