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
1
vote
1 answer

cannot rename things with dependent induction?

In the middle of my proof, this works induction H1 as [ | | | | | | | | | ]. But, when I exchange it for dependent induction H1 as [ | | | | | | | | | ]. I get "Error: Syntax error: [tactic:ltac_use_default] expected after [tactic:tactic] (in…
push33n
  • 398
  • 4
  • 12
1
vote
2 answers

Proving technology of Coq's kernel

Isabelle bases its kernel proof power in resolution coupled with higher-order unification. How are theorems proven by Coq's kernel? The question arises from reading Paulson's "The foundation of a generic theorem prover": Propositions-as-types could…
user1868607
  • 2,558
  • 1
  • 17
  • 38
1
vote
2 answers

define Category in which arrows are parametrised functions using Coq

Coq is version 8.10.2 and I use category-theory library made by jwiegley. I want to define Category whose objects are Euclidean spaces and arrows are Parametrised function (P -> A -> B) between Objects A and B. parameter P is arbitrary Euclidean…
Daisuke Sugawara
  • 311
  • 4
  • 20
1
vote
1 answer

Greatest value in natural number list

I have defined a function,which finds greatest value in the list of natural numbers and head of the list save this value. I want to prove that all the elements in the list are less or equal to natural number present at head of the list.I have…
1
vote
1 answer

How to get cardinal of ensembles explicitly

I am trying to make a function like Definition cardinality (A : Ensemble U) : nat., so that for each ensemble I get its cardinal. I found this to be a challenging problem, and I would like to get some help. By the way, there is cardinal U A n where…
user5876164
  • 471
  • 3
  • 15
1
vote
1 answer

Using Notations in Records

The Coq manual (Simultaneous definition of terms and notations) states Thanks to reserved notations, inductive, co-inductive, record, recursive and corecursive definitions can use customized notations. I would like to define something…
larsr
  • 5,447
  • 19
  • 38
1
vote
1 answer

How to apply a lemma to 2 hypothesis

Theorem ev_plus_plus : forall n m p, even (n+m) -> even (n+p) -> even (m+p). Proof. intros n m p Hnm Hnp. We get this: 1 subgoal (ID 189) n, m, p : nat Hnm : even (n + m) Hnp : even (n + p) ============================ even (m +…
user4035
  • 22,508
  • 11
  • 59
  • 94
1
vote
1 answer

Improving dependently typed reverse function

Here is the code I have thus far: Section ilist. Variable A: Set. Inductive ilist : nat -> Set := | Nil : ilist O | Cons : forall n, A -> ilist n -> ilist (S n). (* not sure how to use in irev_aux *) Lemma same_length: forall n i2, ilist (n + S…
A Question Asker
  • 3,339
  • 7
  • 31
  • 39
1
vote
1 answer

Abstraction/typing error resulting from case_eq and rewriting in Coq

Consider the situation described by the code below, wherein I have a "piecewise" function h behaving differently (like f, or like g) depending on some (decidable) property condition of its input (h is defined using case_eq). Assume that I can prove…
Feryll
  • 317
  • 1
  • 8
1
vote
1 answer

Dependent pattern match asks for a wildcard instead of proper type

Note: this code is similar (but not identical) to the code in Some help proving coq function terminates. Where that code deals with the question of equality, this tries to extend addition in this little language to include pairs. Inductive type :…
A Question Asker
  • 3,339
  • 7
  • 31
  • 39
1
vote
1 answer

Some help proving coq function terminates

I know this is a common issue :) I will keep reading up, but I've done some searching and thing I don't fully understand how "measure" works I'm working through Benjamin Pierce's class exercises for Certified Programming with Dependent Types. Here's…
A Question Asker
  • 3,339
  • 7
  • 31
  • 39
1
vote
1 answer

How can I create tuples in Coq and use them as new dataTypes

I'm trying to write the following ML code as Coq code: (This ML code comes from the book "computational category theory" by Ryheard and Burstall) datatype ’a Set_Arrow = set_arrow of (’a Set)*(’a->’a)*(’a Set) fun set_s(set_arrow(a,_,_)) =…
frafle
  • 15
  • 4
1
vote
1 answer

Figuring out proper loop invariant when appending to a linked list with verifiable C

I'm working on the beta 5th software foundations module which covers verifiable C. I'm on the final portion, which has to do with operations on a hash map (which requires operations on a linked…
A Question Asker
  • 3,339
  • 7
  • 31
  • 39
1
vote
1 answer

Issue on definition expansion from Coq module system

I have defined a couple of modules in Coq to build a Byte type from a Bit type, recursively, as a three of pairs. But I hit an issue defining a Numeral Notation for the Byte type. Here is the code: Require Import ZArith. (* bit sequence abstracted…
raugfer
  • 1,844
  • 19
  • 19
1
vote
1 answer

How to communicate to Coq that certain types are equal?

I have a heterogenous list as described in CPDT: Section hlist. Variable A : Type. Variable B : A -> Type. Inductive hlist : list A -> Type := | HNil : hlist nil | HCons : forall (x : A) (ls : list A), B x -> hlist ls -> hlist (x :: ls) …
Jan Tušil
  • 958
  • 5
  • 16