"""Second check of the planar lemma via determinants of three l1-unit directions.""" import json import z3 def exclude(name, constraints): solver=z3.SolverFor('QF_NRA') solver.set(timeout=15000) solver.add(*constraints) verdict=solver.check() if verdict!=z3.unsat: raise RuntimeError((name,solver.reason_unknown() if verdict==z3.unknown else solver.model())) return {'case':name,'counterexample':str(verdict)} def run(): # The three normalized sides x, y and x-y have pairwise determinant product # |det(x,y)|^3 / (||x|| ||y|| ||x-y||)^2. It suffices to bound it by 1/4. # Independent sign changes put each projective direction on one of two # edges (s,1-s) or (s,-(1-s)) of the l1 unit diamond, with 0<=s<=1. g,h,a,d=z3.Reals('g h a d') # All on one edge: order the parameters, with gaps g,h. same=exclude('one projective edge',[g>=0,h>=0,g+h<=1,4*g*h*(g+h)>1]) # Two on one edge at x>=y, the other at t on the second. Swap axes to # make t<=1/2 and reorder x,y. The cross-edge determinant magnitude at z # equals f(z)=t+(1-2t)z, which increases. With d=x-y and a=1-t, # d f(x) f(y) <= d f(1) f(1-d) = d a (a-(2a-1)d). mixed=exclude('two projective edges',[2*a>=1,a<=1,d>=0,d<=1,4*d*a*(a-(2*a-1)*d)>1]) return dict(z3=z3.get_version_string(),real_arithmetic=True,checks=[same,mixed]) if __name__=='__main__':print(json.dumps(run(),indent=2))