Skip to content

Commit

Permalink
Change camelCase to snake-case for functions
Browse files Browse the repository at this point in the history
  • Loading branch information
anfelor committed Apr 15, 2018
1 parent ef4d4a8 commit d8ef91d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
10 changes: 5 additions & 5 deletions src/Algebra/Dioid/Bool.agda
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ _and_ : Bool -> Bool -> Bool
true and true = true
_ and _ = false

boolDioid : Dioid -> Bool
boolDioid zero = false
boolDioid one = true
boolDioid (r + s) = boolDioid r or boolDioid s
boolDioid (r * s) = boolDioid r and boolDioid s
bool-dioid : Dioid -> Bool
bool-dioid zero = false
bool-dioid one = true
bool-dioid (r + s) = bool-dioid r or bool-dioid s
bool-dioid (r * s) = bool-dioid r and bool-dioid s
38 changes: 19 additions & 19 deletions src/Algebra/Dioid/Bool/Theorems.agda
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,22 @@ right-distributivity {false} {true} {true} = reflexivity
right-distributivity {false} {true} {false} = reflexivity
right-distributivity {false} {false} {d} = reflexivity

boolDioidLawful : {r s : Dioid} -> r Algebra.Dioid.≡ s -> boolDioid r ≡ boolDioid s
boolDioidLawful {r} {.r} Algebra.Dioid.reflexivity = reflexivity
boolDioidLawful {r} {s} (Algebra.Dioid.symmetry eq) = symmetry (boolDioidLawful eq)
boolDioidLawful {r} {s} (Algebra.Dioid.transitivity eq eq₁) = transitivity (boolDioidLawful eq) (boolDioidLawful eq₁)
boolDioidLawful {.(_ + _)} {.(_ + _)} (Algebra.Dioid.+left-congruence eq) = or-left-congruence (boolDioidLawful eq)
boolDioidLawful {.(_ + _)} {.(_ + _)} (Algebra.Dioid.+right-congruence eq) = or-right-congruence (boolDioidLawful eq)
boolDioidLawful {.(_ * _)} {.(_ * _)} (Algebra.Dioid.*left-congruence eq) = and-left-congruence (boolDioidLawful eq)
boolDioidLawful {.(_ * _)} {.(_ * _)} (Algebra.Dioid.*right-congruence eq) = and-right-congruence (boolDioidLawful eq)
boolDioidLawful {.(s + s)} {s} Algebra.Dioid.+idempotence = or-idempotence
boolDioidLawful {.(_ + _)} {.(_ + _)} Algebra.Dioid.+commutativity = or-commutativity
boolDioidLawful {.(_ + (_ + _))} {.(_ + _ + _)} Algebra.Dioid.+associativity = or-associativity
boolDioidLawful {.(s + zero)} {s} Algebra.Dioid.+zero-identity = or-false-identity
boolDioidLawful {.(_ * (_ * _))} {.(_ * _ * _)} Algebra.Dioid.*associativity = and-associativity
boolDioidLawful {.(zero * _)} {.zero} Algebra.Dioid.*left-zero = reflexivity
boolDioidLawful {.(_ * zero)} {.zero} Algebra.Dioid.*right-zero = and-right-false
boolDioidLawful {.(one * s)} {s} Algebra.Dioid.*left-identity = and-left-true
boolDioidLawful {.(s * one)} {s} Algebra.Dioid.*right-identity = and-right-true
boolDioidLawful {.(_ * (_ + _))} {.(_ * _ + _ * _)} Algebra.Dioid.left-distributivity = left-distributivity
boolDioidLawful {.((_ + _) * _)} {.(_ * _ + _ * _)} Algebra.Dioid.right-distributivity = right-distributivity
bool-dioid-lawful : {r s : Dioid} -> r Algebra.Dioid.≡ s -> bool-dioid r ≡ bool-dioid s
bool-dioid-lawful {r} {.r} Algebra.Dioid.reflexivity = reflexivity
bool-dioid-lawful {r} {s} (Algebra.Dioid.symmetry eq) = symmetry (bool-dioid-lawful eq)
bool-dioid-lawful {r} {s} (Algebra.Dioid.transitivity eq eq₁) = transitivity (bool-dioid-lawful eq) (bool-dioid-lawful eq₁)
bool-dioid-lawful {.(_ + _)} {.(_ + _)} (Algebra.Dioid.+left-congruence eq) = or-left-congruence (bool-dioid-lawful eq)
bool-dioid-lawful {.(_ + _)} {.(_ + _)} (Algebra.Dioid.+right-congruence eq) = or-right-congruence (bool-dioid-lawful eq)
bool-dioid-lawful {.(_ * _)} {.(_ * _)} (Algebra.Dioid.*left-congruence eq) = and-left-congruence (bool-dioid-lawful eq)
bool-dioid-lawful {.(_ * _)} {.(_ * _)} (Algebra.Dioid.*right-congruence eq) = and-right-congruence (bool-dioid-lawful eq)
bool-dioid-lawful {.(s + s)} {s} Algebra.Dioid.+idempotence = or-idempotence
bool-dioid-lawful {.(_ + _)} {.(_ + _)} Algebra.Dioid.+commutativity = or-commutativity
bool-dioid-lawful {.(_ + (_ + _))} {.(_ + _ + _)} Algebra.Dioid.+associativity = or-associativity
bool-dioid-lawful {.(s + zero)} {s} Algebra.Dioid.+zero-identity = or-false-identity
bool-dioid-lawful {.(_ * (_ * _))} {.(_ * _ * _)} Algebra.Dioid.*associativity = and-associativity
bool-dioid-lawful {.(zero * _)} {.zero} Algebra.Dioid.*left-zero = reflexivity
bool-dioid-lawful {.(_ * zero)} {.zero} Algebra.Dioid.*right-zero = and-right-false
bool-dioid-lawful {.(one * s)} {s} Algebra.Dioid.*left-identity = and-left-true
bool-dioid-lawful {.(s * one)} {s} Algebra.Dioid.*right-identity = and-right-true
bool-dioid-lawful {.(_ * (_ + _))} {.(_ * _ + _ * _)} Algebra.Dioid.left-distributivity = left-distributivity
bool-dioid-lawful {.((_ + _) * _)} {.(_ * _ + _ * _)} Algebra.Dioid.right-distributivity = right-distributivity
16 changes: 8 additions & 8 deletions src/Algebra/Dioid/ShortestDistance.agda
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ data _≡_ : (x y : ShortestDistance) -> Set where
symmetry : {x y : ShortestDistance} -> x ≡ y -> y ≡ x
transitivity : {x y z : ShortestDistance} -> x ≡ y -> y ≡ z -> x ≡ z

shortestDistanceDioid : Dioid -> ShortestDistance
shortestDistanceDioid zero = Unreachable
shortestDistanceDioid one = Distance Nat.zero
shortestDistanceDioid (r + s) with shortestDistanceDioid r
... | Unreachable = shortestDistanceDioid s
... | Distance n with shortestDistanceDioid s
shortest-distance-dioid : Dioid -> ShortestDistance
shortest-distance-dioid zero = Unreachable
shortest-distance-dioid one = Distance Nat.zero
shortest-distance-dioid (r + s) with shortest-distance-dioid r
... | Unreachable = shortest-distance-dioid s
... | Distance n with shortest-distance-dioid s
... | Unreachable = Distance n
... | Distance m = Distance (Nat.min n m)
shortestDistanceDioid (r * s) with shortestDistanceDioid r
shortest-distance-dioid (r * s) with shortest-distance-dioid r
... | Unreachable = Unreachable
... | Distance n with shortestDistanceDioid s
... | Distance n with shortest-distance-dioid s
... | Unreachable = Unreachable
... | Distance m = Distance (n Nat.+ m)
2 changes: 1 addition & 1 deletion src/Algebra/LabelledGraph/Theorems.agda
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ left-distributivity {_} {a} {b} {c} {r} =
to-graph : {A} -> LabelledGraph A -> Graph A
to-graph ε = Graph.ε
to-graph (v x) = Graph.v x
to-graph (x -[ r ]> y) with Bool.boolDioid r
to-graph (x -[ r ]> y) with Bool.bool-dioid r
... | Bool.false = to-graph x Graph.+ to-graph y
... | Bool.true = to-graph x Graph.* to-graph y

Expand Down

0 comments on commit d8ef91d

Please sign in to comment.