On this page:
assert
true?
false?
*or
&or
*and
&and
conjunction
disjunction
implication
negation
assume!

2.7 logic-utils🔗

 (require sicm/general/logic-utils) package: rktsicm

syntax

(assert test [msg id args ...])

 
  test : any?
  msg : string?
Helper for raising test failures. Shorthand for
(unless test (error "some message ..."))

procedure

(true? val)  boolean?

  val : any/c

procedure

(false? val)  boolean?

  val : any/c
Check if val is #t or #f respectively.

procedure

(*or lst)  boolean?

  lst : list?

procedure

(&or val ...)  boolean?

  val : any/c
Check if at least one item of lst or of val is #t

procedure

(*and lst)  boolean?

  lst : list?

procedure

(&and val ...)  boolean?

  val : any/c
Check if all items of lst or of val are #t

procedure

(conjunction pred1? pred2?)  predicate/c

  pred1? : predicate/c
  pred2? : predicate/c
Creates a new predicate equal to:
(λ (x) (and (pred1? x) (pred2? x)))

procedure

(disjunction pred1? pred2?)  predicate/c

  pred1? : predicate/c
  pred2? : predicate/c
Creates a new predicate equal to:
(λ (x) (or (pred1? x) (pred2? x)))

procedure

(implication pred1? pred2?)  predicate/c

  pred1? : predicate/c
  pred2? : predicate/c
Creates a new predicate equal to:
(λ (x) (or (not (pred1? x)) (pred2? x)))

procedure

(negation pred?)  predicate/c

  pred? : predicate/c
Creates a new predicate equal to:
(λ (x) (not (pred? x)))

procedure

(assume! assumption responsible [if-false])

  (or/c 'OK 'noted any/c)
  assumption : any/c
  responsible : any/c
  if-false : (-> any/c) = take-note!
If assumption is an expression, and all the operands are number?s, try to evaluate it using the procedure? bound to the operator in scmutils-base-environment. If the assumption is #t, return 'OK. If it is false, evaluate if-false. The default is to add a note about the 'false! assumption, returning 'noted. In all other cases that the assumption was not tested, a note is added to *notes*, with extra info about the responsible rule as an eq-property and the result of the call is 'noted.