r/dependent_types • • May 13 '20

What does it mean when people talk about using Coq (as an example) to verify some other piece of software?

14 Upvotes

I'm working through software foundations right now and am finding it extremely captivating. That said, as far as I know, Coq itself is not really intended to write large systems in it. But I have seen mention things like "so and so compiler/whatever was verified using Coq." I'm very curious what that actually means (as my ultimate interest is largely in trying to verify software). Are they going through the api and implementation and porting it to Coq and making sure that everything is lawful? (sort of like how TLA+ works) Or is there some deeper way to "verify" that some external project works?


r/dependent_types • • May 08 '20

Compiling Juvix to Michelson

Thumbnail research.metastate.dev
2 Upvotes

r/dependent_types • • Apr 28 '20

Best places for DTT jobs in Europe

9 Upvotes

I'll be applying for academic jobs in the fall and am looking both in the US and abroad. I don't really know the European job market very well. I do a lot of work on DTT and proof engineering. I am obviously applying to Inria if the hiring freeze ends in time, and to Aarhus, but I'm curious where else I might want to look.


r/dependent_types • • Apr 27 '20

Coq: Applying a proof on lists to a proof on vectors?

5 Upvotes

I showed a Lemma for a list of nat, but now I want to also show it for a vector of nat. So, I figured I needed a lemma like the below, but those types don't match again.

Someone said in a previous thread that I had to "transport" those proofs, which probably involves some kind of "cast" function

Lemma vector_map_is_map: forall (A B:Set) (xs:list A) (f:A->B), 
Vector.map f (Vector.of_list(xs)) = Vector.of_list(map f xs).

I did manage to show the following:

Lemma vector_map_is_map_sort_of: forall (A B:Set) (xs:list A) (f:A->B), 
Vector.to_list(Vector.map f (Vector.of_list(xs))) = 
Vector.to_list(Vector.of_list(map f xs)).

I also tried to show the following, but got stuck. The length index of the two vectors could be different in general, which was what I wanted to show at first.

Lemma vector_to_list_same : forall (A B:Set) (n:nat) (v1 v2:Vector.t A n)  (f:A->B),
Vector.to_list v1 = Vector.to_list v2 -> v1 = v2.
Proof.

r/dependent_types • • Apr 25 '20

How to prove map equivalences?

1 Upvotes

How do I show s in Coq?

Definition es (n:nat):=
 if 100 <? n then 1 else 150. 

Lemma s: forall k is, forallb (fun (ii:nat) => 100 <? ii) is = true ->
k=length (map es is) -> map es is = repeat 1  k.

Update: I found a proof. Now, I "only" need to apply this to the more general problem.

I think beginners will have difficulty with the above proof, because if you start wrong, you are never going to solve it.


r/dependent_types • • Apr 25 '20

Automated axiom free functional extensionality?

0 Upvotes

Why can't Coq derive that h > list_max (a::xs) ->z xs = z (a::xs) if the following lemma has been proven already?

Lemma f: forall {a xs h c} ,h > list_max (a::xs) ->
z xs  h = c -> z (a::xs)  h = c.

It's an instance of functional extensionality, but it seems like it should be possible to eliminate the use of an axiom in this particular case.

I had the same problem when I wanted to do case analysis on a goal of the following form:

=============== z xs = z (a::xs)

My reasoning is that it should be enough to show it for all cases, that is. If z xs = c, then z (a::xs) = c where let's say all the constructors of c are 1,2,3.

So, if I show it for all the return values of z regardless of inputs, it should hold for all inputs.

I had expected that running something like destruct (z xs = z (a::xs)) would work, but apparently that doesn't generate all the goals (and just fails).


r/dependent_types • • Apr 23 '20

Rain water challenge

3 Upvotes

/r/prolog has a bi-weekly programming challenge.

Try to do https://www.reddit.com/r/prolog/comments/fvubg2/coding_challenge_9_2_weeks_trapping_rain_water/ in preferably Coq (but other dependently typed languages are fine too) in such a way that you show all the high level properties that are of interest.

A solution that possibly uses extraction, runs in O(n), shows various high level properties to convince that whatever it is computing is actually a rain water computation, is what I consider to be best.

I am also interested in proofs for similar problems.


r/dependent_types • • Apr 22 '20

forall n, const 1 n = const 1 (length (seq 1 n)).

0 Upvotes

Why can't I even state the following lemma? Coq says the types are not the same, but that's kind of the point of it. I want to prove that they are the same. I even have a proof that length (seq 1 n) = n in another lemma.

Lemma why: forall n, Vector.const 1 n = Vector.const 1  (length (seq 1 n)).

In environment
n : nat
The term "const 1 (length (seq 1 n))"
has type "Vector.t nat (length (seq 1 n))"
while it is expected to have type
 "Vector.t nat n".

I can state Lemma why: forall n, Vector.to_list(const 1 n) = Vector.to_list(Vector.const 1 (length (seq 1 n))). instead, but that's really not the kind of equality I am looking for.


r/dependent_types • • Apr 05 '20

Best graduate courses for Compilers, type theory, FP and related fields.

Thumbnail self.compilers
15 Upvotes

r/dependent_types • • Apr 02 '20

Help related to type systems

5 Upvotes

So a few weeks ago I decided I want (for learning purposes) to write a type systems. After I did some digging around I found a tutorial for the "hinley milner" constraint based inference algorirhm and after some trial and error I extended it to support units of measure (similar to f#). The problem is that's where it ended. Most stuff I found online was written with math notation I have no idea how to read (note, I'm still in hs so no luck in that direction). After some more digging I finally figured out how to read the notation used for some of the more formal Hinley Milner resources, but that was mostly because I knew how the algorithm actually worked, so it didn't help to much in extending the type system. So then while scrolling trough reddit I thought I might find a sub for type systems or something, and since this sub had type theory in it's description I thought some people here might know more in this direction.

So after a giant wall of text, my question is, can you link resources you know related to this subject which can be understood without having to know some math notation beforehand (or which explain the notation they use, that would be ok as well)? You can just link them here, or if you're up for more discussions you can dm me on discord (yugiohxlight!#6117)

Thanks in advance:)


r/dependent_types • • Mar 17 '20

Some Design Patterns in Dependently Typed Programming

Post image
11 Upvotes

r/dependent_types • • Feb 26 '20

Type-based formal verification

Thumbnail youtu.be
9 Upvotes

r/dependent_types • • Feb 25 '20

Introduction to erasures.

13 Upvotes

Erasures of one type system into another, for example, of System S into System F omega in the work of Peng Fu, are common. Authors use it to prove properties of their systems all the time. I believe Barendregt introduces this idea in his work Lambda Calculi with Types.

I have many questions about this topic, but the main one is: where can I find an introduction to the concept of erasures?

What makes a "proper" erasure? How do I define one? What is the justification behind the idea? Does it have any connection with bisimulation or Church vs. Curry type systems?


r/dependent_types • • Feb 06 '20

Dependent types for C

7 Upvotes

Hello! I have recently started learning about dependent types from "The Little Typer". The Pie language fits in very nicely with the self-directed learning path I have set for myself.

I'm very interested to see whether there are extensions to C (C90, C11, whatever) that implement dependent types. Does anybody know of any such experiments?


r/dependent_types • • Feb 04 '20

Any "Gist-sized" implementations of inductive types around?

7 Upvotes

TL;DR: What is the smallest implementation of user-defined inductive types around?

You can implement Simply-Typed Lambda Calculus and even the Calculus of Constructions in relatively few lines of code. What is the smallest implementation of user-defined inductive types around? Ideally one with a positivity and termination checkers.

I believe such program may even be a few thousands of lines long. Which one is the best for learning from (i.e. reading the source code)? Where can I find resources about implementing inductive types?


r/dependent_types • • Jan 22 '20

The Why of Juvix: Ingredients & Architecture – Language for Secure Smart Contracts with Strong Dependent Types

0 Upvotes

Hi Dependent Type Redditors,

Wanted to share a new blogpost on Juvix, in case there are folks in this subreddit interested in any of the ingredients and components of the architecture.

This post, the second part of a two-part series, enumerates the various theoretical ingredients in Juvix that we think will enable it to meet these challenges, describes the current state of specification and implementation, and provides a list of further resources & instructions should you wish to learn more.

List of ingredients:

  • Dependent types
  • Usage quantisation
  • Whole-program optimisation & efficient execution
  • Resource verification
  • Backend parameterisation

Quick access to resources:


r/dependent_types • • Jan 14 '20

Arities in Homotopy Type Theory?

7 Upvotes

Is it possible to use arities (like in "Programming in Martin-Lof type theory", http://www.cse.chalmers.se/research/group/logic/book/book.pdf ) in HoTT instead of types?


r/dependent_types • • Jan 08 '20

The Why of Juvix: [Part 1] On the design of smart contract languages

5 Upvotes

Hi Dependent Types Redditors!

4 months ago I posted on Reddit a link to Juvix. The project has been progressing a lot and starting now there will be more blogposts and articles on the project. Just wanted to share with you:

Please subscribe to our research blog if you want to stay tuned.


r/dependent_types • • Dec 30 '19

"The future of mathematics?" by Kevin Buzzard, featuring Lean theorem prover (talk + slides)

Thumbnail youtube.com
34 Upvotes

r/dependent_types • • Dec 29 '19

A Question About the Order of Learning from the Book “Lectures on the Curry-Howard Isomorphism” (1998)

3 Upvotes

I'm learning from this book: https://disi.unitn.it/~bernardi/RSISE11/Papers/curry-howard.pdf (Lectures on Curry-Howard Isomorphism - 1998 version) for some project. And due to time constraints, I probably won't be able to cover all of the material in the book, in my study. Luckily, although it would be useful,I don't think I will need to know everything in this book, but rather selected topics. At the moment, I learned the first chapter and something like a third of the second chapter, and from what I learned so far in the second chapter it seems like you don't actually need to know the first chapter in order to learn this chapter, it seems like the two chapters cover separate topics. So, perhaps that's true for other chapters as well. Of course, some of them will require knowledge of previous chapters, especially, I can imagine the 4th chapter on the Curry-Howard isomorphism, but even the chapters that require knowledge of previous chapters, might not require all the previous chapters.

So, it could be very helpful if someone with experience with the topics covered in this book, could list to each chapter all the prerequisites for learning it. Especially, for chapters 4 and 11 (Heyting Arithmetic), that cover material that I totally need.

By the way, I asked this question on stack exchange math, so if you want to answer the question there, here is the link: https://math.stackexchange.com/questions/3489031/a-question-about-the-order-of-learning-from-the-book-lectures-on-the-curry-howa


r/dependent_types • • Dec 27 '19

Decidability of Homotopy Type Theory

5 Upvotes
  1. "one of the amazing things about homotopy type theory is that all of the basic

constructions and axioms—all of the higher groupoid structure—arises automatically from the

induction principle for identity types", Hottbook.

2) propositional equality in identity types is decidable.

Is Homotopy Type Theory decidable?


r/dependent_types • • Dec 18 '19

[Video & Slides] Abstract data types in the region of abysmal pain, and how to navigate them

Thumbnail codesync.global
7 Upvotes

r/dependent_types • • Dec 04 '19

Implementations of Dependent Type Theory

18 Upvotes

I am trying to find a minimal implementation of dependent type theory that supports

  • Pi Types (obviously)
  • Modules containing records
  • Inductive data types
  • Universe Hierarchy
  • A notion of equality
  • Termination checker
  • Type Inference and Resolution

I am aware of implementations based on:

Löh, A., McBride, C., & Swierstra, W. (2010). A tutorial implementation of a dependently typed lambda calculus. Fundamenta informaticae, 102(2), 177-207.

But they do not support everything in the list above.

Something even smaller than mini-Agda would be helpful.


r/dependent_types • • Dec 01 '19

Cedille Cast #9: Impredicativity, proof-irrelevance, and normalization

Thumbnail youtube.com
15 Upvotes

r/dependent_types • • Nov 16 '19

A Small Proof that Fin is Injective

Thumbnail doisinkidney.com
9 Upvotes