예제 #1
0
func babbyo(q l.V) l.Goal {
	keiths_last_name, libbys_last_name, margos_last_name, noras_last_name, ottos_last_name := l.Fresh5()
	keiths_age, noras_age, margos_age, ottos_age, libbys_age := l.Fresh5()
	iveys_age, fells_age, halls_age := l.Fresh3()
	membero := l.StructMemberoConstructor5(c)
	return l.And(
		l.Unify(Children{Child{"Keith", keiths_last_name, keiths_age},
			Child{"Libby", libbys_last_name, libbys_age},
			Child{"Margo", margos_last_name, margos_age},
			Child{"Nora", noras_last_name, noras_age},
			Child{"Otto", ottos_last_name, ottos_age}}, q),

		//2
		l.Difference(keiths_age, 1, iveys_age),
		l.Difference(iveys_age, 1, noras_age),

		//3
		l.Difference(fells_age, 3, margos_age),

		//4
		l.Mult(halls_age, 2, ottos_age),

		// 1
		membero(Child{"Libby", "Jule", v()}, q),

		//
		membero(Child{v(), "Fell", fells_age}, q),
		membero(Child{v(), "Gant", v()}, q),
		membero(Child{v(), "Hall", halls_age}, q),
		membero(Child{v(), "Ivey", iveys_age}, q),
		membero(Child{v(), "Jule", v()}, q),
		membero(Child{v(), v(), 2}, q),
		membero(Child{v(), v(), 3}, q),
		membero(Child{v(), v(), 4}, q),
		membero(Child{v(), v(), 5}, q),
		membero(Child{v(), v(), 6}, q),
	)
}
예제 #2
0
파일: golf.go 프로젝트: glycerine/gologic
func golfo(q l.V) l.Goal {
	membero := l.StructMemberoConstructor4(func(a, b, c, d interface{}) interface{} { return Round{a, b, c, d} })
	bills_job := v()
	bills_score := v()
	mr_clubb_first_name := v()
	mr_clubbs_score := v()
	pro_shop_clerk_score := v()
	frank_score := v()
	caddy_score := v()
	sands_score := v()
	score1, score2, score3, score4 := l.Fresh4()
	mr_carters_first_name := v()
	return l.And(
		l.Unify(Round{Dude{"Bill", v(), v(), score1}, Dude{"Jack", v(), v(), score2}, Dude{"Frank", v(), v(), score3}, Dude{"Paul", v(), v(), score4}}, q),
		l.Neq(score1, score2),
		l.Neq(score1, score3),
		l.Neq(score1, score4),
		l.Neq(score2, score3),
		l.Neq(score2, score4),
		l.Neq(score3, score4),

		membero(Dude{"Jack", v(), v(), v()}, q),
		membero(Dude{v(), "Green", v(), v()}, q),
		membero(Dude{v(), v(), "short-order cook", v()}, q),

		// // 1
		membero(Dude{"Bill", v(), bills_job, bills_score}, q),
		l.Neq(bills_job, "maintenance man"),
		membero(Dude{v(), v(), "maintenance man", v()}, q),
		l.Increasing(bills_score, score2),
		l.Increasing(bills_score, score3),
		l.Increasing(bills_score, score4),

		// // 2
		membero(Dude{mr_clubb_first_name, "Clubb", v(), mr_clubbs_score}, q),
		l.Neq(mr_clubb_first_name, "Paul"),
		membero(Dude{v(), v(), "pro-shop clerk", pro_shop_clerk_score}, q),
		l.Difference(mr_clubbs_score, 10, pro_shop_clerk_score),

		// //3
		membero(Dude{"Frank", v(), v(), frank_score}, q),
		membero(Dude{v(), v(), "caddy", caddy_score}, q),
		membero(Dude{v(), "Sands", v(), sands_score}, q),

		l.Or(l.And(l.Difference(frank_score, 7, sands_score),
			l.Difference(caddy_score, 4, sands_score)),
			l.And(l.Difference(frank_score, 4, sands_score),
				l.Difference(caddy_score, 7, sands_score))),

		// // // 4
		membero(Dude{mr_carters_first_name, "Carter", v(), 78}, q),
		l.Increasing(frank_score, 78),
		l.Neq(mr_carters_first_name, "Frank"),

		// // // 5
		l.Neq(score1, 81),
		l.Neq(score2, 81),
		l.Neq(score3, 81),
		l.Neq(score4, 81),

		scoreo(q),
	)
}