Questions tagged [coq]

Coq is an interactive theorem prover based on the Calculus of Inductive Constructions.

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

Resources

66 questions
49
votes
6 answers

Learning Automated Theorem Proving

I am learning Automated Theorem Proving / SMT solvers / Proof Assistants by myself and post a series of questions about the process, starting here. Note that these topics are not easily digested without a background in (mathematical) logics. If you…
Guy Coder
  • 5,181
  • 2
  • 30
  • 65
23
votes
2 answers

Recursive definitions over an inductive type with nested components

Consider an inductive type which has some recursive occurrences in a nested, but strictly positive location. For example, trees with finite branching with nodes using a generic list data structure to store the children. Inductive LTree : Set := Node…
Gilles 'SO- stop being evil'
  • 44,159
  • 8
  • 120
  • 184
22
votes
1 answer

Is possible to prove undecidability of the halting problem in Coq?

I was watching the "Five Stages of Accepting Constructive Mathematics" by Andrej Bauer and he says that there is two kinds of proof by contradiction (or two things that mathematicians call proof by contradiction): Assume $P$ is false... blah blah…
Rafael Castro
  • 509
  • 4
  • 15
17
votes
4 answers

Has Anyone Actually Created a System that Writes Computer Programs from specification?

Has anyone ever actually written a system (software or detailed explanation on paper with simple examples) that generates computer programs? I input $Prime(x) \wedge x<10$ and it creates a program that lists the prime numbers less than 10. …
Charlie
16
votes
1 answer

What is different between Set and Type in Coq?

AFAIU types can be a Set whose elements are programs or a proposition whose elements are Proofs. So based on this understanding: Inductive prod (X Y: Type) : Set := | pair: X -> Y -> prod X Y. Following code should compile but it does not due to…
Abhishek Kumar
  • 271
  • 2
  • 3
14
votes
1 answer

Monadic Second Order Logic for Dummies

I am programmer with a grip on automata, but not on logic. I read in papers that the two are very tightly related. Deterministic Finite Automata (DFA), Tree Automata and Visibly Pushdown Automata are all related to Monadic Second Order Logic…
13
votes
2 answers

Proving tautology with coq

Currently I have to learn Coq and don't know how to deal with an or : As an example, as simple as it is, I don't see how to prove: Theorem T0: x \/ ~x. I would really appreciate it, if someone could help me. For reference I use this cheat…
Imago
  • 425
  • 4
  • 17
13
votes
2 answers

Standard constructive definitions of integers, rationals, and reals?

Natural numbers are defined inductively as (using Coq syntax as an example) Inductive nat: Set := | O: nat | S: nat -> nat. Is there a standard way to define integers (and maybe other sets like rationals and reals) constructively?
Alex
  • 273
  • 1
  • 5
12
votes
0 answers

Is extensionality for coinductive datatypes consistent with Coq's logic?

Given a coinductive datatype, one can usually (always?) define a bisimulation as the largest equivalence relation over it. I would like to add an axiom stating that if two members of the type are related by the bisimulation, they are equal in the…
Jannis Limperg
  • 241
  • 1
  • 5
12
votes
1 answer

baz_num_elts exercise from Software Foundations

I'm at the following exercise in Software Foundations: (** **** Exercise: 2 stars (baz_num_elts) *) (** Consider the following inductive definition: *) Inductive baz : Type := | x : baz -> baz | y : baz -> bool -> baz. (** How _many_…
Twernmilt
  • 123
  • 6
12
votes
2 answers

Why does Coq include let-expressions in its core language

Coq includes let-expressions in its core language. We can translate let-expressions to applications like this: let x : t = v in b ~> (\(x:t). b) v I understand that this does not always work because the value v would not be available when…
Labbekak
  • 575
  • 3
  • 11
11
votes
3 answers

Polymorphism and Inductive datatypes

I'm curious. I've been working on this datatype in OCaml: type 'a exptree = | Epsilon | Delta of 'a exptree * 'a exptree | Omicron of 'a | Iota of 'a exptree exptree Which can be manipulated using explicitly typed recursive functions (a…
Stéphane Gimenez
  • 1,490
  • 1
  • 14
  • 29
10
votes
1 answer

Why are recursive types needed as primitives for proofs in dependent type systems?

I'm relatively new to type theory and dependent programming. I've been studying the calculus of constructions (CoC) and other pure type systems. I'm particularly interested in using it as a proof-preserving intermediate representation for a compiler…
paulotorrens
  • 731
  • 3
  • 11
10
votes
2 answers

Theorem Proofs in Coq

Background I am learning assistance, Coq, on my own. So far, I have completed reading Yves Bertot's Coq in a Hurry. Now, my goal is to prove some basic results concerning the natural numbers, culminating with the so-called division algorithm.…
8
votes
1 answer

What does instantiating existential variables with out of scope variable imply?

I have following unfinished proof of a lemma: Goal forall (P : Type -> Prop) (Q : Prop), ((forall x, (P x)) -> Q) -> (exists x, P x -> Q). Proof. intros. eapply ex_intro. intros. apply H. intros. eapply H0. The problem is the last eapply…
Jason Hu
  • 642
  • 3
  • 13
1
2 3 4 5