对于涉及整数除法的简单查询,Z3返回unknown

时间:2016-02-10 22:43:09

标签: z3

这是一个简单的Z3查询,涉及整数除法(即非线性运算):

(declare-const a01 Int)
(declare-const a02 Int)
(assert(or (= (/ a01 a02) 2) (= (/ a02 a01) 2)))
(assert( > a01 0))
(assert( > a02 0))
(check-sat)

Z3在尝试解决此查询时返回uknown。我知道非线性整数算法是不可判定的,但我仍然希望Z3在实践中不那么脆弱。

如果我遗漏了一些我可以为Z3设置的明显参数来帮助它解决此类查询,请告诉我。我正在使用Z3 4.4.1,我也尝试了在rise4fun上的版本。谢谢!

1 个答案:

答案 0 :(得分:0)

使用 Login.html <html ng-app="LoginApp"> <body> <script src="angular.min.js"></script> <script src="LoginApp.js"> </script> <div ng-controller="loginController as login"> Username <input type="text" ng-model="username" /><br/> Password <input type="text" ng-model="password" /><br/> <button ng-click="validate()">Validate</button> </div> <br/> <a href="Reg.html">Register Me/New user</a> </body> </html> LoginApp.js (function(){ var app; app=angular.module('LoginApp',[]); app.controller('loginController',function($scope,$http){ var dataObj = { "name" : "Java Honk", "password" : "NY" }; $scope.validate = function() { dataObj.name=$scope.username; dataObj.password=$scope.password; //if($scope.username=="sam" && $scope.password=="pwd") // console.log("password match"); // else //console.log("username/pwd not matching"); $http.post('http://localhost:8080/demomongo/templateapp/login', dataObj) .success(function(responseData) { $scope.responseData = responseData; console.log(responseData); }).error(function(data, status, headers, config) { alert( "Exception details: " + JSON.stringify({data: data})); }); } }); })();代替 CORSFilter.java package com.demo.mongo.example.filter; import java.io.IOException; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.web.filter.OncePerRequestFilter; public class CORSFilter extends OncePerRequestFilter { private static final Log LOG = LogFactory.getLog(CORSFilter.class); @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { response.addHeader("Access-Control-Allow-Origin", "*"); if (request.getHeader("Access-Control-Request-Method") != null && "OPTIONS".equals(request.getMethod())) { LOG.trace("Sending Header...."); // CORS "pre-flight" request response.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE"); // response.addHeader("Access-Control-Allow-Headers", "Authorization"); response.addHeader("Access-Control-Allow-Headers", "Content-Type"); response.addHeader("Access-Control-Max-Age", "1"); } filterChain.doFilter(request, response); } }

    //templatecontroller.java
    package com.demo.mongo.example.controller;
    import java.util.List;

    import org.springframework.http.MediaType;
    import org.springframework.http.ResponseEntity;
    import org.springframework.stereotype.Controller;
    import org.springframework.ui.ModelMap;
    import org.springframework.web.bind.annotation.CrossOrigin;
    import org.springframework.web.bind.annotation.RequestBody;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RequestMethod;
    import org.springframework.web.bind.annotation.RequestParam;
    import org.springframework.web.bind.annotation.ResponseBody;
    import org.springframework.web.bind.annotation.RestController;
    import org.springframework.web.util.UriComponentsBuilder;

    import com.demo.mongo.example.model.UserDetails;


    @RestController
    @RequestMapping("/templateapp")
    public class TemplateController {
    	@CrossOrigin
    	@RequestMapping(value="/login", method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE)
        public @ResponseBody String validateUser(@RequestBody UserDetails udata,UriComponentsBuilder ucBuilder) {
    		/*UserDetails obj=new UserDetails();
    		List<UserDetails> values=obj.UserDetails(udata.getName(),udata.getPassword());
    		if(values.size()>0){
    			return "welcome udata.getName";
    		}
    		else
    		{
    			return "please register using registration link";
    		}*/
            if(udata.getName().equalsIgnoreCase("admin") &&  udata.getPassword().equalsIgnoreCase("admin"))
            {
            	return "welcome admin";
            }
            else
            {
            	return "password mismatch/not an admin";
            }
    	}
    	@CrossOrigin
    	@RequestMapping(value="/addUser", method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE)
        public @ResponseBody String addUser(@RequestBody UserDetails udata,UriComponentsBuilder ucBuilder) {
            
            return " new user details: name "+ udata.getName() + " Email Id " + udata.getEmailid() ;
    	}
    	
    }