Isabelle语法:运算符不是函数类型

时间:2015-10-05 10:40:39

标签: types typeerror isabelle

我刚开始在Isabelle中使用套装,并且我有以下内容:

theory telephone
imports 
Main 
begin 

typedecl NAME
typedecl TELEPHONE

record TelephoneBook = 
KNOWN :: " NAME set"
NUMBER :: "(NAME * TELEPHONE) set"

locale telephone_book = 
fixes known :: " NAME set"
and number :: "(NAME * TELEPHONE) set"
assumes "known = Domain number"
begin

definition FindBirthday :: 
 "TelephoneBook => TelephoneBook => NAME => TELEPHONE => bool"
where 
"FindTelephone telephonebook telephonebook' name telephone == (
(name \<in> known)
∧ 
(telephone = number name)
)"

问题在于telephone = number name行 我有错误信息

Type unification failed: Clash of types " _ => _" and "_ set"

Type error in application: operator not of function type

Operator:  number :: (NAME × TELEPHONE) set
Operand:   name :: NAME

我已经尝试添加括号(telephone = number (name))或tilda (telephone = number~name),但它仍然存在同样的问题。

我知道这个号码想要一个NAME和TELEPHONE,但我希望当telephone为其telephone时,输出name应为function qp($comp) { $p = ping $comp -n 1 -w 2 -4 IF($? -eq $true){$out = $p[1].split("[")[1].split("]")[0]} else{$out = $False} return $out } $comps = Get-Content C:\PacketCapture\comps.txt DO { foreach($comp in $comps) { ECHO "$(qp $comp);$comp" >>"C:\PacketCapture\IP_$(Get-date -format HHmm-ddMMyy).txt" } Start-sleep 3600 } until($null -eq "WANG") 时显示该定义是正确的。

1 个答案:

答案 0 :(得分:1)

这正是Isabelle所说的,即你不能将一个集合用作函数,所以你不能将一个参数应用于一个集合,在你的情况下你不能将name应用于{ {1}}。您可能想要的是

number

(name, telephone) : number