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
Section CultOfLoveDoesNotExist. | |
Variable human : Set. | |
Variable P : human -> Prop. (* xは愛の教団に属する *) | |
Variable L : human -> human -> Prop. (* xはyを愛する *) | |
Theorem CultOfLoveDoesNotExist | |
(forall x : human, P x -> forall y : human, ~ L y y -> L x y) /\ | |
(forall x : human, P x -> forall y : human, L x y -> ~ L y y) -> | |
~ (exists x : human, P x). |
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
open System | |
open Microsoft.FSharp.Quotations | |
open Microsoft.FSharp.Quotations.ExprShape | |
open Microsoft.FSharp.Linq.QuotationEvaluation | |
module Util = | |
let rnd = new Random() | |
let (|Range|_|) min max x = | |
if min <= x && x <= max then Some() else 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
(* | |
type IFoo = | |
abstract M1 : unit -> int | |
abstract M2 : unit -> int | |
このインターフェースの一部だけを実装した抽象クラス | |
[<AbstractClass>] | |
type Bar() = | |
interface IFoo with | |
override x.M1() = 0 | |
が作れないのでF#でthisをプロパティにするアプローチは微妙。 |
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 A<'X, 'Y when 'X :> A<'X, 'Y> and 'Y :> B<'X, 'Y>> = interface end | |
and B<'X, 'Y when 'X :> A<'X, 'Y> and 'Y :> B<'X, 'Y>> = interface end | |
type C = inherit A<C, D> | |
and D = inherit B<C, D> |
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 ; | |
import js.JQuery; | |
import js.Lib; | |
enum Pair<A, B> { | |
pair(a : A, b : B); | |
} | |
class Util { | |
public static function fst<A, B>(p: Pair<A, B>) { |
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
module ElimArrayBoundCheck = | |
type BIndex<'Tag>(idx) = | |
member this.Idx = idx | |
type BArray<'Tag, 'T>(arr : 'T[]) = | |
member this.lookup(bidx : BIndex<'Tag>) = arr.[bidx.Idx] | |
type C<'T, 'R> = interface | |
abstract s<'Tag> : BIndex<'Tag> * BArray<'Tag, 'T> -> 'R | |
abstract f : 'R | |
end |
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
let blackTile = '.' | |
let redTile = '#' | |
let man = '@' | |
let loopEnd = ref false | |
while not !loopEnd do | |
let [|I; J|] = System.Console.ReadLine().Split([|' '|]) |> Array.map int | |
if I = 0 && J = 0 then | |
loopEnd := true | |
else | |
let maze = |
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
let ringo = '@' | |
let kaki = '#' | |
let mikan = '*' | |
let loopEnd = ref false | |
while not !loopEnd do | |
let [|I; J|] = System.Console.ReadLine().Split([|' '|]) |> Array.map int | |
if I = 0 && J = 0 then | |
loopEnd := true | |
else | |
let maze = |
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
let lineSize = System.Console.ReadLine() |> int | |
for x = 0 to lineSize - 1 do | |
let nums = System.Console.ReadLine().Split([|' '|]) |> Array.map int | |
let suc = ref false | |
let rec dfs i bMax cMax = | |
if i < nums.Length - 1 then | |
if nums.[i] > bMax then | |
dfs (i+1) nums.[i] cMax | |
if nums.[i] > cMax then |
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
let [| height; width; cheeseSize |] = System.Console.ReadLine().Split([|' '|]) |> Array.map int | |
let maze = | |
[| for x = 0 to height - 1 do | |
yield System.Console.ReadLine().ToCharArray() |] | |
let start = ref (0, 0) | |
for h = 0 to height - 1 do | |
for w = 0 to width - 1 do | |
if maze.[h].[w] = 'S' then |