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

What does Proof. simpl. reflexivity. Qed. mean in Coq?

I'm reading the book Software Foundations and got stuck at the very beginning. The author defined a boolean type and common operations: Inductive bool: Type := | true | false. Definition orb (b1: bool) (b2: bool) : bool := match b1 with |…
jvrn3
  • 600
  • 1
  • 5
  • 18
1
vote
1 answer

Take a conjunction of two hypotheses and create a new hypothesis in Coq

I'm wondering as destruct H as (H1 & H2). on hypothesis H : p /\ q creates two hypotheses H1 : p and H2 : q, if there is any tactic that does the other way around. That is, taking two hypotheses and creating one with conjunction of those.
1
vote
1 answer

How can I prevent Coq notations in closed scopes interfering with notations in open ones?

I'm fairly new to Coq, and I'm trying to use ListNotations in Coq so that I can write lists like [ 1 ; 2 ] rather than cons 1 (cons 2 nil). However, I'm using a library that defines its own notation for the ; character. I was thinking that I could…
Finn
  • 652
  • 7
  • 16
1
vote
1 answer

Coq error: Unable to unify "true" with "is_true (0 < a - b - 3)"

Not sure what I am doing wrong but I thought reflexivity should work on below, but it does not. a, b : nat H : (1 <=? a - b - 3) = true ______________________________________(1/7) is_true (0 < a - b - 3) I also tried to apply leb_complete in H.…
1
vote
1 answer

How to index a tuple with ssreflect ordinals

I have written a few projects in Coq but I haven't used ssreflect before and I'm having trouble with it. I have a data structure with indices into itself. Below is the simplified version. Record Graph := { size: nat ; nodes : size.-tuple (seq…
Joonazan
  • 1,408
  • 10
  • 18
1
vote
1 answer

is there any tactic in Coq that can transform a bool expression to a Prop one?

For example, I have this hypothesis in my context: Heq: (a =? b) && (c =? d) && (e =? f) = true that I would like to transform to this: Heq: (a = b) /\ (c = d) /\ (e = f) I have seen this post coq tactic for replacing bools…
1
vote
1 answer

Defining Addition Over Integers in Coq

I am following answer from this question in defining the integers in Coq, but when trying to define addition over it, an error "Cannot guess decreasing argument", always occurs. I have tried multiple different definitions and it always seems to…
Dole
  • 339
  • 4
  • 16
1
vote
1 answer

Can I print the partial definition of not finished proof in coq?

Is there any command to print the not finished proof with metavariables? For example, Lemma a: forall P Q, (P -> Q) -> P -> Q. intros. apply X. in this state of proof, can I print a := X ? by a command?
12412316
  • 725
  • 7
  • 17
1
vote
1 answer

Vector error : The type of this term is a product

I want last k elements of vector. I wrote this code with reference to Coq.Vectors.VectorDef. Require Import Coq.Reals.Reals. (* vector of R *) Inductive Euc:nat -> Type:= |RO : Euc 0 |Rn : forall {n:nat}, R -> Euc n -> Euc (S n). Notation "[…
Daisuke Sugawara
  • 311
  • 4
  • 20
1
vote
1 answer

Coq: Ltac for transitivity of implication (a.k.a. hypothetical syllogism)

This question is about a project that I am doing, namely, to code Principia Mathematica in Coq. Principia has derived rules of inference, one of which is Syll: ∀ P Q R : Prop, P→Q, Q→R : P→R I am trying to create an Ltac script that codifies the…
1
vote
2 answers

exact value of the derivative on Coq

I want to represent the exact value of the derivative. I can calculate an approximation like this. Require Import Coq.Reals.Reals. Open Scope R_scope. Definition QuadraticFunction (x:R) := x^2. Definition differentiation (x:R)(I:R -> R):= let h…
Daisuke Sugawara
  • 311
  • 4
  • 20
1
vote
1 answer

Records as Prop?

I just learnt that 'record' keyword can be used to define a Prop type, for example in: Record Equivalence (A : Type) (R : relation A) : Prop := Build_Equivalence { Equivalence_Reflexive : Reflexive R; Equivalence_Symmetric : Symmetric R; …
Anon
  • 381
  • 1
  • 2
  • 13
1
vote
1 answer

Proof mode definitions in Coq?

Can anyone give me some good source on how to read proof mode-definitions (an example is given:) Definition A (ss: FSS) (n:nat) (s: {s:S | state_is_wf s /\ RESS.get_element n (proj1_sig ss) = Some s}) :…
Anon
  • 381
  • 1
  • 2
  • 13
1
vote
1 answer

How are logics encoded in Coq?

Isabelle is a sort of logical framework. You can introduce the axioms and rules of a logic and reason about them using the meta-theory. For instance, you can see the encoding of intuitionistic first order logic in IFOL.thy of the Isabelle…
user1868607
  • 2,558
  • 1
  • 17
  • 38
1
vote
1 answer

Not explicitly specifying instances of a type in coq

I'm interested in trying my hand at constructing set theory using Coq. I would like to define a type sets without specifying what its members are, and a function mapping two sets to a Prop Definition elem (s1 s1 : sets) : Prop. I would then make the…
Abe
  • 55
  • 3