Isabelle’s use of unifjcation When using rule , erule , drule Isabelle uses a process known as higher-order unifjcation What is: • Unifjcation • ...and specifjcally, higher-order unifjcation? 1
Isabelle’s use of unifjcation When using rule , erule , drule Isabelle uses a process known as higher-order unifjcation What is: • Unifjcation • ...and specifjcally, higher-order unifjcation? 1
Unifjcation Given two terms t , u defjned over: • Set of variables • Constant symbols for some notion of equivalence or equality? 2 can we fjnd a substitution θ such that: t θ = u θ
First-order unifjcation In fjrst-order unifjcation terms are fjrst-order terms : Equality is syntactic identity Substitutions are fjnite functions from variables to terms This process may be familiar: • Part of operational semantics of logic programming (e.g. Prolog) • Used widely in fjrst-order theorem proving 3 t , u , v ::= X | c | f ( t 1 , . . . , t n )
First-order unifjcation In fjrst-order unifjcation terms are fjrst-order terms : Equality is syntactic identity Substitutions are fjnite functions from variables to terms This process may be familiar: • Part of operational semantics of logic programming (e.g. Prolog) • Used widely in fjrst-order theorem proving 3 t , u , v ::= X | c | f ( t 1 , . . . , t n )
First-order unifjcation In fjrst-order unifjcation terms are fjrst-order terms : Equality is syntactic identity Substitutions are fjnite functions from variables to terms This process may be familiar: • Part of operational semantics of logic programming (e.g. Prolog) • Used widely in fjrst-order theorem proving 3 t , u , v ::= X | c | f ( t 1 , . . . , t n )
Example Suppose X and Y are variables Unify: 5 6 Y with X 5 5 Solution X 5 6 and Y 5 5 4 Suppose + is a function symbol and 5 and 6 are constants
Example Suppose X and Y are variables Unify: with Solution X 5 6 and Y 5 5 4 Suppose + is a function symbol and 5 and 6 are constants +(+( 5 , 6 ) , Y ) + ( X , +( 5 , 5 ))
Example Suppose X and Y are variables Unify: with 4 Suppose + is a function symbol and 5 and 6 are constants +(+( 5 , 6 ) , Y ) + ( X , +( 5 , 5 )) Solution X �→ +( 5 , 6 ) and Y �→ +( 5 , 5 )
Properties of fjrst-order unifjcation Has many nice properties: • Decidable • Most general unifjers exist • Linear-time algorithm via Martelli and Montanori 5
Isabelle’s terms First-order unifjcation inappropriate: • Notion of equality is -equivalence • Substitutions are capture avoiding substitutions from -calculus Need higher-order unifjcation... 6 Terms in Isabelle are typed λ -terms
Isabelle’s terms First-order unifjcation inappropriate: Need higher-order unifjcation... 6 Terms in Isabelle are typed λ -terms • Notion of equality is β ( η ) -equivalence • Substitutions are capture avoiding substitutions from λ -calculus
Isabelle’s terms First-order unifjcation inappropriate: Need higher-order unifjcation... 6 Terms in Isabelle are typed λ -terms • Notion of equality is β ( η ) -equivalence • Substitutions are capture avoiding substitutions from λ -calculus
Properties of higher-order unifjcation x c -calculus) theory of simply-typed x x c are both equivalent to c (in equational x c c and Note x x F and F • Unifjability test is undecidable (Goldfarb and Huet) Consider two different solutions: c and F c Unify (where F is a variable of function type and c is a constant): Example: • Unifjer set may be infjnite • When unifjers do exist, most general unifjers need not 7
Properties of higher-order unifjcation • Unifjability test is undecidable (Goldfarb and Huet) • When unifjers do exist, most general unifjers need not • Unifjer set may be infjnite Example: Unify (where F is a variable of function type and c is a constant): F c and c Consider two different solutions: and 7 F �→ λ x . c F �→ λ x . x Note ( λ x . c ) c and ( λ x . x ) c are both equivalent to c (in equational theory of simply-typed λ -calculus)
All is not lost! Gerard Huet discovered a semi-decision procedure for higher-order unifjcation in 1970s Huet’s algorithm: • Finds unifjers when they exist • May not terminate if unifjers do not exist • Generally works well in practice Most Isabelle unifjcation problems are pattern unifjcation problems: • Decidable subfragment • Discovered by Miller whilst working on Prolog • Most general unifjers exist • Effjcient algorithms exist for pattern unifjcation (Qian: linear time/space) Isabelle uses pattern unifjcation to reduce calls to Huet’s algorithm 8
All is not lost! Gerard Huet discovered a semi-decision procedure for higher-order unifjcation in 1970s Huet’s algorithm: • Finds unifjers when they exist • May not terminate if unifjers do not exist • Generally works well in practice Most Isabelle unifjcation problems are pattern unifjcation problems: • Decidable subfragment • Most general unifjers exist • Effjcient algorithms exist for pattern unifjcation (Qian: linear time/space) Isabelle uses pattern unifjcation to reduce calls to Huet’s algorithm 8 • Discovered by Miller whilst working on λ Prolog
Recommend
More recommend