Skip to content

Instantly share code, notes, and snippets.

The following plot summary was written by ChatGPT, after being asked to adapt Little Red Riding Hood to a cyberpunk setting. Some follow-up discussion helped to clarify some points.
-----------------------
In a dystopian future where the powerful multinational LupusCorp controls the world and is waging war on freedom, the people of the slums are forced to rely on hacking and do-it-yourself cyber-augmentations to survive. The main character, RedRider, is a young hacker who discovers damning trade secrets about LupusCorp. Her mission is to bring these secrets to the Gran-Tech, a leader of the resistance against LupusCorp who is loved and respected by all for her selfless dedication to freedom.
The Gran-Tech refuses to use cybernetics for fear of hacking and surveillance, so RedRider must journey into the dangerous corporate-controlled city to deliver the secrets in person. Along the way, she is pursued by LupusCorp's security force, who will stop at nothing to capture her and the secrets she holds. RedRider
Chris:
Are there decidable second order models in logic?
ChatGPT:
In logic, a second-order model is a type of mathematical structure that
allows quantification over predicates, in addition to the standard
quantification over individuals that is possible in first-order models.
Second-order models can be either decidable or undecidable, depending
on the specific details of the model in question.
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
> [ (a, b, c, d, e, f, g, h) | [a, b, c, d, e, f, g, h] <- permutations [1..8], 10*a+b == 10*c+d + 10*e+f + 10*g+h]
[]
> [ (a, b, c, d, e, f, g, h) | [a, b, c, d, e, f, g, h] <- permutations [1..8], 10*a+b > 10*c+d + 10*e+f + 10*g+h, c > e, e > g]
[(8,4,3,5,2,6,1,7),
(8,5,3,4,2,6,1,7),
(8,6,3,4,2,5,1,7),
(8,6,4,3,2,5,1,7),
(8,4,3,6,2,5,1,7),
(8,6,4,5,2,3,1,7),
(8,5,3,6,2,4,1,7),
module T13704b1 where
main :: IO ()
main = return ()
-- wrapped by T13704b2.hs
@cdsmith
cdsmith / sqrt.hs
Last active November 6, 2018 08:01
fixpoint :: Eq a => (a -> a) -> a -> a
fixpoint f x
| x == fx = fx
| otherwise = fixpoint f fx
where fx = f x
mySqrt :: Double -> Double
mySqrt n = fixpoint (\x -> (x + n/x) / 2) 1
main :: IO ()