Bret Taylor designs Truss, a programming language for agents

(github.com)

2 points | by smugma 3 hours ago ago

1 comments

  • rawgabbit 19 minutes ago ago

    I like the core idea of pushing "proof" or conformance away from the compiler to the package/code authors. Otherwise, I have had a hard time wrapping my head around some of the naming-terminology for the "contracts".

        [for-all] is really a constraint defining valid input domains and valid ranges via an inline function.  
        I would rename [forall(index, end, predicate)] to [domain-constraint(domain-begin,domain-end,domain-step,function())]
        
        "requires" is really a constraint defining valid inputs.
        I would rename [requires] keyword  [input-constraint(function(input1,input2, etc))].
    
        "ensures" is really a constraints defining valid outputs.
        I would rename [ensures] keyword to [output-constraint(function(result,input1,input2,etc))] 
    
        "terminates", I have no idea what this does.
    
    GITHUB DOCS snippets: [forall(index, end, predicate)] says that the predicate holds for every integer index from zero up to, and excluding, end. [requires] gives the caller an obligation and gives spend a fact on entry. Here it establishes that subtraction cannot underflow. For an amount read at runtime, branch on whether it fits before calling spend. [ensures] gives a caller facts on each return from the function. result refers to the returned value, budget.remaining to the resulting field, and old(budget.remaining) to that field on entry. to_natural expresses the arithmetic in the proof's unbounded nonnegative domain. [terminates] asks the checker to establish that each call meeting the preconditions returns in finitely many steps without a language trap. This requires proving access and arithmetic bounds, using callees with their own termination claims, and supplying a decreasing measure for each reachable loop.