Skip to content

Instantly share code, notes, and snippets.

View yoshihiro503's full-sized avatar

YOSHIHIRO Imai yoshihiro503

View GitHub Profile
Theorem contrapositive_bool : forall (p q : bool),
(p = true -> q = true) -> (q = false -> p = false).
Proof.
intros p q H Hq.
destruct p. (* pで場合分け*)
- (* pがtrueのとき *)
rewrite H in Hq.
+ discriminate Hq.
+ reflexivity.
- (* pがfalseのとき*)
From mathcomp Require Import all_ssreflect.
Lemma rensyu : forall i x y,
i != 0 -> (x - y) = 0 -> x.+1 - y <= i.
Proof.
move=> i x y i0 /eqP xy.
rewrite -addn1.
rewrite leq_subLR.
apply: leq_add.
by [].
open SCaml
let empty_bytes = Bytes "0x"
let is_empty_bytes b = (Bytes.length b = Nat 0)
let bytes_concat sep ss =
match ss with
| [] -> empty_bytes
| s0 :: ss ->
List.fold_left' (fun (acc, s) -> Bytes.concat (Bytes.concat acc sep) s) s0 ss
(** * Draft: The evolution of a Coq programmer *)
(** ** Freshman Coq programmer *)
Fixpoint fac n :=
match n with
| O => 1
| S p => n * fac p
end.
(* begin hide *) Reset fac. (* end hide *)
Require Import Nat.
Inductive Person :=
| CPerson : nat -> option Person -> Person.
Definition 年齢 p :=
let 'CPerson 年齢 配偶者 := p in 年齢.
Definition 配偶者 p :=
let 'CPerson 年齢 配偶者 := p in 配偶者.

formatting

フォーマットに準拠しているか検査

dune build @fmt

強制的にフォーマット

dune build @fmt --auto-promote
int hoge(x) {
int y = x + 1;
return y;
}
This file has been truncated, but you can view the full file.
Aug 18 15:38:43.133 - external_block_validator: initialized
Aug 18 15:38:43.260 - external_block_validator: block validator process started with pid 3093
Aug 18 15:38:44.027 - external_block_validator: shutting down
Aug 18 15:38:44.035 - external_block_validator: process terminated normally
Aug 18 15:40:14.584 - external_block_validator: initialized
Aug 18 15:40:14.713 - external_block_validator: block validator process started with pid 3726
Aug 18 15:40:14.722 - external_block_validator: shutting down
Aug 18 15:40:14.726 - external_block_validator: process terminated normally
Aug 18 15:53:56.974 - external_block_validator: initialized
Aug 18 15:53:57.102 - external_block_validator: block validator process started with pid 5518
@yoshihiro503
yoshihiro503 / List_map_length.v
Created April 21, 2021 10:35
list mapがリストの長さを変えないことを証明する例です
Require Import List.
Import ListNotations.
Fixpoint list_map {A B:Type} (f : A -> B) (xs : list A) :=
match xs with
| [] => []
| x :: xs => f x :: list_map f xs
end.
Theorem list_map_length : forall (A B: Type) (f: A -> B) xs,

概要

ブロックチェーン Tezos において、ノードの立ち上げやクライアントを使ったインタラクションをOCaml上で実行できるフレームワーク Tezt が爆誕したので試してみる。

Tezt とはなに?

Tezos開発者がOCamlでTezosの tezos プロジェクトに内包される形で提供されようとして現在 Merge Request が出ている段階である。