steve_bank
Diabetic retinopathy and poor eyesight. Typos ...
An Exercise In Logic. As a general overview you can look at as synthesizing a set of premises to support a conclusion. We start at the conclusion, the operation of an elevator, then work backwards to synthesize formal logic underneath the conclusion.
Consider an elevator. While the control system would be coded in a language like C, the decision making is done using a from of formal-symbolic logic. All computer lanmguages have some implementation of formal logic.
The task is to develop an algorithm using formal logic to determine the sequence of floor stops depending on the external call buttons and the buttons inside the elevator.
At any time an up or down button or the button fpr floors 1,2,3,4 can be pressed in the elevator.
There are logical hazards If the elevator is goind up headed towards the firs4 th floor and someone gets on at the third flor and presses 1, the elevator must go to 4 first. Another example, as people get on and off the elevator pessing the 2 anf 3 floor buttons the elevator can not get stuck going back and fothrt between the two floors.
Given are logical-Boolean variables.
Elevator call variables u. True if pressed false otherwise. When someone presses the button calling for an elevator the variable goes true. When the door opens at the floor the variable is returned to false.
F1_ Up
F2_Up
F2_Down
F3_Up
F3_Down
F4_Down
Floor indicators, tells you when a floor has been reacjed.
F1
F2
F3
F4
Up Down status.
Elevevator_Up
Elevator_Down
Elevator car buttons. Normally false, made true when pressed, and made false wham the floor is reached.
The algorithm must make the variables false when an operation is completed.
The algorithm will entail and ifnite loop.
START
…algorithm
Got TO START
When the algorithm starts it logically evaluates the buttons and determines the floor to go to. Paradoxes ot logical traps as outlined above are to be avoided. We all are familiar with elevators so the sequencing requirements should be obvious.
If the elevator is going up the Up vatribale is true. Down the Down variable is true.
Make use of logical contracts like if then else and while.
while(logical function){ logical stae,emts } executes the logical segments in the braces while the logical function is true.
If(logical function) { } same as above and so on.
If(logical function) { } else { }
Logical function is a variable or logical statement that evaluates to true or false. A logica; function could be if(F1_Up & F2_Up) ( …} If the function is true than excite the expressions in the braces. If false ignore.
It is a simplified version of a complete system. Simply properly sequence the elevator based on floor call buttons and elevator car buttons.
Something a little different than the usual syllogism. Applied logic.
https://en.wikipedia.org/wiki/Symbolic_language_(programming)
Some coding examples
https://en.wikipedia.org/wiki/List_of_logic_symbols
https://fresh2refresh.com/c-programming/c-operators-expressions/c-logical-operators/
https://www.tutorialspoint.com/cprogramming/c_logical_operators
Consider an elevator. While the control system would be coded in a language like C, the decision making is done using a from of formal-symbolic logic. All computer lanmguages have some implementation of formal logic.
The task is to develop an algorithm using formal logic to determine the sequence of floor stops depending on the external call buttons and the buttons inside the elevator.
At any time an up or down button or the button fpr floors 1,2,3,4 can be pressed in the elevator.
There are logical hazards If the elevator is goind up headed towards the firs4 th floor and someone gets on at the third flor and presses 1, the elevator must go to 4 first. Another example, as people get on and off the elevator pessing the 2 anf 3 floor buttons the elevator can not get stuck going back and fothrt between the two floors.
Given are logical-Boolean variables.
Elevator call variables u. True if pressed false otherwise. When someone presses the button calling for an elevator the variable goes true. When the door opens at the floor the variable is returned to false.
F1_ Up
F2_Up
F2_Down
F3_Up
F3_Down
F4_Down
Floor indicators, tells you when a floor has been reacjed.
F1
F2
F3
F4
Up Down status.
Elevevator_Up
Elevator_Down
Elevator car buttons. Normally false, made true when pressed, and made false wham the floor is reached.
The algorithm must make the variables false when an operation is completed.
The algorithm will entail and ifnite loop.
START
…algorithm
Got TO START
When the algorithm starts it logically evaluates the buttons and determines the floor to go to. Paradoxes ot logical traps as outlined above are to be avoided. We all are familiar with elevators so the sequencing requirements should be obvious.
If the elevator is going up the Up vatribale is true. Down the Down variable is true.
Make use of logical contracts like if then else and while.
while(logical function){ logical stae,emts } executes the logical segments in the braces while the logical function is true.
If(logical function) { } same as above and so on.
If(logical function) { } else { }
Logical function is a variable or logical statement that evaluates to true or false. A logica; function could be if(F1_Up & F2_Up) ( …} If the function is true than excite the expressions in the braces. If false ignore.
It is a simplified version of a complete system. Simply properly sequence the elevator based on floor call buttons and elevator car buttons.
Something a little different than the usual syllogism. Applied logic.
https://en.wikipedia.org/wiki/Symbolic_language_(programming)
Some coding examples
https://en.wikipedia.org/wiki/List_of_logic_symbols
https://fresh2refresh.com/c-programming/c-operators-expressions/c-logical-operators/
https://www.tutorialspoint.com/cprogramming/c_logical_operators
Last edited: