]/[Prolog], this problem would be [trivial] to solve.\r\n\r\n

4.6 The [standard approach].

\r\n\r\n

We know what a Lion is from [ISO] 4711/X.123. Since [CCITT] have specified a Lion to be a [particular option] of a [cat] we will have to wait for a [harmonized standard] to appear. $20,000,000 have been [fund]ed for [initial investigations] into this [standard development].\r\n\r\n

[linear search|4.7 Linear search.]

\r\n\r\n

Stand in the top left hand [corner] of the Sahara Desert. Take one [step] east. Repeat until you have found the lion, or you reach the right hand edge. If you reach the right hand [edge], take one step southwards, and proceed towards the left hand edge. When you finally reach the lion, put it the cage. If the lion should happen to eat you before you manage to get it in the cage, press the [reset button], and try again.\r\n

Optionally, [experienced programmer]s will place a [pink elephant] in [Johannesburg] as a [sentinel value]. (thanks [ariels])\r\n \r\n

[Dijkstra's algorithm |4.8 The Dijkstra approach:]

\r\n\r\n

The way the problem reached me was: catch a wild lion in the Sahara\r\nDesert. [Another way of stating the problem] is:\r\n\r\n

\r\n       [Axiom] 1: Sahara [elem] deserts\r\n       Axiom 2: Lion elem Sahara\r\n       Axiom 3: NOT(Lion elem cage)\r\n
\r\n

We observe the following invariant:\r\n\r\n

       P1:     C(L) v not(C(L))\r\n
\r\n

where C(L) means: the value of \"L\" is in the cage.\r\n\r\n

Establishing C initially is trivially accomplished with the statement\r\n\r\n

       ;cage := {}\r\nNote 0:\r\n[This is easily implemented] by opening the door to the \r\ncage and shaking out any lions that happen to be there \r\ninitially.\r\n(End of note 0.)\r\n
\r\n

The obvious [program structure] is then:\r\n

\r\n       ;cage:={}\r\n       ;do NOT (C(L)) ->\r\n               ;\"approach lion under [invariance] of P1\"\r\n               ;if P(L) ->\r\n                       ;\"insert lion in cage\"\r\n                [] not P(L) ->\r\n                       ;skip\r\n               ;fi\r\n       ;od\r\n\r\nwhere P(L) means: the value of L is within arm's reach.\r\n\r\nNote 1:\r\nAxiom 2 ensures that the [loop termination|loop terminates].\r\n(End of note 1.)\r\n\r\nExercise 0:\r\nRefine the step \"Approach lion under invariance of P1\".\r\n(End of exercise 0.)\r\n\r\nNote 2:\r\nThe program is [robust] in the sense that it will lead to\r\n[abortion] if the value of L is \"lioness\".\r\n(End of note 2.)\r\n\r\nRemark 0: This may be a new sense of the word \"robust\" for you.\r\n(End of remark 0.)\r\n\r\nNote 3:\r\n\r\nFrom observation we can see that the above program leads to the\r\n[desired goal]. It goes without saying that we therefore do not \r\nhave to [run] it.\r\n(End of note 3.)\r\n(End of approach.) \r\n(End of document)\r\n
\r\n\r\n         
\r\n\r\n

You can find an infinity of variations on the above [theme] floating around in the [cyberspace] (and probably in [dead tree] format too), but some of them tend to wear the concept a bit [thin]...

"}],"type":"e2node"},"user":{"node_id":"779713","coolsleft":0,"title":"Guest User","is_guest":1,"can_vote":0,"coolsafety":0,"can_cool":0,"info_authorsince_off":0,"is_editor":0,"votesafety":0}},"assets_location":"https://s3-us-west-2.amazonaws.com/deployed.everything2.com/12f701fc1c860c10ddd3467bb16b07723732e55f","guest":1,"display_prefs":{"edn_hideutil":0,"nw_nojunk":false,"rtn_hideedc":0,"vit_hidenodeinfo":0,"num_newwus":"10","rtn_hidecwu":0,"edn_hideedev":0,"vit_hidemaintenance":0,"vit_hidemisc":0,"vit_hidelist":0,"rtn_hidenws":0,"vit_hidenodeutil":0},"use_local_assets":"0","pageheader":{},"nodeletorder":["sign_in","recommended_reading","new_writeups"],"newWriteups":[{"writeuptype":"review","parent":{"node_id":1679687,"title":"The Fall of the Towers","type":"e2node"},"notnew":false,"is_junk":false,"is_log":false,"author":{"type":"user","node_id":977360,"title":"Glowing Fish"},"title":"The Fall of the Towers (review)","node_id":"2213459"},{"writeuptype":"fiction","notnew":false,"parent":{"title":"Hello, Thinker","node_id":2213455,"type":"e2node"},"is_junk":false,"is_log":false,"author":{"type":"user","title":"Swift","node_id":1251226},"title":"Hello, Thinker (fiction)","node_id":"2213454"},{"title":"A Hornet's Nest in the Back of a Barn (poetry)","node_id":"2213448","is_log":false,"is_junk":false,"author":{"title":"lostcauser","node_id":1992599,"type":"user"},"notnew":false,"parent":{"type":"e2node","title":"A Hornet's Nest in the Back of a Barn","node_id":2213449},"writeuptype":"poetry"},{"writeuptype":"thing","notnew":false,"parent":{"title":"From some far memory","node_id":2208060,"type":"e2node"},"author":{"title":"etouffee","node_id":1153472,"type":"user"},"is_junk":false,"is_log":false,"node_id":"2208061","title":"From some far memory (thing)"},{"is_junk":false,"is_log":false,"author":{"title":"lostcauser","node_id":1992599,"type":"user"},"title":"The Chocolate Room (poetry)","node_id":"2213441","writeuptype":"poetry","parent":{"type":"e2node","title":"The Chocolate Room","node_id":2213442},"notnew":false},{"parent":{"title":"Dick Kickem Lifts the Gay Way","node_id":2213439,"type":"e2node"},"notnew":false,"writeuptype":"fiction","title":"Dick Kickem Lifts the Gay Way (fiction)","node_id":"2213438","is_junk":false,"is_log":false,"author":{"type":"user","node_id":1251226,"title":"Swift"}},{"title":"Maui (thing)","node_id":"2213436","is_junk":false,"is_log":false,"author":{"title":"Pandeism Fish","node_id":1902455,"type":"user"},"parent":{"title":"Maui","node_id":12024,"type":"e2node"},"notnew":false,"writeuptype":"thing"},{"title":"mirzabeig dynamical system (thing)","node_id":"2213435","is_junk":false,"is_log":false,"author":{"title":"raincomplex","node_id":1797883,"type":"user"},"parent":{"type":"e2node","title":"mirzabeig dynamical system","node_id":2213434},"notnew":false,"writeuptype":"thing"},{"title":"Joseph Ducreux (person)","node_id":"2213433","is_log":false,"is_junk":false,"author":{"type":"user","title":"Jet-Poop","node_id":6339},"notnew":false,"parent":{"type":"e2node","node_id":2023993,"title":"Joseph Ducreux"},"writeuptype":"person"},{"is_log":false,"is_junk":false,"author":{"node_id":1902455,"title":"Pandeism Fish","type":"user"},"title":"World and Life Views, Emerging From Religion, Philosophy and Perception of Nature (thing)","node_id":"2213427","writeuptype":"thing","notnew":false,"parent":{"type":"e2node","node_id":2213432,"title":"World and Life Views, Emerging From Religion, Philosophy and Perception of Nature"}},{"node_id":"2213429","title":"Paradise (review)","author":{"node_id":977360,"title":"Glowing Fish","type":"user"},"is_log":false,"is_junk":false,"parent":{"title":"Paradise","node_id":25493,"type":"e2node"},"notnew":false,"writeuptype":"review"},{"parent":{"type":"e2node","node_id":35250,"title":"Long Hair"},"notnew":false,"writeuptype":"poetry","node_id":"2213422","title":"Long Hair (poetry)","author":{"type":"user","node_id":1017738,"title":"Oolong"},"is_junk":false,"is_log":false},{"author":{"title":"etouffee","node_id":1153472,"type":"user"},"is_junk":false,"is_log":false,"node_id":"2213395","title":"knowing many, loving none (poetry)","writeuptype":"poetry","parent":{"title":"knowing many, loving none","node_id":2213393,"type":"e2node"},"notnew":false},{"writeuptype":"thing","parent":{"type":"e2node","title":"Ball's Pyramid","node_id":2197262},"notnew":false,"author":{"type":"user","title":"Finky","node_id":2212534},"is_log":false,"is_junk":false,"node_id":"2213418","title":"Ball's Pyramid (thing)"},{"title":"I Will Kill Your Imaginary Friend for $200 (review)","node_id":"2213416","is_junk":false,"is_log":false,"author":{"title":"Glowing Fish","node_id":977360,"type":"user"},"parent":{"type":"e2node","title":"I Will Kill Your Imaginary Friend for $200","node_id":2213415},"notnew":false,"writeuptype":"review"},{"node_id":"2213360","title":"The Pandeism Anthology Project goes to war with Amazon.com (thing)","author":{"type":"user","title":"Pandeism Fish","node_id":1902455},"is_junk":false,"is_log":false,"notnew":false,"parent":{"type":"e2node","title":"The Pandeism Anthology Project goes to war with Amazon.com","node_id":2213409},"writeuptype":"thing"},{"parent":{"node_id":2213405,"title":"February 28, 2026","type":"e2node"},"notnew":false,"writeuptype":"thing","title":"February 28, 2026 (thing)","node_id":"2213408","is_log":true,"is_junk":false,"author":{"type":"user","node_id":1455010,"title":"JD"}},{"parent":{"type":"e2node","node_id":2213407,"title":"old excerpt from my grandpas emails to his brothers"},"notnew":false,"writeuptype":"personal","title":"old excerpt from my grandpas emails to his brothers (personal)","node_id":"2213406","is_log":false,"is_junk":false,"author":{"type":"user","node_id":2201248,"title":"lilah june"}},{"writeuptype":"poetry","parent":{"type":"e2node","title":"The Leaves Don't Know What November Is","node_id":2213403},"notnew":false,"is_junk":false,"is_log":false,"author":{"type":"user","node_id":1992599,"title":"lostcauser"},"title":"The Leaves Don't Know What November Is (poetry)","node_id":"2213402"},{"writeuptype":"fiction","notnew":false,"parent":{"type":"e2node","title":"Marlene Remembers, Marlene Laughs","node_id":2213400},"is_junk":false,"is_log":false,"author":{"type":"user","title":"lostcauser","node_id":1992599},"title":"Marlene Remembers, Marlene Laughs (fiction)","node_id":"2213399"},{"is_junk":false,"is_log":false,"author":{"type":"user","title":"Finky","node_id":2212534},"title":"Paper Towns (definition)","node_id":"2213398","writeuptype":"definition","parent":{"node_id":1991895,"title":"Paper Towns","type":"e2node"},"notnew":false},{"parent":{"node_id":2213389,"title":"buycott","type":"e2node"},"notnew":false,"writeuptype":"idea","title":"buycott (idea)","node_id":"2213390","is_log":false,"is_junk":false,"author":{"title":"mauler","node_id":1180811,"type":"user"}},{"parent":{"node_id":2213384,"title":"Fill in the Blanks","type":"e2node"},"notnew":false,"writeuptype":"fiction","title":"Fill in the Blanks (fiction)","node_id":"2213383","is_log":false,"is_junk":false,"author":{"title":"lostcauser","node_id":1992599,"type":"user"}},{"writeuptype":"personal","parent":{"node_id":2213382,"title":"Like stars, blazing beacons of light in the emptiness of space","type":"e2node"},"notnew":false,"is_junk":false,"is_log":false,"author":{"title":"relentless","node_id":2049451,"type":"user"},"title":"Like stars, blazing beacons of light in the emptiness of space (personal)","node_id":"2213378"},{"writeuptype":"thing","notnew":false,"parent":{"type":"e2node","title":"Electro Convulsive Treatment","node_id":2213381},"is_junk":false,"is_log":false,"author":{"title":"O-Swirl","node_id":1132040,"type":"user"},"title":"Electro Convulsive Treatment (thing)","node_id":"2213379"},{"node_id":"2213375","title":"Boys Will Lie (poetry)","author":{"node_id":1992599,"title":"lostcauser","type":"user"},"is_junk":false,"is_log":false,"notnew":false,"parent":{"type":"e2node","title":"Boys Will Lie","node_id":2213374},"writeuptype":"poetry"},{"writeuptype":"personal","notnew":false,"parent":{"type":"e2node","node_id":2213370,"title":"An Old Coffee Can and a Libbyland Dinner"},"author":{"type":"user","node_id":1992599,"title":"lostcauser"},"is_log":false,"is_junk":false,"node_id":"2213369","title":"An Old Coffee Can and a Libbyland Dinner (personal)"},{"node_id":"2213364","title":"February 21, 2026 (log)","author":{"title":"passalidae","node_id":2178478,"type":"user"},"is_log":true,"is_junk":false,"notnew":false,"parent":{"type":"e2node","title":"February 21, 2026","node_id":2213362},"writeuptype":"log"},{"writeuptype":"poetry","notnew":false,"parent":{"type":"e2node","title":"I Would Like To Be Only a Bright Red Coat","node_id":2213358},"is_log":false,"is_junk":false,"author":{"type":"user","node_id":1992599,"title":"lostcauser"},"title":"I Would Like To Be Only a Bright Red Coat (poetry)","node_id":"2213357"},{"writeuptype":"personal","notnew":false,"parent":{"type":"e2node","node_id":2213350,"title":"It always spits before it rains"},"author":{"type":"user","title":"Hazelnut","node_id":1708694},"is_junk":false,"is_log":false,"node_id":"2213355","title":"It always spits before it rains (personal)"},{"is_junk":false,"is_log":false,"author":{"type":"user","node_id":2049451,"title":"relentless"},"title":"leetcode (opinion)","node_id":"2213351","writeuptype":"opinion","notnew":false,"parent":{"type":"e2node","title":"leetcode","node_id":2213354}},{"writeuptype":"thing","parent":{"type":"e2node","title":"Kyawthuite","node_id":2213353},"notnew":false,"author":{"type":"user","node_id":2212534,"title":"Finky"},"is_junk":false,"is_log":false,"node_id":"2213352","title":"Kyawthuite (thing)"},{"title":"maybe i'll be mauled (log)","node_id":"2213259","is_log":false,"is_junk":false,"author":{"type":"user","node_id":2201248,"title":"lilah june"},"parent":{"type":"e2node","title":"maybe i'll be mauled","node_id":2213349},"notnew":false,"writeuptype":"log"},{"writeuptype":"fiction","parent":{"node_id":2213346,"title":"Better the Bones of the Lions You Know","type":"e2node"},"notnew":false,"is_log":false,"is_junk":false,"author":{"title":"lostcauser","node_id":1992599,"type":"user"},"title":"Better the Bones of the Lions You Know (fiction)","node_id":"2213347"},{"notnew":false,"parent":{"type":"e2node","title":"Most Businesspeople Spend Time Doing Business: Explaining the Great AI Productivity Mirage","node_id":2213342},"writeuptype":"idea","title":"Most Businesspeople Spend Time Doing Business: Explaining the Great AI Productivity Mirage (idea)","node_id":"2213343","is_log":false,"is_junk":false,"author":{"title":"Glowing Fish","node_id":977360,"type":"user"}},{"author":{"type":"user","node_id":2212534,"title":"Finky"},"is_junk":false,"is_log":false,"node_id":"2213323","title":"Dora and the Lost City of Gold (review)","writeuptype":"review","parent":{"title":"Dora and the Lost City of Gold","node_id":2213341,"type":"e2node"},"notnew":false},{"is_junk":false,"is_log":true,"author":{"title":"Peaceful Chicken","node_id":2208334,"type":"user"},"title":"February 17, 2026 (log)","node_id":"2213340","writeuptype":"log","parent":{"type":"e2node","node_id":2213335,"title":"February 17, 2026"},"notnew":false},{"notnew":false,"parent":{"type":"e2node","node_id":2213335,"title":"February 17, 2026"},"writeuptype":"thing","title":"February 17, 2026 (thing)","node_id":"2213339","is_log":true,"is_junk":false,"author":{"type":"user","node_id":1866071,"title":"Auspice"}},{"parent":{"type":"e2node","node_id":2174497,"title":"Many Things to Many People"},"notnew":false,"writeuptype":"fiction","title":"Many Things to Many People (fiction)","node_id":"2213338","is_log":false,"is_junk":false,"author":{"title":"lostcauser","node_id":1992599,"type":"user"}}],"node_id":"1478480","user":{"in_room":"0","title":"Guest User","developer":true,"node_id":"779713","guest":true,"admin":false,"chanop":false,"editor":false},"staffpicks":[{"type":"e2node","title":"lembas","node_id":"385499"},{"title":"night vision","node_id":"103951","type":"e2node"},{"title":"Free Slaves","node_id":"748981","type":"e2node"},{"node_id":"945429","title":"The semi-fictional life of every real woman","type":"e2node"},{"type":"e2node","node_id":"1394138","title":"Well-Tempered Clavier"},{"type":"e2node","node_id":"952875","title":"vowel harmony"},{"node_id":"101390","title":"mayonnaise","type":"e2node"},{"type":"e2node","node_id":"163462","title":"Math is not a social construct"},{"type":"e2node","node_id":"1138093","title":"Maria Montessori"},{"title":"I dream that I walk with her","node_id":"1216368","type":"e2node"},{"node_id":"32676","title":"Onion","type":"e2node"},{"type":"e2node","title":"How to get rid of a tailgater","node_id":"525732"},{"title":"La vache! The strange fixation on cows by the French","node_id":"1325857","type":"e2node"},{"title":"I have a dream","node_id":"373463","type":"e2node"},{"type":"e2node","node_id":"679335","title":"I like the way he reads poetry"}],"reactPageMode":true}