mirror of
				https://github.com/Z3Prover/z3
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	update expected
This commit is contained in:
		
							parent
							
								
									97fe2c8609
								
							
						
					
					
						commit
						a1928a2438
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -859,13 +859,14 @@ def RecFunction(name, *sig):
 | 
			
		|||
 | 
			
		||||
def RecAddDefinition(f, args, body):
 | 
			
		||||
    """Set the body of a recursive function.
 | 
			
		||||
       Recursive definitions are only unfolded during search.
 | 
			
		||||
       Recursive definitions can be simplified if they are applied to ground
 | 
			
		||||
       arguments.       
 | 
			
		||||
    >>> ctx = Context()
 | 
			
		||||
    >>> fac = RecFunction('fac', IntSort(ctx), IntSort(ctx))
 | 
			
		||||
    >>> n = Int('n', ctx)
 | 
			
		||||
    >>> RecAddDefinition(fac, n, If(n == 0, 1, n*fac(n-1)))
 | 
			
		||||
    >>> simplify(fac(5))
 | 
			
		||||
    fac(5)
 | 
			
		||||
    120
 | 
			
		||||
    >>> s = Solver(ctx=ctx)
 | 
			
		||||
    >>> s.add(fac(n) < 3)
 | 
			
		||||
    >>> s.check()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue