Questions tagged [proof]

A mathematical proof is any mathematical argument which demonstrates the truth of a mathematical statement. Informal proofs are typically rendered in natural language and are held true by consensus; formal proofs are typically rendered symbolically and can be checked mechanically. "Proofs" can be valid or invalid; only the former kind constitutes actual proof, whereas the latter kind usually refers to a flawed attempt at proof.

828 questions
4
votes
1 answer

Can I safely assume that isomorphic types are equal?

Let A and B be Types, and f : A -> B and g : B -> A be functions inverse to each other. In other words A and B are isomorphic types. Is it true that one cannot prove that A <> B? Can I safely add the axiom that A = B? Is this axiom compatible with…
Bob
  • 1,713
  • 10
  • 23
4
votes
2 answers

Apply function in goal in lean proof

There are a tree data structure and a flip method for it. I want to write a proof that if you apply the flip method to a tree twice you get initial tree. I've got a goal ⊢ flip_mytree (flip_mytree (mytree.branch t_ᾰ t_ᾰ_1 t_ᾰ_2)) = mytree.branch t_ᾰ…
osseum
  • 187
  • 14
4
votes
2 answers

how to run mizar on mac

If this is not the right stack exchange site for this type of question please let me know where would be more appropriate. Also let me know if there are better tags for this question and I'll add them (or if you want/can, add them yourself). Also I…
Mathew
  • 1,116
  • 5
  • 27
  • 59
4
votes
2 answers

Proving `forall x xs ys, subseq (x :: xs) ys -> subseq xs ys` in Coq

I have the following definition Inductive subseq : list nat -> list nat -> Prop := | empty_subseq : subseq [] [] | add_right : forall y xs ys, subseq xs ys -> subseq xs (y::ys) | add_both : forall x y xs ys, subseq xs ys -> subseq (x::xs)…
4
votes
2 answers

Haskell Function Composition with Map Function

I'm going through the Richard Bird's "Thinking Functionally with Haskell" book and there is a section that I can't understand where he's proving a property of the filter method. What he's proving is: filter p . map f = map f . filter (p .…
flopoe
  • 165
  • 1
  • 9
4
votes
6 answers

Prove correctness of unit test

I'm creating a graph framework for learning purposes. I'm using a TDD approach, so I'm writing a lot of unit tests. However, I'm still figuring out how to prove the correctness of my unit tests For example, I have this class (not including the…
Timo Willemsen
  • 8,717
  • 9
  • 51
  • 82
4
votes
2 answers

Writing a circuit in ZoKrates to proof age is over 21 years

I am trying to see if I can use ZoKrates in a scenario where a user can prove to the verifier that age is over 21 years without revealing the date of birth. I think its a good use case for zero-knowledge proof but like to understand the best way to…
Razi
  • 51
  • 4
4
votes
0 answers

Subtyping proofs

Suppose I have two types Type1 and Type2 and (non-diverging) values of type Type1 <:< Type2 and Type2 <:< Type1, is it possible for Type1 and Type2 to not be the same type? Assuming such a thing is not possible (and I don't think it is), are the…
Alec
  • 31,829
  • 7
  • 67
  • 114
4
votes
1 answer

Coq: working with inequalities (<>)

I'm trying to understand the logic about working with inequalities in Coq. When <> is present in the goal, doing intros contra. changes the goal to False and moves the goal to an hypothesis but with <> switched to =. I think I understand how it is…
Waiting for Dev...
  • 12,629
  • 5
  • 47
  • 57
4
votes
3 answers

How would you write ∀ y ∈ R+, ∃ z ∈ R, e^z = y in pseudocode?

I’m reading about proofs, currently reading Mathematics for Computer Science by Eric Lehman and Tom Leighton, they illustrate in a sample proposition that "as z ranges over the real numbers, e^z takes on every positive, real value at least once".…
Carlos Granados
  • 407
  • 4
  • 14
4
votes
3 answers

Prove or disprove n^2 - n + 2 ∈ O(n)

For my algorithm analysis course, I've derived from an algorithm the function f(n) = n^2 - n + 2. Now I need to prove or disprove f(n) ∈ O(n). Obviously it's not, so I've been trying to disprove that for a few hours and can't figure out how to do…
Daniel
  • 675
  • 6
  • 11
4
votes
1 answer

Can a red node have just 1 black child in a red-black tree?

The rules for a Red-Black Tree: Every node is either red or black. The root is black. Every leaf (NIL) is black. If a node is red, then both its children are black. For each node, all simple paths from the node to descendant leaves contain the same…
sanic
  • 2,065
  • 4
  • 20
  • 33
4
votes
2 answers

arrange numbers to form largest number - proof of algorithm

There is well known algorithmic problem, given array of numbers e.g. [1, 20, 3, 14] arrange numbers in such a way that they form biggest number possible, in this case 320141. There is plenty of solutions on SO and other sites, using the following…
csharpfolk
  • 4,124
  • 25
  • 31
4
votes
2 answers

Proof automation in Coq how to factorize a proof

I'm following the book Software Foundation and I'm on the chapter named "Imp". The authors expose a small language that is the following : Inductive aexp : Type := | ANum : nat -> aexp | APlus : aexp -> aexp -> aexp | AMinus : aexp -> aexp ->…
Saroupille
  • 609
  • 8
  • 14
4
votes
1 answer

Operator overloading in Isabelle

I want to use the nat type in Isabelle but I want to overload some existing definitions like for example addition. I wrote the following code: theory Prueba imports Main HOL begin primrec suma::"nat ⇒ nat ⇒ nat" where "suma 0 n = 0" | "suma (Suc x)…
Martin Copes
  • 931
  • 1
  • 7
  • 14