

(* Returns a large list of nat related values *) Search "_ + _". (* Inductive bool : Set := true : Bool | false : Bool *) Search nat.

(* Prints information about an object *) (* Print information including the definition *) Print true. (* tt : unit *) (* Check the type of an expressions *) About plus. (* There exists a large number of vernacular commands for querying information. *) Definition inc_nat ( x : nat ) : nat := x + 1. (* Coq can sometimes infer the types of arguments, but it is common practice to annotate with types. Variable and function declarations are formed with the Definition vernacular. Vernacular keywords are capitalized and the commands end with a period. *) (*** Variables and functions ***) (* The Coq proof assistant can be controlled and queried by a command language called the vernacular. (*** Comments ***) (* Comments are enclosed in (* and *). Inside Proof General Ctrl+C Ctrl+ will evaluate up to your cursor. Two common such editors are the CoqIDE and Proof General Emacs mode. The standard usage model of Coq is to write it with interactive tool assistance, which operates like a high powered REPL. This tutorial is based upon its OCaml equivalent It may be helpful, but not necessary to learn some OCaml first, especially if you are unfamiliar with functional programming. This tutorial will focus on the programming aspects of Coq, rather than the proving. Coq is a language containing many fascinating but difficult topics. Via the Curry-Howard correspondence, programs, properties and proofs are formalized in the same language.Ĭoq is developed in OCaml and shares some syntactic and conceptual similarity with it. In this respect, it is similar to other related languages such as Agda, Idris, F*, Lean, and others. This means that the types of the language may depend on the values of variables. The Coq system contains the functional programming language Gallina and is capable of proving properties about programs written in this language.Ĭoq is a dependently typed language. It is designed to build and verify mathematical proofs.
