coq

Converting Coq to Idris

本秂侑毒 提交于 2019-12-02 20:56:24
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. 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 / Elab.Reflection form) is not really recommended at the moment, this facility is somewhat fragile, and

Can Coq be used (easily) as a model checker?

浪尽此生 提交于 2019-12-02 19:06:34
As the title says, can Coq be used as a model checker? Can I mix model checking with Coq proving? Is this usual? Google talks about a "µ-calculus", does anyone have experience with this or something similar? Is it advised to use Coq in this way, or should I look for another tool? A proof assistant like Coq will verify that your proof is sound and that any theorems you propose can (or cannot) be derived using axioms and previously proven results. It will also provide you with support in proposing proof steps to reduce the effort you have to make to discharging the proofs. A model checker, in

Why haven't newer dependently typed languages adopted SSReflect's approach?

对着背影说爱祢 提交于 2019-12-02 17:33:52
There are two conventions I've found in Coq's SSReflect extension that seem particularly useful but which I haven't seen widely adopted in newer dependently-typed languages (Lean, Agda, Idris). Firstly, where possible predicates are expressed as boolean-returning functions rather than inductively defined datatypes. This brings decidability by default, opens up more opportunities for proof by computation, and improves checking performance by avoiding the need for the proof engine to carry around large proof terms. The main disadvantage I see is the need to use reflection lemmas to manipulate

Coq convert non exist to forall statement

岁酱吖の 提交于 2019-12-02 15:59:10
问题 I'm new to Coq. Here's my problem. I have a statement says: H : forall x : term, ~ (exists y : term, P x y /\ ~ P y x) I guess it is equivalent to: forall x y : term, (P x y /\ ~ P y x) -> false But which tactic can I use to convert the hypothesis? 回答1: I don't know of a tactic to turn not-exists into forall-not, but you can always just assert and prove it. (If you need that repeatedly, you can pack that up into an Ltac tactic definition or a simple theorem[1].) Here's three ways of getting

Can I extract a Coq proof as a Haskell function?

你说的曾经没有我的故事 提交于 2019-12-02 15:50:43
Ever since I learned a little bit of Coq I wanted to learn to write a Coq proof of the so-called division algorithm that is actually a logical proposition: forall n m : nat, exists q : nat, exists r : nat, n = q * m + r I recently accomplished that task using what I learned from Software Foundations . Coq being a system for developing constructive proofs, my proof is in effect a method to construct suitable values q and r from values m and n . Coq has an intriguing facility for "extracting" an algorithm in Coq's algorithm language (Gallina) to general-purpose functional programming languages

What are the practical limitations of a non-turing complete language like Coq?

流过昼夜 提交于 2019-12-02 13:55:13
As there are non-Turing complete languages out there, and given I didn't study Comp Sci at university, could someone explain something that a Turing-incomplete language (like Coq ) cannot do? Or is the completeness/incompleteness of no real practical interest (i.e. does it not make much difference in practice)? EDIT - I'm looking for an answer along the lines of you cannot build a hash table in a non-Turing complete language due to X , or something like that! First, I assume you've already heard of the Church-Turing thesis , which states that anything we call “computation” is something that

Call a theorem using let-in

天大地大妈咪最大 提交于 2019-12-02 13:46:42
问题 I have a function f returning a pair. Then I prove some results about it. In my lemmas, my first attempt to get each component was using let (x, y) := f z in . But then, trying to use these lemmas seems cumbersome. apply does not work directly, I have to add the lemma in the hypothesis using pose proof or a variant of it and destruct f z to be able to use it. Is there a way to use let-in smoothly in lemmas ? Or is it discouraged because it is painful to use ? To complete my question, here are

Coq convert non exist to forall statement

无人久伴 提交于 2019-12-02 10:10:24
I'm new to Coq. Here's my problem. I have a statement says: H : forall x : term, ~ (exists y : term, P x y /\ ~ P y x) I guess it is equivalent to: forall x y : term, (P x y /\ ~ P y x) -> false But which tactic can I use to convert the hypothesis? I don't know of a tactic to turn not-exists into forall-not, but you can always just assert and prove it. (If you need that repeatedly, you can pack that up into an Ltac tactic definition or a simple theorem[1].) Here's three ways of getting this proved. (You should be able to just copy/paste this transcript into CoqIDE or Emacs/ProofGeneral and

How to define axiom of a line as two points in Coq

不打扰是莪最后的温柔 提交于 2019-12-02 08:22:34
问题 I am trying to find an example axiom in Coq of something like the line axiom in geometry: If given two points, there exist a line between those two points. I would like to see how this could be defined in Coq. Inherently choosing this simple line axiom to see how something very primitive is defined, because I'm having a hard time defining it outside natural language. Specifically, I have seen these two axioms and would like to know how in Coq to define both: Any two distinct points always

Coq: Stuck using the subtype

和自甴很熟 提交于 2019-12-02 05:14:10
问题 I have following definitions: (definition of positive integers as a subtype of nat) Definition Z_pos_filter (p: nat) : bool := if (beq_nat p 0) then false else true. Definition Z_pos: Set := {n : nat | is_true (Z_pos_filter n) }. Definition Z_pos__N (p: Z_pos): nat := proj1_sig p. Definition Z_pos_mult (p q: Z_pos): Z_pos. destruct (Z_pos_filter (Z_pos__N p * Z_pos__N q)) eqn:prf. - exact ((exist _ (Z_pos__N p * Z_pos__N q) prf)). - assert (forall n: nat, S n <> 0) by (intros; omega). assert