mirror of
https://github.com/Smaug123/FicroKanSharp
synced 2025-10-12 23:08:41 +00:00
Format
This commit is contained in:
@@ -11,9 +11,14 @@ module TestThing =
|
||||
let aAndB =
|
||||
Goal.conj
|
||||
(Goal.callFresh (fun x -> Goal.equiv (Term.Variable x) (Term.Literal 7)))
|
||||
(Goal.callFresh (fun x -> Goal.disj (Goal.equiv (Term.Variable x) (Term.Literal 5)) (Goal.equiv (Term.Variable x) (Term.Literal 6))))
|
||||
(Goal.callFresh (fun x ->
|
||||
Goal.disj
|
||||
(Goal.equiv (Term.Variable x) (Term.Literal 5))
|
||||
(Goal.equiv (Term.Variable x) (Term.Literal 6))
|
||||
))
|
||||
|
||||
let u = Goal.evaluate aAndB State.empty
|
||||
|
||||
match u |> Stream.peel with
|
||||
| None -> failwith "oh no"
|
||||
| Some (s, rest) ->
|
||||
@@ -48,13 +53,17 @@ module TestThing =
|
||||
(Goal.callFresh (fun x -> Goal.equiv (Term.Variable x) (Term.Literal 5)))
|
||||
|
||||
let u = Goal.evaluate aAndB State.empty
|
||||
|
||||
match u |> Stream.peel with
|
||||
| None -> failwith "oh no"
|
||||
| Some (s, rest) ->
|
||||
|
||||
s
|
||||
|> Map.toList
|
||||
|> shouldEqual [Variable.VariableCount 0, Term.Literal 5]
|
||||
|> shouldEqual
|
||||
[
|
||||
Variable.VariableCount 0, Term.Literal 5
|
||||
]
|
||||
|
||||
match Stream.peel rest with
|
||||
| None -> ()
|
||||
@@ -65,14 +74,19 @@ module TestThing =
|
||||
let rec fives (x : Variable) =
|
||||
(Goal.disj (Goal.equiv (Term.Variable x) (Term.Literal 5)) (Goal.delay (fun () -> fives x)))
|
||||
|
||||
let u = Goal.evaluate (Goal.callFresh fives) State.empty
|
||||
let u =
|
||||
Goal.evaluate (Goal.callFresh fives) State.empty
|
||||
|
||||
match u |> Stream.peel with
|
||||
| None -> failwith "oh no"
|
||||
| Some (s, rest) ->
|
||||
|
||||
s
|
||||
|> Map.toList
|
||||
|> shouldEqual [Variable.VariableCount 0, Term.Literal 5]
|
||||
|> shouldEqual
|
||||
[
|
||||
Variable.VariableCount 0, Term.Literal 5
|
||||
]
|
||||
|
||||
match Stream.peel rest with
|
||||
| None -> failwith "oh no"
|
||||
@@ -80,33 +94,45 @@ module TestThing =
|
||||
|
||||
s
|
||||
|> Map.toList
|
||||
|> shouldEqual [Variable.VariableCount 0, Term.Literal 5]
|
||||
|> shouldEqual
|
||||
[
|
||||
Variable.VariableCount 0, Term.Literal 5
|
||||
]
|
||||
|
||||
match Stream.peel rest with
|
||||
| None -> failwith "oh no"
|
||||
| Some (s, _rest) ->
|
||||
|
||||
s
|
||||
|> Map.toList
|
||||
|> shouldEqual [Variable.VariableCount 0, Term.Literal 5]
|
||||
s
|
||||
|> Map.toList
|
||||
|> shouldEqual
|
||||
[
|
||||
Variable.VariableCount 0, Term.Literal 5
|
||||
]
|
||||
|
||||
[<Fact>]
|
||||
let ``Another recursive example`` () =
|
||||
let rec fives (x : Variable) =
|
||||
(Goal.disj (Goal.equiv (Term.Variable x) (Term.Literal 5)) (Goal.delay (fun () -> fives x)))
|
||||
|
||||
let rec sixes (x : Variable) =
|
||||
(Goal.disj (Goal.equiv (Term.Variable x) (Term.Literal 6)) (Goal.delay (fun () -> sixes x)))
|
||||
|
||||
let fivesAndSixes =
|
||||
Goal.callFresh (fun x -> Goal.disj (fives x) (sixes x))
|
||||
|
||||
let u = Goal.evaluate fivesAndSixes State.empty
|
||||
|
||||
match u |> Stream.peel with
|
||||
| None -> failwith "oh no"
|
||||
| Some (s, rest) ->
|
||||
|
||||
s
|
||||
|> Map.toList
|
||||
|> shouldEqual [Variable.VariableCount 0, Term.Literal 5]
|
||||
|> shouldEqual
|
||||
[
|
||||
Variable.VariableCount 0, Term.Literal 5
|
||||
]
|
||||
|
||||
match Stream.peel rest with
|
||||
| None -> failwith "oh no"
|
||||
@@ -114,7 +140,10 @@ module TestThing =
|
||||
|
||||
s
|
||||
|> Map.toList
|
||||
|> shouldEqual [Variable.VariableCount 0, Term.Literal 6]
|
||||
|> shouldEqual
|
||||
[
|
||||
Variable.VariableCount 0, Term.Literal 6
|
||||
]
|
||||
|
||||
match Stream.peel rest with
|
||||
| None -> failwith "oh no"
|
||||
@@ -122,12 +151,18 @@ module TestThing =
|
||||
|
||||
s
|
||||
|> Map.toList
|
||||
|> shouldEqual [Variable.VariableCount 0, Term.Literal 5]
|
||||
|> shouldEqual
|
||||
[
|
||||
Variable.VariableCount 0, Term.Literal 5
|
||||
]
|
||||
|
||||
match Stream.peel rest with
|
||||
| None -> failwith "oh no"
|
||||
| Some (s, _rest) ->
|
||||
|
||||
s
|
||||
|> Map.toList
|
||||
|> shouldEqual [Variable.VariableCount 0, Term.Literal 6]
|
||||
s
|
||||
|> Map.toList
|
||||
|> shouldEqual
|
||||
[
|
||||
Variable.VariableCount 0, Term.Literal 6
|
||||
]
|
||||
|
Reference in New Issue
Block a user