This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File /usr/lib/omake/build/OCaml.om: line 563, | |
failed on target: hoge.cmi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import play.api.mvc._ | |
object ImplicitClosureTest extends Controller { | |
def foo(implicit f:Flash) = f.toString | |
def hoge = Action { | |
implicit request => Ok(foo) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
スタック言語のプログラムを評価する関数 | |
*) | |
Fixpoint s_execute (st : state) (stack : list nat) | |
(prog : list sinstr) | |
: list nat := | |
match (prog, stack) with | |
| (nil, _) => stack | |
| (SPush n :: prog', _) => s_execute st (n::stack) prog' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Require Import ssreflect. | |
(* **** Exercise: 3 stars (swap_if_branches) *) | |
(** **** 練習問題: ★★★ (swap_if_branches) *) | |
Theorem swap_if_branches: forall b e1 e2, | |
cequiv | |
(IFB b THEN e1 ELSE e2 FI) | |
(IFB BNot b THEN e2 ELSE e1 FI). | |
Proof. | |
move => b e1 e2. | |
split => H. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type LS = List[String] | |
def f(x : Any) = x match { | |
case (x : LS) => Some(x) | |
case _ => None | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Theorem WHILE_true: forall b c, | |
bequiv b BTrue -> | |
cequiv | |
(WHILE b DO c END) | |
(WHILE BTrue DO SKIP END). | |
Proof. | |
move => b c H. | |
unfold cequiv => st st'. | |
split => HH. | |
- destruct(WHILE_true_nonterm b c st st' H). by assumption. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(** **** 練習問題: ★★, recommended (assign_aequiv) *) | |
Theorem assign_aequiv : forall X e, | |
aequiv (AId X) e -> | |
cequiv SKIP (X ::= e). | |
Proof. | |
move=> X e H. split => HH. | |
- inversion HH. subst. | |
assert (st' = update st' X (st' X)). | |
- apply functional_extensionality => x. | |
by rewrite update_same; reflexivity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MAX 5 | |
mtype = { mesg, ack, nak, err }; | |
proctype sender(chan in_, out) | |
{ byte o, s, r; | |
o=MAX-1; | |
do | |
:: o = (o+1)%MAX; /* next msg */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Theorem map_length: forall A B:Type f xs, | |
length (map f xs) = length xs. | |
Proof. | |
intros A B f xs. induction xs. | |
reflexivity. | |
simpl. rewrite IHxs. reflexivity. | |
Qed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Require Import ssreflect ssrbool eqtype ssrnat. | |
Section HilbertSaxiom. | |
Variables A B C : Prop. | |
Lemma HilbertS : (A -> B -> C) -> (A -> B) -> A -> C. | |
Proof. | |
move=> hAiBiC hAiB hA. | |
move: hAiBiC. |