[
drop condition-value get
[ [ =t ] [ =t ] bi* <--> ]
- [ [ =f ] [ =f ] bi* <--> ] 2bi /\
+ [ [ =f ] [ =f ] bi* <--> ] 2bi 2array
]
}
{
[
drop condition-value get
[ [ =t ] [ =f ] bi* <--> ]
- [ [ =f ] [ =t ] bi* <--> ] 2bi /\
+ [ [ =f ] [ =t ] bi* <--> ] 2bi 2array
]
}
{
{ { t f } { f } }
[
first =t
- condition-value get =t /\
+ condition-value get =t 2array
swap t-->
]
}
{ { f } { t f } }
[
second =t
- condition-value get =f /\
+ condition-value get =f 2array
swap t-->
]
}
{ { t f } { t } }
[
first =f
- condition-value get =t /\
+ condition-value get =t 2array
swap f-->
]
}
{ { t } { t f } }
[
second =f
- condition-value get =f /\
+ condition-value get =f 2array
swap f-->
]
}
[
first
[ [ =t ] bi@ <--> ]
- [ [ =f ] bi@ <--> ] 2bi /\
+ [ [ =f ] bi@ <--> ] 2bi 2array
0 include-child-constraints
]
}
[
second
[ [ =t ] bi@ <--> ]
- [ [ =f ] bi@ <--> ] 2bi /\
+ [ [ =f ] bi@ <--> ] 2bi 2array
1 include-child-constraints
]
}
ARTICLE: "compiler.tree.propagation.constraints" "Support for predicated value info"
"A constraint is a statement about a value."
$nl
+"Boolean constraints:"
+{ $subsections true-constraint true-constraint }
"Utilities:"
{ $subsections t--> f--> } ;
: assume ( constraint -- ) dup satisfied? [ drop ] [ assume* ] if ;
-! Boolean constraints
TUPLE: true-constraint value ;
: =t ( value -- constraint ) resolve-copy true-constraint boa ;
! Conjunction constraints -- sequences act as conjunctions
M: sequence assume* [ assume ] each ;
-: /\ ( p q -- constraint ) 2array ;
-
: t--> ( constraint boolean-value -- constraint' ) =t swap --> ;
: f--> ( constraint boolean-value -- constraint' ) =f swap --> ;
in2 value-info interval>> :> i2
in1 i1 i2 op assumption is-in-interval
in2 i2 i1 op swap-comparison assumption is-in-interval
- /\ ;
+ 2array ;
:: comparison-constraints ( in1 in2 out op -- constraint )
in1 in2 op (comparison-constraints) out t-->
- in1 in2 op negate-comparison (comparison-constraints) out f--> /\ ;
+ in1 in2 op negate-comparison (comparison-constraints) out f--> 2array ;
: define-comparison-constraints ( word op -- )
'[ _ comparison-constraints ] "constraints" set-word-prop ;
: predicate-constraints ( value class boolean-value -- constraint )
[ [ is-instance-of ] dip t--> ]
[ [ class-not is-instance-of ] dip f--> ]
- 3bi /\ ;
+ 3bi 2array ;
: custom-constraints ( #call quot -- )
[ [ in-d>> ] [ out-d>> ] bi append ] dip