证明一个简单的定理 我在证明中遇到了元级别的含义。可以拥有它们还是可以避免它们?如果我应该处理它们,这是正确的方法吗?
theory Sandbox
imports Main
begin
lemma "(x::nat) > 0 ? x = 0"
proof (cases x)
assume "x = 0"
show "0 < x ? x = 0" by (auto)
next
have "x = Suc n ? 0 < x" by (simp only: Nat.zero_less_Suc)
then have "x = Suc n ? 0 < x ? x = 0" by (auto)
then show "?nat. x = Suc nat ? 0 < x ? x = 0" by (auto)
qed …Run Code Online (Sandbox Code Playgroud) 我尝试了各种版本的 Nodejs 数据报套接字模块的发送功能:
var dgram = require('dgram');
var client = dgram.createSocket('udp4');
client.send('Hello World!',0, 12, 12000, '127.0.0.1', function(err, bytes) {});
client.send('Hello2World!',0, 12, 12000, '127.0.0.1');
client.send('Hello3World!',12000, '127.0.0.1');
client.close();
Run Code Online (Sandbox Code Playgroud)
我的服务器确实与另一个客户端一起工作,但不是这个,没有数据包到达。
socket.send(msg[, offset, length], port[, address][, callback])
Run Code Online (Sandbox Code Playgroud)
是我填写的参数有问题还是其他原因导致它失败?在服务器程序中,我确实使用了端口 12000 和环回 IP 地址。
http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html
写道:
如果您没有猜到,这与单子有关,因为它们出现在像Haskell这样的纯函数式编程语言中。它们与范畴论的单子关系密切,但是由于Haskell并不强制分类单子满足的身份而并不完全相同。
以上文字是在谈论这些身份吗?
return a >>= k = k a
m >>= return = m
m >>= (\x -> k x >>= h) = (m >>= k) >>= h
Run Code Online (Sandbox Code Playgroud) 我试图用partial_function关键字定义部分函数.那没起效.这是最能表达直觉的:
partial_function (tailrec) oddity :: "nat => nat"
where
"oddity Zero = Zero "
| "oddity (Succ (Succ n)) = n"
Run Code Online (Sandbox Code Playgroud)
然后我尝试了以下内容:
partial_function (tailrec) oddity :: "nat => nat"
where
"oddity arg = ( case arg of (Succ (Succ n)) => n
| Zero => Zero
)"
partial_function (tailrec) oddity :: "nat => nat"
where
"oddity (Succ(Succ n)) = n
| oddity Zero = Zero"
partial_function (tailrec) oddity :: "nat => nat"
where
"oddity n =
(if n …Run Code Online (Sandbox Code Playgroud) 我有一个工作程序
main = do
inpStr <- getLine
putStrLn ( "Hello " ++ inpStr )
Run Code Online (Sandbox Code Playgroud)
哪里
putStrLn :: String -> IO ()
Run Code Online (Sandbox Code Playgroud)
和
getLine :: IO String
Run Code Online (Sandbox Code Playgroud)
由此我可以断定的类型<-是
IO a -> a
Run Code Online (Sandbox Code Playgroud)
?
遵循如何使用 - 持久堆 - 图像 - 使理论加载 - 更快 - 在isabelle和另一个建议我为Nominal Isabelle创建了一个图像:
isabelle build -v -b -d . Nominal2
Run Code Online (Sandbox Code Playgroud)
堆映像是在〜/ .isabelle下创建的:
.isabelle/Isabelle2013-2/heaps/polyml-5.5.1_x86-linux/Nominal2
Run Code Online (Sandbox Code Playgroud)
然后我开始了
isabelle jedit -d /path/to/Nominal-distribution -l Nominal2
Run Code Online (Sandbox Code Playgroud)
我希望系统能够快速加载一个导入名义部分的理论,但这花了差不多一分钟.这是通常的吗?
我试图证明一个存在定理
\n\nlemma "\xe2\x88\x83 x. x * (t :: nat) = t"\nproof\n obtain y where "y * t = t" by (auto)\nRun Code Online (Sandbox Code Playgroud)\n\n但我无法完成证明。所以我有了必要的东西y,但我怎样才能将其纳入最初的目标呢?
我想保存Lisp编译器的状态,以便我不需要在几分钟内加载我的文件,而是我会在几秒钟内加载该图像.
哪个Common Lisp编译器对我有利?
我接受了这个想法,因为新泽西州的标准ML做到了这一点:出口堆.
linesHaskell中的函数将字符串的行分成字符串列表:
lines :: String -> [String]
Run Code Online (Sandbox Code Playgroud)
该readFile函数将文件读取为字符串:
readFile :: FilePath -> IO String
Run Code Online (Sandbox Code Playgroud)
尝试组合这些函数以获取文件中的行列表会导致类型错误:
Prelude> (lines . readFile) "quux.txt"
<interactive>:26:10: error:
• Couldn't match type ‘IO String’ with ‘[Char]’
Expected type: FilePath -> String
Actual type: FilePath -> IO String
• In the second argument of ‘(.)’, namely ‘readFile’
In the expression: lines . readFile
In the expression: (lines . readFile) "quux.txt"
Run Code Online (Sandbox Code Playgroud)
我该怎么做单子戏?