Professional Documents
Culture Documents
Formality
Victor Maia
Leonardo Souza
!1 devcon iv
Thesis: crypto browsers will rise soon
!2 devcon iv
Moon Project
Finding the best UX for Ethereum
!3 devcon iv
!4 devcon iv
!5 devcon iv
!6 devcon iv
A small problem...
!7 devcon iv
Idris Agda Coq Isabelle
!8 devcon iv
High Level Fast
Formal Proofs No GC
Idris Solidity?
Haskell? C Vyper?
Isabelle Fortran
!9 devcon iv
Formality
High-level functional language
Non-garbage collected
!10 devcon iv
-- Natural number
data Nat : Type
| succ : (n : Nat) -> Nat
| zero : Nat
-- Equality
data Eq : (A : Type, x : A, y : A) -> Type
| refl : (A : Type, x : A) -> Eq(A, x, x)
!11 devcon iv
-- Doubles a number
let double(a : Nat) =>
case a
| succ(pred) => Nat.succ(Nat.succ(fold(pred)))
| zero => Nat.zero
: Nat
-- Type-safe head
let head(A : Type, n : Nat, vect : Vect(A, Nat.succ(n))) =>
case vect
| cons(A, n, x, xs) => x
| nil(A) => Unit.void
: (A, n) => HeadOf(A, n)
-- Proof that 'a == b' implies 'b == a'
let sym(A : Type, a : A, b : A, e : Eq(A, a, b)) =>
case e
| refl(A, x) => Eq.refl(A, x)
: (A, a, b) => Eq(A, b, a)
devcon iv
How fast?
!13 devcon iv
// Array with 100 zeros
var nums = Array(100).fill(0);
// Outputs result
console.log(JSON.stringify(nums));
devcon iv
List.map (high-level code)
// Prints result
console.log(JSON.stringify(bits));
devcon iv
Bits.flip (low-level code)
How?
GPU runtime?
EVM compilation?
!19 devcon iv
Mathematics
!20 devcon iv
The four axis of Formality
Lazy Clones
Linear Types
Unlike Rust, values can be cloned with no
Like Rust, values can only exist in one place at the
costs, making linearity much less painful, as we
same time, making garbage collection
don't need borrows. That is possible because
unnecessary: memory is freed when values go out
copies are made lazily.
of scope!
!21 devcon iv
A new model of computation Lambda
Calculus
Turing
Machine
Interaction
Combinators
http://bit.do/icomb
!22 devcon iv
High Level Fast
Formal Proofs No GC
Idris Solidity?
Haskell? C Vyper?
Isabelle Fortran
!23 devcon iv
20xx?
github.com/astump/cedilleum-spec
!25 devcon iv
Contact us!
github.com/MaiaVictor/Formality
!26 devcon iv
Contact us!
/MaiaVictor /LeonardoSTSouza
/MaiaVictor /LSTSouza
github.com/MaiaVictor/Formality
!27 devcon iv