coq

What exactly is a Set in COQ

故事扮演 提交于 2019-12-04 10:26:28
问题 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. 回答1: Set means rather different things in Coq and HoTT. In Coq, every object has a type, including types themselves. Types of types are usually referred to as sorts , kinds or universes . In Coq, the (computationally relevant) universes are Set , and Type_i , where i ranges over

How can I read Coq's definition of proj1_sig?

佐手、 提交于 2019-12-04 08:22:50
In Coq, sig is defined as Inductive sig (A:Type) (P:A -> Prop) : Type := exist : forall x:A, P x -> sig P. Which I read as "A sig P is a type, where P is a function taking an A and returning a Prop. The type is defined such that an element x of type A is of type sig P if P x holds." proj1_sig is defined as Definition proj1_sig (e:sig P) := match e with | exist _ a b => a end. I'm not sure what to make of that. Could somebody provide a more intuitive understanding? Non-dependent pairs vs. sig The type is defined such that an element x of type A is of type sig P if P x holds. That is not

Converting Coq to Idris

允我心安 提交于 2019-12-04 08:09:18
问题 What would be some useful guidelines for converting Coq source to Idris (e.g. how similar are their type systems and what can be made of translating the proofs)? From what I gather, Idris' built-in library of tactics is minimal yet extendable, so I suppose with some extra work this should be possible. 回答1: I've recently translated a chunk of Software Foundations and did a partial port of {P|N|Z}Arith, some observations I've made in the process: Generally using Idris tactics (in their Pruvloj

Coq error: The reference evenb was not found in the current environment

最后都变了- 提交于 2019-12-04 05:39:57
I'm trying to go through the Software Foundations Coq book ( http://www.cis.upenn.edu/~bcpierce/sf/current/toc.html ), but when I compile Induction.v (which looks like http://www.cs.uml.edu/~rhenniga/coq/sf_induction.html ), I get the error message "Error: The reference evenb was not found in the current environment." -- even after compilation of Basics.v. Any ideas why? I can confirm that opening CoqIDE from the same directory works on macOS: cd <sf-dir>; /Applications/CoqIDE_8.5.app/Contents/MacOS/coqide from: The reference "X" was not found in the current environment Try to erase every

Decomposing equality of constructors coq

大兔子大兔子 提交于 2019-12-04 03:20:56
问题 Often in Coq I find myself doing the following: I have the proof goal, for example: some_constructor a c d = some_constructor b c d And I really only need to prove a = b because everything else is identical anyway, so I do: assert (a = b). Then prove that subgoal, then rewrite H. reflexivity. finishes the proof. But it seems to just be unnecessary clutter to have those hanging around at the bottom of my proof. Is there a general strategy in Coq for taking an equality of constructors and

How to extract the second element of Sigma on the Calculus of Constructions?

放肆的年华 提交于 2019-12-04 03:12:29
I'm attempting to do that as follows: λ (A : *) -> λ (B : (A -> *)) -> λ (t : (∀ (r : *) -> (∀ (x : a) -> (B x) -> r)) -> r) -> (t (B (t A (λ (x : A) -> λ (y : (B x)) -> x))) (λ (x : A) -> λ (y : (B x)) -> y)) Notice that, since the value returned by that function depends on a value inside the sigma itself, I need to extract that value. This code doesn't check, because, I believe, it fails to unify the type extracted from Sigma with the type inside it. Is there any workaround? 来源: https://stackoverflow.com/questions/43957592/how-to-extract-the-second-element-of-sigma-on-the-calculus-of

Compute with a recursive function defined by well-defined induction

。_饼干妹妹 提交于 2019-12-04 02:59:35
问题 When I use Function to define a non-structurally recursive function in Coq, the resulting object behaves strangely when a specific computation is asked. Indeed, instead of giving directly the result, the Eval compute in ... directive return a rather long (typically 170 000 lines) expression. It seems that Coq cannot evaluate everything, and therefore returns a simplified (but long) expression instead of just a value. The problem seems to come from the way I prove the obligations generated by

Consistent formulations of sets in Coq?

此生再无相见时 提交于 2019-12-04 02:06:14
I'm quite new at Coq and trying to develop a framework based on my research. My work is quite definition-heavy and I'm having trouble encoding it because of how Coq seems to treat sets. There are Type and Set , which they call 'sorts', and I can use them to define a new set: Variable X: Type. And then there's a library encoding (sub)sets as ' Ensembles ', which are functions from some Type to a Prop . In other words, they are predicates on a Type : Variable Y: Ensemble X. Ensemble s feel more like proper mathematical sets. Plus, they are built upon by many other libraries. I've tried focussing

Teach coq to check termination

Deadly 提交于 2019-12-03 20:48:27
Coq, unlike many others, accepts an optional explicit parameter,which can be used to indicate the decreasing structure of a fixpoint definition. From Gallina specification, 1.3.4, Fixpoint ident params {struct ident0 } : type0 := term0 defines the syntax. but from it, we've known that it must be an identifier, instead of a general measure. However, in general, there are recursive functions, that the termination is not quite obvious,or it in fact is, but just difficult for the termination checker to find a decreasing structure. For example, following program interleaves two lists, Fixpoint

What is the difference between “Qed” and “Defined”?

╄→尐↘猪︶ㄣ 提交于 2019-12-03 17:03:06
问题 In the interactive theorem prover Coq, any interactive proof or definition can be terminated with either Qed or Defined . There is some concept of "opacity" which Qed enforces but Defined does not. For instance, the book Certified Programming with Dependent Types , by Adam Chlipala, states: We end the "proof" with Defined instead of Qed , so that the definition we constructed remains visible. This contrasts to the case of ending a proof with Qed , where the details of the proof are hidden