proof

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 <->

What is the proof of of (N–1) + (N–2) + (N–3) + … + 1= N*(N–1)/2 [closed]

一世执手 提交于 2020-01-22 04:36:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 9 years ago . I got this formula from a data structure book in the bubble sort algorithm. I know that we are (n-1) * (n times), but why the division by 2? Can anyone please explain this to me or give the detailed proof for it. Thank you 回答1: See triangle numbers. 回答2: Start with the triangle... * ** *** **** representing 1+2

Can two Minimum Spanning Trees for the same graph have different edge weights?

泪湿孤枕 提交于 2020-01-13 03:52:23
问题 A graph can have many different Minimum Spanning Trees (MSTs), but can different MSTs have different sets of edge weights? For example, if an MST uses edge weights {2,3,4,5}, must every other MST have edge weights {2,3,4,5}, or can some other MST use a different collection of weights? What gave me the idea is property that a graph has no unique MST only if its edge weights are different. 回答1: The sets must have the same weight. Here's a simple proof: suppose they don't. Let's let T1 and T2 be

Why Coq doesn't allow inversion, destruct, etc. when the goal is a Type?

流过昼夜 提交于 2020-01-10 19:32:28
问题 When refine ing a program, I tried to end proof by inversion on a False hypothesis when the goal was a Type . Here is a reduced version of the proof I tried to do. Lemma strange1: forall T:Type, 0>0 -> T. intros T H. inversion H. (* Coq refuses inversion on 'H : 0 > 0' *) Coq complained Error: Inversion would require case analysis on sort Type which is not allowed for inductive definition le However, since I do nothing with T , it shouldn't matter, ... or ? I got rid of the T like this, and

Why Coq doesn't allow inversion, destruct, etc. when the goal is a Type?

末鹿安然 提交于 2020-01-10 19:31:31
问题 When refine ing a program, I tried to end proof by inversion on a False hypothesis when the goal was a Type . Here is a reduced version of the proof I tried to do. Lemma strange1: forall T:Type, 0>0 -> T. intros T H. inversion H. (* Coq refuses inversion on 'H : 0 > 0' *) Coq complained Error: Inversion would require case analysis on sort Type which is not allowed for inductive definition le However, since I do nothing with T , it shouldn't matter, ... or ? I got rid of the T like this, and

Congruence for heterogenous equality

时光毁灭记忆、已成空白 提交于 2020-01-03 15:18:11
问题 I'm trying to use heterogenous equality to prove statements involving this indexed datatype: data Counter : ℕ → Set where cut : (i j : ℕ) → Counter (suc i + j) I was able to write my proofs using Relation.Binary.HeterogenousEquality.≅-Reasoning , but only by assuming the following congruence property: Counter-cong : ∀ {n n′} {k : Counter n} {k′ : Counter n′} → {A : ℕ → Set} → (f : ∀{n} → Counter n → A n) → k ≅ k′ → f k ≅ f k′ Counter-cong f k≅k′ = {!!} However, I can't pattern match on k≅k′

How to implement `forall` (mathematics) in a procedural or OO language

不羁岁月 提交于 2020-01-02 12:16:12
问题 I am trying to understand how to implement forall in a procedural or OO language like Ruby or JavaScript. For example (this is Coq): Axiom point : Type. Axiom line : Type. Axiom lies_in : point -> line -> Prop. Axiom ax : forall (p1 p2 : point), p1 <> p2 -> exists! l : line, lies_in p1 l /\ lies_in p2 l. My attempt at doing this is just defining a class such as this (call MainAxiom == ax ). class MainAxiom attr :p1 attr :p2 def initialize raise 'Invalid' if @p1 == @p2 l = Line.new check_lies

Proof of associativity law for type-level set

不羁岁月 提交于 2020-01-02 07:55:10
问题 I'm trying to prove that type-level function Union is associative, but I'm not sure how it should be done. I proved right identity and associativity laws for type-level append function and right identity for union: data SList (i :: [k]) where SNil :: SList '[] SSucc :: SList t -> SList (h ': t) appRightId :: SList xs -> xs :~: (xs :++ '[]) appRightId SNil = Refl appRightId (SSucc xs) = case appRightId xs of Refl -> Refl appAssoc :: SList xs -> Proxy ys -> Proxy zs -> (xs :++ (ys :++ zs)) :~:

In Coq, which tactic to change the goal from `S x = S y` to `x = y`

霸气de小男生 提交于 2020-01-02 07:03:21
问题 I want to change the goal from S x = S y to x = y . It's like inversion , but for the goal instead of a hypothesis. Such a tactic seems legit, because when we have x = y , we can simply use rewrite and reflexivity to prove the goal. Currently I always find myself using assert (x = y) to introduce a new subgoal, but it's tedious to write when x and y are complex expression. 回答1: The tactic apply f_equal. will do what you want, for any constructor or function. The lema f_equal shows that for