Questions tagged [equivalence]

Equivalence is a relationship in which two or more identifiers are abstractions for the same data structure.

References

168 questions
15
votes
12 answers

What are uses of the C++ construct "placement new"?

I just learned about the C++ construct called "placement new". It allows you to exactly control where a pointer points to in memory. It looks like this: #include // Must #include this to use "placement new" #include "Fred.h" //…
Scottie T
  • 11,729
  • 10
  • 45
  • 59
12
votes
6 answers

How should one proceed to prove (or find) if two regular expressions are same or equivalent?

For example, in an assignment given to me, we were asked to find out if two regular expressions are equal or not. (a+b+c)* and ((ab)**c*)* My question is how is one supposed to do that? If I draw the transition graphs for both and then run a few…
10
votes
3 answers

Equivalence between two automata

Which is the best or easiest method for determining equivalence between two automata? I.e., if given two finite automata A and B, how can I determine whether both recognize the same language? They are both deterministic or both nondeterministic.
franvergara66
  • 10,524
  • 20
  • 59
  • 101
10
votes
1 answer

How do you use MSBuild less than / greater than conditions?

How do you do less than or greater than in MSBuild conditions? I've tried the following variations both with and without single quotes surrounding the values, but no dice
Zain Rizvi
  • 23,586
  • 22
  • 91
  • 133
10
votes
3 answers

Why are vector's multi-argument constructors taking construction parameters not marked "explicit"?

I observed the following vector constructors in the Standard C++ library explicit vector(size_type n); vector(size_type n, const T& value, const Allocator& = Allocator()); Is there a reason why the second constructor is not marked explicit? This…
Johannes Schaub - litb
  • 496,577
  • 130
  • 894
  • 1,212
9
votes
2 answers

Check if two "simple" 'if statements' in C are equivalent

I have 'if statements' from two different sources, which try to implement the same condition possibly in a different way. The 'if statements' are C. If at all possible I need a python script that can decide whether pairs of conditions are equivalent…
user1514631
  • 1,183
  • 1
  • 9
  • 14
7
votes
9 answers

How to reduce a logical statement?

I'm pretty sure I can remember doing something like this in one of my college level courses and that there was some kind of formula to it, but my mind is failing me beyond that. Given the statement: ( a OR b OR d ) AND ( a OR c ) I'm pretty sure…
David
  • 19,389
  • 12
  • 63
  • 87
7
votes
1 answer

haskell check equality by function

In haskell I can use sortBy (comparing snd) to sort by the second value in a tuple. Is there an equivalent function for testing equivalency? I've come up with this but maybe there is something in the standard library. equalsBy :: Eq b => (a -> b)…
Erik Bergsten
  • 123
  • 1
  • 8
6
votes
1 answer

How to mimic EQUIVALENCE when using Fortran allocatable arrays

I have 3 allocatable 1D arrays in a Fortran routine, VX(:), VY(:), VZ(:), all with the same size. I need to aggregate them in a 2D array named VARXYZ and send it to a routine that modifies the 'matrix'. The code below works but forces to double the…
Pierre
  • 97
  • 4
6
votes
4 answers

String.Format (.NET) equivalent in Java?

The String.Format in .NET (maybe just VB.NET) convert {0}, {1}, ... into determined String, for example: Dim St As String = "Test: {0}, {1}" Console.WriteLine(String.Format(St, "Text1", "Text2")) I've tried to search in both Google and…
Luke Vo
  • 17,859
  • 21
  • 105
  • 181
6
votes
2 answers

Trying to find an algorithm which takes 2 regular expressions and tells whether they are equivalent

I'm trying to find out what the algorithm would be by being given two languages L1 and L2 to determine if they are equivalent (L1 = L2). It's surprisingly difficult to come up with one as I've found, although I am pretty sure it needs to be…
John
  • 61
  • 1
6
votes
7 answers

Java char is also an int?

I was trying to get some code done for class: public int getValue(char value) { if (value == 'y') return this.y; else if (value == 'x') return this.x; Since I might not be able to return anything in the end, it told me to do this at the…
Zizouz212
  • 4,908
  • 5
  • 42
  • 66
6
votes
1 answer

Test for equivalence with only less than operator?

Say I have two literals of type 'T'. I'd like to test if they were equivalent, but type 'T' only has the "less than" operator implemented. How would I be able to test this in C++?
user3019324
  • 97
  • 1
  • 8
6
votes
4 answers

Conversion from lambda term to combinatorial term

Suppose there are some data types to express lambda and combinatorial terms: data Lam α = Var α -- v | Abs α (Lam α) -- λv . e1 | App (Lam α) (Lam α) -- e1 e2 deriving (Eq,…
6
votes
4 answers

How do I find equal columns in R?

Given the following: a <- c(1,2,3) b <- c(1,2,3) c <- c(4,5,6) A <- cbind(a,b,c) I want to find which columns in A are equal to for example my vector a. My first attempt would be: > which(a==A) [1] 1 2 3 4 5 6 Which did not do that. (Too be honest…
jonalv
  • 5,706
  • 9
  • 45
  • 64
1
2
3
11 12