Std. Proof. IntMath
(Cure Standard Library v0.37.2)
View Source
Proof-carrying facts about Int, via decidable-Boolean reflection.
Following Idris (So/Oh), Agda (T), and Lean (Decidable), this module
reflects a decidable Boolean condition into a proposition: the comparisons
already fold to the inductive Bool, so a closed condition reduces to
True() and is inhabited by pure computation, while an open condition is
carried as evidence by whoever constructs the value. This reflection is the
refinement-surface encoding and is entirely generic over the reflected
Bool — it does NOT depend on how Int is represented.
(Int is now the inductive family FromNat(Nat) | NegativeSuccessor(Nat)
rather than a primitive, so open arithmetic IsTrue-claims can additionally
be discharged by structural induction — see Std.Proof.IntOrder. The
IsTrue/Confirmed/decide_is_true machinery below is unchanged and
continues to coexist as the decidable-Boolean reflector.)
Examples
use Std.Bool
use Std.Proof.IntMath
decide_is_true(1 < 2) # => Yes(Confirmed())
Summary
Types
Evidence that a decided Boolean condition holds. Its sole constructor
demands the condition already be True(), so a closed satisfied comparison
inhabits it by computation and an unsatisfied one is uninhabited.
Functions
Decide a condition, carrying checked evidence in either branch.
A confirmed condition cannot also be false: matching evidence for the false case is impossible, so the empty match discharges it.
Types
type IsTrue indices (claim: Bool)
Confirmed : IsTrue(True())
Evidence that a decided Boolean condition holds. Its sole constructor
demands the condition already be True(), so a closed satisfied comparison
inhabits it by computation and an unsatisfied one is uninhabited.
Functions
fn decide_is_true(claim: Bool) -> Decision(IsTrue(claim))
Decide a condition, carrying checked evidence in either branch.
fn true_is_not_false(proof: IsTrue(False())) -> Empty
A confirmed condition cannot also be false: matching evidence for the false case is impossible, so the empty match discharges it.