# Type Theory

## Part I - Logic

GIF

# Why Type Theory??

# Disclaimer

Few GIFs and few analogies on this talk

Sorry.

# Disclaimer

abstraction(abtsraction(abstraction)))

Sorry.

# When we write code

# How do we guarantee our program meets the spec?

# Most of the time is spent with "I think..."

# Only formal proofs could guarantee something more precise

# Formal proofs => Logic?

# What's the relationship between programming and logic?

Programing

Logic

Types

Propositions

# Look at the compiler or lexical structure of a language

# It's a bunch of logical statements

# Programming language can be seen as a logical system

# Propositions and types become identical

# How accurate are you with programming specs?

# We usually do the reverse that we do in Logic

# We write some code and after that we try to bring up a "proof"

# Would it be possible to have a way to "pre-prove" our code?

# Maybe some formalism could help

# Can you think about strong typed languages and the opposite?

# If you have ensured types, doing this proof would require less steps

# Let's talk about ensured types, quickly

*"Hurry up and show me examples of all this formalism"*

# p:P

## WTF???

- This is not an emoji
- "The value p has the type P"
- And so what? Then we analyse the functions, implications and mathematical constructions.

## p:P

- Look carefully and think about functions (form Algebra)
- D(f):{2,9} or
- Value and Types could express domains and ranges in functions!

# And this is a bit about Type Theory

Type Theory

Logic

Type Theory

λ-calculus

Functional Programming

Mathematical Constructions

# Logic

# Nice course

https://www.coursera.org/course/maththink

# About Logic

## "If it's contradictory for no object x has the property P(x), then there's an object x with the property P(x)."

# Concept #1

Constructive vs non-constructive

# Constructive Logic

# What is ~~love~~ ?

# Logic

todo add gif

# Science of the argument

# What is correct?

- Write arguments that can be checked mechanically
- Study properties
- Elaborate semantic meanings

# Concept #2

Types of Logic (Type(type(type))

# Propositional Logic

# and, or, not

# https://github.com/dyokomizo/type-algebra-slides

Type Algebras

# Predicate Logic

# Relating with Functions

# Next steps: lamba calculus

## References and special thanks

- GIRARD, Jean-Yves.
*Proofs and Types.* - @lafp, @romulostotel, @pedrofelipee: GIFs
- @klauss_weyl, for showing me the importance of logic and Type Theory
- Henrique

## Thank you :)

Questions?

hannelita@gmail.com

@hannelita

#### Type Theory

By Hanneli Tavante (hannelita)