Juan-Carlos Gandhi (
juan_gandhi) wrote2019-05-19 01:03 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
еще похвастаться
def checkDistributivity(cat: Category): MatchResult[Any] = {
val topos = new CategoryOfDiagrams(cat)
import topos._
val points = Ω.points
val desc = s"Testing ${cat.name} distributivity laws"
println(desc)
for { pt1 ← points } {
println(s" at ${pt1.tag}")
val p = predicateFor(pt1)
for { pt2 ← points } {
val q = predicateFor(pt2)
val pAndQ = p ∧ q
val pOrQ = p ∨ q
for { pt3 ← points } {
val r = predicateFor(pt3)
// distributivity of conjunction over disjunction
(p ∧ (q ∨ r)) === (pAndQ ∨ (p ∧ r))
// distributivity of disjunction over conjunction
(p ∨ (q ∧ r)) === (pOrQ ∧ (p ∨ r))
}
}
}
ok
}