Questions tagged [unification]

Unification, in computer science and logic, is an algorithmic process by which one attempts to solve the satisfiability problem. The goal of unification is to find a substitution which demonstrates that two seemingly different terms are in fact either identical or just equal.

Unification, in computer science and logic, is an algorithmic process by which one attempts to solve the satisfiability problem. The goal of unification is to find a substitution which demonstrates that two seemingly different terms are in fact either identical or just equal.

Unification is widely used in automated reasoning, logic programming and programming language type system implementation. In particular, it is widely used in type deduction for example in C++ templates type deduction or in functional language such as Scala/Ocaml/Haskell type synthesis.

Several kinds of unification are commonly studied: syntactic unification (for theories without any equations) and semantic unification (for non-empty equational theories).

See also

228 questions
0
votes
1 answer

Prolog - how to reserve the information when split a variable list?

As a follow up question to my last question (thanks to Patrick), I have a variable list like this,which is a output from a predicate to_var_list(InputList, X): X = [_G1426, _G1429, _G1432, 9, _G1438, _G1441]. Now I want split the list by "9", so…
Miles
  • 13
  • 3
0
votes
0 answers

Asking for one of several conditions

I realize this is very basic, but I could not work this out from Prolog tutorials, so I hope someone here could help me solve my problem. I have a term which is true if one of several conditions applies: answer --> Var, a([Att1],[Var1]), …
Arne
  • 17,706
  • 5
  • 83
  • 99
0
votes
1 answer

Why the result of evaluating `init . cuts [1,2,3]` is different from `(init . cuts) [1,2,3]`?

I'm trying to understand why this two evaluations: (init . cuts) [1,2,3] and init . cuts [1,2,3] are different, where: cuts :: [a] -> [([a],[a])] cuts xs = zipWith splitAt [0..length xs] (repeat xs) The first gives the result that I expected:…
Fof
  • 407
  • 2
  • 8
0
votes
1 answer

Manual derivation of the type of q (specified in the body)

I don't realize why q's type is Ord t => [t] -> [a] and not Ord a => [a] -> [a] q [] = [] q (x:xs) = q us ++ q ws where us = filter (<=x) xs ws = filter (>=x) xs Under which circumstances the input type could differ from the…
Fof
  • 407
  • 2
  • 8
0
votes
1 answer

Deriving the type of (foldr (.))

I'm trying to manually derive the type of (foldr (.)) foldr :: (a1 -> b1 -> b1) -> b1 -> [a1] -> b1 (.) ::(b2 -> c2) -> (a2 -> b2) -> a2 -> c2 Then: a1 ~ (b2 -> c2) b1 ~ (a2 -> b2) b1 ~ a2 So I get that (foldr (.)) :: (a2 -> b2) -> [(b2 -> c2)] ->…
Fof
  • 407
  • 2
  • 8
0
votes
2 answers

Manual derivation of the type for `f1 x xs = (filter . (<)) x xs`

I want to manually derive the type of: f1 x xs = (filter . (<)) x xs First time we see x, so: x :: t1 Then (<) has this type: (<) :: Ord a1 => a1 -> a1 -> Bool We can only say (< x) if the following types can be unified: t1 ~ a1 Then x ::…
Fof
  • 407
  • 2
  • 8
0
votes
1 answer

Which is the type of (flip .)?

I'm trying to understand why the type of: (flip .) is: (a -> a1 -> b -> c) -> a -> b -> a1 -> c First of all, the type of: flip: is (a -> b -> c) -> b -> a -> c (.): is (b -> c) -> (a -> b) -> a -> c I will rename the variables to be more clear in…
Fof
  • 407
  • 2
  • 8
0
votes
1 answer

finding MGU for symmetrical expression

given this pair of expressions, is it possible to find a MGU for it? f(x,y) f(y,x) I wanted to say that it is possible, when x/y, but I wasn't sure if that's legal. what do you guys say? thanks!
ibezito
  • 5,782
  • 2
  • 22
  • 46
0
votes
1 answer

Why does this not unify? (Prolog)

I'm writing a proof-checker for natural deduction, and I'm having a problem with parts of the proof that go "one step further" down the list. First I read a file etc, and then I call the function that is causing trouble: validate([q],[[1, q,…
Rickard
  • 1,289
  • 1
  • 17
  • 27
0
votes
1 answer

Finding values without creating new unifications

I have a set of definitions of the form pair/2 and a predicate propagate/3: pair(1, 2). pair(2, 3). pair(3, 4). pair(4, 5). propagate([], _, []) :- !. propagate([pair(N, Num)|Tail], Num, [N|ResultTail]) :- propagate(Tail, Num, ResultTail),…
Paul Manta
  • 30,618
  • 31
  • 128
  • 208
0
votes
3 answers

Unification(?) in Prolog

I have a school project where I have to work with Prolog. This is all new to me, so I'm having some problems. I have a list like this: List = [(_,_,_),(_,_,_),(_,_,_)] I'm supposed to receive from the input information about each member, through…
bex91
  • 123
  • 8
0
votes
1 answer

Logic Programming: Solve the term constraint f(X; Y; g(a)) = f(g(Y ); Z; X)

I was not able to attend my programming language class the other day due to my wonderful car crapping out on me. I am working on our homework assignment, I am doing pretty good till I got to this scary looking question: "5. Solve the term constraint…
James Little
  • 601
  • 7
  • 24
0
votes
3 answers

implementing unification algorithm

I worked the last 5 days to understand how unification algorithm works in Prolog . Now ,I want to implement such algorithm in Java .. I thought maybe best way is to manipulate the string and decompose its parts using some datastructure such as…
Choas
0
votes
1 answer

Breadth-first Resolution Algorithm

I want to implement a resolution algorithm which tries to get empty set as it resolves the candidate clauses. I want algorithm to resolve the candidate parent clauses in a breadth-first order. However, I got confused at a point: Let S be conjunction…
bfaskiplar
  • 865
  • 1
  • 7
  • 23
0
votes
1 answer

Type Error In Haskell Function

I've written a Haskell function like so: shift :: Subst a -> Subst a shift (S s) = [(x, (subst s' d)) | (x,d) <- s] where s' = [(x,d) | (x,d) <- s, null (vars d)] With a data type like so data Subst a = S [(String,a)] I've declared subst…
Bobo
  • 165
  • 6
1 2 3
15
16