order.bend checks
raw source on the hub · import bend-mathlib@0.8.1.0/order.bend as Order
bend-mathlib/order.bend: abstract preorder/total-order facts over a Bool comparator ~le.
2 imports
import Base import ./nat.bend as MNat
Laws
law le_trans3 provedsource · line 6 · raw
@-A:Data -> @-le:(@_:A -> @_:A -> Bool) -> @-le_trans:(@x:A -> @y:A -> @z:A -> @_:{le(x, y) == True{} : Bool} -> @_:{le(y, z) == True{} : Bool} -> {le(x, z) == True{} : Bool}) -> @+a:A -> @+b:A -> @+c:A -> @+d:A -> @ab:{le(a, b) == True{} : Bool} -> @bc:{le(b, c) == True{} : Bool} -> @cd:{le(c, d) == True{} : Bool} -> {le(a, d) == True{} : Bool}A chain of three comparisons composes.
law le_trans4 provedsource · line 23 · raw
@-A:Data -> @-le:(@_:A -> @_:A -> Bool) -> @-le_trans:(@x:A -> @y:A -> @z:A -> @_:{le(x, y) == True{} : Bool} -> @_:{le(y, z) == True{} : Bool} -> {le(x, z) == True{} : Bool}) -> @+a:A -> @+b:A -> @+c:A -> @+d:A -> @+e:A -> @ab:{le(a, b) == True{} : Bool} -> @bc:{le(b, c) == True{} : Bool} -> @cd:{le(c, d) == True{} : Bool} -> @de:{le(d, e) == True{} : Bool} -> {le(a, e) == True{} : Bool}A chain of four comparisons composes.
law le_antisymm_eq provedsource · line 42 · raw
@-A:Data -> @-le:(@_:A -> @_:A -> Bool) -> @-le_antisymm:(@x:A -> @y:A -> @_:{le(x, y) == True{} : Bool} -> @_:{le(y, x) == True{} : Bool} -> {x == y : A}) -> @+a:A -> @+b:A -> @ab:{le(a, b) == True{} : Bool} -> @ba:{le(b, a) == True{} : Bool} -> {a == b : A}Antisymmetry gives equality.
law le_total_true provedsource · line 56 · raw
@-A:Data -> @-le:(@_:A -> @_:A -> Bool) -> @-le_total:(@x:A -> @y:A -> {Bool.or(le(x, y), le(y, x)) == True{} : Bool}) -> @+a:A -> @+b:A -> {Bool.or(le(a, b), le(b, a)) == True{} : Bool}Totality as a Bool disjunction.
law le_total_of_not_le provedsource · line 75 · raw
@-A:Data -> @-le:(@_:A -> @_:A -> Bool) -> @-le_total:(@x:A -> @y:A -> {Bool.or(le(x, y), le(y, x)) == True{} : Bool}) -> @+a:A -> @+b:A -> @h:{le(a, b) == False{} : Bool} -> {le(b, a) == True{} : Bool}The other side of a total order holds when one side fails.
law le_total_true_sym provedsource · line 117 · raw
@-A:Data -> @-le:(@_:A -> @_:A -> Bool) -> @-le_total:(@x:A -> @y:A -> {Bool.or(le(x, y), le(y, x)) == True{} : Bool}) -> @+a:A -> @+b:A -> {True{} == Bool.or(le(a, b), le(b, a)) : Bool}Totality as a Bool disjunction, reversed to rewrite toward the simple side.
Definitions
def internal_or_of_false_right source · line 67 · raw
@a:Bool -> @b:Bool -> @h:{Bool.or(a, b) == True{} : Bool} -> @ha:{a == False{} : Bool} -> {b == True{} : Bool}
def internal_nat_le_total source · line 88 · raw
@a:Nat -> @b:Nat -> {Bool.or(Nat.is_le(a, b), Nat.is_le(b, a)) == True{} : Bool}Nat calls of the laws above: --verdict takes a ~ constant's model from a call of its law (PLAN F38).
def internal_nat_le_trans3 source · line 99 · raw
@+a:Nat -> @+b:Nat -> @+c:Nat -> @+d:Nat -> @ab:0x8ae61ec3a6615abd35f196c07232ad28/nat.le(a, b) -> @bc:0x8ae61ec3a6615abd35f196c07232ad28/nat.le(b, c) -> @cd:0x8ae61ec3a6615abd35f196c07232ad28/nat.le(c, d) -> 0x8ae61ec3a6615abd35f196c07232ad28/nat.le(a, d)
def internal_nat_le_trans4 source · line 102 · raw
@+a:Nat -> @+b:Nat -> @+c:Nat -> @+d:Nat -> @+e:Nat -> @ab:0x8ae61ec3a6615abd35f196c07232ad28/nat.le(a, b) -> @bc:0x8ae61ec3a6615abd35f196c07232ad28/nat.le(b, c) -> @cd:0x8ae61ec3a6615abd35f196c07232ad28/nat.le(c, d) -> @de:0x8ae61ec3a6615abd35f196c07232ad28/nat.le(d, e) -> 0x8ae61ec3a6615abd35f196c07232ad28/nat.le(a, e)
def internal_nat_le_antisymm_eq source · line 105 · raw
@+a:Nat -> @+b:Nat -> @ab:0x8ae61ec3a6615abd35f196c07232ad28/nat.le(a, b) -> @ba:0x8ae61ec3a6615abd35f196c07232ad28/nat.le(b, a) -> {a == b : Nat}
def internal_nat_le_total_true source · line 108 · raw
@+a:Nat -> @+b:Nat -> {Bool.or(Nat.is_le(a, b), Nat.is_le(b, a)) == True{} : Bool}
def internal_nat_le_total_of_not_le source · line 111 · raw
@+a:Nat -> @+b:Nat -> @h:{Nat.is_le(a, b) == False{} : Bool} -> 0x8ae61ec3a6615abd35f196c07232ad28/nat.le(b, a)
def internal_nat_le_total_true_sym source · line 129 · raw
@+a:Nat -> @+b:Nat -> {True{} == Bool.or(Nat.is_le(a, b), Nat.is_le(b, a)) : Bool}Calls of the twins, as the calls above the generated section make of their laws (PLAN F38).