About Neural Outlet..

Science-ish blog: https://neuraloutlet.wordpress.com/

(A ((Pretty OK) Lisp) Interpreter {in SETL})

This post overviews a Common Lisp interpreter written in the Set Theoretic programming language SETL. Source code is here: https://bitbucket.org/NeuralOutlet/setlisp
A complete list of available functions can be found in the doc folder.

SETL
Originally developed in  the 1960s by Jack Schwartz, SETL (Set Language) is peculiar in that it feels old and new at the same time. You’re writing imperatively with these chunky procedures then suddenly doing aggressive set comprehension like generating a set of unique primorial numbers in one terse but coherent line:

-- This is a comment
pset := {*/{p in {2..n} | forall m in {2..p - 1} | p mod m > 0} : n in {0..20}};
print(pset); --prints: {2 6 30 210 2310 30030 510510 9699690}

David Bacon developed the GNU SETL version between 1989-2009, fantastically nice to use, it is extended somewhat by adding POSIX support. Though it should be noted the parts that feel new were in SETL from its inception, it is said to be the first language to include list comprehension.

SETL spawned many versions of itself (SETLB, SETL2, ISETL, SetlX, etc) and influenced two other Set Theoretical languages called ProSet and Slim. Though out of all these languages the only ones still kicking around are GNU SETL, ISETL, and SetlX. There was a non-Set Theoretic language influenced by SETL – ABC (the predecessor to Python).

A good taste of the language can be found in the GNU SETL Om, for a more in depth understanding there is David Bacon’s PhD thesis. A ton of useful and interesting example programs can be found at Håkan Kjellerstrand’s SETL page. Historically there is also an early paper by Jack Schwartz.

SETLisp
So far setlisp has about 60 functions (SETLisp documentation) and the datatypes: Boolean, Number, String, Symbol, Function, List, and Set.

Sets – Lisp has a function for making lists, it looks like (list 5 4 3 3) which produces the list (5 4 3 3). Pretty simple, the function ‘set’ already exists for setting the value of a symbol so I chose to use ‘setl’ as the set function (setl 5 4 3 3) which yields {3 4 5}. The curly brackets indicate it is a set not a list. In Set Theory the order or duplicity of elements in a set do not matter so SETL orders the elements of a set by value and removes duplicates.

Expressions – The use of sets is extended to set-expressions, these are more of a playful idea than anything useful. The arguments are automatically bagged up into a set instead of being mapped to variable names in a list. Here you can see addition used as an s-expression and a set-expression:

set-expression

The add function specifically is just the ‘+’ operator cast over a set or list of elements, which means that unlike ‘+’ in Lisp this one will do numeric affirmation aswell as addition. It infact extends further to also perform set union and string or tuple concatenation. I added the functions ‘append’ and ‘concatenate’ but they just call ‘+’. The code itself uses the ‘/’ notation alongside the list comprehension:

-- (+ args...)
proc scl_add(sargs, env);
	return [+/sargs, env];
end proc;

-- {+ args...}
proc setl_add(sargs, env);
	return [+/sargs, env];
end proc;

There is a ‘mapchoice’ function which is a play on the ‘mapcar’ function in Lisp and the Choice Function in Set Theory. The function ‘cardinality’ does the same as ‘length’. Also any s-expressions I add with only one or zero arguments is done for both s/set-expressions. {quit} is the same as (quit) for example.

This does open up overloading, a function can be defined as s-exp or set-exp or both (requires two identical definitions). The defun function works slightly different for each, s-exp are defined just as they should be, but the set-exp hides all parameters in a named set. This needs to be accessed with set functions such as from or with looping:

;; S-Expression
(defun my-func (param1 param2 param3)
    (print param1)
    (print param2)
    (print param3))
(my-func 14 80 32) ; prints 14 80 32

;; SET-Expression
{defun my-func params
    (print (from params))  ;Note: 'from' is destructive to the set, but
    (print (from params))  ;      (loop for val in params do...) is not
    (print (from params))}
{my-func 14 80 32}         ; prints 14 32 80

Behind the Scenes – SETL has another useful type (although it is more of a mechanism) called maps. Obviously straight from Set Theory – maps, sets, and tuple are the core of the language. A map is defined as a set containing only 2-tuples. Below is a map called stuff that has ‘this’ mapped to 5 and ‘that’ mapped to a tuple of the numbers 1 to 100:

stuff := {['this', 5], ['that', [1..100]]};
print( stuff('this') );
print( stuff('that') );

In SETLisp the variables environment is constructed with maps and so is the function type. To create local scope a list of maps is treated as a stack – checking from the top down searching for a value to map to a variable, then popping that definition map off the stack when leaving scope. The addition of an implicit map type in setlisp was my favourite feature to add, check out the Fun with Maps example.

Lisp Reader/Printer – The largest leaps in clarity for me came from trying to emulate the print and read functionality of lisp. The Lisp Printer is alluded to in the HyperSpec but it’s not a function available to the user, it just takes an object and makes it string-ready. It has a comrade in the ‘read’ function.  Initially for my parser I was reading a line of code in and tokenising that and then I extended it to get more lines if the bracket count was uneven .i.e., more ‘(‘ than ‘)’. I stayed with this for most of the development then when I had enough basic functions I wanted to add macros. For a very long time I tried to add read macros at the already tokenised stage, it was horrible. After a hiatus I wrote a macro-safe read-line, with this I was able to write the ‘set-macro-character‘ functionality and it all became clear. I needed to write a ‘read’ function and then use that to read lisp objects in instead of parsing lines one character at a time. SETLisp has the following print and read functions:

Printing functions: write, print, princ, prin1, format.

Read functions: load, read, read-line, read-char, read-setl.

Obviously the last one is setlisp specific, it is a wrapper for evaluating a SETL variable or variable construcor. In the setlisp.rc file you can see it is, in conjuction with ‘eval-setl’, used to allow SETL list/set comprehension in the macros ${ … } and $( … ).

Nil vs Om – These are two very similar concepts that appear in a lot of programming situations. In SETL any function without a return value will return om (printed as an asterisk ‘*’), this is the same for nil in Lisp. Lists in Lisp are constructed by cons cells ending with a nil cdr (a . (b . (c . nil))), in SETL a tuple is hypothetically of infinite size with om in every leading index [a b c * * … *]. One problem this brings up is that (list nil nil nil) should evaluate to (NIL NIL NIL) but [om, om, om] creates an empty tuple instead of [* * *]. The boolean types in Common Lisp are ‘t’ and ‘nil’ although anything not nil is considered true – SETL has the standard true/false duality but then om is there being all interesting.

Types – SETL doesn’t have characters, it’s very weird to me but a character is the same as a string of length 1. But what are strings made of? Aren’t they ordered sets of characters? I don’t know why there isn’t a byte-friendly char type in SETL but they exist in Common Lisp so I added a type system for various things. There are types for: Function, List, Set, Character, Complex, and Symbol. The syntax for characters are setup in the runtime configuration file, but I never implemented complex numbers in the form #C(1 2).

Macros – I didn’t add the more powerful ‘defmacro’ to SETLisp but for some of the beloved Lisp syntax such as ‘quote and #’function I added ‘set-macro-character‘ and ‘set-dispatch-macro-character‘. The extra syntax is implemented in the setlisp.rc file (read in before anything else). It begins with adding single line comments:

"Strings are nice, but let's make comments!"
(defun comment-macro (s c)
	(read-line s)
	(values))
(set-macro-character ";" (function comment-macro))
(format t "  Comment macro added.~%")

and builds up to this definition for multi-line comments:

; Multi-line comments
(defun multi-line-macro (s c n)
	(if (equal "|" (read-char s))
		(if (equal "#" (peek-char s))
			(progn
				(read-char s)
				(values))
			(multi-line-macro s c n))
		(multi-line-macro s c n)))
(set-dispatch-macro-character #\# #\| #'multi-line-macro)
(format t "  Multi-line Comments added.~%")
Advertisements

Mandelbrot: SETL & Lisp

SETL is a general-purpose programming language developed by Jack Schwartz back in the late 1960s. The language is multiparadigm – both Procedural (containing subroutines and control structures like if statements) and Set Theoretical. The latter is not often mentioned when talking about language paradigms – and is not to be confused with Logical Programming. The concept is outlined in the 1974 paper An Introduction to the Set Theoretical Language SETL. Importantly though data in SETL is of three main types: Atoms, Sets, and Sequences (also referred to as tuples or ordered sets).

A good overview of SETL can be found in the GNU SETL Om.

setl-mandelbrot

Pixels inside the Mandelbrot Set are marked in black, the code used to generate them (mandelbrot.setl) can be found here.

Generation of the Mandelbrot Set
On the Wikipedia page for the Mandelbrot Set you will find its formal definition, which looks like so: M = \left\{c\in \mathbb C : \exists s\in \mathbb R, \forall n\in \mathbb N, |P_c^n(0)| \le s \right\}.

The most fantastic thing about SETL is how powerful its Set Builder Notation is. Almost exactly as you would in the formal case (removing ‘there exists some real s’ for the practical application):

M := {c : c in image | forall num in {0..iterations} | cabs(pofc(c, num)) <= 2};

For some reason SETL doesn’t support complex numbers, but they are easily handled by writing the necessary procedures we need like cabs, ctimes, and cplus dealing with tuples in the form [x, y]. The variable ‘image’ is a sequence of these tuples. Another procedure is written, pofc, which is a more practical version of P_c^n(0).

Interaction with the Lisp graphical display
The goal of the SETL program is to produce a set of points that lie inside the Mandelbrot set. To actually display the image I used Common Lisp and displayed a widget with the image using CommonQt. In a very rudimentary way I had mandelbrot.setl take arguments about the image then print the set of pixel co-ordinates. All lisp had to do was swap and ‘{}’ or ‘[]’ for ‘()’ and read it as lisp code then update the image.

(setf in-set (read-from-string (parse-line (uiop:run-program "setl mandelbrot.setl -- -250 -250 250 8" :output :string))))
(draw-mandel instance in-set)

An after-thought was to make a Mandelbrot searcher where you could zoom and move using the mouse but the SETL code is such an inefficient way of doing it that it’s not worth it. As an attempt to mimic the formal definition it was highly successful and fun. Though much quicker SETL code could be written for generating the Mandelbrot Set.

Source file for mandelbrot.setl and the Lisp/CommonQt front end can be found here.

MuSh: Multi-Shebang Scripting

MuSh is a super simple meta-scripting language for parsing multiple shebang statements that invoke different interpretors. Why would you want to do this? I have no idea. Although there is no real reason to do this you might want to just for the fun of it.

How it works
MuSh is python based and has a linear approach, it splits up the script into smaller single-language scripts then runs them one after the other. Variables are transported between scripts using a register file (msb_register.json) and hook-in functions which add code to the scripts for interacting with the register. There are two important syntaxes (syntaces?) for separating languages, the first is:

#!! <interpretor> <passed-variables …>

A very simple Guess my Number game that uses Bash, Python and Common Lisp.

A little Guess my Number game that uses Shell, Python and Common Lisp. This example can be found at ‘examples/guess_my_num.msb‘ and uses the Vim syntax file found in the repo at editor_support/mush.vim.

Subscripting
The second separation syntax is for embedded use, it has open and close functionality:

#![ <interpretor> <passed-variables …>
#!] <passed-variables …>

MuSh uses the hook-in function inline_replace which replaces the embedded code with a call to a subscript (of that code). In the example below you can see how a python program might use subscripting to use Lisp. The left is the original, the right is after inline_replace has been called:

def fact_lisp(n):
        #![ clisp n
        (defun fact (n)
                (if (< n 2) 1
                (* n (fact(- n 1)))))
        (setf out (fact n))
        #!] out
        return out
def fact_lisp(n):
	# Get 'n' from register ...
	from subprocess import call
	call("./subscript_0", shell=True)
	# Get 'out' from register ...
	return out

The above code is from ‘examples/fact_speed_IO.msb from the repo. The meta-script starts with a python program that defines three factorial functions using subscripts to Python, Common Lisp, and Shell (sh). These three are called inside a python forloop 1000 times – calculating 10! each loop. Python timing methods are used giving:

 Subscripts Python Common Lisp Shell
Time (seconds) 25.4605309963 18.8304021358 21.1056499481

It also defines a pure python factorial function, which it also loops for. Next the meta-script moves to a Lisp program which has a Lisp forloop and factorial function, timing here is done with (get-internal-real-time) and (internal-time-units-per-second). Finally the meta-script moves to Shell and runs a while loop for its factorial function. These script results seem peculiar to me, Lisp shows to be slower than Python and Shell is almost as bad as subscripting:

 Scripts Python Common Lisp Shell
Time (seconds) 0.002014 0.009645 14

I find it strange that when using a python loop/timing – python was the slowest, but when using native loops/timing – python was the fastest. This could be because my implementation is incorrect somewhere or python just has great looping but bad recursive arithmetic. Maybe it’s a reflection of how python interacts with the register. I’m more confused by why shell is so slow.

WavelengthPro Version 2.0 Release Notes

*scroll down for release notes*

This is WavelengthPro, software for full-spectrum and multi-spectral photo editing. The first video shows a demo of the original version including the Kodak Ektachrome IR film Emulator, Channel Mixer and pseudo colour-mapping. It’s an example of some ways to merge infrared, visible & ultraviolet images together:

This video (and this blog post) shows multiple ways someone might edit ultraviolet images, including Luminance Mapping:

Then finally here is a start to finish edit of an ultraviolet image to apply the ‘Gold UV’ effect:


Release Notes

Fixes of V1.2 Issues:

  • Removed pop-up welcome message
  • Added default settings

New Features Added:

  • Colour-Space Mixer
  • Colour Purity Tool
  • Cloud-Balancer
  • General editing of images (hue shift/brightness/contrast/invert/etc)
  • General loading of images (non-spectral)
  • ‘Drop to Pool’ functionality for all tools
  • Drag and Drop functionality for loading images
  • Custom greyscale in Multi-Channel Mixer
  • Advanced settings to edit config file directly
  • About WLP menu
  • Examples menu with links
  • Scale Pool

Upgrades:

  • Three image pools (Spectral, Created & General)
  • Settings now in wlpConfig.ini instead of text file
  • More basic settings options
  • More greyscale options in Multi-Channel Mixer
  • 3DLUT for Lab & LCHab colour-spaces

The RGB Universe

Three images bounded to the respective spaces: Colour, Chromaticity, and Hue.

One image bounded to three respective spaces: Colour, Chromaticity, and Hue.

The Colour-Space: RGB
Everyone is familiar with this, it is the additive model for colours that uses the primaries: red, green & blue. A 3D Model where each unique colour sits at position (x: r, y: g, z: b).

The Chromaticity-Space: RCGCBC
Some people will be familiar with this, it is RGB without luminance, the brightness is removed in a way that doesn’t effect the hue or saturation. It is referred to as rg-Chromaticity because it’s construction from RGB means only two elements are needed to represent all the chromaticity values:

Conversion to Conversion from (kind of*)
R_C= \frac{R}{R+G+B}
G_C= \frac{G}{R+G+B}
B_C= \frac{B}{R+G+B}
 R = \frac{R_C G}{G_C}
G = G
B = \frac{(1 - R_C - G_C) G}{G_C}

It will always be that R_C + G_C + B_C = 1 so by discarding the blue component we can have unique chromaticities as (x: r’, y: g’). This means that rg-Chromaticity is a 2D-Model and when converting to it from RGB we lose the luminance. So it is impossible to convert back. *An in-between for this is the colour-space rgG where the G component preserves luminance in the image.

The Hue-Space: RHGHBH
No one uses this, I just thought it would be fun to apply the same as above and extract the saturation from RCGCBC. Like RCGCBC it is a 2D Model, this seems strange because it is only representing one attribute –hue– but it is because the elements themselves have a ternary relationship (how much red, how much green, how much blue) and so to extrapolate one you must know the other two.

Conversion to 3-tuple Hue Normalise to 2D
M = \text{Max}(R,G,B)
m = \text{Min}(R,G,B)
\delta = 255/(M-m)
R_h = (R-m) \delta
G_h = (G-m) \delta
B_h = (B-m) \delta
R_H = \frac{R_h}{R_h + G_h + B_h}
G_H = \frac{G_h}{R_h + G_h + B_h}
B_H = \frac{B_h}{R_h + G_h + B_h}

Measuring Hue Distance
The HSL colour-space records hue as a single element, H, making measuring distance as easy as \Delta H = \sqrt{{H_a}^2 - {H_b}^2} where as in rg-Hue we have two elements so \Delta H = \sqrt{({R''_a}^2 - {R''_b}^2) + ({G''_a}^2 - {G''_b}^2)} where R'' = R_H and G'' = G_H for readability. What’s interesting here is it works almost the same. Though it should be noted that on a line only two distances are equidistant to zero at one time where as in rg-Hue, on a 2D plane, there are many equidistant points around circles.

Below are images of a RGB testcard where each pixel’s hue has been measured against a colour palette (60° Rainbow) and coloured with the closest match. The rg-Hue measure has a notable consistency to it and shows more red on the right hand side than HSL, but also between the yellow and red there is a tiny slither of purple. I believe this is from the equal distance hues and the nature of looking through a list for the lowest value when there are multiple lowest values:

Hue Distance (HSL) Hue Distance (RHGHBH)
HSL Measure rg-Hue Measure

Islam: The Religion of… Logic? (3/3)

Not often described as the Religion of Logic, Islam had a golden age spanning from the 8th-12th century (CE). This is the last in a three-part post on logic and rational thought in Islam. The previous post looked at the Mu’tazilites, who believed in reason and rational thought above all else. Here we will look at applications and types of logic in Islamic law making.

Islamic Jurisprudence (fiqh)
In the modern day there are many schools of fiqh (madhhab) which can be seen in this world map. The four accepted Sunni madhhabs are Hanafi, Shafi’i, Maliki and Hanbali. The Shia’s have the Ja’fari, Isma’ili and Zaidi madhhabs. Mu’tazilism, being a system of theological interpretations, doesn’t exactly have a madhhab. This gives a rather confusing situation where you can have “Sunni Mu’tazalites” and “Shia Mu’tazalites”. This would be Mu’tazilites roughly following, for example, a Hanafi or Zaidi madhhab. The movement was predominantly of Sunnis, notably the founder Wasil ibn Ata (a good friend of Zayd ibn Ali) and scholar Abd al-Jabbar, but there were also Shi’ite Mu’tazilah like Ayatollah Hilli and the poet Ibn al-Rumi. The introduction of Mu’tazilism on the kalam of Judaism even brought about “Jewish Mu’tazilites” such as David ibn Merwan al-Mukkamas. Though again we see another area of Islam wherein Mu’tazilites are shown to be very different from standard Islamic views.

The Sources of God’s Law (Sharia)
Fiqh is the process used for creating, understanding and applying religious laws, for the main part madhhabs can be seen to follow a process of stages involving different religious sources: The main ones being the Qur’an, Sunnah, Ijma, Qiyas (Sunni) and ‘aql (Shia). The madhhabs give different weight to different sources. Hanbali, for example, give credence to the first two stages and ignore the last ones.

1 2 3 4
Sunni Qur’an Sunnah Ijma Qiyas
Shia Qur’an Sunnah Ijma ‘Aql
Mutazilah ‘Aql Qur’an Sunnah Qiyas*

ijma – meaning “consensus” either by religious authorities (Sunni), the Imam (Shia) or the Muslim community (Ibadi). Sunni’s often use the Companions of Mohammad (Sahabah) as the religious authorities, looking for their consensus in Hadiths. Using ijma is invalid for Mu’tazilah because of a rational scepticism towards peoples’ ability to make mistakes. For this same reason Hadiths are treated with caution and discarded if they contradict the Quran. Both the Shia and Mu’tazilah held critical views about the first generation of Muslims, with Ibadi also viewing Uthman and Ali as less than righteous.

Qiyas – meaning “deductive analogy” in reference to what is written in The Qur’an and Hadiths with what is being assessed. Because most Mu’tazilites follow Hanafi teachings Qiyas were often accepted, though not always. Notably Ibrahim an-Nazzam who denied Qiyas, Ijma and even Sunnah as sources for Sharia stating that only The Qur’an and ‘aql were acceptable.

‘Aql – meaning “reason” is intellect in terms of the rational faculty of the soul, deep understanding of God’s words, Imams have ‘aql. The term is slightly different when seen from Mu’tazilah doctrine as much closer to rational logic than religious understanding. Where Qiyas are analogical reason, ‘aql is pure logical reason.

A Note on Ibadi’ism
I found two completely contradictory Ibadi views on Qiyas and ijma, the first was Ibadi madhhab rejects the 3rd and 4th stages as a form of innovation (bid‘ah). This follows from the generally conservative nature of Ibadi Islam, but then in a state-published book on Ibadi’ism from Oman it says they follow 5 stages of fiqh: Qur’an, Sunnah, ijma, Qiyas & Induction (istidlal). The use of ijma can be seen to follow directly from the democratic nature of the Ibadi caliph. So I’m not sure which is the case as they both make sense for different reasons.

Sources: Initially Wikipedia then al-islam.org (Shia), livingislam.org (Sunni) then videos of scholars, academics and documentaries on Youtube (Sunni & Shia & Ibadi). The information was sporadic and sometimes contradictory so please feel free to correct me if I made mistakes.

Islam: The Religion of… Logic? (2/3)

Often described as the Religion of Violence, Islam had a golden age spanning from the 8th-12th century (CE). The previous post brushed over the Islamic Golden Age and Kalam. This post introduces a prominent theological school that lived and died in that time.

The Mu’ tazila

Logical-Koran-2

Paradoxical statements in the Qur’an had to be logically qualified.

Their theology was and is incredibly different to mainstream Islam for many reasons, the big ones being belief in Free Will, Atomism, rationalising discrepancies in the Qur’an and that the Qur’an itself was created. Now although the Qur’an is a primary source for knowing God’s laws – pure analytical reason gets the final say! Listed below are the five fundamental beliefs in Mu’tazilism, although monotheism and divine justice are standard for virtually all forms of Islam the interpretation makes them very important. The First Principle, as stated in the Mu’tazila text Kitab Al-Usul Al-Khamsa, is that good and evil can be known solely through human reason (without revelation) and that it is a Muslim’s duty to try and know God in this way. This principle, the autonomy of intellect, underpins the five fundamentals below:

  • MonotheismTawhid,  better expressed as the oneness of God, has had slightly different meanings over the history of Islam. Usually the Qur’an is seen to be an essence of God (His word) and thus co-eternal with Him. Mu’tazilites strict interpretation of tawhid says the Qur’an cannot both be part of Him and apart from Him, so the Qur’an cannot be eternal and thus is created. This became one of the most contested positions in Islamic thought. A view shared by the Ibadi Muslims of present day Oman.
  • Divine JusticeAl-‘Adl, there are many divine attributes and although virtually all schools of thought believe God to have justice as one – the strict analysis of it by Mu’tazilites brings about a controversial view. In answer to the Problem of Evil, like in Zoroastrianism, they respond by introducing Free Will – something completely opposed to the determinism of mainstream Islam. This is because if God is divinely just then he cannot create someone, command them to do evil then punish them for doing so.
  • The Promise and the Threat – At-wa’d wa al-wa’id, this is divine retribution. For this reason one must try to know God through rationality in order not to inadvertently disobey Him (and burn in Hell).
  • The Intermediate PositionAl-Manzilah Bayna al-Manzilatayn, when a Muslim sins they do not become a disbeliever (kafir) but neither do they stay a true believer (mu’min). If they die in this state they will be judged by God separately from a mu’min and a kafir. This view sits between the Kharijite position that sinning is disbelief (a view shared by modern day Islamic Extremists) and the Murjite position that a sinner is still a believer until Judgement Day where God will decide.
  • Commanding Good, Prohibiting EvilAl-‘amr bil ma’ruf wa al-nahy ‘an al-munkar, an obligation for all mu’min. This is the maxim that led to political intervention in the Abbasid Caliphate.

Mu’tazila: Sunni, Shia, Ibadi?
There are quite a few sects/schools/movements in Islam, this infograph shows the types that are around today. It doesn’t mention Mu’tazila and in my reading I have seen them referred to as Sunni sub-set, their own sect and even not Muslims at all. I would say there is enough difference in views to call them an independent sect. If we look at views on who can be a caliph we see that Sunni say the caliph must be from the tribe of Mohammed, Shia say the caliph must be from the family of Ali then the Ibadi say it can be anyone of strong faith. The Ibadi view was one adopted from their predecessor the Kharijites, the Mu’tazila share the Ibadi and Kharijite view on who can be caliph. But their rational dispute with the texts and onus on self-reasoning is contrary to conservative Ibadi/Kharijite views. Although the lines do blur as we will see in the next post, Mu’tazilites were quite the contrarians of their time – and even of our time.

Nobody Expects the Islamic Inquisition! (Minha)
The fifth doctrine, commanding good and prohibiting evil, invoked political action during the Abbasid Caliphate. Pro-Mu’tazila ulama (religious officials), including the caliphs al-Ma’mun and al-Mu’tasim, began interrogating scholars and ulama who did not believe in the Jahmite and Mu’tazilte view of Quranic Createdness. Imprisonment, punishment and even death would fall on those who did not concede. There was a growing ‘traditionalist’ re-serge in Sunni Islam at the time which promoted much the opposite and the fact that Mu’tazila shared views in-line with Zoroastrians and Shia muslims did not win them any favours with the populous. In the field of kalam two more systematic schools emerged in response, these were the Ashi’arites and the Maturidis. The latter was a hardline reaction that advocated Quranic literalism and threw out rational applications. The Ashi’arite school was the middle ground and found much support.

The 10th caliph of the Abbasid reign, Al-Mutawakkil, reversed the order of Minha and with that the ulama freely became less accepting of Mu’tazilites. The general community were already rather against them and Mu’tazilites quickly lost any power or influence they once held. Even after the Mu’tazilites had all gone – their practices still continued, mainly with the Zaidi Shias of Yemen, but also Ismaili Shias, Karaite Jews and certain Sufi schools had by this time all adopted different aspects of Mu’tazila doctrine. The Ashi’arite school of theology which advocated a lighter version of rationalism became moderately accepted in the Sunni mainstream.

The next post is on interpreting sharia (law).

Sources: Initially Wikipedia then mutazilah.com, asharis.comal-islam.orglivingislam.org, scholars on Youtube (Sunni & Shia, including Wahhabist Feiz Mohammad), academics and documentaries online. The information was sporadic and sometimes contradictory so I also bought the book Defenders of Reason in Islam which is a detailed analysis of the movement’s initial serge all the way up to it’s revival in our modern times.