Documentation Menu · Concepts across several words, part 1
Concepts across several words, part 1
Time, clocks, open holes, 3-valued external answers, roles, projects, laws, examples, and simultaneous tie-breaking.
Reference entries for the concepts that no single closed word carries: time, questions, outside answers, roles, projects, examples, laws, and simultaneous changes. Each entry gives the business meaning, the words that express it, what Hector derives or refuses, one trap, then a small program that holds.
Time and clocks #
A business deadline is stated once: a hold that lapses fifteen minutes after it was taken, a claim that is overdue after its thirtieth day. The words are after for a delay counted from the entry into a status, and when now > … for a fixed instant or for a date plus a delay; entered(S) and born give the instant a status or a row began. Inside an example, at moves the clock forward to an instant and never back. after reads a duration expression, including a named duration. within takes an exact duration literal or the name of a world value defined directly by such a literal, including a ratio with a duration unit; it does not resolve arbitrary expressions or chains of names. Hector computes the instant of each change and checks the deadlines on the next event or step; the author never writes a timer. Refused: an at that goes back in time, and a bare number without a duration unit after within. A hole after within stays unresolved.
Trap: after d fires at the exact end of the delay, so writing it for "still in time on the last day" gives the wrong edge; that reading is a strict when that compares now with the entry plus d.
-- but: une place tenue 15 min puis libérée ; un dossier en retard après son trentième jour
Desk
hold = 15 min
Seat label: Text
status: Held | Free
-> Held on Reserve by Desk
Held -> Free after hold
Claim opened: Instant
status: Filed | Overdue
-> Filed on File by Desk
Filed -> Overdue when now > opened + 30 day
show status to Desk within 1 s
example place tenue puis libérée
s = Reserve(label: "A1")
after 14 min
see s is Held
after 1 min
see s is Free
example dossier à la limite puis en retard
at 2026-11-01T08:00
c = File(opened: 2026-11-01T08:00)
at 2026-12-01T08:00
see c is Filed
at 2026-12-01T08:01
see c is Overdue
Questions and answers #
A question is a value the business has not given: a VAT rate the program never states, a fee the client has not yet chosen. The program names it with ?name where it is used, and the author answers it in the file with one line ?name = value, at column zero, with its unit. Until the answer is given the verdict is 3, not 0, and the checker names the open hole, so an unanswered name is a question rather than a silent zero. Every expression that reads the name is computed from that one answer, and every see line is checked against it. A name that is misspelled is an open question too, which is why a typo shows as a hole rather than passing.
Trap: writing the rate inside each expression to silence the question hides it from the next change; one answer line is read everywhere.
-- but: le taux de TVA n'est pas donné par le programme ; la réponse est écrite à la fin
Clerk
Order amount: Money
tax = amount * vat
show tax to Clerk within 1 s
-> on Open by Clerk
?vat = 20 %
example taxe
o = Open(amount: 50 EUR)
see o.tax = 10 EUR
example deuxieme commande
p = Open(amount: 200 EUR)
see p.tax = 40 EUR
Answers from the outside world #
A bank, a network or a sensor decides a value the program does not own, and it may answer late, never, or not yet. The field card: Accepted | Declined by Bank on Ask asks the bank at the named event; Hector adds the case Unknown itself, so the author never writes a Pending case in the answer field. The waiting is a status the business sees, kept by stays Pending while card is Unknown, so a deadline on that status does not fire while the bank is silent. An example gives the reply after the event with r.card = Accepted by Bank, and the status follows the reply where it arrives. Hector never takes Unknown as false: a rule that needs the answer to be absent waits.
Trap: a rule written as not card is Accepted does not release on silence; the bank's silence keeps the status, and a release on silence is a rule the author must state on purpose.
-- but: une demande de prêt attend la réponse de la banque ; elle n'est jamais décidée sans elle
Bank
Clerk
Applicant name: Text
Request applicant: Applicant, amount: Money
status: Pending | Granted | Refused
card: Accepted | Declined by Bank on Ask
-> Pending on Ask by Clerk
Pending -> Granted when card is Accepted
Pending -> Refused when card is Declined
Pending -> Refused after 2 day
stays Pending while card is Unknown
example reponse attendue
ana = Applicant(name: "Ana")
r = Ask(applicant: ana, amount: 1000 EUR)
after 3 day
see r is Pending
see r.card is Unknown
r.card = Accepted by Bank
see r is Granted
example refus de la banque
bo = Applicant(name: "Bo")
q = Ask(applicant: bo, amount: 300 EUR)
q.card = Declined by Bank
see q is Refused
Roles and who sees what #
Who may act and who may read are business facts: a customer withdraws a case, an advisor closes it, and an internal note stays with the advisor. A role is a bare line such as Advisor; a field that names a person, such as customer, is a role for the row that holds it. by on an event says who may trigger it, show … to says who receives a value, and hidden … to in an example checks that a person does not receive it. Hector derives the refusal of an event by anyone else and the lines each observer sees; the author writes no permission check. An example names a person before using by; a role is written without a name, and a field-role is never a line of the example.
Trap: writing by customer in an example is refused, since customer belongs to Case and the line has no subject; name the person first (ana = Customer(...)) and write by ana, or leave the by out for a role.
-- but: une note interne reste au conseiller ; le client retire son dossier, le conseiller le clôt
Advisor
Customer name: Text
Case customer: Customer, note: Text
status: Open | Withdrawn | Closed
-> Open on File by customer
Open -> Withdrawn on Withdraw by customer
Open -> Closed on Close by Advisor
show note to Advisor within 1 s
show status to customer within 1 s
example retrait par le client
ana = Customer(name: "Ana")
bob = Customer(name: "Bob")
d = File(customer: ana, note: "à vérifier")
refused Withdraw(d) by bob
Withdraw(d) by ana
see d is Withdrawn
hidden d.note to ana
example cloture par le conseiller
ana = Customer(name: "Ana")
d = File(customer: ana, note: "urgent")
Close(d)
see d is Closed
Projects and packages #
A rule set written once for a kind of thing, such as a deposit kept until a lease is returned, is reused for another kind of thing with its own copy. A package file holds the rules with holes: ?Holder for a sort and ?done for a status; the holes are filled by the use line of the main program. A project is a directory: the package file and a main program that holds the use line and the examples, and the example runs the whole directory. Each use gives its own fields and statuses to the sort it names, so two use lines make two separate copies, and a hole with no value stays an open question. Hector checks the directory as one program, so the examples of the main file test the package through it.
Trap: a word used both in the package and in the main program (the same status name in two sorts) is an ambiguous path; choose distinct names.
-- Caution : une somme gardée jusqu'à ce que la sorte ?Holder atteigne ?done, puis rendue.
-- Paramètres : ?Holder la sorte qui retient la somme, ?done le statut qui la libère.
?Holder
refund: Held | Released
Held -> Released when ?done
-- but: une caution de location, rendue quand le bien est rendu ; le locataire est le seul à la réclamer
Owner name: Text
Lease tenant: Owner, deposit: Money
status: Running | Returned
-> Running on Start by tenant
Running -> Returned on Return by tenant
show status to tenant within 1 s
use Deposit(Holder = Lease, done = Returned)
example caution rendue
ana = Owner(name: "Ana")
l = Start(tenant: ana, deposit: 500 EUR)
see l.refund = Held
Return(l)
see l.refund = Released
example caution encore tenue
bo = Owner(name: "Bo")
m = Start(tenant: bo, deposit: 300 EUR)
see m.refund = Held
Examples as tests #
An example is a worked case the business can read, and also a test: each see line is a value the author computed by hand from the subject. The words are example with a name, see for a value, a status or a count, refused for an event that must be refused, and after or at to move the clock. If a see is false the verdict is 1 with a counter-example; if a refused event is accepted, the example is false too. Hector checks every status, event and law against the examples, and reports those that no example exercises. Write two to four examples per program, each named after the case it tells; a value Hector computes but no example states is not tested by it.
Trap: copying a value from the checker's output into a see makes the test prove nothing; a refuted see means the rule or the hand computation is wrong, so recompute from the subject before changing the line.
-- but: un bon d'achat ne s'utilise qu'une fois ; le montant est toujours positif
Clerk
Voucher value: Money
status: Unused | Used
-> Unused on Issue by Clerk
Unused -> Used on Redeem by Clerk
law value > 0 EUR
show status to Clerk within 1 s
example un bon, un seul usage
b = Issue(value: 20 EUR)
c = Issue(value: 5 EUR)
Redeem(b)
refused Redeem(b)
see b is Used
see c is Unused
see count(Voucher where Used) = 1
example montant nul refusé
refused Issue(value: 0 EUR)
see count(Voucher) = 0
Laws and what they derive #
A law is a ceiling or a uniqueness the business never accepts to break: a team never spends more than its budget, and two teams never share a name. Written inside the sort, law spent <= budget with spent = sum(expenses.amount) makes Hector refuse every spend that would break it, without any check in the event. law unique(name) refuses a second row with the same name, and law amount > 0 EUR refuses a zero amount at the birth of a row. The refusal names the law, and the examples show it as refused lines; a law about one sort is written under that sort, not at column zero. Hector derives from each law the weakest condition under which an event may happen, so the events need no copy of the ceiling in their when.
Trap: copying the budget into the when of each spend duplicates the law; the law alone refuses, and an event's when reads what the event brings and the state before it.
-- but: une équipe ne dépense jamais plus que son budget ; deux équipes ne portent pas le même nom
Manager
Team name: Text, budget: Money
spent = sum(expenses.amount)
law spent <= budget
law unique(name)
-> on Open by Manager
Expense team: Team, amount: Money
law amount > 0 EUR
-> on Spend by Manager
example budget tenu
t = Open(name: "Ops", budget: 100 EUR)
refused Open(name: "Ops", budget: 5 EUR)
Spend(team: t, amount: 60 EUR)
refused Spend(team: t, amount: 50 EUR)
Spend(team: t, amount: 40 EUR)
see t.spent = 100 EUR
refused Spend(team: t, amount: 1 EUR)
example montant nul
u = Open(name: "Hall", budget: 10 EUR)
refused Spend(team: u, amount: 0 EUR)
see u.spent = 0 EUR
Choices between simultaneous changes #
Two changes that leave the same status can both be true at the same instant: a payment accepted and a hold that lapses, for example. The business decides which one wins. tie A -> B minimizing 0 and tie A -> C minimizing 1 name two transitions from the same start; the smaller key wins, and without a tie Hector refuses the program with DoubleWrite and gives a fix: line. Hector proves exclusive transitions by itself, so a tie is written only where two changes really can both hold. Here the lapse wins at the instant the hold ends, so the status at that instant is set by the tie and not by the order of the events.
Trap: the winner of a tie is a business decision; with the payment as winner, the lapse waits while the bank is silent, because an unknown answer is never false.
-- but: une place réservée est confirmée si le paiement est accepté ; libérée à la 15e minute, qui gagne à égalité
Driver name: Text
Spot driver: Driver, opened: Instant, paid: Accepted | Declined by Bank on Pay
status: Held | Paid | Released
-> Held on Hold by driver
Held -> Paid when paid is Accepted
Held -> Released when paid is Declined or now >= opened + 15 min
tie Held -> Released minimizing 0
tie Held -> Paid minimizing 1
example paiement accepte a temps
ana = Driver(name: "Ana")
s = Hold(driver: ana, opened: 2026-11-10T09:00)
Pay(s)
s.paid = Accepted by Bank
see s is Paid
example place libérée sans réponse
bo = Driver(name: "Bo")
t = Hold(driver: bo, opened: 2026-11-10T09:00)
at 2026-11-10T09:14
see t is Held
at 2026-11-10T09:15
see t is Released