Questions tagged [coq]

Coq is a formal proof management system, semi-interactive theorem prover and functional programming language. Coq is used for software verification, the formalization of programming languages, the formalization of mathematical theorems, teaching, and more. Due to the interactive nature of Coq, we recommend questions to link to executable examples at https://x80.org/collacoq/ if deemed appropriate.

Coq is an interactive theorem prover based on the calculus of inductive constructions.

Resources

2862 questions
23
votes
2 answers

What does V stand for in the Coq file extension?

Is .v for verification? validation? vamanos? Why not use a .coq extension?
mcandre
  • 22,868
  • 20
  • 88
  • 147
22
votes
5 answers

proofs about regular expressions

Does anyone know any examples of the following? Proof developments about regular expressions (possibly extended with backreferences) in proof assistants (such as Coq). Programs in dependently-typed languages (such as Agda) about regular…
user108761
22
votes
4 answers

coqide - can't load modules from same folder

I can't load modules that are in same folder in CoqIde. I'm trying to load sources from Software Foundations, I'm running coqide in folder that contains SF sources with coqide or coqide ./, then after opening and running the file, I'm getting this…
sinan
  • 6,809
  • 6
  • 38
  • 67
21
votes
2 answers

Find the definition and notations like ++ in Coq

How can we get the definition/type for those notations like "+", or "++" of List? I have tried : Search ++, Search "++", Search (++), SearchAbout ... and Check ++, Check "++", Check(++). None of them work however... SearchAbout "++" does show some…
zell
  • 9,830
  • 10
  • 62
  • 115
19
votes
2 answers

What exactly is a Set in Coq

I'm still puzzled what the sort Set means in Coq. When do I use Set and when do I use Type? In Hott a Set is defined as a type, where identity proofs are unique. But I think in Coq it has a different interpretation.
Cryptostasis
  • 1,166
  • 6
  • 15
19
votes
1 answer

How to type check recursive definitions using Algorithm W?

I am implementing Algorithm W (the Hindley-Milner type system) in JavaScript: The function which implements the above rules is typecheck and it has the following signature: typecheck :: (Context, Expr) -> Monotype It is defined as…
Aadit M Shah
  • 72,912
  • 30
  • 168
  • 299
18
votes
1 answer

What does "Error: Universe inconsistency" mean in Coq?

I am working through Software Foundations and am currently doing the exercises on Church numerals. Here is the type signature of a natural number: Definition nat := forall X : Type, (X -> X) -> X -> X. I have defined a function succ of type nat ->…
augurar
  • 12,081
  • 6
  • 50
  • 65
18
votes
5 answers

Definition of a certified program

I see a couple of different research groups, and at least one book, that talk about using Coq for designing certified programs. Is there are consensus on what the definition of certified program is? From what I can tell, all it really means is…
wyer33
  • 6,060
  • 4
  • 23
  • 53
17
votes
0 answers

What is the Parigot Mendler encoding?

The following encoding of Nats is used in some Cedille sources: cNat : ★ cNat = ∀ X : ★ . X ➔ (∀ R : ★ . (R ➔ X) ➔ R ➔ X) ➔ X cZ : cNat cZ = Λ X . λ z . λ s . z cS : ∀ A : ★ . (A ➔ cNat) ➔ A ➔ cNat cS = Λ A . λ e . λ d . Λ X . λ z . λ s . s · A (λ…
MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
17
votes
3 answers

Keeping information when using induction?

I am using the Coq Proof Assistant to implement a model of a (small) programming language (extending an implementation of Featherweight Java by Bruno De Fraine, Erik Ernst, Mario Südholt). One thing that keeps coming up when using the induction…
mdiin
  • 427
  • 6
  • 12
17
votes
2 answers

How to switch the current goal in Coq?

Is it possible to switch the current goal or subgoal to prove in Coq? For example, I have a goal like this (from an eexists): ______________________________________(1/1) ?s > 0 /\ r1 * (r1 + s1) + ?s = r3 * (r3 + s2) What I want to do is to split…
thor
  • 21,418
  • 31
  • 87
  • 173
17
votes
1 answer

"Verbose" auto in Coq

I'm learning Coq and the book I'm learning from, (CPDT) makes heavy use of auto in proofs. Since I'm learning I think it might be helpful for me to see exactly what auto is doing under the hood (the less magic early on the better). Is there any way…
user2079615
  • 171
  • 4
16
votes
2 answers

Ltac-tically abstracting over a subterm of the goal type

As a rough and untutored background, in HoTT, one deduces the heck out of the inductively defined type Inductive paths {X : Type } : X -> X -> Type := | idpath : forall x: X, paths x x. which allows the very general construction Lemma transport {X…
14
votes
3 answers

Why do Calculus of Construction based languages use Setoids so much?

One finds that Setoids are widely used in languages such as Agda, Coq, ... Indeed languages such as Lean have argued that they could help avoid "Setoid Hell". What is the reason for using Setoids in the first place? Does the move to extensional type…
Henry Story
  • 2,116
  • 1
  • 17
  • 28
14
votes
1 answer

Require, Import, Require Import

In Coq, what's the difference between ... ? Require X. Import X. Require Import X. I have basically memorized some common patterns. I usually see code using Require Import X. Then there's Import ListNotation. And I just noticed it's also possible…
Mei Zhang
  • 1,434
  • 13
  • 29