Skip to content

Instantly share code, notes, and snippets.

@y-taka-23
y-taka-23 / whitespace_pumpkin.ws
Created November 7, 2013 12:06
CodeIQ「カボチャの種を数えて!」の Whitespace による解答です。 処理系の仕様により EOF が扱えないため、「標準入力で '?' より前に現れた 'O' の個数」をカウントします。
.
.
.
.
.
.
.
.
.
.
@y-taka-23
y-taka-23 / alloy_group.als
Created October 31, 2013 18:33
Alloy による群のモデリング
// ************************************
// 群のモデル
// ************************************
// ------------------------------------
// 群の公理
// ------------------------------------
// 群の元
sig Element {
@y-taka-23
y-taka-23 / alloy_combilogic.als
Last active December 25, 2015 19:49
Alloy による組み合わせ回路のモデリング
// ************************************
// 組み合わせ回路のモデル
// ************************************
// ------------------------------------
// 組み合わせ回路の性質
// ------------------------------------
// 回路の構成要素
abstract sig Element {
@y-taka-23
y-taka-23 / alloy_git.als
Last active July 13, 2022 18:00
Alloy による Git のコミットグラフのモデリング
// ************************************
// Git のコミットグラフのモデル
// ************************************
open util/ordering[Time]
// ------------------------------------
// グラフの構成要素
// ------------------------------------
@y-taka-23
y-taka-23 / alloy_decimal.als
Created October 9, 2013 16:12
Alloy による十進位取り記数法のモデリング
// ************************************
// 十進法による符号なし整数演算のモデル
// ************************************
open util/ordering[Position]
// ------------------------------------
// 位取り記数法のモデリング
// ------------------------------------
@y-taka-23
y-taka-23 / coq_perceptron.v
Created September 17, 2013 11:43
Proof of Novikoff's Perceptron Convergence Theorem (Unfinished)
Section Perceptron.
Require Import QArith List.
Inductive Q_vector : nat -> Set :=
| vnil : Q_vector O
| vcons : forall n : nat,
Q -> Q_vector n -> Q_vector (S n).
Implicit Arguments vcons [n].
Notation "x ; v" := (vcons x v)
@y-taka-23
y-taka-23 / alloy_vender.als
Last active July 27, 2018 12:53
Alloy による自動販売機のモデリング
// ************************************
// ジュースの自動販売機のモデル
// ************************************
open util/ordering[Time]
// 時刻パラメータ
sig Time {}
// 簡略化のため、コインの額面とジュースの種類はそれぞれ 1 種類とする
@y-taka-23
y-taka-23 / coq_stackcomp.v
Created July 27, 2013 07:34
Validation of the Compiler for the Stack Machine (via "Software Foundations" http://www.cis.upenn.edu/~bcpierce/sf/Imp.html.html)
(*******************************************************)
(** //// Validation of the Stack Machine Compiler //// *)
(*******************************************************)
Require Import List.
(* Definition : Identifiers *)
Inductive id : Type :=
| Id : nat -> id.
@y-taka-23
y-taka-23 / coq_quine.v
Last active November 15, 2019 20:44
Quine (Self-Reproducing Program) on Coq
Require Import Ascii String.
Open Scope string_scope.
Definition Q : string := "
Eval compute in ""
Require Import Ascii String.
Open Scope string_scope.
Definition Q : string := "" ++ """" ++ Q ++ """" ++ ""."" ++ Q.".
Eval compute in "
Require Import Ascii String.
Open Scope string_scope.
@y-taka-23
y-taka-23 / coq_qsort.v
Last active December 11, 2015 01:49
Validation of the Quick Sort
(******************************************************)
(** //// Validation of the Quick Sort //// *)
(******************************************************)
Section QuickSort.
Require Import Arith List.
Require Import Recdef.
Require Import Sorting.Sorted Sorting.Permutation.