Introduction to Coq Proof Assistant

Similar documents
Coq in a Hurry. Yves Bertot

Introduction to dependent types in Coq

Static and User-Extensible Proof Checking. Antonis Stampoulis Zhong Shao Yale University POPL 2012

ABriefOverviewofAgda A Functional Language with Dependent Types

KAT and PHL in Coq. 1 Introduction. 2 Revision of KAT and PHL concepts. David Pereira 1 and Nelma Moreira 1

An experiment with variable binding, denotational semantics, and logical relations in Coq. Adam Chlipala University of California, Berkeley

Formal proofs and certified computation in Coq

A NEW PROOF-ASSISTANT THAT REVISITS HOMOTOPY TYPE THEORY THE THEORETICAL FOUNDATIONS OF COQ USING NICOLAS TABAREAU

Types Summer School Gothenburg Sweden August Dogma oftype Theory. Everything has a type

Coq, a formal proof development environment combining logic and programming. Hugo Herbelin

Heq: a Coq library for Heterogeneous Equality

Coq Summer School. Yves Bertot

Universes. Universes for Data. Peter Morris. University of Nottingham. November 12, 2009

Coq in a Hurry. Yves Bertot. To cite this version: HAL Id: inria v6

Coq in a Hurry. Yves Bertot. October 2008

Embedding logics in Dedukti

Induction in Coq. Nate Foster Spring 2018

Infinite Objects and Proofs 1

Natural deduction environment for Matita

A Reflection-based Proof Tactic for Lattices in COQ

Logical Verification Course Notes. Femke van Raamsdonk Vrije Universiteit Amsterdam

Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description)

Certified Programming with Dependent Types

Introduction to the Calculus of Inductive Definitions

The Coq Proof Assistant A Tutorial

Introduction to Co-Induction in Coq

Advanced Features: Type Classes and Relations

CS 456 (Fall 2018) Scribe Notes: 2

Program Calculation in Coq

The Coq Proof Assistant A Tutorial

On Agda JAIST/AIST WS CVS/AIST Yoshiki Kinoshita, Yoriyuki Yamagata. Agenda

Cooperating Theorem Provers: A Case Study Combining HOL-Light and CVC Lite

c constructor P, Q terms used as propositions G, H hypotheses scope identifier for a notation scope M, module identifiers t, u arbitrary terms

Coq quick reference. Category Example Description. Inductive type with instances defined by constructors, including y of type Y. Inductive X : Univ :=

Lost in translation. Leonardo de Moura Microsoft Research. how easy problems become hard due to bad encodings. Vampire Workshop 2015

CS3110 Spring 2017 Lecture 9 Inductive proofs of specifications

Bidirectional Certified Programming

Functional Programming

Adam Chlipala University of California, Berkeley ICFP 2006

Coq Summer School, Session 9 : Dependent programs with logical parts. Pierre Letouzey

Higher-Order Recursive Path Orderings à la carte

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

System Description: Twelf A Meta-Logical Framework for Deductive Systems

A Coq tutorial for confirmed Proof system users

Formal Verification of a Floating-Point Elementary Function

The Coq Proof Assistant A Tutorial

The Coq Proof Assistant Reference Manual

Autosubst Manual. May 20, 2016

Towards Coq Formalisation of {log} Set Constraints Resolution

Introduction to the Coq proof assistant First part

CS3110 Spring 2016 Lecture 5 Modules for Rational Numbers

Automata and Formal Languages - CM0081 Introduction to Agda

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214

Lesson 4 Typed Arithmetic Typed Lambda Calculus

Proofs-Programs correspondance and Security

B vs. Coq to prove a Garbage Collector

Programming and Reasonning with PowerLists in Coq. Virginia Niculescu. Rapport n o RR

Mathematics for Computer Scientists 2 (G52MC2)

An Introduction to Programming and Proving in Agda (incomplete draft)

LASER 2011 Summerschool Elba Island, Italy Basics of COQ

SJTU SUMMER 2014 SOFTWARE FOUNDATIONS. Dr. Michael Clarkson

CS3110 Spring 2017 Lecture 7 Specifications using types continued

Research Institute for Symbolic Computation Johannes Kepler University A-4040 Linz, Austria, Europe

Inductive data types

Improving Coq Propositional Reasoning Using a Lazy CNF Conversion

The Matita Interactive Theorem Prover

Coq projects for type theory 2018

Lecture slides & distribution files:

Isabelle/HOL:Selected Features and Recent Improvements

Friends with Benefits

CIS 500: Software Foundations

First-Class Type Classes

HIGHER-ORDER ABSTRACT SYNTAX IN TYPE THEORY

CIS 194: Homework 8. Due Wednesday, 8 April. Propositional Logic. Implication

Coq with Classes. Matthieu Sozeau. Journées PPS 2011 September 5th 2011 Trouville, France. Project Team πr 2 INRIA Paris

Synthesis of distributed mobile programs using monadic types in Coq

Functional Programming with Isabelle/HOL

Analysis of dependent types in Coq through the deletion of the largest node of a binary search tree

From Digital Images to Simplicial Complexes: A Report

Numerical Computations and Formal Methods

Equations: a tool for dependent pattern-matching

A Natural Deduction Environment for Matita

Ideas over terms generalization in Coq

It is noted in this comparative study that the strongest point of the Coq system is the power of the logic it is based on. The HOL logic is much more

Inductive Beluga: Programming Proofs

Crafting a Proof Assistant

We Trusted What We Proved! Greatest Common Divisors: Theorem, Proof and Algorithm in PowerEpsilon

Inductive Definitions, continued

CS3110 Spring 2017 Lecture 8 Specifications continued

Mathematics for Computer Scientists 2 (G52MC2)

A NEW PROOF-ASSISTANT THAT REVISITS HOMOTOPY TYPE THEORY THE THEORETICAL FOUNDATIONS OF COQ USING NICOLAS TABAREAU

CIS 500 Software Foundations. Midterm I. (Standard and advanced versions together) October 1, 2013 Answer key

CS3110 Spring 2017 Lecture 6 Building on Problem Set 1

Isabelle Tutorial: System, HOL and Proofs

Automated verification of termination certificates

Coq in a Hurry. Yves Bertot. HAL Id: inria v5

Modular dependent induction in Coq, Mendler-style. Paolo Torrini

Catamorphism Generation and Fusion Using Coq

When double rounding is odd

Proof Trick: Small Inversions

Transcription:

Introduction to Coq Proof Assistant Qian Hu, M.Sc McMaster University March 3, 2010

Presentation Outline Overview Computer Assistance in Proofs Proof Assistant Coq Introduction The Coq Proof Assistant Programming With Coq Demo References 2

Overview Computer Assistance in Proofs Proof consists of: reasoning (derivation rules) and computations (reductions). Computers can assist with both: Computations: numerical computations ( calculators ) symbolic computations (computer algebra systems) Reasoning: Automated theorem provers Fully automated System delivers a proof Specialized Proof assistants Interactive Human delivers a proof Highly general Under development: combining computations and reasoning in one system (e.g. Maple mode for Coq) 3

Overview Proof Assistants General structure (details may vary) User Specification User Tactics Proof Development System Proof Assistant Proof Object Proof Checker Verified Statement An error in the checker invalidates the whole approach! De Bruijn principle: we shall prefer systems with a small, reliable checker 4

Presentation Outline Overview Computer in Proofs Proof Assistant Coq Introduction The Coq Proof Assistant Programming With Coq Demo References 2

Introduction Coq: Short Intro Theorem prover developed in France Name is the French word for rooster Lots of library & tool support Available for all major platforms(linux, MS Win, OSX) on the web at http://coq.inria.fr Written in the language O Caml Working with Coq: interface CoqIDE (User-friendly but not stable for Windows) ProofGeneral (uses Xemacs, somehow more difficult to use but stable) 5

Introduction CoqIDE Proof Script Current Goal Error Reporting 6

The Coq Proof Assistant Mechanisms Coq provides mechanisms for Writing (encoding) specifications Developing interactively new proofs Batch checking of existing proofs Reusing previously developed proofs and specifications Extracting programs from proofs 7

The Coq Proof Assistant CIC The formalism (metalanguage) of Coq is the Calculus of (Co)Inductive Constructions (CIC), a conservative extension of) lc lc plus inductive types 8

The Coq Proof Assistant Curry-Howard Isomorphism Central Principle: Systems are represented (encoded) via the Curry-Howard isomorphism Propositions as types, Proofs as terms proof term Proposition type proof checking type checking proving / proof search term search program, algorithm term specification type program proof 9

The Coq Proof Assistant Tactic-based System CIC is quite powerful, so automatic proof generation is quite limited Instead, a user provides hints in the form of proof scripts Proof scripts are lists of tactics, which guide Coq in generating the proof 10

Programming With Coq Declarations Variables can be declared as follows: Coq < Variable n : nat. n is assumed One may assume properties for declared variables: Coq < Hypothesis Pos_n : n>0. Pos_n is assumed 12

Programming With Coq Definitions Attach a name to an expression Coq < Definition three := 3. three is defined Definition Functions Coq < Definition add3 (x : nat) := x + 3. add3 is defined 13

Programming With Coq Check The command Check produces the type of its argument. Coq < Check O. 0 : nat Coq < Check 2 + 3. 2 + 3 : nat 14

Programming With Coq Libraries When you start Coq the Core library is loaded at start. It defines many basic notions and notations (e.g. Set, nat, plus, +, <). For more involved properties and definitions one may need to load other libraries. E.g.: Coq < Require Import Arith. 15

Programming With Coq Some Useful Tactics => for all /\ \/ exist not = Hypothesis apply apply elim elim elim elim rewrite goal intros intros split Left or right Exists v intros reflexivity 16

Programming With Coq Proving A -> A 17

Programming With Coq Proving A /\ B -> B /\ A 18

Programming With Coq Demo Demo 1 More examples in the Demo 2 19

References 1 Coq: http://coq.inria.fr The Coq development team. The Coq proof Assistant Reference Msnual, Ecole Polytechnique, INRIA, 2009 Yves Bertot, Coq in A Hurry,2005 Yves Bertot, Pierre Castéran, Coq'Art: The Calculus of Inductive Constructions. Springer-Verlag,2004 Eduardo Giménez, Pierre Castéran, A Tutorial on [Co- ]Inductive Types in Coq, 2006 20

References 2 Adam Koprowski, Introduction to Coq--Proving With Computer Assistance, 2007 Yves Bertot, A Short Presentation of Coq, 2008 Furio Honsell, Interactive Proof Assistants Based on Type Theory: Coq, 2001 Martin Henz and Aquinas Hobor, Automated Theorem Proving Wiki, Curry Howard correspondence 21

The End Thank You! 22