coq

Provide example in Coq where (A B: Prop), P: Prop -> Type, such that A <-> B, but one cannot replace P A with P B

家住魔仙堡 提交于 2020-04-17 19:13:51
问题 As the title asks, I wish for an example where: Section Question: Definition A: Prop := <whatever you like>. Definition B:Prop := <whatever you like>. Definition/Inductive/Fixpoint P: Prop -> Type := <whatever you like>. Theorem AEquivB: A <-> B. Proof. <supply proof here>. Qed. (* Question 1. can we pick a P, A, B to prove this? *) Theorem PA_not_equals_Pb: P A <> P B. Proof. <supply proof here>. Qed. (* Question 1.5. can we pick a P, A, B to prove this? *) Theorem PA_not_equiv_PB: ~(P A <->

Provide example in Coq where (A B: Prop), P: Prop -> Type, such that A <-> B, but one cannot replace P A with P B

£可爱£侵袭症+ 提交于 2020-04-17 19:12:14
问题 As the title asks, I wish for an example where: Section Question: Definition A: Prop := <whatever you like>. Definition B:Prop := <whatever you like>. Definition/Inductive/Fixpoint P: Prop -> Type := <whatever you like>. Theorem AEquivB: A <-> B. Proof. <supply proof here>. Qed. (* Question 1. can we pick a P, A, B to prove this? *) Theorem PA_not_equals_Pb: P A <> P B. Proof. <supply proof here>. Qed. (* Question 1.5. can we pick a P, A, B to prove this? *) Theorem PA_not_equiv_PB: ~(P A <->

coq error when trying to use Case. Example from Software Foundations book

时间秒杀一切 提交于 2020-04-10 07:50:21
问题 I am trying to learn Coq by working through the online Software Foundations book: http://www.cis.upenn.edu/~bcpierce/sf/ I'm using the interactive command line Coq interpreter coqtop . In the induction chapter (http://www.cis.upenn.edu/~bcpierce/sf/Induction.html), I am following the instructions exactly. I compile Basics.v using coqc Basics.v . I then start coqtop and type exactly: Require Export Basics. Theorem andb_true_elim1 : forall b c : bool, andb b c = true -> b = true. Proof. intros

even_Sn_not_even_n - apply 1 hypothesis in another

末鹿安然 提交于 2020-03-23 12:22:30
问题 Unfortunately I got stuck again: Inductive even : nat > Prop := | ev_0 : even 0 | ev_SS (n : nat) (H : even n) : even (S (S n)). Lemma even_Sn_not_even_n : forall n, even (S n) <-> not (even n). Proof. intros n. split. + intros H. unfold not. intros H1. induction H1 as [|n' E' IHn]. - inversion H. - inversion_clear H. apply IHn in H0. apply H0. + intros H. induction n as [|n' IHn]. - exfalso. apply H. apply ev_0. - apply evSS_inv'. Here is the result: 1 subgoal (ID 179) n' : nat H : ~ even (S

Coq : Admit assert

て烟熏妆下的殇ゞ 提交于 2020-02-24 09:05:14
问题 Is there a way to admit asserts in Coq ? Suppose I have a theorem like this: Theorem test : forall m n : nat, m * n = n * m. Proof. intros n m. assert (H1: m + m * n = m * S n). { Admitted. } Abort. The above assert doesn't seem to work for me. The error I receive is: Error: No focused proof (No proof-editing in progress). What I want is something like undefined in Haskell. Baiscally, I will come back to this later and prove it. Is there something like that in Coq to achieve it ? 回答1: In

Coq: Prove equality of two factorial functions using induction

徘徊边缘 提交于 2020-02-04 11:47:49
问题 I want to prove that two factorial functions are equivalent in Coq using induction. The base case n = 0 is easy, however, the induction case is more complicated. I see, that if I could rewrite (visit_fac_v2 n' (n * a)) to n * (visit_fac_v2 n' a) , I would be done. However, translating this idea into Coq causes me troubles. How would one go about proving this in Coq? Fixpoint fac_v1 (n : nat) : nat := match n with | 0 => 1 | S n' => n * (fac_v1 n') end. Fixpoint visit_fac_v2 (n a : nat) : nat

Coq: Prove equality of two factorial functions using induction

可紊 提交于 2020-02-04 11:47:15
问题 I want to prove that two factorial functions are equivalent in Coq using induction. The base case n = 0 is easy, however, the induction case is more complicated. I see, that if I could rewrite (visit_fac_v2 n' (n * a)) to n * (visit_fac_v2 n' a) , I would be done. However, translating this idea into Coq causes me troubles. How would one go about proving this in Coq? Fixpoint fac_v1 (n : nat) : nat := match n with | 0 => 1 | S n' => n * (fac_v1 n') end. Fixpoint visit_fac_v2 (n a : nat) : nat

Coq: Prove equality of two factorial functions using induction

▼魔方 西西 提交于 2020-02-04 11:47:14
问题 I want to prove that two factorial functions are equivalent in Coq using induction. The base case n = 0 is easy, however, the induction case is more complicated. I see, that if I could rewrite (visit_fac_v2 n' (n * a)) to n * (visit_fac_v2 n' a) , I would be done. However, translating this idea into Coq causes me troubles. How would one go about proving this in Coq? Fixpoint fac_v1 (n : nat) : nat := match n with | 0 => 1 | S n' => n * (fac_v1 n') end. Fixpoint visit_fac_v2 (n a : nat) : nat

Ltac: repeating a tactic n times with backtracking

六眼飞鱼酱① 提交于 2020-01-25 00:37:46
问题 Suppose I have a tactic like this (taken from HaysTac), that searches for an argument to specialize a particular hypothesis with: Ltac find_specialize_in H := multimatch goal with | [ v : _ |- _ ] => specialize (H v) end. However, I'd like to write a tactic that searches for n arguments to specialize a tactic with. The key is that it needs to backtrack. For example, if I have the following hypotheses: y : T H : forall (x : T), x = y -> P x x1 : T x2 : T Heq : x1 = y If I write do 2 (find

Import <Module> vs. Include <Module> in Coq Module system

ⅰ亾dé卋堺 提交于 2020-01-24 14:13:42
问题 What is the exact semantics of Include M1 inside another module, say M ? How is it different from doing Import M1 inside the module M ? More precisely what is the semantics of the following command: Module Type M := M1 <+ M2 <+ M3. 回答1: To summarize the semantics of both vernacular commands: The command Include M1 (which can be used in the definition of a module or a module type ) asks Coq to make a copy of all the fields of M1 . Thus, it acts just like a "copy-and-paste" of the contents of