\begin{code}
main = putStrLn "Easter Egg: to force Makefile"
\end{code}
**Goal**
Automatically Proving Properties of Programs
Algorithmic Verification
========================
A Classic Example
-----------------
**Verify:** indices `i`, `min` are *within bounds* of `arr`
A Classic Example
-----------------
Easy, use Program **Logic** + **Analysis**
Program Logic
-------------
------------------- ----------------------------------------------------
**Specification** *Predicates* eg. invariants, pre-/post-conditions
**Verification** *Conditions* checked by SMT solver
------------------- ----------------------------------------------------
Program Logic
-------------
------------------- ----------------------------------------------------
**Specification** *Predicates* eg. invariants, pre-/post-conditions
**Verification** *Conditions* checked by SMT solver
------------------- ----------------------------------------------------
No invariants? **Inference** via Analysis...
Program Analysis
----------------
**Invariants are Fixpoints of Reachable States**
Computable via *Dataflow Analysis* or *Abstract Interpretation*
Logic + Analysis
----------------
------------------- ----------------------------------------------------
**Specification** *Predicates*, eg. invariants, pre-/post-conditions
**Verification** *Conditions* checked by SMT solver
**Inference** *Fixpoint* over abstract domain
------------------- ----------------------------------------------------
But ... limited to "classical" programs!
"Classical" vs. "Modern" Programs
=================================
{#classicalvmodern}
--------------------
"Classical" Programs
--------------------
**Imperative**
Assignments, Branches, Loops
**First-Order Functions**
Recursion
**Objects**
Classes, Inheritance*
"Modern" Programs
-----------------
**Containers**
Arrays, Lists, HashMaps,...
**Polymorphism**
Generics, Typeclasses...
**Higher Order Functions**
Callbacks, map, reduce, filter,...
A "Modern" Example
------------------
Verify indices `i`, `min` are *within bounds* of `arr`
A "Modern" Example
------------------
Pose vexing challenges for Logic + Analysis
Logic + Analysis Challenges
----------------------------
+ How to analyze **unbounded** contents of `arr`?
+
How to **summarize** `reduce` independent of `callback`?
+
How to precisely reuse summary at each **context** ?
{#motiv}
=========
Logic + Analysis + *Types*
--------------------------
Logic + Analysis + *Types*
==========================
Refinement Types
----------------
Use **Types** to lift **Logic + Analysis** to Modern Programs